op_2130_path_height_update_monotone
A single cumulative-height update preserves coordinatewise order when the center heights have the same parity and the two tie-breaking coins are ordered.
Statement
theorem op_2130_path_height_update_monotone (l m r L M R : ℤ) (coin coin' : Bool) (hl : l ≤ L) (hm : m ≤ M) (hr : r ≤ R) (hp : m % 2 = M % 2) (hc : coin = false ∨ coin' = true) : m + (if 2 * m < l + r then 1 else if l + r < 2 * m then -1 else if coin then 1 else -1) ≤ M + (if 2 * M < L + R then 1 else if L + R < 2 * M then -1 else if coin' then 1 else -1)
- Source
- OP-2130: attractive coupling for cumulative path discrepancies
- Verified
- 22 Nov 2026
- Axioms
Quot.soundpropext- Used by 1
- op_2130_path_prefix_discrepancies_coin_monotoneFor path requests written left to right, increasing any subset of the tie coins cannot decrease any prefix sum of the discrepancy vector…
The proof, explained
The claim is proved by exhaustive case analysis and integer linear arithmetic. When $m < M$, the parity hypothesis $m \\equiv M \\pmod 2$ forces $M - m \\ge 2$, so the updated heights satisfy $m' \\le m + 1 \\le M - 1 \\le M'$ regardless of the neighbor heights or coin flips. When $m = M$, the step direction depends monotonically on the neighbor sums $l + r \\le L + R$ and the ordered coins, ensuring the increment at $m$ cannot exceed the increment at $M$. In the formal proof, Lean branches on the boolean coins, expands the conditional update expressions with `split_ifs`, and settles every resulting arithmetic branch using `omega`.
The updated height at the lower configuration is at most the updated height at the upper configuration: $m' \\le M'$. automation
The proof splits on the boolean coin values `coin` and `coin'`. The combination `coin = true` and `coin' = false` contradicts the hypothesis `hc` and is immediately eliminated by `simp_all`. In the remaining cases, `split_ifs` unpacks the piecewise conditions comparing each center height to the sum of its neighbors ($2m < l + r$, $l + r < 2m$, etc.). Every resulting branch reduces to showing that $m \\pm 1 \\le M \\pm 1$ given $l \\le L$, $m \\le M$, $r \\le R$, the parity equality $m \\equiv M \\pmod 2$, and the branch inequalities; all of these linear integer arithmetic subgoals are closed by `omega`.
cases coin <;> cases coin' <;> simp_all <;> split_ifs <;> omega
- The proof is packaged into a single chained tactic pipeline: after case-splitting on the boolean coin flips and the conditional branches of the update rule, all resulting linear arithmetic and parity obligations are closed entirely by the automated decision procedure `omega`.
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_path_height_update_monotone (l m r L M R : ℤ) (coin coin' : Bool) (hl : l ≤ L) (hm : m ≤ M) (hr : r ≤ R) (hp : m % 2 = M % 2) (hc : coin = false ∨ coin' = true) : m + (if 2 * m < l + r then 1 else if l + r < 2 * m then -1 else if coin then 1 else -1) ≤ M + (if 2 * M < L + R then 1 else if L + R < 2 * M then -1 else if coin' then 1 else -1) := by cases coin <;> cases coin' <;> simp_all <;> split_ifs <;> omega