op_2130_bounded_path_has_nonincreasing_edge
If D is positive and each of 2D integer discrepancies has absolute value below D, some adjacent pair is non-increasing from left to right.
Statement
theorem op_2130_bounded_path_has_nonincreasing_edge (D : ℕ) (hD : 1 ≤ D) (d : Fin (2 * D) → ℤ) (h : ∀ i, |d i| < (D : ℤ)) : ∃ i : Fin (2 * D - 1), d ⟨i.val, by omega⟩ ≥ d ⟨i.val + 1, by omega⟩
- Source
- OP-2130: existence of a legal potential-increasing move before the threshold
- Verified
- 22 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 2
- TotalPreorderA total preorder: a preorder where
≤is total (complete). This is weaker thanLinearOrder— it does NOT require antisymmetry or… - LinearOrder.toTotalPreorderEvery
LinearOrderis aTotalPreorder.
- TotalPreorderA total preorder: a preorder where
- 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
The theorem is proved by contradiction. If no adjacent pair is non-increasing, every adjacent pair must strictly increase, so each step increases by at least 1 in the integers. Telescoping this lower bound across all 2D - 1 steps implies that the total change d_{2D-1} - d_0 is at least 2D - 1. However, since every discrepancy is bounded in absolute value by D - 1, the maximum possible span between any two values is at most (D - 1) - (-D + 1) = 2D - 2, producing an arithmetic contradiction.
Assume for contradiction that the sequence is strictly increasing at every step.
We proceed by contradiction, assuming no adjacent pair satisfies d_i ≥ d_{i+1}. Negating this existential hypothesis gives that d_i < d_{i+1} for all valid indices i in {0, ..., 2D - 2}. The bounds i < 2D and i + 1 < 2D required for the Fin indices are verified by integer arithmetic.
theorem op_2130_bounded_path_has_nonincreasing_edge (D : ℕ) (hD : 1 ≤ D) (d : Fin (2 * D) → ℤ) (h : ∀ i, |d i| < (D : ℤ)) : ∃ i : Fin (2 * D - 1), d ⟨i.val, by omega⟩ ≥ d ⟨i.val + 1, by omega⟩ := by by_contra hcon push_neg at hcon
Extend d to a function f on all natural numbers by clamping at index 2D - 1.
We define f(n) = d(min(n, 2D - 1)). Clamping ensures that f is well-defined for every n ∈ ℕ, agreeing with d on the range 0 ≤ n ≤ 2D - 1.
let f : ℕ → ℤ := fun n => d ⟨min n (2 * D - 1), by omega⟩
Every step of f on the range 0 ≤ i < 2D - 1 increases by at least 1.
For i ∈ Finset.range (2 * D - 1), we have i < 2D - 1 by Finset.mem_range.mp, so the contradiction hypothesis gives d_i < d_{i+1}. Because i ≤ 2D - 1 and i + 1 ≤ 2D - 1, Nat.min_eq_left (using le_of_lt) shows min(i, 2D - 1) = i and min(i + 1, 2D - 1) = i + 1. Thus f(i + 1) - f(i) = d_{i+1} - d_i. Since these are integers and d_i < d_{i+1}, linear integer arithmetic confirms that the step is at least 1.
uses
Finset.mem_range.mp,Nat.min_eq_left,le_of_lthave hstep : ∀ i ∈ Finset.range (2 * D - 1), (1 : ℤ) ≤ f (i + 1) - f i := by intro i hi have hi' : i < 2 * D - 1 := Finset.mem_range.mp hi have hlt : d ⟨i, by omega⟩ < d ⟨i + 1, by omega⟩ := by simpa using hcon ⟨i, hi'⟩ simp only [f] have hmin1 : min i (2 * D - 1) = i := Nat.min_eq_left (le_of_lt hi') have hmin2 : min (i + 1) (2 * D - 1) = i + 1 := Nat.min_eq_left (by omega) simp only [hmin1, hmin2] omega
The telescoped sum f(2D - 1) - f(0) is at least 2D - 1.
Summing the step lower bound 1 ≤ f(i + 1) - f(i) over all 2D - 1 indices via Finset.sum_le_sum yields 2D - 1 ≤ ∑ (f(i + 1) - f(i)). Applying Finset.sum_range_sub telescopes the sum to f(2D - 1) - f(0).
uses
Finset.sum_le_sum,Finset.sum_range_subhave hsum : ((2 * D - 1 : ℕ) : ℤ) ≤ ∑ i ∈ Finset.range (2 * D - 1), (f (i + 1) - f i) := by calc ((2 * D - 1 : ℕ) : ℤ) = ∑ i ∈ Finset.range (2 * D - 1), (1 : ℤ) := by simp _ ≤ ∑ i ∈ Finset.range (2 * D - 1), (f (i + 1) - f i) := Finset.sum_le_sum hstep rw [Finset.sum_range_sub] at hsum
The net difference between the endpoints satisfies d_{2D-1} - d_0 ≥ 2D - 1.
By definition of f, f(2D - 1) = d_{2D-1} and f(0) = d_0. Rewriting these endpoint values into the telescoped inequality gives 2D - 1 ≤ d_{2D-1} - d_0.
have hflast : f (2 * D - 1) = d ⟨2 * D - 1, by omega⟩ := by simp [f] have hf0 : f 0 = d ⟨0, by omega⟩ := by simp [f] rw [hflast, hf0] at hsum
The lower bound on d_{2D-1} - d_0 contradicts the discrepancy bounds.
From the bound |d_i| < D applied at i = 0 and i = 2D - 1 via abs_lt.mp, we have -D < d_0 and d_{2D-1} < D. For integers, these imply d_0 ≥ -D + 1 and d_{2D-1} ≤ D - 1, meaning the total span d_{2D-1} - d_0 cannot exceed (D - 1) - (-D + 1) = 2D - 2. This contradicts d_{2D-1} - d_0 ≥ 2D - 1, and integer linear arithmetic (omega) closes the proof.
uses
abs_lt.mphave h0 := (abs_lt.mp (h ⟨0, by omega⟩)).1 have hlast := (abs_lt.mp (h ⟨2 * D - 1, by omega⟩)).2 omega
Finset.mem_range.mp- For natural numbers, if i ∈ Finset.range n, then i < n.
Nat.min_eq_left- For natural numbers a and b, if a ≤ b, then min a b = a.
le_of_lt- In a preorder, if a < b, then a ≤ b.
Finset.sum_le_sum- If f i ≤ g i for all i in a finite set s, then ∑ i ∈ s, f i ≤ ∑ i ∈ s, g i.
Finset.sum_range_sub- For any function f into an additive group, the telescoping sum ∑ i ∈ Finset.range n, (f (i + 1) - f i) equals f n - f 0.
abs_lt.mp- If |a| < b, then -b < a and a < b.
- The sequence d, originally defined on Fin (2 * D), is extended to a function f : ℕ → ℤ by clamping the input with min n (2 * D - 1). This formal device allows the proof to apply library lemmas like Finset.sum_range_sub that operate on functions with domain ℕ without having to carry around boundary proofs at every step.
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.
theorem op_2130_bounded_path_has_nonincreasing_edge (D : ℕ) (hD : 1 ≤ D) (d : Fin (2 * D) → ℤ) (h : ∀ i, |d i| < (D : ℤ)) : ∃ i : Fin (2 * D - 1), d ⟨i.val, by omega⟩ ≥ d ⟨i.val + 1, by omega⟩ := by by_contra hcon push_neg at hcon let f : ℕ → ℤ := fun n => d ⟨min n (2 * D - 1), by omega⟩ have hstep : ∀ i ∈ Finset.range (2 * D - 1), (1 : ℤ) ≤ f (i + 1) - f i := by intro i hi have hi' : i < 2 * D - 1 := Finset.mem_range.mp hi have hlt : d ⟨i, by omega⟩ < d ⟨i + 1, by omega⟩ := by simpa using hcon ⟨i, hi'⟩ simp only [f] have hmin1 : min i (2 * D - 1) = i := Nat.min_eq_left (le_of_lt hi') have hmin2 : min (i + 1) (2 * D - 1) = i + 1 := Nat.min_eq_left (by omega) simp only [hmin1, hmin2] omega have hsum : ((2 * D - 1 : ℕ) : ℤ) ≤ ∑ i ∈ Finset.range (2 * D - 1), (f (i + 1) - f i) := by calc ((2 * D - 1 : ℕ) : ℤ) = ∑ i ∈ Finset.range (2 * D - 1), (1 : ℤ) := by simp _ ≤ ∑ i ∈ Finset.range (2 * D - 1), (f (i + 1) - f i) := Finset.sum_le_sum hstep rw [Finset.sum_range_sub] at hsum have hflast : f (2 * D - 1) = d ⟨2 * D - 1, by omega⟩ := by simp [f] have hf0 : f 0 = d ⟨0, by omega⟩ := by simp [f] rw [hflast, hf0] at hsum have h0 := (abs_lt.mp (h ⟨0, by omega⟩)).1 have hlast := (abs_lt.mp (h ⟨2 * D - 1, by omega⟩)).2 omega