AFTD Auto-Formalizing Theoretical Domains

op2130_height_wire

theoremverified

An isolated sign moves one site to the right in two forced height updates when the adjacent three sites are zero.

Statement

theorem op2130_height_wire (h : ℕ → ℤ) (p : ℕ) (hp : 1 ≤ p)
    (s : ℤ) (hs : s = 1 ∨ s = -1)
    (hL : h (p-1) = 0) (hC : h p = s)
    (hR : h (p+1) = 0) (hRR : h (p+2) = 0) (c1 c2 : Bool) :
    op2130_height_step (op2130_height_step h (p+1) c1) p c2 =
      Function.update (Function.update h (p+1) s) 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…

The proof, explained

The proof proceeds in two steps corresponding to the two height updates. First, updating at site $p+1$ evaluates the neighbor heights $h(p) = s$ and $h(p+2) = 0$ against the center height $h(p+1) = 0$, which strictly forces the height at $p+1$ to become $s$ regardless of the coin toss $c_1$. Second, in this updated configuration, updating at site $p$ compares $2s$ with the neighbor sum $0 + s = s$, strictly forcing the height at $p$ to change by $-s$ and returning site $p$ to 0.

  1. The first height update at site $p+1$ deterministically sets its height to $s$: `op2130_height_step h (p+1) c1 = Function.update h (p+1) s`.

    We unfold the definition of `op2130_height_step` at site $p+1$. Its neighbors are $(p+1) - 1 = p$ and $(p+1) + 1 = p + 2$, verified by index arithmetic (`omega`). Substituting the known heights $h(p) = s$, $h(p+1) = 0$, and $h(p+2) = 0$, the center height is 0 (so $2 \cdot h(p+1) = 0$) and the sum of the neighbor heights is $s + 0 = s$. By splitting into cases on $s \in \{1, -1\}$ (`rcases hs with rfl | rfl`), the update direction is strictly determined: if $s = 1$, then $0 < 1$, so the site is incremented to 1; if $s = -1$, then $-1 < 0$, so the site is decremented to $-1$. In both cases the resulting height at $p+1$ is $s$, without needing the coin toss $c_1$.

    lines 7–12

      have hcopy : op2130_height_step h (p+1) c1 = Function.update h (p+1) s := by
        unfold op2130_height_step
        have hh : p + 1 - 1 = p := by omega
        have hh2 : p + 1 + 1 = p + 2 := by omega
        rw [hh, hh2, hC, hR, hRR]
        rcases hs with rfl | rfl <;> simp
  2. The second height update at site $p$ deterministically resets the height at site $p$ to 0, completing the proof.

    We rewrite the inner step using `hcopy` and unfold `op2130_height_step` at site $p$. Linear arithmetic (`omega`) establishes that $p \ne p + 1$ and $p - 1 \ne p + 1$, so rewriting with `Function.update_apply` shows the previous update at site $p+1$ does not affect sites $p$ or $p-1$. Consequently, the heights are $h(p-1) = 0$ at the left neighbor, $s$ at the center site $p$, and $s$ at the right neighbor $p+1$. The center doubled is $2s$, while the neighbor sum is $0 + s = s$. Splitting into cases on $s \in \{1, -1\}$, if $s = 1$, the neighbor sum $1$ is strictly less than $2s = 2$, which forces the height to decrement by 1 to 0; if $s = -1$, $2s = -2$ is strictly less than the neighbor sum $-1$, which forces the height to increment by 1 to 0. In both cases site $p$ is reset to 0, matching the right-hand side.

    lines 13–18

    uses Function.update_apply, if_false, if_true

      rw [hcopy]
      unfold op2130_height_step
      have hp1 : p ≠ p+1 := by omega
      have hp2 : p-1 ≠ p+1 := by omega
      simp only [Function.update_apply, hp1, hp2, if_false, if_true, hC, hL]
      rcases hs with rfl | rfl <;> simp
Function.update_apply
Evaluating an updated function `Function.update f a b` at an argument `x` yields `b` if `x = a` and `f x` otherwise.
if_false
The conditional expression `if False then a else b` simplifies to `b`.
if_true
The conditional expression `if True then a else b` simplifies to `a`.

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_wire (h : ℕ → ℤ) (p : ℕ) (hp : 1 ≤ p)    (s : ℤ) (hs : s = 1 ∨ s = -1)    (hL : h (p-1) = 0) (hC : h p = s)    (hR : h (p+1) = 0) (hRR : h (p+2) = 0) (c1 c2 : Bool) :    op2130_height_step (op2130_height_step h (p+1) c1) p c2 =      Function.update (Function.update h (p+1) s) p 0 := by  have hcopy : op2130_height_step h (p+1) c1 = Function.update h (p+1) s := by    unfold op2130_height_step    have hh : p + 1 - 1 = p := by omega    have hh2 : p + 1 + 1 = p + 2 := by omega    rw [hh, hh2, hC, hR, hRR]    rcases hs with rfl | rfl <;> simp  rw [hcopy]  unfold op2130_height_step  have hp1 : p ≠ p+1 := by omega  have hp2 : p-1 ≠ p+1 := by omega  simp only [Function.update_apply, hp1, hp2, if_false, if_true, hC, hL]  rcases hs with rfl | rfl <;> simp
See it in the graphDiscuss this resultChallenge it