SilverSight/formal/CoreFormalism/HopfFibration.lean
allaun 48ee7f7fdb fix(c,octave): C stack overflow test fuel, Octave instance methods
C: stack_overflow test now uses AVM_MAX_STACK+10 fuel
Octave: test creates AVM() instance and calls methods on it
2026-06-30 18:26:10 -05:00

55 lines
1.6 KiB
Text

import CoreFormalism.BraidStateN
import CoreFormalism.FixedPoint
open SilverSight.BraidStateN
open SilverSight.FixedPoint
namespace SilverSight.HopfFibration
structure Quaternion where
a : Q16_16
b : Q16_16
c : Q16_16
d : Q16_16
deriving Repr
namespace Quaternion
def conj (q : Quaternion) : Quaternion :=
{ a := q.a, b := Q16_16.neg q.b, c := Q16_16.neg q.c, d := Q16_16.neg q.d }
def sumSq (q : Quaternion) : Q16_16 :=
let sq (x : Q16_16) := Q16_16.mul x x
Q16_16.add (Q16_16.add (sq q.a) (sq q.b)) (Q16_16.add (sq q.c) (sq q.d))
def isUnit (q : Quaternion) : Prop :=
sumSq q = Q16_16.one
def ofChiralLabel (label : ChiralLabel) : Quaternion :=
match label with
| ChiralLabel.achiral_stable => { a := Q16_16.one, b := 0, c := 0, d := 0 }
| ChiralLabel.left_handed_mass_bias => { a := 0, b := Q16_16.one, c := 0, d := 0 }
| ChiralLabel.right_handed_vector_bias => { a := 0, b := 0, c := Q16_16.one, d := 0 }
| ChiralLabel.chiral_scarred => { a := 0, b := 0, c := 0, d := Q16_16.one }
theorem ofChiralLabel_isUnit (label : ChiralLabel) : isUnit (ofChiralLabel label) := by
unfold isUnit ofChiralLabel sumSq
simp
end Quaternion
structure PointS7 where
q1 : Quaternion
q2 : Quaternion
deriving Repr
def braidToS7 (s : BraidStateN 8) : PointS7 :=
let a0 := (s.strands ⟨0, by decide⟩).residue
let a1 := (s.strands ⟨2, by decide⟩).residue
let a2 := (s.strands ⟨4, by decide⟩).residue
let a3 := (s.strands ⟨6, by decide⟩).residue
{ q1 := { a := a0, b := a1, c := 0, d := 0 }
, q2 := { a := a2, b := a3, c := 0, d := 0 }
}
end SilverSight.HopfFibration