AFTD Auto-Formalizing Theoretical Domains

op_2130_same_parity_greedy_edge_nonexpansive

theoremverified

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 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

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.

  1. 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$.

    lines 2–3

      rcases hx with ⟨p, hp⟩
      rcases hy with ⟨q, hq⟩
  2. 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.

    line 4

      have hsep : x - y = z - w ∨ x - y + 2 ≤ z - w ∨ z - w + 2 ≤ x - y := by omega
  3. 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.

    line 5

      rcases hsep with heq | hle | hge <;> cases c <;> dsimp <;> split_ifs <;> nlinarith

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

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
See it in the graphDiscuss this resultChallenge it