AFTD Auto-Formalizing Theoretical Domains

op_2130_path_height_update_monotone

theoremverified

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

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

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

    line 2

      cases coin <;> cases coin' <;> simp_all <;> split_ifs <;> 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

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