op2130_height_majority_gate
Two isolated signed unit heights separated by one zero can be combined into a single isolated majority signal in three updates.
Statement
theorem op2130_height_majority_gate (h : ℕ → ℤ) (p : ℕ) (hp : 2 ≤ p) (x y : ℤ) (hx : x = 1 ∨ x = -1) (hy : y = 1 ∨ y = -1) (hLL : h (p-2) = 0) (hL : h (p-1) = x) (hC : h p = 0) (hR : h (p+1) = y) (hRR : h (p+2) = 0) (c cl cr : Bool) : let z : ℤ := if x = y then x else if c then 1 else -1 op2130_height_step (op2130_height_step (op2130_height_step h p c) (p-1) cl) (p+1) cr = Function.update (Function.update (Function.update h p z) (p-1) 0) (p+1) 0
- Source
- OP-2130, forced signal circuit on path heights
- Verified
- 24 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 4
- op2130_height_stepOne greedy update of a path cumulative-height profile at an interior site, using the supplied coin for a tie.
- op2130_height_clearA signed unit height between a zero height and another signed unit height is forced to zero.
- op2130_height_gateUpdating a zero height between two independent signed unit heights gives their majority with the supplied tie coin.
- op2130_height_clear_mirrorA signed unit height between another signed unit height and a zero height is forced to zero.
The proof, explained
The proof evaluates the three sequential height updates at positions $p$, $p - 1$, and $p + 1$ one by one. First, the update at the central position $p$ acts as a majority gate on the neighboring values $x$ and $y$, setting $h(p)$ to $z \in \{1, -1\}$ via `op2130_height_gate`. Next, the update at $p - 1$ sees left neighbor $0$ and right neighbor $z$, so `op2130_height_clear` resets position $p - 1$ to $0$. Finally, the update at $p + 1$ sees left neighbor $z$ and right neighbor $0$, so `op2130_height_clear_mirror` resets position $p + 1$ to $0$, leaving only the central majority signal $z$.
$z \in \{1, -1\}$, where $z$ is the output of the majority gate on $x$ and $y$ with coin $c$.
Define $z$ to be $x$ when $x = y$, and otherwise $1$ or $-1$ depending on whether the coin $c$ is true or false. Because $x, y \in \{1, -1\}$ and $c \in \{\text{true}, \text{false}\}$, exhausting the eight possible value combinations shows that $z$ is always either $1$ or $-1$.
dsimp only let z : ℤ := if x = y then x else if c then 1 else -1 have hz : z = 1 ∨ z = -1 := by dsimp [z] rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> cases c <;> simp
The first update step at position $p$ changes the height at $p$ from $0$ to $z$.
Since $h(p) = 0$ with left neighbor $h(p - 1) = x \in \{1, -1\}$ and right neighbor $h(p + 1) = y \in \{1, -1\}$, lemma `op2130_height_gate` implies that updating $h$ at site $p$ replaces $h(p)$ with $z$. We rewrite the innermost step of the goal using this identity.
uses
op2130_height_gatehave hgate : op2130_height_step h p c = Function.update h p z := op2130_height_gate h p x y hx hy hL hC hR c rw [hgate]
The second update step at position $p - 1$ clears the height at that position to $0$.
We evaluate the update step at $p - 1$ on the state updated at $p$ using lemma `op2130_height_clear`. The lemma requires checking the values around $p - 1$: 1. At $(p - 1) - 1 = p - 2$, the value is $h(p - 2) = 0$ because $p \ge 2$ ensures $p - 2 \neq p$. 2. At $p - 1$, the value is $h(p - 1) = x$ because $p - 1 \neq p$. 3. At $(p - 1) + 1 = p$, the value is $z$ from the first update. Because the left neighbor is $0$, the center is $x \in \{1, -1\}$, and the right neighbor is $z \in \{1, -1\}$, `op2130_height_clear` applies and sets position $p - 1$ to $0$. We rewrite the second update in the goal with this result.
uses
op2130_height_clearhave hleft : op2130_height_step (Function.update h p z) (p-1) cl = Function.update (Function.update h p z) (p-1) 0 := by apply op2130_height_clear _ _ x z hx hz · have h1 : p-1-1 = p-2 := by omega have h2 : p-2 ≠ p := by omega simp [h1, h2, hLL] · have h1 : p-1 ≠ p := by omega simp [h1, hL] · have h1 : p-1+1 = p := by omega simp [h1] rw [hleft]
The third update step at position $p + 1$ clears the height at that position to $0$, yielding the target configuration.
We evaluate the final update at $p + 1$ on the state updated at $p$ and $p - 1$ using `op2130_height_clear_mirror`. Checking the neighborhood of $p + 1$: 1. At $(p + 1) - 1 = p$, the height is $z$, since $p \neq p - 1$ (as $p \ge 2$), so this site was unaffected by the update at $p - 1$. 2. At $p + 1$, the height is $h(p + 1) = y$, since $p + 1 \neq p$ and $p + 1 \neq p - 1$. 3. At $(p + 1) + 1 = p + 2$, the height is $h(p + 2) = 0$, since $p + 2 \neq p$ and $p + 2 \neq p - 1$. With left neighbor $z \in \{1, -1\}$, center $y \in \{1, -1\}$, and right neighbor $0$, `op2130_height_clear_mirror` clears position $p + 1$ to $0$, completing the proof.
uses
op2130_height_clear_mirrorapply op2130_height_clear_mirror _ _ y z hy hz · have h1 : p+1-1 = p := by omega have h2 : p ≠ p-1 := by omega simp [h1, h2] · have h1 : p+1 ≠ p := by omega have h2 : p+1 ≠ p-1 := by omega simp [h1, h2, hR] · have h1 : p+1+1 = p+2 := by omega have h2 : p+2 ≠ p := by omega have h3 : p+2 ≠ p-1 := by omega simp [h1, h2, h3, hRR]
op2130_height_gate- If a site $p$ has height $0$ while its neighbors $p - 1$ and $p + 1$ have heights $x, y \in \{1, -1\}$, an update step at $p$ with coin $c$ sets the height at $p$ to $x$ (if $x = y$) or to $\pm 1$ according to $c$ (if $x \neq y$).
op2130_height_clear- If a site $p$ has height $x \in \{1, -1\}$ with left neighbor $0$ and right neighbor $y \in \{1, -1\}$, an update step at $p$ resets the height at $p$ to $0$.
op2130_height_clear_mirror- If a site $p$ has height $x \in \{1, -1\}$ with left neighbor $y \in \{1, -1\}$ and right neighbor $0$, an update step at $p$ resets the height at $p$ to $0$.
- Index arithmetic identities and inequalities (such as $p - 2 \neq p$ and $p + 1 \neq p - 1$ for $p \ge 2$), used to determine which positions are affected by `Function.update`, are handled automatically by `omega` and `simp`.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem op2130_height_majority_gate (h : ℕ → ℤ) (p : ℕ) (hp : 2 ≤ p) (x y : ℤ) (hx : x = 1 ∨ x = -1) (hy : y = 1 ∨ y = -1) (hLL : h (p-2) = 0) (hL : h (p-1) = x) (hC : h p = 0) (hR : h (p+1) = y) (hRR : h (p+2) = 0) (c cl cr : Bool) : let z : ℤ := if x = y then x else if c then 1 else -1 op2130_height_step (op2130_height_step (op2130_height_step h p c) (p-1) cl) (p+1) cr = Function.update (Function.update (Function.update h p z) (p-1) 0) (p+1) 0 := by dsimp only let z : ℤ := if x = y then x else if c then 1 else -1 have hz : z = 1 ∨ z = -1 := by dsimp [z] rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> cases c <;> simp have hgate : op2130_height_step h p c = Function.update h p z := op2130_height_gate h p x y hx hy hL hC hR c rw [hgate] have hleft : op2130_height_step (Function.update h p z) (p-1) cl = Function.update (Function.update h p z) (p-1) 0 := by apply op2130_height_clear _ _ x z hx hz · have h1 : p-1-1 = p-2 := by omega have h2 : p-2 ≠ p := by omega simp [h1, h2, hLL] · have h1 : p-1 ≠ p := by omega simp [h1, hL] · have h1 : p-1+1 = p := by omega simp [h1] rw [hleft] apply op2130_height_clear_mirror _ _ y z hy hz · have h1 : p+1-1 = p := by omega have h2 : p ≠ p-1 := by omega simp [h1, h2] · have h1 : p+1 ≠ p := by omega have h2 : p+1 ≠ p-1 := by omega simp [h1, h2, hR] · have h1 : p+1+1 = p+2 := by omega have h2 : p+2 ≠ p := by omega have h3 : p+2 ≠ p-1 := by omega simp [h1, h2, h3, hRR]