pith. machine review for the scientific record. sign in
theorem proved term proof high

gray8At_injective

show as:
view Lean formalization →

The canonical 3-bit Gray code map from Fin 8 to Fin 8 is injective. Pattern enumeration work in Recognition Science cites it to guarantee distinct positions in the eight-tick cycle for D=3. The proof exhausts all input pairs with fin_cases on both arguments, then dispatches the equality hypothesis by cases and reflexivity.

claimThe function $g : {0,1,2,3,4,5,6,7} → {0,1,2,3,4,5,6,7}$ given by the sequence $[0,1,3,2,6,7,5,4]$ is injective.

background

The GrayCycle module works with the state space of all 3-bit patterns (functions Fin 3 → Bool). Two patterns are adjacent when they differ in exactly one coordinate. A Gray cycle is a closed walk of length 8 that visits every pattern once, supplying the explicit adjacency structure missing from the earlier cardinality result Patterns.period_exactly_8. The function gray8At encodes the standard binary-reflected Gray code order on these eight states.

proof idea

One-line wrapper that applies fin_cases to both indices, cases on the equality hypothesis, and closes each branch by rfl.

why it matters in Recognition Science

The result is invoked directly by grayCycle3_injective to obtain injectivity of the full cycle path grayCycle3Path. It supplies the uniqueness step required to align the eight-tick octave (T7) with ledger-compatible adjacency for D=3. The module note states that this stronger object is needed once cardinality facts are upgraded to Hamiltonian-cycle properties.

scope and limits

Lean usage

have h0 : gray8At i = gray8At j := pattern3_injective (by simpa [grayCycle3Path] using hij); exact gray8At_injective h0

formal statement (Lean)

 109theorem gray8At_injective : Function.Injective gray8At := by

proof body

Term-mode proof.

 110  intro i j h
 111  -- brute-force on the 8 cases
 112  fin_cases i <;> fin_cases j <;> cases h <;> rfl
 113
 114/-! ## A small helper: 3-bit patterns can be re-encoded as a Nat in [0,8) -/
 115
 116/-- Convert a 3-bit pattern to a Nat by the usual binary expansion. -/

used by (1)

From the project-wide theorem graph. These declarations reference this one in their body.

depends on (5)

Lean names referenced from this declaration's body.