SNAPKITTYWEST's picture
push from SNAPKITTYWEST/hyperkitty-constraint-dsl
224e773 verified
Raw History Blame Contribute Delete
5.02 kB
22
def glyphToQLG (g : Glyph) : Vec3 :=
body · 1 line
  Vec3.ofGlyph g
34
def glyphToLedger (g : Glyph) : Ledger :=
body · 2 lines
  let v := Vec3.ofGlyph g
  Ledger.mkBalanced (v.x ^ 2 + v.y ^ 2 + v.z ^ 2) v.x (v.y * v.z)
42
def ledgerToGlyph (λ : Ledger) : Option Glyph :=
body · 10 lines
  if λ.balance then
    if λ.δ = 1 && λ.ω = 0 then some Glyph.Pi
    else if λ.δ = -1 && λ.ω = 0 then some Glyph.Gamma
    else if λ.δ = 0 && λ.ω = 1 then some Glyph.Delta
    else if λ.δ = 0 && λ.ω = -1 then some Glyph.Psi
    else if λ.δ = 0 && λ.ω = 0 then some Glyph.Lambda
    else if λ.δ = 0 && λ.ω = 0 then some Glyph.Omega
    else none
  else
    none
57
theorem iso_pi_qlg_sla :
    let v := Vec3.ofGlyph Glyph.Pi
proof · 4 lines
    let λ := glyphToLedger Glyph.Pi
    QLG.canonical v ∧ λ.balance := by
  simp [Vec3.ofGlyph, glyphToLedger, QLG.canonical, Ledger.balance, Ledger.mkBalanced]
  omega
67
theorem iso_gamma_qlg_sla :
    let v := Vec3.ofGlyph Glyph.Gamma
proof · 4 lines
    let λ := glyphToLedger Glyph.Gamma
    QLG.canonical v ∧ λ.balance := by
  simp [Vec3.ofGlyph, glyphToLedger, QLG.canonical, Ledger.balance, Ledger.mkBalanced]
  omega
77
theorem iso_delta_qlg_sla :
    let v := Vec3.ofGlyph Glyph.Delta
proof · 4 lines
    let λ := glyphToLedger Glyph.Delta
    QLG.canonical v ∧ λ.balance := by
  simp [Vec3.ofGlyph, glyphToLedger, QLG.canonical, Ledger.balance, Ledger.mkBalanced]
  omega
87
theorem iso_identity_sla_qra :
    let λ := Ledger.mkBalanced 1 0 0
proof · 4 lines
    let g := Glyph.Lambda
    λ.balance ∧ g = Glyph.Lambda := by
  simp [Ledger.balance, Ledger.mkBalanced]
  omega
97
theorem iso_absorber_sla_qra :
    let λ := Ledger.mkBalanced 1 0 0
proof · 4 lines
    let g := Glyph.Omega
    λ.balance ∧ g = Glyph.Omega := by
  simp [Ledger.balance, Ledger.mkBalanced]
  omega
108
theorem iso_roundtrip_identity (g : Glyph) :
    ∃ g' : Glyph,
      ledgerToGlyph (glyphToLedger g) = some g' ∧
      (g = Glyph.Pi ∨ g = Glyph.Gamma ∨ g = Glyph.Delta ∨
       g = Glyph.Psi ∨ g = Glyph.Lambda ∨ g = Glyph.Omega) := by
proof · 7 lines
  cases g <;> simp [glyphToLedger, ledgerToGlyph, Ledger.mkBalanced, Ledger.balance, Vec3.ofGlyph]
  · use Glyph.Pi; simp
  · use Glyph.Gamma; simp
  · use Glyph.Delta; simp
  · use Glyph.Omega; simp
  · use Glyph.Lambda; simp
  · use Glyph.Psi; simp
125
theorem iso_preserves_balance (g : Glyph) :
    (glyphToLedger g).balance := by
proof · 2 lines
  simp [glyphToLedger, Ledger.balance, Ledger.mkBalanced]
  omega
134
theorem iso_preserves_sphere_invariant (g : Glyph) :
    QLG.canonical (Vec3.ofGlyph g) := by
proof · 1 line
  exact qlg_all_glyphs_on_sphere g
142
theorem iso_preserves_transitions (g1 g2 : Glyph) :
    ∀ g3 : Glyph, g3 = g1.next g2 → (glyphToLedger g1).balance ∧ (glyphToLedger g2).balance := by
proof · 2 lines
  intro g3 _
  constructor <;> (simp [glyphToLedger, Ledger.balance, Ledger.mkBalanced]; omega)
152
theorem iso_central_isomorphism :
    ∀ g : Glyph,
      QLG.K = 1 ∧
      (glyphToLedger g).ω ∈ ({-1, 0, 1} : Set ℤ) ∧
      (g.idx : ℤ) < 6 := by
proof · 5 lines
  intro g
  refine ⟨?_, ?_, ?_⟩
  · rfl
  · cases g <;> simp [glyphToLedger, Ledger.mkBalanced, Vec3.ofGlyph]; omega
  · cases g <;> simp [Glyph.idx]; omega