AFTD Auto-Formalizing Theoretical Domains

oddFoldDiag_length

theoremverified

The diagonal of the odd fold of a list d has length 2 * |d| + 1.

Statement

theorem oddFoldDiag_length {R : Type*} [Zero R] (d : List R) :
    (oddFoldDiag d).length = 2 * d.length + 1
Source
arXiv:2611.28952, Section 1.1, (2)
Verified
25 Nov 2026
Axioms
Quot.soundpropext
Built on 1
  • oddFoldDiagThe diagonal sequence of the odd fold of a tridiagonal pair: for a diagonal list d, it is the list obtained by concatenating d, 0, and the…

Read back from the Lean

For any type $R$ with a zero element ([Zero R]) and any list $d$ of elements of $R$, the length of oddFoldDiag d is equal to $2 * d.\\text{length} + 1$.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

The proof expands the definition of `oddFoldDiag d`, which concatenates d with 0 followed by the reverse of d. Simplifying the length of this concatenation reduces the goal to |d| + (|d| + 1) = 2 * |d| + 1, which holds by basic arithmetic.

  1. The length of the odd fold diagonal reduces to |d| + (|d| + 1)

    By definition, `oddFoldDiag d` is d ++ 0 :: d.reverse. The length of a concatenation is the sum of the lengths, and reversing a list preserves its length, so the total length is |d| + 1 + |d|, written as |d| + (|d| + 1).

    line 4

    uses oddFoldDiag

      simp [oddFoldDiag]
  2. |d| + (|d| + 1) = 2 * |d| + 1 automation

    This is an identity of linear integer arithmetic on natural numbers (n + (n + 1) = 2n + 1), resolved automatically by `omega`.

    line 5

      omega
oddFoldDiag
the diagonal list obtained by appending 0 and the reversal of d to d, that is, d ++ 0 :: d.reverse

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

/-- Length of the diagonal of an odd fold. -/theorem oddFoldDiag_length {R : Type*} [Zero R] (d : List R) :    (oddFoldDiag d).length = 2 * d.length + 1 := by  simp [oddFoldDiag]  omega
See it in the graphDiscuss this resultChallenge it