AFTD Auto-Formalizing Theoretical Domains

op2130_height_clear

theoremverified

A signed unit height between a zero height and another signed unit height is forced to zero.

Statement

theorem op2130_height_clear (h : ℕ → ℤ) (p : ℕ) (x y : ℤ)
    (hx : x = 1 ∨ x = -1) (hy : y = 1 ∨ y = -1)
    (hL : h (p-1) = 0) (hC : h p = x) (hR : h (p+1) = y) (c : Bool) :
    op2130_height_step h p c = Function.update h p 0
Source
OP-2130, forced signal circuit on path heights
Verified
23 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

We unfold the definition of the height update step and substitute the neighborhood heights $h(p-1) = 0$, $h(p) = x$, and $h(p+1) = y$. We then perform a case analysis on the four possible combinations of signs for $x, y \in \{1, -1\}$. In each case, $2x$ and $y$ compare strictly: when $x = 1$, $2x > y$ forces a decrement to $0$; when $x = -1$, $2x < y$ forces an increment to $0$. The update therefore resets the height at position $p$ to $0$ without ever consulting the coin flip.

  1. The update at position $p$ reduces to modifying $h$ at $p$ by adding a correction to $x$, determined by the comparison between $2x$ and $y$.

    We unfold the definition of the height update step `op2130_height_step` and substitute the neighborhood heights $h(p-1) = 0$, $h(p) = x$, and $h(p+1) = y$. Under these substitutions, the center term $2 \cdot h(p)$ becomes $2x$ and the sum of the neighboring heights $h(p-1) + h(p+1)$ becomes $0 + y = y$.

    lines 5–6

      unfold op2130_height_step
      rw [hL, hC, hR]
  2. In all four possible cases for $x, y \in \{1, -1\}$, the updated height at position $p$ is $0$.

    We split into four cases using the hypotheses $x = \pm 1$ and $y = \pm 1$. When $x = 1$, we have $2x = 2$, which is strictly greater than $y \in \{1, -1\}$, so the update rule subtracts $1$ from $x$, yielding $1 - 1 = 0$. When $x = -1$, we have $2x = -2$, which is strictly less than $y \in \{1, -1\}$, so the update rule adds $1$ to $x$, yielding $-1 + 1 = 0$. In every branch, simplification evaluates the integer inequalities and arithmetic to show that the new value at $p$ is $0$, independently of the coin flip $c$.

    line 7

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