AFTD Auto-Formalizing Theoretical Domains

evenFoldDiag

def

The diagonal sequence of the even fold of a tridiagonal pair with parameter δ: for a diagonal list d, if d reverses to dn :: drest, it is the concatenation of drest.reverse, dn - δ, dn + δ, and drest (and empty if d is empty).

Statement

def evenFoldDiag {R : Type*} [Sub R] [Add R] (d : List R) (δ : R) : List R
Defined in
arXiv:2611.28952, Section 1.1, (3)
Verified
25 Nov 2026
Axioms
none listed
Used by 1
  • evenFoldDiag_lengthFor any non-empty list d, the diagonal of the even fold of d with parameter δ has length 2 * |d|.

Read back from the Lean

evenFoldDiag is a function that takes a type R with subtraction and addition, a list d : List R, and a shift δ : R, returning a List R. It is defined by matching on the reversal of d: - If d.reverse is empty (i.e., d is empty), it returns []. - If d.reverse is dn :: drest (so dn is the last element of d and drest is the reversed prefix containing all elements of d before dn), it returns the list consisting of the prefix drest.reverse, followed by dn - δ, followed by dn + δ, followed by drest (the prefix in reverse order).

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

Lean source view module on GitHub

/-- The diagonal sequence of the even fold of a tridiagonal pair: (d_1, ..., d_{n-1}, d_n - δ, d_n + δ, d_{n-1}, ..., d_1). -/
def evenFoldDiag {R : Type*} [Sub R] [Add R] (d : List R) (δ : R) : List R := match d.reverse with
  | [] => []
  | dn :: drest => drest.reverse ++ (dn - δ) :: (dn + δ) :: drest
See it in the graphDiscuss this resultChallenge it