op_2130_centered_path_potential_bound
For 2D integers of absolute value below positive D, the sum of the discrepancy at i weighted by 2i+1−2D is at most 2D²(D−1).
Statement
theorem op_2130_centered_path_potential_bound (D : ℕ) (hD : 1 ≤ D) (d : Fin (2 * D) → ℤ) (h : ∀ i, |d i| < (D : ℤ)) : (∑ i : Fin (2 * D), (2 * (i.val : ℤ) + 1 - 2 * (D : ℤ)) * d i) ≤ 2 * (D : ℤ)^2 * ((D : ℤ) - 1)- Source
- OP-2130: bound for the centered weighted potential of the path witness
- Verified
- 22 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 2
- op_2130_path_cascade_witnessFor every D ≥ 1 there is an edge sequence on SimpleGraph.pathGraph (2*D) of length at most D^3 and one coin tape whose greedy run reaches…
- op_2130_terminal_path_cascade_witnessFor every positive D, there is a fixed sequence of at most D³ requests on the 2D-vertex path and a fixed coin tape for which the terminal…
The proof, explained
To bound the weighted sum ∑_{i=0}^{2D-1} (2i + 1 - 2D) d(i), the index range {0, …, 2D - 1} is split into the first D and last D elements, pairing each index i with D + i for i ∈ {0, …, D - 1}. For each pair, the coefficient of d(i) is negative while that of d(D + i) is positive; using the bounds -(D - 1) ≤ d(i) and d(D + i) ≤ D - 1, the paired contribution is bounded above by (2D - 1 - 2i)(D - 1) + (2i + 1)(D - 1) = 2D(D - 1). Summing this constant upper bound over all D pairs yields 2D²(D - 1). Finally, the domain size is transferred from D + D to 2D to complete the theorem.
It suffices to show that for every i ∈ {0, …, D - 1}, the paired summand (2i + 1 - 2D) d(i) + (2(D + i) + 1 - 2D) d(D + i) is at most 2D(D - 1).
Using Fin.sum_univ_add, the sum over {0, …, 2D - 1} is split into the first D indices i and the remaining D indices D + i. We recombine these two sums into a single sum of pairs using Finset.sum_add_distrib. By Finset.sum_le_sum, bounding the total sum by ∑_{i < D} 2D(D - 1) reduces to showing that each paired summand is bounded above by 2D(D - 1).
uses
Fin.sum_univ_add,Finset.sum_add_distrib,Finset.sum_le_sumrw [Fin.sum_univ_add, ← Finset.sum_add_distrib] calc _ ≤ ∑ _i : Fin D, (2 * (D : ℤ) * ((D : ℤ) - 1)) := by apply Finset.sum_le_sum intro i _
For each i ∈ {0, …, D - 1}, the paired summand (2i + 1 - 2D) d(i) + (2(D + i) + 1 - 2D) d(D + i) is at most 2D(D - 1).
From |d(j)| < D for all j (via abs_lt.mp), the integer values satisfy d(i) ≥ -(D - 1) and d(D + i) ≤ D - 1, meaning d(i) + D - 1 ≥ 0 and D - 1 - d(D + i) ≥ 0. Since 0 ≤ i < D, the coefficients 2D - 1 - 2i and 2i + 1 are both non-negative. By mul_nonneg, the products (2D - 1 - 2i)(d(i) + D - 1) and (2i + 1)(D - 1 - d(D + i)) are non-negative. After simplifying index casts with Fin.val_castAdd, Fin.val_natAdd, and Nat.cast_add, adding these two inequalities shows that -(2i + 1 - 2D) d(i) + (2i + 1) d(D + i) ≤ 2D(D - 1), which nlinarith verifies.
uses
abs_lt.mp,mul_nonneg,Fin.val_castAdd,Fin.val_natAdd,Nat.cast_addhave hdleft := abs_lt.mp (h (Fin.castAdd D i)) have hdright := abs_lt.mp (h (Fin.natAdd D i)) have hi : (i.val : ℤ) < (D : ℤ) := by exact_mod_cast i.isLt have hi0 : (0 : ℤ) ≤ (i.val : ℤ) := by positivity have hp : 0 ≤ 2 * (D : ℤ) - 1 - 2 * (i.val : ℤ) := by omega have hq : 0 ≤ 2 * (i.val : ℤ) + 1 := by omega have hp' := mul_nonneg hp (show 0 ≤ d (Fin.castAdd D i) + (D : ℤ) - 1 by omega) have hq' := mul_nonneg hq (show 0 ≤ (D : ℤ) - 1 - d (Fin.natAdd D i) by omega) simp only [Fin.val_castAdd, Fin.val_natAdd, Nat.cast_add] at * nlinarith
The sum ∑_{i < D} 2D(D - 1) equals 2D²(D - 1), completing the bound for op_2130_centered_bound_aux.
The sum consists of D identical terms each equal to 2D(D - 1). Evaluating the sum over Fin D yields D · 2D(D - 1) (by simp), which simplifies to 2D²(D - 1) by polynomial arithmetic (ring).
_ = 2 * (D : ℤ)^2 * ((D : ℤ) - 1) := by simp; ring
The potential bound holds for any d : Fin (2 * D) → ℤ.
To bridge the domain size 2 * D in the theorem statement and D + D in the auxiliary lemma, we formulate a generalized claim hg for any n with n = D + D, prove it by substituting n = D + D and applying op_2130_centered_bound_aux, and then instantiate hg at n = 2 * D, discharging 2 * D = D + D by linear arithmetic (omega).
uses
op_2130_centered_bound_auxhave hg : ∀ (n : ℕ), n = D + D → ∀ (d : Fin n → ℤ), (∀ i, |d i| < (D : ℤ)) → (∑ i : Fin n, (2 * (i.val : ℤ) + 1 - 2 * (D : ℤ)) * d i) ≤ 2 * (D : ℤ)^2 * ((D : ℤ) - 1) := by intro n hn subst n exact op_2130_centered_bound_aux D hD exact hg (2 * D) (by omega) d h
Fin.sum_univ_add- The sum of a function over Fin (a + b) equals the sum of the first a values plus the sum of the remaining b values.
Finset.sum_add_distrib- The sum of a sum of two functions over a finite set equals the sum of the first plus the sum of the second.
Finset.sum_le_sum- If f(i) ≤ g(i) for all i in a finite set, then the sum of f is at most the sum of g.
abs_lt.mp- An absolute value inequality |a| < b implies -b < a and a < b.
mul_nonneg- The product of two non-negative numbers is non-negative.
Fin.val_castAdd- Embedding an element of Fin n into Fin (n + m) as one of the first n elements preserves its numerical value.
Fin.val_natAdd- Embedding an element i of Fin m into Fin (n + m) with offset n has numerical value n + i.
Nat.cast_add- The coercion of a sum of natural numbers to a ring equals the sum of their coercions.
op_2130_centered_bound_aux- For integers d(i) on Fin (D + D) with |d(i)| < D, the weighted sum ∑ (2i + 1 - 2D) d(i) is at most 2D²(D - 1).
- In Lean, `2 * D` and `D + D` are not definitionally equal, so rewriting one to the other inside the type of a function domain `Fin n → ℤ` requires a type-theoretic generalization (lines 23–30) that has no paper-mathematics counterpart.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
private lemma op_2130_centered_bound_aux (D : ℕ) (hD : 1 ≤ D) (d : Fin (D + D) → ℤ) (h : ∀ i, |d i| < (D : ℤ)) : (∑ i : Fin (D + D), (2 * (i.val : ℤ) + 1 - 2 * (D : ℤ)) * d i) ≤ 2 * (D : ℤ)^2 * ((D : ℤ) - 1) := by rw [Fin.sum_univ_add, ← Finset.sum_add_distrib] calc _ ≤ ∑ _i : Fin D, (2 * (D : ℤ) * ((D : ℤ) - 1)) := by apply Finset.sum_le_sum intro i _ have hdleft := abs_lt.mp (h (Fin.castAdd D i)) have hdright := abs_lt.mp (h (Fin.natAdd D i)) have hi : (i.val : ℤ) < (D : ℤ) := by exact_mod_cast i.isLt have hi0 : (0 : ℤ) ≤ (i.val : ℤ) := by positivity have hp : 0 ≤ 2 * (D : ℤ) - 1 - 2 * (i.val : ℤ) := by omega have hq : 0 ≤ 2 * (i.val : ℤ) + 1 := by omega have hp' := mul_nonneg hp (show 0 ≤ d (Fin.castAdd D i) + (D : ℤ) - 1 by omega) have hq' := mul_nonneg hq (show 0 ≤ (D : ℤ) - 1 - d (Fin.natAdd D i) by omega) simp only [Fin.val_castAdd, Fin.val_natAdd, Nat.cast_add] at * nlinarith _ = 2 * (D : ℤ)^2 * ((D : ℤ) - 1) := by simp; ringtheorem op_2130_centered_path_potential_bound (D : ℕ) (hD : 1 ≤ D) (d : Fin (2 * D) → ℤ) (h : ∀ i, |d i| < (D : ℤ)) : (∑ i : Fin (2 * D), (2 * (i.val : ℤ) + 1 - 2 * (D : ℤ)) * d i) ≤ 2 * (D : ℤ)^2 * ((D : ℤ) - 1) := by have hg : ∀ (n : ℕ), n = D + D → ∀ (d : Fin n → ℤ), (∀ i, |d i| < (D : ℤ)) → (∑ i : Fin n, (2 * (i.val : ℤ) + 1 - 2 * (D : ℤ)) * d i) ≤ 2 * (D : ℤ)^2 * ((D : ℤ) - 1) := by intro n hn subst n exact op_2130_centered_bound_aux D hD exact hg (2 * D) (by omega) d h