AFTD Auto-Formalizing Theoretical Domains

op_2130_pair_update_l1_contract

theoremverified

Two greedy updates using the same tie coin do not increase the sum of the absolute differences between the two pairs, provided corresponding discrepancies have the same parity.

Statement

theorem op_2130_pair_update_l1_contract (a b x y : ℤ) (c : Bool) (ha : a % 2 = x % 2) (hb : b % 2 = y % 2) : let p : ℤ := if a < b then 1 else if b < a then -1 else if c then 1 else -1; let q : ℤ := if x < y then 1 else if y < x then -1 else if c then 1 else -1; |(a + p) - (x + q)| + |(b - p) - (y - q)| ≤ |a - x| + |b - y|
Source
OP-2130, synchronous greedy coupling
Verified
23 Nov 2026
Axioms
Quot.soundpropext

The proof, explained

The proof establishes the $\ell_1$-contraction inequality by exhaustive case analysis and Presburger arithmetic. After expanding the local definitions of the greedy updates $p, q \in \{1, -1\}$, it splits on all relative orderings of the pairs, the tie-breaking coin $c$, and the signs of the terms within the absolute values. The `omega` decision procedure then solves every resulting linear arithmetic goal, using the parity hypotheses $a \equiv x \pmod 2$ and $b \equiv y \pmod 2$ to rule out invalid configurations.

  1. The contraction inequality is expressed directly in terms of the initial coordinates and the tie-breaker flag.

    The definitions of the local variables $p$ and $q$ are inlined directly into the goal inequality $|(a + p) - (x + q)| + |(b - p) - (y - q)| \le |a - x| + |b - y|$, replacing them with their respective conditional expressions.

    line 2

      dsimp only
  2. The $\ell_1$-contraction inequality holds under all cases. automation

    The argument proceeds by exhaustive case analysis. First, `split_ifs` branches on all comparisons determining the update steps $p$ and $q$ (comparing $a$ with $b$, $x$ with $y$, and checking the tie-breaking coin $c$). Next, rewriting with `abs` and `max_def` expresses each absolute value as a conditional expression, and a second `split_ifs` branches on the signs of all expressions. Finally, the `omega` Presburger arithmetic decision procedure solves every resulting branch, using the parity hypotheses $a \equiv x \pmod 2$ and $b \equiv y \pmod 2$ to eliminate impossible cases and verify the linear inequalities.

    line 3

    uses abs, max_def

      split_ifs <;> simp only [abs, max_def] <;> split_ifs <;> omega
abs
The absolute value function on an additive lattice group, defined as the maximum of an element and its negation: $|t| = \max(t, -t)$.
max_def
The definition of the maximum of two elements in a linear order: $\max(a, b) = \text{if } a \le b \text{ then } b \text{ else } a$.

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_pair_update_l1_contract (a b x y : ℤ) (c : Bool) (ha : a % 2 = x % 2) (hb : b % 2 = y % 2) : let p : ℤ := if a < b then 1 else if b < a then -1 else if c then 1 else -1; let q : ℤ := if x < y then 1 else if y < x then -1 else if c then 1 else -1; |(a + p) - (x + q)| + |(b - p) - (y - q)| ≤ |a - x| + |b - y| := by  dsimp only  split_ifs <;> simp only [abs, max_def] <;> split_ifs <;> omega
See it in the graphDiscuss this resultChallenge it