AFTD Auto-Formalizing Theoretical Domains

matroid_reverse_path_scan_sum_superlinear

theoremverified

For every constant C, some r at least three has C times (2r minus one) strictly smaller than the sum, over i from zero to r minus three, of r minus one minus i.

Statement

theorem matroid_reverse_path_scan_sum_superlinear :
    ∀ C : ℕ, ∃ r : ℕ, 3 ≤ r ∧
      C * (2 * r - 1) < ∑ i ∈ Finset.range (r - 2), (r - 1 - i)
Source
Arithmetic of the reversed-path scan in experiment 44186, related to the frontier scan in arXiv:2611.23624, Algorithm 3.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • LinearOrder.toTotalPreorderEvery LinearOrder is a TotalPreorder.
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…

The proof, explained

To show that the quadratic sum ∑_{i=0}^{r-3} (r - 1 - i) eventually dominates the linear expression C(2r - 1), the proof explicitly chooses r = 8C + 10. It bounds the sum from below by keeping only the first k = 4C + 4 terms, each of which is at least 4C + 5. This partial sum evaluates to at least (4C + 4)(4C + 5) = 16C² + 36C + 20, which strictly exceeds C(2r - 1) = 16C² + 19C.

  1. Fix C and define parameters r = 8C + 10 and k = 4C + 4, with 3 ≤ r and k ≤ r - 2.

    We introduce the constant C and define r = 8C + 10 and k = 4C + 4. Linear arithmetic (`omega`) confirms that r ≥ 10 ≥ 3 and that k = 4C + 4 ≤ (8C + 10) - 2 = 8C + 8 for every natural number C.

    lines 7–11

      intro C
      let r := 8*C+10
      let k := 4*C+4
      have hr : 3 ≤ r := by dsimp [r]; omega
      have hkr : k ≤ r-2 := by dsimp [k,r]; omega
  2. Every term in the first k positions of the sum is at least 4C + 5.

    For each index i in the range of k, we have i < k = 4C + 4 by `Finset.mem_range.mp`. Substituting r and k, the summand r - 1 - i equals 8C + 9 - i; since i ≤ 4C + 3, linear integer arithmetic (`omega`) establishes that 8C + 9 - i ≥ 4C + 5.

    lines 12–16

    uses Finset.mem_range.mp

      have hterm : ∀ i ∈ Finset.range k, 4*C+5 ≤ r-1-i := by
        intro i hi
        have hi' := Finset.mem_range.mp hi
        dsimp [r,k] at *
        omega
  3. The sum of the first k terms is at least k(4C + 5).

    Applying `Finset.sum_le_sum` to the termwise lower bound 4C + 5 ≤ r - 1 - i yields ∑_{i < k} (4C + 5) ≤ ∑_{i < k} (r - 1 - i). Summing the constant 4C + 5 over the k elements gives k · (4C + 5) via `Finset.sum_const` and `nsmul_eq_mul`.

    lines 17–19

    uses Finset.sum_le_sum, Finset.sum_const, nsmul_eq_mul

      have h1 : k*(4*C+5) ≤ ∑ i ∈ Finset.range k, (r-1-i) := by
        have hh := Finset.sum_le_sum hterm
        simpa [Finset.sum_const, nsmul_eq_mul] using hh
  4. The sum of the first k terms is bounded above by the full sum over r - 2 terms.

    Since k ≤ r - 2, the set of indices {0, …, k - 1} is a subset of {0, …, r - 3} by `Finset.range_mono`. Because each omitted term r - 1 - i is a natural number and thus non-negative (`Nat.zero_le`), `Finset.sum_le_sum_of_subset_of_nonneg` ensures that the partial sum is at most the complete sum.

    lines 20–23

    uses Finset.sum_le_sum_of_subset_of_nonneg, Finset.range_mono, Nat.zero_le

      have h2 : (∑ i ∈ Finset.range k, (r-1-i)) ≤ ∑ i ∈ Finset.range (r-2), (r-1-i) := by
        apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.range_mono hkr)
        intro i hi hni
        exact Nat.zero_le _
  5. The witness r satisfies 3 ≤ r and C(2r - 1) < ∑_{i=0}^{r-3} (r - 1 - i).

    We provide r as the existential witness and hr as the proof that 3 ≤ r. Unfolding the definitions, 2r - 1 simplifies to 16C + 19, so the left-hand side is C(16C + 19) = 16C² + 19C. Nonlinear arithmetic (`nlinarith`) closes the goal because 16C² + 19C < (4C + 4)(4C + 5) = 16C² + 36C + 20 ≤ ∑_{i < k} (r - 1 - i) ≤ ∑_{i < r-2} (r - 1 - i).

    lines 24–28

      refine ⟨r,hr,?_⟩
      dsimp [r,k] at *
      have he : 2 * (8*C+10) - 1 = 16*C+19 := by omega
      rw [he]
      nlinarith
Finset.mem_range.mp
An element belonging to the range {0, …, n - 1} is strictly less than n.
Finset.sum_le_sum
If f(i) ≤ g(i) for all elements i in a finite set, then the sum of f is at most the sum of g.
Finset.sum_const
Summing a constant over a finite set equals the cardinality of the set scalar-multiplied by that constant.
nsmul_eq_mul
Natural number scalar multiplication coincides with multiplication in any semiring.
Finset.sum_le_sum_of_subset_of_nonneg
The sum of a non-negative function over a subset of a finite set is at most its sum over the whole set.
Finset.range_mono
The range operation on natural numbers is monotone: if a ≤ b, then the range of a is a subset of the range of b.
Nat.zero_le
Every natural number is greater than or equal to zero.

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

set_option maxRecDepth 8192set_option maxHeartbeats 5000000theorem matroid_reverse_path_scan_sum_superlinear :    ∀ C : ℕ, ∃ r : ℕ, 3 ≤ r ∧      C * (2 * r - 1) < ∑ i ∈ Finset.range (r - 2), (r - 1 - i) := by  intro C  let r := 8*C+10  let k := 4*C+4  have hr : 3 ≤ r := by dsimp [r]; omega  have hkr : k ≤ r-2 := by dsimp [k,r]; omega  have hterm : ∀ i ∈ Finset.range k, 4*C+5 ≤ r-1-i := by    intro i hi    have hi' := Finset.mem_range.mp hi    dsimp [r,k] at *    omega  have h1 : k*(4*C+5) ≤ ∑ i ∈ Finset.range k, (r-1-i) := by    have hh := Finset.sum_le_sum hterm    simpa [Finset.sum_const, nsmul_eq_mul] using hh  have h2 : (∑ i ∈ Finset.range k, (r-1-i)) ≤ ∑ i ∈ Finset.range (r-2), (r-1-i) := by    apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.range_mono hkr)    intro i hi hni    exact Nat.zero_le _  refine ⟨r,hr,?_⟩  dsimp [r,k] at *  have he : 2 * (8*C+10) - 1 = 16*C+19 := by omega  rw [he]  nlinarith
See it in the graphDiscuss this resultChallenge it