op_2130_same_parity_greedy_edge_nonexpansive
Apply the same greedy edge update and tie coin to two integer endpoint pairs. If corresponding endpoint values have the same parity, the sum of squared differences of the pairs cannot increase.
Statement
theorem op_2130_same_parity_greedy_edge_nonexpansive (x y z w : ℤ) (c : Bool) (hx : Even (x - z)) (hy : Even (y - w)) : let a : ℤ := if x < y then 1 else if y < x then -1 else if c then 1 else -1; let b : ℤ := if z < w then 1 else if w < z then -1 else if c then 1 else -1; (x + a - (z + b))^2 + (y - a - (w - b))^2 ≤ (x - z)^2 + (y - w)^2
- Source
- OP-2130: synchronized greedy coupling as a route to pathwise concentration
- Verified
- 22 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 2
- LinearOrder.toTotalPreorderEvery
LinearOrderis aTotalPreorder. - TotalPreorderA total preorder: a preorder where
≤is total (complete). This is weaker thanLinearOrder— it does NOT require antisymmetry or…
- LinearOrder.toTotalPreorderEvery
The proof, explained
Expanding the new sum of squares reveals that it differs from the original by $2\delta(D + \delta)$, where $D = (x - y) - (z - w)$ and $\delta = a - b \in \{-2, 0, 2\}$. Because $x - z$ and $y - w$ have the same parity, $D = (x - z) - (y - w)$ is an even integer, so either $D = 0$ or $|D| \ge 2$. Under the greedy update rules, whenever $\delta \ne 0$, $\delta$ has the opposite sign of $D$ and magnitude at most $|D|$, making $2\delta(D + \delta) \le 0$. The formal proof captures this by establishing a three-way parity gap trichotomy and closing all resulting cases using automated non-linear arithmetic.
There exist integers $p$ and $q$ such that $x - z = 2p$ and $y - w = 2q$.
By definition of an even integer, the assumptions that $x - z$ and $y - w$ are even yield integer witnesses $p$ and $q$ with $x - z = p + p$ and $y - w = q + q$.
rcases hx with ⟨p, hp⟩ rcases hy with ⟨q, hq⟩
Either $x - y = z - w$, or $x - y + 2 \le z - w$, or $z - w + 2 \le x - y$. automation
The difference $(x - y) - (z - w) = (x - z) - (y - w) = 2(p - q)$ is even. Since no even integer equals $1$ or $-1$, the differences $x - y$ and $z - w$ must either be equal or differ by at least $2$. Linear integer arithmetic (`omega`) deduces this trichotomy directly from the parity equations.
have hsep : x - y = z - w ∨ x - y + 2 ≤ z - w ∨ z - w + 2 ≤ x - y := by omega
The sum of squared differences after the update does not exceed the initial sum: $((x + a) - (z + b))^2 + ((y - a) - (w - b))^2 \le (x - z)^2 + (y - w)^2$. automation
The proof performs an exhaustive case analysis across the three gap regimes, the two possible values of the tie coin $c$, and the branch conditions comparing $x$ to $y$ and $z$ to $w$. In every branch, $a$ and $b$ evaluate to constant integers in $\{-1, 1\}$, and non-linear arithmetic (`nlinarith`) verifies that the resulting inequality holds.
rcases hsep with heq | hle | hge <;> cases c <;> dsimp <;> split_ifs <;> nlinarith
- In line 5, the proof automatically branches into numerous subcases via `<;>` chaining across the trichotomy cases, the boolean coin values, and the conditional expressions defining $a$ and $b$. Every branch is discharged by `nlinarith`. Algebraically, the change in the sum of squared differences is $2(a - b)((x - y) - (z - w) + (a - b))$, which is non-positive because the gap trichotomy ensures that whenever $a - b \ne 0$, its sign opposes $(x - y) - (z - w)$ with magnitude at most $|(x - y) - (z - w)|$.
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_same_parity_greedy_edge_nonexpansive (x y z w : ℤ) (c : Bool) (hx : Even (x - z)) (hy : Even (y - w)) : let a : ℤ := if x < y then 1 else if y < x then -1 else if c then 1 else -1; let b : ℤ := if z < w then 1 else if w < z then -1 else if c then 1 else -1; (x + a - (z + b))^2 + (y - a - (w - b))^2 ≤ (x - z)^2 + (y - w)^2 := by rcases hx with ⟨p, hp⟩ rcases hy with ⟨q, hq⟩ have hsep : x - y = z - w ∨ x - y + 2 ≤ z - w ∨ z - w + 2 ≤ x - y := by omega rcases hsep with heq | hle | hge <;> cases c <;> dsimp <;> split_ifs <;> nlinarith