AFTD Auto-Formalizing Theoretical Domains

op2130_two_step_increment

theoremverified

For any integer neighbor-minus-center imbalance, two consecutive updates at one height have an explicit increment: zero in the central three cases, deterministic ±2 outside them, and a fair-coin choice only at imbalance ±2.

Statement

theorem op2130_two_step_increment (a : ℤ) (c1 c2 : Bool) :
    let d := op2130_delta_inc a c1
    d + op2130_delta_inc (a - 2*d) c2 =
      if 3 ≤ a then 2 else if a = 2 then (if c2 then 2 else 0)
      else if a ≤ -3 then -2 else if a = -2 then (if c2 then 0 else -2) else 0
Source
OP-2130, paired updates at arbitrary integer heights
Verified
24 Nov 2026
Axioms
Quot.soundpropext

The proof, explained

The proof proceeds by exhaustive case analysis and integer linear arithmetic. It splits over the boolean inputs c1 and c2, unfolds the definition of the single-step increment, and branches on all integer inequalities defining the piecewise cases. The Presburger arithmetic solver omega then verifies the arithmetic identity on every feasible branch and eliminates all mutually contradictory combinations of inequalities.

  1. The two-step increment d + op2130_delta_inc (a - 2*d) c2 matches the piecewise formula across all integers a and booleans c1, c2 automation

    We case-split on both boolean variables c1 and c2 (giving 4 combinations), unfold the definition of op2130_delta_inc, and evaluate boolean equalities and if-then-else expressions. We then split on all remaining condition branches (the inequalities defining op2130_delta_inc and the piecewise branches in the theorem statement). Each resulting branch either presents contradictory integer inequalities or reduces to a constant arithmetic equality, all of which are closed by the Presburger arithmetic tactic omega.

    lines 11–12

    uses op2130_delta_inc, Bool.false_eq_true, Bool.true_eq_false, if_true, if_false

      cases c1 <;> cases c2 <;> simp only [op2130_delta_inc, Bool.false_eq_true,
        Bool.true_eq_false, if_true, if_false] <;> split_ifs <;> omega
op2130_delta_inc
The definition of the single-step increment: returns 1 if a > 0, -1 if a < 0, and if a = 0 returns 1 when c is true and -1 when false
Bool.false_eq_true
The proposition that false equals true simplifies to False
Bool.true_eq_false
The proposition that true equals false simplifies to False
if_true
An if-then-else expression whose condition is True simplifies to the then-branch
if_false
An if-then-else expression whose condition is False simplifies to the else-branch

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

set_option maxHeartbeats 2000000def op2130_delta_inc (a : ℤ) (c : Bool) : ℤ :=  if 0 < a then 1 else if a < 0 then -1 else if c then 1 else -1theorem op2130_two_step_increment (a : ℤ) (c1 c2 : Bool) :    let d := op2130_delta_inc a c1    d + op2130_delta_inc (a - 2*d) c2 =      if 3 ≤ a then 2 else if a = 2 then (if c2 then 2 else 0)      else if a ≤ -3 then -2 else if a = -2 then (if c2 then 0 else -2) else 0 := by  cases c1 <;> cases c2 <;> simp only [op2130_delta_inc, Bool.false_eq_true,    Bool.true_eq_false, if_true, if_false] <;> split_ifs <;> omega
See it in the graphDiscuss this resultChallenge it