AFTD Auto-Formalizing Theoretical Domains

op2130_height_gate

theoremverified

Updating a zero height between two independent signed unit heights gives their majority with the supplied tie coin.

Statement

theorem op2130_height_gate (h : ℕ → ℤ) (p : ℕ) (x y : ℤ)
    (hx : x = 1 ∨ x = -1) (hy : y = 1 ∨ y = -1)
    (hL : h (p-1) = x) (hC : h p = 0) (hR : h (p+1) = y) (c : Bool) :
    op2130_height_step h p c =
      Function.update h p (if x = y then x else if c then 1 else -1)
Source
OP-2130, forced signal circuit on path heights
Verified
24 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • op2130_height_stepOne greedy update of a path cumulative-height profile at an interior site, using the supplied coin for a tie.
  • 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…
Used by 1
  • op2130_height_majority_gateTwo isolated signed unit heights separated by one zero can be combined into a single isolated majority signal in three updates.

The proof, explained

Updating a height function at a site p where h(p) = 0 between two unit-height neighbors x, y ∈ {1, -1} implements a majority gate: the new value is x if x = y, and otherwise falls back to the tie coin c. The proof unfolds the step definition, substitutes the local values h(p - 1) = x, h(p) = 0, and h(p + 1) = y, and exhaustively verifies the 2 × 2 × 2 = 8 possible assignments of (x, y, c) by case splitting and automated simplification.

  1. The update formula at position p reduces to evaluating whether x + y is positive, negative, or zero.

    Unfolding the definition of `op2130_height_step` expresses the update at position p as h(p) plus a conditional value comparing 2 * h(p) to h(p - 1) + h(p + 1). Rewriting with the hypotheses h(p - 1) = x, h(p) = 0, and h(p + 1) = y instantiates these terms, leaving 0 + (if 0 < x + y then 1 else if x + y < 0 then -1 else if c then 1 else -1) as the new value at index p.

    lines 6–7

      unfold op2130_height_step
      rw [hL, hC, hR]
  2. In all eight cases for x, y, and c, the update formula matches the majority gate with tie-breaker c. automation

    By assumption, x and y are each either 1 or -1, and c is a boolean. Case splitting on hx, hy, and c produces eight concrete subgoals. In each branch, `simp` computes the arithmetic: when x = y = 1, x + y = 2 > 0 and both sides equal 1; when x = y = -1, x + y = -2 < 0 and both sides equal -1; and when x ≠ y, x + y = 0, so the tie-break condition triggers and both sides evaluate to 1 if c is true and -1 if c is false.

    line 8

      rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> cases c <;> simp

Written by a model (gemini-3.8-flash) from the Lean source alone (no goal states were available). Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem op2130_height_gate (h : ℕ → ℤ) (p : ℕ) (x y : ℤ)    (hx : x = 1 ∨ x = -1) (hy : y = 1 ∨ y = -1)    (hL : h (p-1) = x) (hC : h p = 0) (hR : h (p+1) = y) (c : Bool) :    op2130_height_step h p c =      Function.update h p (if x = y then x else if c then 1 else -1) := by  unfold op2130_height_step  rw [hL, hC, hR]  rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> cases c <;> simp
See it in the graphDiscuss this resultChallenge it