AFTD Auto-Formalizing Theoretical Domains

signed_relation_linear_combination_of_step_basis

theoremverified

Because any vector x decomposes into a telescoping sum of step basis vectors with sum of differences equal to x(n-1), any linear combination of signed relations that evaluates to 1 on all step basis vectors evaluates to x(n-1) on all vectors x.

Statement

theorem signed_relation_linear_combination_of_step_basis (n : ℕ) (hn : 1 ≤ n) (y : Fin n → ℝ) :
    (∀ i : Fin n, (∑ j : Fin n, y j * signed_relation n (j.val + 1) (fun k => if i.val ≤ k.val then 1 else 0)) = 1) →
      ∀ x : Fin n → ℝ, (∑ j : Fin n, y j * signed_relation n (j.val + 1) x) = x ⟨n - 1, by omega⟩
Source
step towards dual_certificate_identity
Verified
17 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 4
  • signed_relationFor a dimension n : ℕ, an index j : ℕ, and a vector x : Fin n → ℝ, signed_relation n j x is the real number (∑ t ∈ Finset.range p, coord…
  • triangular_numberFor any natural number k, the k-th triangular number is defined as k(k+1)/2.
  • dual_cert_pFor each natural number m, p(m) is the largest integer p >= 2 such that p + (p-2)(p-1)/2 < m, or 1 if no such integer exists.
  • FThe prime field $\mathrm{GF}(p)$, realized as $\mathbb{Z}/p\mathbb{Z}$ via ZMod.
Used by 1
  • dual_certificate_identityFor every natural number n with 1 ≤ n, there exists a sequence of integers y : Fin n → ℤ with 1 ≤ y j for all j : Fin n, such that for all…

The proof, explained

The proof decomposes an arbitrary vector x into a telescoping linear combination of step basis vectors with coefficients given by consecutive differences d(i) = F(i + 1) - F(i) of its cumulative coordinates. By linearity of the signed relations, the linear combination applied to x expands into a weighted sum over the step basis vectors. By hypothesis, the linear combination evaluates to 1 on every step basis vector, reducing the total sum to the sum of differences d(i). This sum telescopes to F(n) - F(0) = x(n - 1), proving the claim.

  1. The coordinate accessor X and the definitional form of the signed relation are well-defined.

    The function X(x, t) accesses coordinate x(t - 1) when 0 < t ≤ n (justified by omega) and 0 otherwise. The lemma sr_X expresses the signed relation definitionally in terms of X.

    lines 1–9

    namespace DCB4
    
    noncomputable def X {n : ℕ} (x : Fin n → ℝ) (t : ℕ) : ℝ :=
      if h : 0 < t ∧ t ≤ n then x ⟨t - 1, by omega⟩ else 0
    
    theorem sr_X (n J : ℕ) (x : Fin n → ℝ) : signed_relation n J x =
        (∑ t ∈ Finset.range (dual_cert_p (n - J + 1)), X x (J + t)) - X x (J - 1)
          - ∑ k ∈ Finset.range (dual_cert_p (n - J + 1) - 1), X x (n - triangular_number k) := rfl
    
  2. The coordinate accessor X distributes over finite sums of vectors. automation

    We unfold X and split on the condition 0 < t ≤ n. In the positive branch, the sum of functions is evaluated componentwise via Finset.sum_apply; in the negative branch, both sides evaluate to 0.

    lines 10–15

    uses Finset.sum_apply

    theorem X_sum {n : ℕ} {ι : Type*} (s : Finset ι) (f : ι → Fin n → ℝ) (t : ℕ) :
        X (∑ i ∈ s, f i) t = ∑ i ∈ s, X (f i) t := by
      unfold X; split_ifs
      · simp [Finset.sum_apply]
      · simp
    
  3. The coordinate accessor X commutes with scalar multiplication. automation

    Unfolding X and splitting on 0 < t ≤ n, scalar multiplication factors out directly in the active branch, while in the inactive branch both sides are zero.

    lines 16–20

    theorem X_smul {n : ℕ} (c : ℝ) (x : Fin n → ℝ) (t : ℕ) : X (c • x) t = c * X x t := by
      unfold X; split_ifs
      · simp
      · simp
    
  4. The signed relation functional is linear over linear combinations of vectors.

    Expanding the signed relation in terms of X using sr_X, linearity follows from the additivity and scalar homogeneity of X (X_sum, X_smul), ring distributivity (mul_sub, Finset.mul_sum, Finset.sum_sub_distrib), and interchanging finite summations with Finset.sum_comm.

    lines 21–26

    uses sr_X, X_sum, X_smul, mul_sub, Finset.mul_sum, Finset.sum_sub_distrib, Finset.sum_comm

    theorem sr_sum (n J : ℕ) {ι : Type*} (s : Finset ι) (a : ι → ℝ) (f : ι → Fin n → ℝ) :
        signed_relation n J (∑ i ∈ s, a i • f i) = ∑ i ∈ s, a i * signed_relation n J (f i) := by
      simp only [sr_X, X_sum, X_smul, mul_sub, Finset.mul_sum, Finset.sum_sub_distrib]
      rw [Finset.sum_comm (s := Finset.range (dual_cert_p (n - J + 1))),
        Finset.sum_comm (s := Finset.range (dual_cert_p (n - J + 1) - 1))]
    
  5. Introduce the vector x, the hypothesis hy, and define the difference sequence d.

    We introduce the assumption hy that the linear combination evaluates to 1 on all step basis vectors, and fix an arbitrary vector x. We define an extended sequence Xn padded with 0, a 1-shifted sequence F with F(0) = 0 and F(t) = Xn(t - 1) for t > 0, and the difference sequence d(i) = F(i + 1) - F(i). The inequality n - 1 < n is justified by omega from 1 ≤ n.

    lines 27–33

    theorem lin_comb (n : ℕ) (hn : 1 ≤ n) (y : Fin n → ℝ) :
        (∀ i : Fin n, (∑ j : Fin n, y j * signed_relation n (j.val + 1) (fun k => if i.val ≤ k.val then 1 else 0)) = 1) →
          ∀ x : Fin n → ℝ, (∑ j : Fin n, y j * signed_relation n (j.val + 1) x) = x ⟨n - 1, by omega⟩ := by
      intro hy x
      let Xn : ℕ → ℝ := fun t => if h : t < n then x ⟨t, h⟩ else 0
      let F : ℕ → ℝ := fun t => if t = 0 then 0 else Xn (t - 1)
      let d : ℕ → ℝ := fun i => F (i + 1) - F i
  6. The vector x decomposes into a linear combination of step basis vectors with coefficients d(i).

    By function extensionality at index k, the sum of d(i) over indices i ≤ k is converted from Fin n to Finset.range n (Fin.sum_univ_eq_sum_range) and rewritten as a sum over the filtered set {i ∈ range n | i ≤ k} (Finset.sum_ite, Finset.sum_const_zero, add_zero). Using Finset.mem_filter and Finset.mem_range, this filtered set equals Finset.range (k + 1). The sum of differences d(i) = F(i + 1) - F(i) telescopes via Finset.sum_range_sub to F(k + 1) - F(0) = x(k).

    lines 34–43

    uses Finset.sum_apply, Pi.smul_apply, smul_eq_mul, mul_ite, mul_one, mul_zero, Fin.sum_univ_eq_sum_range, Finset.sum_ite, Finset.sum_const_zero, add_zero, Finset.mem_filter, Finset.mem_range, Finset.sum_range_sub

      have hx : x = ∑ i : Fin n, d i.val • (fun k : Fin n => if i.val ≤ k.val then (1 : ℝ) else 0) := by
        funext k
        rw [Finset.sum_apply]
        simp only [Pi.smul_apply, smul_eq_mul, mul_ite, mul_one, mul_zero]
        rw [Fin.sum_univ_eq_sum_range (fun i => if i ≤ k.val then d i else 0), Finset.sum_ite,
          Finset.sum_const_zero, add_zero]
        have hfilt : (Finset.range n).filter (fun i => i ≤ k.val) = Finset.range (k.val + 1) := by
          ext i; simp only [Finset.mem_filter, Finset.mem_range]; have := k.isLt; omega
        rw [hfilt, Finset.sum_range_sub (fun i => F i)]
        simp [F, Xn, k.isLt]
  7. Substitute the step basis decomposition of x into the linear combination of signed relations and swap the summations.

    We rewrite x using its decomposition hx. Linearity of the signed relation (sr_sum) and distributivity (Finset.mul_sum) expand the expression into a double sum over j and i, which is then transposed using Finset.sum_comm.

    lines 44–47

    uses sr_sum, Finset.mul_sum, Finset.sum_comm

      conv_lhs => rw [hx]
      simp only [sr_sum]
      simp only [Finset.mul_sum]
      rw [Finset.sum_comm]
  8. For each basis step vector, the inner sum over j evaluates to the difference coefficient d(i).

    Factoring d(i) out of the inner sum using Finset.mul_sum, Finset.sum_congr, and ring, the remaining sum evaluates to 1 by the hypothesis hy applied to i. Using mul_one and Finset.sum_congr across all i, the entire double sum simplifies to the sum of the differences d(i).

    lines 48–56

    uses Finset.mul_sum, Finset.sum_congr, mul_one

      have : ∀ i : Fin n, ∑ j : Fin n, y j * (d i.val * signed_relation n (j.val + 1)
          (fun k : Fin n => if i.val ≤ k.val then (1 : ℝ) else 0)) = d i.val := by
        intro i
        have h1 := hy i
        calc _ = d i.val * ∑ j : Fin n, y j * signed_relation n (j.val + 1)
              (fun k : Fin n => if i.val ≤ k.val then (1 : ℝ) else 0) := by
                rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro j _; ring
          _ = d i.val := by rw [h1, mul_one]
      rw [Finset.sum_congr rfl (fun i _ => this i)]
  9. The sum of differences telescopes to x(n - 1).

    Converting the sum over Fin n to Finset.range n with Fin.sum_univ_eq_sum_range, the sum of differences telescopes via Finset.sum_range_sub to F(n) - F(0). Since n ≥ 1, n ≠ 0 and n - 1 < n by omega, so F(n) = x(n - 1) and F(0) = 0, leaving x(n - 1).

    lines 57–64

    uses Fin.sum_univ_eq_sum_range, Finset.sum_range_sub

      rw [Fin.sum_univ_eq_sum_range (fun i => d i), Finset.sum_range_sub (fun i => F i)]
      simp only [F, Xn]
      have : n ≠ 0 := by omega
      simp [this, show n - 1 < n by omega]
    
    end DCB4
    
    /-- Any linear combination of signed relations evaluating to 1 on all step basis vectors evaluates to x(n-1) on all vectors x. -/
  10. The linear combination of signed relations evaluates to x(n - 1) on all vectors x.

    The main theorem signed_relation_linear_combination_of_step_basis directly invokes DCB4.lin_comb, which establishes the result.

    lines 65–68

    uses DCB4.lin_comb

    theorem signed_relation_linear_combination_of_step_basis (n : ℕ) (hn : 1 ≤ n) (y : Fin n → ℝ) :
        (∀ i : Fin n, (∑ j : Fin n, y j * signed_relation n (j.val + 1) (fun k => if i.val ≤ k.val then 1 else 0)) = 1) →
          ∀ x : Fin n → ℝ, (∑ j : Fin n, y j * signed_relation n (j.val + 1) x) = x ⟨n - 1, by omega⟩ := by
      exact DCB4.lin_comb n hn y
Finset.sum_apply
Evaluating a finite sum of functions at a point equals the sum of the functions evaluated at that point.
sr_X
Definitional formula expressing the signed relation in terms of the coordinate accessor X.
X_sum
The coordinate accessor X distributes over finite sums of vectors.
X_smul
The coordinate accessor X commutes with scalar multiplication.
mul_sub
Multiplication distributes over subtraction from the left.
Finset.mul_sum
Multiplication by a scalar distributes over a finite sum from the left.
Finset.sum_sub_distrib
A finite sum of differences distributes into the difference of the two finite sums.
Finset.sum_comm
The order of two independent finite summations can be exchanged.
Pi.smul_apply
Evaluating a scalar-multiplied function at an input equals the scalar multiplied by the value of the function.
smul_eq_mul
Scalar multiplication of real numbers coincides with ordinary multiplication.
mul_ite
Multiplication distributes into an if-then-else expression.
mul_one
Multiplying any element by 1 leaves it unchanged.
mul_zero
Multiplying any element by 0 yields 0.
Fin.sum_univ_eq_sum_range
A sum over the elements of Fin n equals the sum over the natural numbers from 0 to n - 1.
Finset.sum_ite
A sum of conditional expressions splits into the sum over elements satisfying the condition and the sum over elements not satisfying it.
Finset.sum_const_zero
A finite sum of zeros is zero.
add_zero
Adding zero to an element leaves it unchanged.
Finset.mem_filter
An element belongs to a filtered set if and only if it belongs to the original set and satisfies the predicate.
Finset.mem_range
A natural number belongs to Finset.range n if and only if it is strictly less than n.
Finset.sum_range_sub
The sum of consecutive differences f(i + 1) - f(i) from 0 to n - 1 telescopes to f(n) - f(0).
sr_sum
The signed relation functional is linear over linear combinations of vectors.
Finset.sum_congr
Two finite sums are equal if their index sets are identical and their summands agree at every index.
DCB4.lin_comb
Any linear combination of signed relations evaluating to 1 on all step basis vectors evaluates to x(n - 1) on all vectors x.

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

namespace DCB4noncomputable def X {n : ℕ} (x : Fin n → ℝ) (t : ℕ) : ℝ :=  if h : 0 < t ∧ t ≤ n then x ⟨t - 1, by omega⟩ else 0theorem sr_X (n J : ℕ) (x : Fin n → ℝ) : signed_relation n J x =    (∑ t ∈ Finset.range (dual_cert_p (n - J + 1)), X x (J + t)) - X x (J - 1)      - ∑ k ∈ Finset.range (dual_cert_p (n - J + 1) - 1), X x (n - triangular_number k) := rfltheorem X_sum {n : ℕ} {ι : Type*} (s : Finset ι) (f : ι → Fin n → ℝ) (t : ℕ) :    X (∑ i ∈ s, f i) t = ∑ i ∈ s, X (f i) t := by  unfold X; split_ifs  · simp [Finset.sum_apply]  · simptheorem X_smul {n : ℕ} (c : ℝ) (x : Fin n → ℝ) (t : ℕ) : X (c • x) t = c * X x t := by  unfold X; split_ifs  · simp  · simptheorem sr_sum (n J : ℕ) {ι : Type*} (s : Finset ι) (a : ι → ℝ) (f : ι → Fin n → ℝ) :    signed_relation n J (∑ i ∈ s, a i • f i) = ∑ i ∈ s, a i * signed_relation n J (f i) := by  simp only [sr_X, X_sum, X_smul, mul_sub, Finset.mul_sum, Finset.sum_sub_distrib]  rw [Finset.sum_comm (s := Finset.range (dual_cert_p (n - J + 1))),    Finset.sum_comm (s := Finset.range (dual_cert_p (n - J + 1) - 1))]theorem lin_comb (n : ℕ) (hn : 1 ≤ n) (y : Fin n → ℝ) :    (∀ i : Fin n, (∑ j : Fin n, y j * signed_relation n (j.val + 1) (fun k => if i.val ≤ k.val then 1 else 0)) = 1) →      ∀ x : Fin n → ℝ, (∑ j : Fin n, y j * signed_relation n (j.val + 1) x) = x ⟨n - 1, by omega⟩ := by  intro hy x  let Xn : ℕ → ℝ := fun t => if h : t < n then x ⟨t, h⟩ else 0  let F : ℕ → ℝ := fun t => if t = 0 then 0 else Xn (t - 1)  let d : ℕ → ℝ := fun i => F (i + 1) - F i  have hx : x = ∑ i : Fin n, d i.val • (fun k : Fin n => if i.val ≤ k.val then (1 : ℝ) else 0) := by    funext k    rw [Finset.sum_apply]    simp only [Pi.smul_apply, smul_eq_mul, mul_ite, mul_one, mul_zero]    rw [Fin.sum_univ_eq_sum_range (fun i => if i ≤ k.val then d i else 0), Finset.sum_ite,      Finset.sum_const_zero, add_zero]    have hfilt : (Finset.range n).filter (fun i => i ≤ k.val) = Finset.range (k.val + 1) := by      ext i; simp only [Finset.mem_filter, Finset.mem_range]; have := k.isLt; omega    rw [hfilt, Finset.sum_range_sub (fun i => F i)]    simp [F, Xn, k.isLt]  conv_lhs => rw [hx]  simp only [sr_sum]  simp only [Finset.mul_sum]  rw [Finset.sum_comm]  have : ∀ i : Fin n, ∑ j : Fin n, y j * (d i.val * signed_relation n (j.val + 1)      (fun k : Fin n => if i.val ≤ k.val then (1 : ℝ) else 0)) = d i.val := by    intro i    have h1 := hy i    calc _ = d i.val * ∑ j : Fin n, y j * signed_relation n (j.val + 1)          (fun k : Fin n => if i.val ≤ k.val then (1 : ℝ) else 0) := by            rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro j _; ring      _ = d i.val := by rw [h1, mul_one]  rw [Finset.sum_congr rfl (fun i _ => this i)]  rw [Fin.sum_univ_eq_sum_range (fun i => d i), Finset.sum_range_sub (fun i => F i)]  simp only [F, Xn]  have : n ≠ 0 := by omega  simp [this, show n - 1 < n by omega]end DCB4/-- Any linear combination of signed relations evaluating to 1 on all step basis vectors evaluates to x(n-1) on all vectors x. -/theorem signed_relation_linear_combination_of_step_basis (n : ℕ) (hn : 1 ≤ n) (y : Fin n → ℝ) :    (∀ i : Fin n, (∑ j : Fin n, y j * signed_relation n (j.val + 1) (fun k => if i.val ≤ k.val then 1 else 0)) = 1) →      ∀ x : Fin n → ℝ, (∑ j : Fin n, y j * signed_relation n (j.val + 1) x) = x ⟨n - 1, by omega⟩ := by  exact DCB4.lin_comb n hn y
See it in the graphDiscuss this resultChallenge it