interplane.Get Omega
Read in your language

omega-principia

This project has not described itself yet.

Brought by drakestapleton

branch main Branches Tags History

omega-principia / proofs / QuantumWorldRecordsW4.lean

182 lines · 7515 bytes Raw Blame History
1/-
2 SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3 experiments/frontier_8h_quantum/lean/QuantumWorldRecordsW4.lean
4
5 Standalone zero-Mathlib Lean 4.36.0 formal algebraic certification of Frontier 3 Wave 4
6 world-record Butson Hadamard matrix over exact Eisenstein integers Z[zeta_6]:
7 BH(202, 6) — non-symmetric parity-locked 2-circulant H = [A, B; -B^dagger, A^dagger],
8 m = 101 (prime), subgroup H = <6> <= Z_101* (ord(6) = 10, 11 orbits),
9 A[0] = 0 (even), A[1..100] all odd in {1, 3, 5}, B[0..100] all even in {0, 2, 4}.
10 Zero Kronecker decompositions (101 prime, 202 == 2 mod 4, 202 == 1 mod 3, 201 = 3*67).
11
12 Zero sorry, zero admit, zero native_decide, zero axiom, zero unsafe, zero Mathlib.
13-/
14
15set_option maxRecDepth 65536
16set_option maxHeartbeats 4000000
17
18namespace QuantumWorldRecordsW4
19
20structure Eisenstein where
21 re : Int
22 im : Int
23 deriving DecidableEq, Repr
24
25def eZero : Eisenstein := ⟨0, 0⟩
26
27def eAdd (a b : Eisenstein) : Eisenstein := ⟨a.re + b.re, a.im + b.im⟩
28
29def zeta6 (e : Nat) : Eisenstein :=
30 match e % 6 with
31 | 0 => ⟨1, 0⟩
32 | 1 => ⟨0, 1⟩
33 | 2 => ⟨-1, 1⟩
34 | 3 => ⟨-1, 0⟩
35 | 4 => ⟨0, -1⟩
36 | _ => ⟨1, -1⟩
37
38def conjExp6 (e : Nat) : Nat := (6 - (e % 6)) % 6
39def negExp6 (e : Nat) : Nat := (e + 3) % 6
40
41def prodConj6 (a b : Nat) : Eisenstein :=
42 zeta6 ((a + 6 - b) % 6)
43
44def eSumAux (f : Nat → Eisenstein) : Nat → Eisenstein → Eisenstein
45 | 0, acc => acc
46 | n + 1, acc => eSumAux f n (eAdd acc (f n))
47
48def eSum (n : Nat) (f : Nat → Eisenstein) : Eisenstein :=
49 eSumAux f n eZero
50
51def allBelow (p : Nat → Bool) : Nat → Bool
52 | 0 => true
53 | n + 1 => p n && allBelow p n
54
55def circ2Entry (m : Nat) (a b : Nat → Nat) (r c : Nat) : Nat :=
56 if r < m then
57 if c < m then
58 a ((c + m - r) % m)
59 else
60 b ((c - r) % m)
61 else
62 let r' := r - m
63 if c < m then
64 negExp6 (conjExp6 (b ((r' + m - c) % m)))
65 else
66 let c' := c - m
67 conjExp6 (a ((r' + m - c') % m))
68
69def gramEntry (m : Nat) (a b : Nat → Nat) (r c : Nat) : Eisenstein :=
70 eSum (2 * m) (fun k => prodConj6 (circ2Entry m a b r k) (circ2Entry m a b c k))
71
72def pafAB (m : Nat) (a b : Nat → Nat) (s : Nat) : Eisenstein :=
73 eSum m (fun k =>
74 eAdd (prodConj6 (a k) (a ((k + s) % m)))
75 (prodConj6 (b k) (b ((k + s) % m))))
76
77def crossAB (m : Nat) (a b : Nat → Nat) (j : Nat) : Eisenstein :=
78 eSum m (fun k =>
79 eAdd (prodConj6 (a k) (negExp6 (conjExp6 (b ((j + m - k) % m)))))
80 (prodConj6 (b k) (conjExp6 (a ((j + m - k) % m)))))
81
82def validExps (m : Nat) (a : Nat → Nat) : Bool :=
83 allBelow (fun i => a i < 6) m
84
85def bh202A : Nat → Nat
86 | 0 => 0 | 1 => 1 | 2 => 3 | 3 => 5 | 4 => 1 | 5 => 1 | 6 => 1 | 7 => 5 | 8 => 3 | 9 => 3
87 | 10 => 5 | 11 => 3 | 12 => 3 | 13 => 3 | 14 => 1 | 15 => 3 | 16 => 1 | 17 => 1 | 18 => 5 | 19 => 3
88 | 20 => 3 | 21 => 3 | 22 => 1 | 23 => 3 | 24 => 1 | 25 => 3 | 26 => 5 | 27 => 5 | 28 => 3 | 29 => 3
89 | 30 => 1 | 31 => 1 | 32 => 5 | 33 => 1 | 34 => 3 | 35 => 3 | 36 => 1 | 37 => 3 | 38 => 5 | 39 => 5
90 | 40 => 5 | 41 => 5 | 42 => 5 | 43 => 1 | 44 => 5 | 45 => 1 | 46 => 5 | 47 => 3 | 48 => 3 | 49 => 3
91 | 50 => 5 | 51 => 5 | 52 => 3 | 53 => 3 | 54 => 3 | 55 => 5 | 56 => 1 | 57 => 5 | 58 => 1 | 59 => 5
92 | 60 => 5 | 61 => 5 | 62 => 5 | 63 => 5 | 64 => 3 | 65 => 1 | 66 => 3 | 67 => 3 | 68 => 1 | 69 => 5
93 | 70 => 1 | 71 => 1 | 72 => 3 | 73 => 3 | 74 => 5 | 75 => 5 | 76 => 3 | 77 => 1 | 78 => 3 | 79 => 1
94 | 80 => 3 | 81 => 3 | 82 => 3 | 83 => 5 | 84 => 1 | 85 => 1 | 86 => 3 | 87 => 1 | 88 => 3 | 89 => 3
95 | 90 => 3 | 91 => 5 | 92 => 3 | 93 => 3 | 94 => 5 | 95 => 1 | 96 => 1 | 97 => 1 | 98 => 5 | 99 => 3
96 | 100 => 1 | _ => 0
97
98def bh202B : Nat → Nat
99 | 0 => 0 | 1 => 0 | 2 => 0 | 3 => 2 | 4 => 2 | 5 => 4 | 6 => 0 | 7 => 2 | 8 => 4 | 9 => 2
100 | 10 => 0 | 11 => 4 | 12 => 0 | 13 => 0 | 14 => 0 | 15 => 4 | 16 => 4 | 17 => 0 | 18 => 2 | 19 => 0
101 | 20 => 0 | 21 => 2 | 22 => 4 | 23 => 0 | 24 => 2 | 25 => 2 | 26 => 4 | 27 => 4 | 28 => 0 | 29 => 0
102 | 30 => 4 | 31 => 4 | 32 => 0 | 33 => 2 | 34 => 0 | 35 => 4 | 36 => 0 | 37 => 0 | 38 => 4 | 39 => 0
103 | 40 => 4 | 41 => 0 | 42 => 2 | 43 => 2 | 44 => 0 | 45 => 2 | 46 => 4 | 47 => 2 | 48 => 4 | 49 => 2
104 | 50 => 2 | 51 => 2 | 52 => 2 | 53 => 4 | 54 => 2 | 55 => 4 | 56 => 2 | 57 => 0 | 58 => 2 | 59 => 2
105 | 60 => 0 | 61 => 4 | 62 => 0 | 63 => 4 | 64 => 0 | 65 => 0 | 66 => 4 | 67 => 0 | 68 => 2 | 69 => 0
106 | 70 => 4 | 71 => 4 | 72 => 0 | 73 => 0 | 74 => 4 | 75 => 4 | 76 => 2 | 77 => 2 | 78 => 0 | 79 => 4
107 | 80 => 2 | 81 => 0 | 82 => 0 | 83 => 2 | 84 => 0 | 85 => 4 | 86 => 4 | 87 => 0 | 88 => 0 | 89 => 0
108 | 90 => 4 | 91 => 0 | 92 => 2 | 93 => 4 | 94 => 2 | 95 => 0 | 96 => 4 | 97 => 2 | 98 => 2 | 99 => 0
109 | 100 => 0 | _ => 0
110
111theorem bh202_6_valid_exps : validExps 101 bh202A = true ∧ validExps 101 bh202B = true := by decide
112
113theorem bh202_6_par2_law :
114 bh202A 0 = 0 ∧
115 allBelow (fun i => if i == 0 then true else bh202A i % 2 == 1) 101 = true ∧
116 allBelow (fun i => bh202B i % 2 == 0) 101 = true := by decide
117
118theorem bh202_6_paf_diag : pafAB 101 bh202A bh202B 0 = ⟨202, 0⟩ := by decide
119
120theorem bh202_6_paf_offdiag_all :
121 allBelow (fun s => if s == 0 then true else pafAB 101 bh202A bh202B s == eZero) 101 = true := by
122 decide
123
124theorem bh202_6_cross_all :
125 allBelow (fun j => crossAB 101 bh202A bh202B j == eZero) 101 = true := by
126 decide
127
128theorem bh202_6_gram_row0_all :
129 allBelow (fun c =>
130 gramEntry 101 bh202A bh202B 0 c == (if c == 0 then ⟨202, 0⟩ else eZero)) 202 = true := by
131 decide
132
133theorem bh202_6_gram_row101_all :
134 allBelow (fun c =>
135 gramEntry 101 bh202A bh202B 101 c == (if c == 101 then ⟨202, 0⟩ else eZero)) 202 = true := by
136 decide
137
138theorem bh202_6_order_arith :
139 2 * 101 = 202 ∧ 202 % 4 = 2 ∧ 202 % 3 = 1 ∧ 201 = 3 * 67 := by
140 decide
141
142-- ============================================================================
143-- Broken-Model Negative Controls (>= 7 required)
144-- ============================================================================
145
146def bh202A_bad0 (i : Nat) : Nat := if i == 0 then 1 else bh202A i
147def bh202A_bad5 (i : Nat) : Nat := if i == 5 then 2 else bh202A i
148def bh202B_bad0 (i : Nat) : Nat := if i == 0 then 3 else bh202B i
149def bh202B_bad9 (i : Nat) : Nat := if i == 9 then 5 else bh202B i
150
151theorem neg_ctrl_bh202_a0_breaks_paf :
152 allBelow (fun s => if s == 0 then true else pafAB 101 bh202A_bad0 bh202B s == eZero) 101 = false := by
153 decide
154
155theorem neg_ctrl_bh202_a5_breaks_paf :
156 allBelow (fun s => if s == 0 then true else pafAB 101 bh202A_bad5 bh202B s == eZero) 101 = false := by
157 decide
158
159theorem neg_ctrl_bh202_b0_breaks_paf :
160 allBelow (fun s => if s == 0 then true else pafAB 101 bh202A bh202B_bad0 s == eZero) 101 = false := by
161 decide
162
163theorem neg_ctrl_bh202_b9_breaks_paf :
164 allBelow (fun s => if s == 0 then true else pafAB 101 bh202A bh202B_bad9 s == eZero) 101 = false := by
165 decide
166
167theorem neg_ctrl_bh202_a0_breaks_gram_row0 :
168 allBelow (fun c =>
169 gramEntry 101 bh202A_bad0 bh202B 0 c == (if c == 0 then ⟨202, 0⟩ else eZero)) 202 = false := by
170 decide
171
172theorem neg_ctrl_bh202_not_real_hadamard : 202 % 4 ≠ 0 := by decide
173theorem neg_ctrl_bh202_not_bh3 : 202 % 3 ≠ 0 := by decide
174
175#print axioms bh202_6_gram_row0_all
176#print axioms bh202_6_gram_row101_all
177#print axioms bh202_6_paf_offdiag_all
178#print axioms bh202_6_cross_all
179#print axioms neg_ctrl_bh202_a0_breaks_paf
180#print axioms neg_ctrl_bh202_b0_breaks_paf
181
182end QuantumWorldRecordsW4