SNAPKITTYWEST's picture
push from SNAPKITTYWEST/hyperkitty-constraint-dsl
224e773 verified
Raw History Blame Contribute Delete
2.93 kB
19
theorem qlg_pi_on_sphere : QLG.canonical (Vec3.ofGlyph Glyph.Pi) := by
proof · 2 lines
  unfold QLG.canonical Vec3.ofGlyph
  norm_num
26
theorem qlg_gamma_on_sphere : QLG.canonical (Vec3.ofGlyph Glyph.Gamma) := by
proof · 2 lines
  unfold QLG.canonical Vec3.ofGlyph
  norm_num
33
theorem qlg_delta_on_sphere : QLG.canonical (Vec3.ofGlyph Glyph.Delta) := by
proof · 2 lines
  unfold QLG.canonical Vec3.ofGlyph
  norm_num
40
theorem qlg_psi_on_sphere : QLG.canonical (Vec3.ofGlyph Glyph.Psi) := by
proof · 2 lines
  unfold QLG.canonical Vec3.ofGlyph
  norm_num
47
theorem qlg_lambda_on_sphere : QLG.canonical (Vec3.ofGlyph Glyph.Lambda) := by
proof · 2 lines
  unfold QLG.canonical Vec3.ofGlyph
  norm_num
54
theorem qlg_omega_on_sphere : QLG.canonical (Vec3.ofGlyph Glyph.Omega) := by
proof · 2 lines
  unfold QLG.canonical Vec3.ofGlyph
  norm_num
62
theorem qlg_all_glyphs_on_sphere : ∀ g : Glyph, QLG.canonical (Vec3.ofGlyph g) := by
proof · 2 lines
  intro g
  cases g <;> simp [QLG.canonical, Vec3.ofGlyph]
71
theorem qlg_zero_not_on_sphere : ¬QLG.canonical {x:=0, y:=0, z:=0} := by
proof · 2 lines
  unfold QLG.canonical
  norm_num
80
theorem qlg_exactly_six_solutions (v : Vec3) (h : QLG.canonical v) :
    ∃ g : Glyph, Vec3.ofGlyph g = v := by
proof · 21 lines
  unfold QLG.canonical at h
  -- We prove by case analysis on x, y, z
  -- If x² + y² + z² = 1, then each of x, y, z is in {-1, 0, 1}
  have hx : v.x ∈ ({-1, 0, 1} : Set ℤ) := by
    omega
  have hy : v.y ∈ ({-1, 0, 1} : Set ℤ) := by
    omega
  have hz : v.z ∈ ({-1, 0, 1} : Set ℤ) := by
    omega
  -- Enumerate all 27 cases
  interval_cases v.x <;> interval_cases v.y <;> interval_cases v.z
  all_goals (
    try simp at h
    try omega
    try (use Glyph.Pi; rfl)
    try (use Glyph.Gamma; rfl)
    try (use Glyph.Delta; rfl)
    try (use Glyph.Psi; rfl)
    try (use Glyph.Lambda; rfl)
    try (use Glyph.Omega; rfl)
  )