/-- Positive-exponent powers distinguish natural-number seeds. -/ theorem power_23_injective (a b : Nat) (h : a ^ 23 = b ^ 23) : a = b := (Nat.pow_left_inj (by decide : (23 : Nat) ≠ 0)).mp h /-- The two little-endian base-256 digits recover the seed. -/ theorem two_byte_identity (seed : Nat) : seed % 256 + 256 * (seed / 256) = seed := Nat.mod_add_div seed 256 /-- The selected 23rd power is the stated integer. -/ theorem power_399 : (399 : Nat) ^ 23 = 664318888400147317962445992095559074642829054227185303529199 := by decide /-- Coordinates in the free integer module with basis (1, phi, pi, phi*pi). -/ structure ZPhiPi where c1 : Int cPhi : Int cPi : Int cPhiPi : Int deriving DecidableEq, Repr /-- The exact symbolic seed state. -/ def seedState (s : Int) : ZPhiPi := ⟨s, 0, 1 - s, s - 1⟩ /-- Coordinates of phi * x + pi, using phi^2 = phi + 1. -/ def applyNumerator (x : ZPhiPi) : ZPhiPi := ⟨x.cPhi, x.c1 + x.cPhi, x.cPhiPi + 1, x.cPi + x.cPhiPi⟩ /-- Coordinates of phi^(-1) * (x - pi). -/ def recoverNumerator (x : ZPhiPi) : ZPhiPi := ⟨x.cPhi - x.c1, x.c1, x.cPhiPi - x.cPi + 1, x.cPi - 1⟩ /-- Coordinates of s * (phi + pi). -/ def scaledOmega (s : Int) : ZPhiPi := ⟨0, s, s, 0⟩ /-- The affine integer maps recover every coordinate vector. -/ theorem recover_after_apply (x : ZPhiPi) : recoverNumerator (applyNumerator x) = x := by cases x <;> simp [recoverNumerator, applyNumerator] <;> omega theorem apply_after_recover (x : ZPhiPi) : applyNumerator (recoverNumerator x) = x := by cases x <;> simp [recoverNumerator, applyNumerator] <;> omega /-- Cancellation and inverse reconstruction hold for all integer seeds. -/ theorem omega_module_cancellation (s : Int) : applyNumerator (seedState s) = scaledOmega s := by simp [applyNumerator, seedState, scaledOmega] <;> omega theorem omega_module_recovery (s : Int) : recoverNumerator (scaledOmega s) = seedState s := by simp [recoverNumerator, scaledOmega, seedState] <;> omega #print axioms power_23_injective #print axioms two_byte_identity #print axioms power_399 #print axioms recover_after_apply #print axioms apply_after_recover #print axioms omega_module_cancellation #print axioms omega_module_recovery