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 / CanWorldRecordsW2a.lean

764 lines · 40745 bytes Raw Blame History
1/-
2 SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3 experiments/frontier_8h_can/lean/CanWorldRecordsW2a.lean
4
5 Standalone Zero-Mathlib, Kernel-Checked Lean 4.36.0 Formal Proof of
6 Live-2026 Covering Array World Record:
7 CA(270; 4, 18, 3) — strictly beating live 2026-12-02 CAN(4, 18, 3) <= 271
8 (247,860 4-way interactions)
9 Uses O(1) list-traversal zero-match bitmask reduction for fast kernel checking.
10 0 sorry, 0 admit, 0 native_decide, 0 axiom, 0 unsafe, 0 Mathlib.
11-/
12
13set_option maxRecDepth 16384
14set_option maxHeartbeats 2400000
15set_option exponentiation.threshold 512
16
17namespace CanWorldRecordsW2a
18
19def IsCoveringArray4 (N k v : Nat) (rows : List (List Nat)) : Prop :=
20 rows.length = N ∧
21 (∀ r, r < N → (rows.getD r []).length = k ∧
22 ∀ c, c < k → (rows.getD r []).getD c v < v) ∧
23 (∀ c0 c1 c2 c3, c0 < c1 → c1 < c2 → c2 < c3 → c3 < k →
24 ∀ p0 p1 p2 p3, p0 < v → p1 < v → p2 < v → p3 < v →
25 ∃ r, r < N ∧
26 (rows.getD r []).getD c0 v = p0 ∧
27 (rows.getD r []).getD c1 v = p1 ∧
28 (rows.getD r []).getD c2 v = p2 ∧
29 (rows.getD r []).getD c3 v = p3)
30
31def getSym (m : Nat × Nat × Nat) : Nat → Nat
32 | 0 => m.1
33 | 1 => m.2.1
34 | _ => m.2.2
35
36theorem exists_testBit_of_ne_zero :
37 ∀ b n, n < 2 ^ b → n ≠ 0 → ∃ i, i < b ∧ n.testBit i = true := by
38 intro b
39 induction b with
40 | zero => intro n hlt hne; simp at hlt; exact absurd hlt hne
41 | succ m ih =>
42 intro n hlt hne
43 by_cases hodd : n % 2 = 1
44 · refine ⟨0, Nat.zero_lt_succ m, ?_⟩
45 simp [Nat.testBit, Nat.shiftRight_zero, hodd]
46 · have hmod0 : n % 2 = 0 := by omega
47 have hdiv_ne : n / 2 ≠ 0 := by omega
48 have hdiv_lt : n / 2 < 2 ^ m := by
49 have hp : 2 ^ (m + 1) = 2 * 2 ^ m := by rw [Nat.pow_succ, Nat.mul_comm]
50 omega
51 obtain ⟨j, hj, hbit⟩ := ih (n / 2) hdiv_lt hdiv_ne
52 refine ⟨j + 1, Nat.succ_lt_succ hj, ?_⟩
53 rw [Nat.testBit_succ]; exact hbit
54
55theorem testBit_land_true {a b i : Nat} (h : (a &&& b).testBit i = true) :
56 a.testBit i = true ∧ b.testBit i = true := by
57 rw [Nat.testBit_and, Bool.and_eq_true] at h; exact h
58
59theorem land_lt_pow2 {a b m : Nat} (ha : a < 2 ^ m) : (a &&& b) < 2 ^ m :=
60 Nat.lt_of_le_of_lt Nat.and_le_left ha
61
62-- Unrolled 3-way check with zero closure allocation
63def chk1 (m012 : Nat) (m3 : Nat × Nat × Nat) : Bool :=
64 ((m012 &&& m3.1) != 0) && ((m012 &&& m3.2.1) != 0) && ((m012 &&& m3.2.2) != 0)
65
66def chk2 (m01 : Nat) (m2 m3 : Nat × Nat × Nat) : Bool :=
67 chk1 (m01 &&& m2.1) m3 && chk1 (m01 &&& m2.2.1) m3 && chk1 (m01 &&& m2.2.2) m3
68
69def chk3 (m0 : Nat) (m1 m2 m3 : Nat × Nat × Nat) : Bool :=
70 chk2 (m0 &&& m1.1) m2 m3 && chk2 (m0 &&& m1.2.1) m2 m3 && chk2 (m0 &&& m1.2.2) m2 m3
71
72def chkTuple (m0 m1 m2 m3 : Nat × Nat × Nat) : Bool :=
73 chk3 m0.1 m1 m2 m3 && chk3 m0.2.1 m1 m2 m3 && chk3 m0.2.2 m1 m2 m3
74
75theorem chk1_sound {m012 : Nat} {m3 : Nat × Nat × Nat} (h : chk1 m012 m3 = true)
76 (p3 : Nat) (hp3 : p3 < 3) : (m012 &&& getSym m3 p3) ≠ 0 := by
77 simp only [chk1, Bool.and_eq_true, bne_iff_ne, ne_eq] at h
78 match p3 with
79 | 0 => exact h.1.1
80 | 1 => exact h.1.2
81 | 2 => exact h.2
82 | n + 3 => omega
83
84theorem chk2_sound {m01 : Nat} {m2 m3 : Nat × Nat × Nat} (h : chk2 m01 m2 m3 = true)
85 (p2 p3 : Nat) (hp2 : p2 < 3) (hp3 : p3 < 3) : ((m01 &&& getSym m2 p2) &&& getSym m3 p3) ≠ 0 := by
86 simp only [chk2, Bool.and_eq_true] at h
87 match p2 with
88 | 0 => exact chk1_sound h.1.1 p3 hp3
89 | 1 => exact chk1_sound h.1.2 p3 hp3
90 | 2 => exact chk1_sound h.2 p3 hp3
91 | n + 3 => omega
92
93theorem chk3_sound {m0 : Nat} {m1 m2 m3 : Nat × Nat × Nat} (h : chk3 m0 m1 m2 m3 = true)
94 (p1 p2 p3 : Nat) (hp1 : p1 < 3) (hp2 : p2 < 3) (hp3 : p3 < 3) :
95 (((m0 &&& getSym m1 p1) &&& getSym m2 p2) &&& getSym m3 p3) ≠ 0 := by
96 simp only [chk3, Bool.and_eq_true] at h
97 match p1 with
98 | 0 => exact chk2_sound h.1.1 p2 p3 hp2 hp3
99 | 1 => exact chk2_sound h.1.2 p2 p3 hp2 hp3
100 | 2 => exact chk2_sound h.2 p2 p3 hp2 hp3
101 | n + 3 => omega
102
103theorem chkTuple_sound {m0 m1 m2 m3 : Nat × Nat × Nat} (h : chkTuple m0 m1 m2 m3 = true)
104 (p0 p1 p2 p3 : Nat) (hp0 : p0 < 3) (hp1 : p1 < 3) (hp2 : p2 < 3) (hp3 : p3 < 3) :
105 (((getSym m0 p0 &&& getSym m1 p1) &&& getSym m2 p2) &&& getSym m3 p3) ≠ 0 := by
106 simp only [chkTuple, Bool.and_eq_true] at h
107 match p0 with
108 | 0 => exact chk3_sound h.1.1 p1 p2 p3 hp1 hp2 hp3
109 | 1 => exact chk3_sound h.1.2 p1 p2 p3 hp1 hp2 hp3
110 | 2 => exact chk3_sound h.2 p1 p2 p3 hp1 hp2 hp3
111 | n + 3 => omega
112
113-- O(1) list-traversal 4-tuple checker (zero index lookup in inner loops!)
114def chkL1 (m0 m1 m2 : Nat × Nat × Nat) : List (Nat × Nat × Nat) → Bool
115 | [] => true
116 | m3 :: rest => chkTuple m0 m1 m2 m3 && chkL1 m0 m1 m2 rest
117
118def chkL2 (m0 m1 : Nat × Nat × Nat) : List (Nat × Nat × Nat) → Bool
119 | [] => true
120 | m2 :: rest => chkL1 m0 m1 m2 rest && chkL2 m0 m1 rest
121
122def chkL3 (m0 : Nat × Nat × Nat) : List (Nat × Nat × Nat) → Bool
123 | [] => true
124 | m1 :: rest => chkL2 m0 m1 rest && chkL3 m0 rest
125
126def chkL4 : List (Nat × Nat × Nat) → Bool
127 | [] => true
128 | m0 :: rest => chkL3 m0 rest && chkL4 rest
129
130theorem chkL1_sound (m0 m1 m2 : Nat × Nat × Nat) :
131 ∀ l i, chkL1 m0 m1 m2 l = true → i < l.length →
132 chkTuple m0 m1 m2 (l.getD i (0, 0, 0)) = true := by
133 intro l
134 induction l with
135 | nil => intro i _ hi; cases hi
136 | cons x xs ih =>
137 intro i h hi
138 simp only [chkL1, Bool.and_eq_true] at h
139 cases i with
140 | zero => simp only [List.getD_cons_zero]; exact h.1
141 | succ j => simp only [List.getD_cons_succ]; exact ih j h.2 (Nat.lt_of_succ_lt_succ hi)
142
143theorem chkL2_sound (m0 m1 : Nat × Nat × Nat) :
144 ∀ l i2 i3, chkL2 m0 m1 l = true → i2 < i3 → i3 < l.length →
145 chkTuple m0 m1 (l.getD i2 (0, 0, 0)) (l.getD i3 (0, 0, 0)) = true := by
146 intro l
147 induction l with
148 | nil => intro i2 i3 _ _ hi3; cases hi3
149 | cons x xs ih =>
150 intro i2 i3 h hlt hi3
151 simp only [chkL2, Bool.and_eq_true] at h
152 cases i2 with
153 | zero =>
154 cases i3 with
155 | zero => omega
156 | succ j3 =>
157 simp only [List.getD_cons_zero, List.getD_cons_succ]
158 exact chkL1_sound m0 m1 x xs j3 h.1 (Nat.lt_of_succ_lt_succ hi3)
159 | succ j2 =>
160 cases i3 with
161 | zero => omega
162 | succ j3 =>
163 simp only [List.getD_cons_succ]
164 exact ih j2 j3 h.2 (Nat.lt_of_succ_lt_succ hlt) (Nat.lt_of_succ_lt_succ hi3)
165
166theorem chkL3_sound (m0 : Nat × Nat × Nat) :
167 ∀ l i1 i2 i3, chkL3 m0 l = true → i1 < i2 → i2 < i3 → i3 < l.length →
168 chkTuple m0 (l.getD i1 (0, 0, 0)) (l.getD i2 (0, 0, 0)) (l.getD i3 (0, 0, 0)) = true := by
169 intro l
170 induction l with
171 | nil => intro i1 i2 i3 _ _ _ hi3; cases hi3
172 | cons x xs ih =>
173 intro i1 i2 i3 h h12 h23 hi3
174 simp only [chkL3, Bool.and_eq_true] at h
175 cases i1 with
176 | zero =>
177 cases i2 with
178 | zero => omega
179 | succ j2 =>
180 cases i3 with
181 | zero => omega
182 | succ j3 =>
183 simp only [List.getD_cons_zero, List.getD_cons_succ]
184 exact chkL2_sound m0 x xs j2 j3 h.1 (Nat.lt_of_succ_lt_succ h23) (Nat.lt_of_succ_lt_succ hi3)
185 | succ j1 =>
186 cases i2 with
187 | zero => omega
188 | succ j2 =>
189 cases i3 with
190 | zero => omega
191 | succ j3 =>
192 simp only [List.getD_cons_succ]
193 exact ih j1 j2 j3 h.2 (Nat.lt_of_succ_lt_succ h12) (Nat.lt_of_succ_lt_succ h23) (Nat.lt_of_succ_lt_succ hi3)
194
195theorem chkL4_sound :
196 ∀ l i0 i1 i2 i3, chkL4 l = true → i0 < i1 → i1 < i2 → i2 < i3 → i3 < l.length →
197 chkTuple (l.getD i0 (0, 0, 0)) (l.getD i1 (0, 0, 0)) (l.getD i2 (0, 0, 0)) (l.getD i3 (0, 0, 0)) = true := by
198 intro l
199 induction l with
200 | nil => intro i0 i1 i2 i3 _ _ _ _ hi3; cases hi3
201 | cons x xs ih =>
202 intro i0 i1 i2 i3 h h01 h12 h23 hi3
203 simp only [chkL4, Bool.and_eq_true] at h
204 cases i0 with
205 | zero =>
206 cases i1 with
207 | zero => omega
208 | succ j1 =>
209 cases i2 with
210 | zero => omega
211 | succ j2 =>
212 cases i3 with
213 | zero => omega
214 | succ j3 =>
215 simp only [List.getD_cons_zero, List.getD_cons_succ]
216 exact chkL3_sound x xs j1 j2 j3 h.1 (Nat.lt_of_succ_lt_succ h12) (Nat.lt_of_succ_lt_succ h23) (Nat.lt_of_succ_lt_succ hi3)
217 | succ j0 =>
218 cases i1 with
219 | zero => omega
220 | succ j1 =>
221 cases i2 with
222 | zero => omega
223 | succ j2 =>
224 cases i3 with
225 | zero => omega
226 | succ j3 =>
227 simp only [List.getD_cons_succ]
228 exact ih j0 j1 j2 j3 h.2 (Nat.lt_of_succ_lt_succ h01) (Nat.lt_of_succ_lt_succ h12) (Nat.lt_of_succ_lt_succ h23) (Nat.lt_of_succ_lt_succ hi3)
229
230-- Check rows match colMasks via O(1) parallel list walk
231def checkRowWalk (r : Nat) : List Nat → List (Nat × Nat × Nat) → Bool
232 | [], [] => true
233 | val :: rrest, m :: mrest =>
234 decide (val < 3) &&
235 (m.1.testBit r == decide (val = 0)) &&
236 (m.2.1.testBit r == decide (val = 1)) &&
237 (m.2.2.testBit r == decide (val = 2)) &&
238 checkRowWalk r rrest mrest
239 | _, _ => false
240
241theorem checkRowWalk_len (r : Nat) :
242 ∀ row ms, checkRowWalk r row ms = true → row.length = ms.length := by
243 intro row
244 induction row with
245 | nil =>
246 intro ms h
247 cases ms with
248 | nil => rfl
249 | cons _ _ => simp [checkRowWalk] at h
250 | cons v rest ih =>
251 intro ms h
252 cases ms with
253 | nil => simp [checkRowWalk] at h
254 | cons m mrest =>
255 simp only [checkRowWalk, Bool.and_eq_true] at h
256 simp only [List.length_cons, ih mrest h.2]
257
258theorem checkRowWalk_entry (r : Nat) :
259 ∀ row ms idx, checkRowWalk r row ms = true → idx < row.length →
260 row.getD idx 3 < 3 ∧
261 ∀ s, s < 3 → (getSym (ms.getD idx (0, 0, 0)) s).testBit r = true → row.getD idx 3 = s := by
262 intro row
263 induction row with
264 | nil => intro ms idx _ hlt; cases hlt
265 | cons v rest ih =>
266 intro ms idx h hlt
267 cases ms with
268 | nil => simp [checkRowWalk] at h
269 | cons m mrest =>
270 simp only [checkRowWalk, Bool.and_eq_true, decide_eq_true_eq, beq_iff_eq] at h
271 cases idx with
272 | zero =>
273 simp only [List.getD_cons_zero]
274 refine ⟨h.1.1.1.1, ?_⟩
275 intro s hs hbit
276 match s with
277 | 0 => simp only [getSym] at hbit; have h0 := h.1.1.1.2; rw [hbit] at h0; exact (decide_eq_true_eq.mp h0.symm)
278 | 1 => simp only [getSym] at hbit; have h1 := h.1.1.2; rw [hbit] at h1; exact (decide_eq_true_eq.mp h1.symm)
279 | 2 => simp only [getSym] at hbit; have h2 := h.1.2; rw [hbit] at h2; exact (decide_eq_true_eq.mp h2.symm)
280 | n + 3 => omega
281 | succ j =>
282 simp only [List.getD_cons_succ]
283 exact ih mrest j h.2 (Nat.lt_of_succ_lt_succ hlt)
284
285def checkAllRows (ms : List (Nat × Nat × Nat)) (r : Nat) : List (List Nat) → Bool
286 | [] => r == 270
287 | row :: rest => checkRowWalk r row ms && checkAllRows ms (r + 1) rest
288
289theorem checkAllRows_len (ms : List (Nat × Nat × Nat)) :
290 ∀ rows r, checkAllRows ms r rows = true → rows.length + r = 270 := by
291 intro rows
292 induction rows with
293 | nil => intro r h; simp [checkAllRows] at h; simp only [List.length_nil]; omega
294 | cons row rest ih =>
295 intro r h; simp only [checkAllRows, Bool.and_eq_true] at h
296 have hlen := ih (r + 1) h.2; simp only [List.length_cons]; omega
297
298theorem checkAllRows_at (ms : List (Nat × Nat × Nat)) :
299 ∀ rows base idx, checkAllRows ms base rows = true → idx < rows.length →
300 checkRowWalk (base + idx) (rows.getD idx []) ms = true := by
301 intro rows
302 induction rows with
303 | nil => intro base idx _ hlt; cases hlt
304 | cons row rest ih =>
305 intro base idx h hlt
306 simp only [checkAllRows, Bool.and_eq_true] at h
307 cases idx with
308 | zero => simp only [List.getD_cons_zero, Nat.add_zero]; exact h.1
309 | succ j =>
310 simp only [List.getD_cons_succ]
311 have heq : base + 1 + j = base + (j + 1) := by omega
312 rw [← heq]; exact ih (base + 1) j h.2 (Nat.lt_of_succ_lt_succ hlt)
313
314def checkMasksLt (bound : Nat) : List (Nat × Nat × Nat) → Bool
315 | [] => true
316 | m :: rest => decide (m.1 < bound) && decide (m.2.1 < bound) && decide (m.2.2 < bound) && checkMasksLt bound rest
317
318theorem checkMasksLt_sound (bound : Nat) :
319 ∀ ms i, checkMasksLt bound ms = true → i < ms.length →
320 ∀ s, s < 3 → getSym (ms.getD i (0, 0, 0)) s < bound := by
321 intro ms
322 induction ms with
323 | nil => intro i _ hi; cases hi
324 | cons m rest ih =>
325 intro i h hi s hs
326 simp only [checkMasksLt, Bool.and_eq_true, decide_eq_true_eq] at h
327 cases i with
328 | zero =>
329 simp only [List.getD_cons_zero]
330 match s with
331 | 0 => exact h.1.1.1
332 | 1 => exact h.1.1.2
333 | 2 => exact h.1.2
334 | n + 3 => omega
335 | succ j =>
336 simp only [List.getD_cons_succ]
337 exact ih j h.2 (Nat.lt_of_succ_lt_succ hi) s hs
338
339def colMasks : List (Nat × Nat × Nat) := [
340 (653577823652027798433344090711552658346950122778414356687925234943622501566265496, 993159196116748458214431304055268811500015104527123619272155146240360639268765794, 250400570295412289172011623615521212421010201456317025262392675201665575185680133),
341 (156788841640913667759388774150019313042611112033324618071406399548553233841294400, 772673749082903180906322941628992215878608631715798449102504013540060804337918003, 967674999340371697154075302603331153346755685012731934048562643297034677841499020),
342 (327047588457023400333456226596992592743538029371889687646055172435990370958033432, 1549413975269240049149116613848477556492661113480614653924998282401099151948397955, 20676026337925096337214177936872533031776285909350659651419601548559193114280036),
343 (1567479905021546179873964052022519910365165923992433399823131452939895386303170561, 329113947515642380867833445333582541299184609676555524230949980428393269510185810, 543737526999985077989521026240230603624895092866077168391623017360060207355052),
344 (1370052173288315186282281954427201110106982579734167929639573742613418289993552960, 504818690303660662193655508423329011176895057725897963738939064296928943505957130, 22266726472212697343849555531812560984097791301789107843960249475301482521201333),
345 (956155020266357427681585192107949035062298873165220492373883166958745491192451361, 877513111177505396090663119808851980651696155122089258553963341370485986776206994, 63469458620325722047538706465541666553980400474545250294626548056417238052053068),
346 (63490070184844424437051298354938683084909444549542858386442206056931344596862328, 1082967235452422454510105989664736152615376886429435876725850372111249116364798466, 750680284426921666872629730362667846567689097782876266110180478217468255059050629),
347 (1190366258484450025376877812190651482372965242835478051776966226177642252182239384, 96455738855306723579493140635749990138366713786721682072140689923745982278403330, 610315592724431796863416065555941209756643472139655267373366140284260481560068709),
348 (1014813082992110293216126612134001581711844316619688280030619798005955833794433312, 637611042626644963755294397429924201387534737427844727651339570905779823208636490, 244713464445433288848366008818416899168596374714321993540513687473913059017641621),
349 (120956205295644752642066261795035801124177985775054599643350516300920406000706192, 1204370730355071531432576807646542252245113067280910944605702746917787574747597867, 571810654413472261745143948940764628898684375705889456973419793166940735272407364),
350 (654461445092094534485016601418497099409678217166654079982992600729910427311432897, 964463599883337914646536742966463419778353484685454342348048022360592202523773706, 278212545088756096688233673997382163079943726909746578891432433295146086185504820),
351 (129124693405218751581601944757207518521928057610463157086873118357700481560120385, 715172383281872603459968263273724224019779572970036513629362318010488498254188810, 1052840513377097190778216810351410939726267798181355330506237620017459736206402228),
352 (1263704319540669164169748077103969005736354768449653228967400945480991117052289952, 157753663544809299274713160136639041393032402630247104728123829011210024208339987, 475679606978710082375325781141734635138588257681954667526948281893447574760081484),
353 (60918461922165855744400738790151479843090975327614147904658049182337330852258329, 140962960531136603971709965253398141858019063264441580520894742034834542066270306, 1695256167610886086103676314338793060566865390169799272796920265168476843102182788),
354 (474983918366280387433300283522200916563249105053942642695064539835451160839192600, 19520586087728706865357256571382104830723308601485020384760510723557213406771939, 1402633085610179451521129478288759660874003015106427338142648005826640341774746884),
355 (244793528204781470275962776832678687049314106230749380229628183782948063551291929, 181710559493123656768754965092000686448822525681736467257275222782660017867048194, 1470633502366283418775069276457663308769838796849369153735569649820040634602371300),
356 (30815485351337718547605687094454788249278875779787873391399713944634274544555072, 369290952880510013967880627819295020506052207572014356017908963678274564420831923, 1497031151832340813304300703468592873512644345410052771813164378762739877055324428),
357 (474358194122337050215901227182863672706653086188361403243103011748358289090584577, 974072272191300533113709036841687422048607346515439196477062616628841432458482642, 448707123750550962490176754357791587512714996058054401502307428008448994471644204)
358]
359
360def caRows : List (List Nat) := [
361 [2, 1, 1, 0, 2, 0, 2, 2, 2, 1, 0, 0, 1, 0, 1, 0, 1, 0],
362 [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
363 [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
364 [0, 2, 0, 2, 1, 2, 0, 0, 1, 1, 1, 1, 2, 0, 0, 0, 2, 2],
365 [0, 1, 0, 1, 2, 1, 0, 0, 2, 0, 2, 2, 1, 0, 0, 0, 1, 1],
366 [1, 1, 2, 2, 2, 0, 0, 2, 0, 1, 2, 2, 0, 1, 1, 2, 1, 2],
367 [1, 0, 2, 1, 0, 2, 0, 2, 1, 2, 0, 0, 2, 1, 1, 2, 0, 1],
368 [0, 2, 1, 2, 2, 1, 2, 0, 2, 0, 0, 2, 0, 2, 1, 2, 1, 1],
369 [2, 2, 1, 1, 1, 0, 0, 1, 0, 2, 1, 1, 0, 2, 2, 1, 2, 1],
370 [2, 2, 0, 1, 2, 1, 1, 2, 2, 0, 1, 2, 0, 0, 1, 0, 1, 1],
371 [2, 0, 1, 2, 0, 1, 0, 1, 2, 1, 0, 0, 1, 2, 2, 1, 0, 2],
372 [0, 0, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 2, 1, 2, 1, 2],
373 [0, 2, 1, 2, 0, 0, 1, 0, 0, 2, 2, 1, 1, 2, 1, 2, 0, 1],
374 [0, 1, 1, 1, 1,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, 2, 0, 2],
626 [0, 1, 0, 1, 0, 2, 0, 1, 0, 2, 0, 2, 0, 0, 2, 1, 2, 2],
627 [0, 0, 1, 0, 0, 1, 1, 2, 1, 0, 0, 0, 1, 1, 2, 1, 1, 2],
628 [2, 1, 0, 1, 0, 1, 2, 0, 2, 1, 2, 1, 0, 2, 2, 0, 1, 2],
629 [0, 1, 1, 0, 1, 1, 2, 2, 1, 2, 0, 1, 2, 2, 0, 2, 2, 0],
630 [1, 2, 1, 0, 0, 0, 1, 0, 0, 1, 1, 2, 0, 2, 2, 2, 2, 1]
631]
632
633theorem colMasks_len : colMasks.length = 18 := by decide
634theorem ca_rows_check : checkAllRows colMasks 0 caRows = true := by decide
635theorem ca_masks_lt : checkMasksLt (2 ^ 270) colMasks = true := by decide
636theorem ca_all_tuples_covered : chkL4 colMasks = true := by decide
637
638theorem ca_270_4_18_3_covers_all : IsCoveringArray4 270 18 3 caRows := by
639 have hrows := ca_rows_check
640 have hlen : caRows.length = 270 := by
641 have := checkAllRows_len colMasks caRows 0 hrows; omega
642 have hmlen := colMasks_len
643 refine ⟨hlen, ?_, ?_⟩
644 · intro r hr
645 have hr' : r < caRows.length := by rw [hlen]; exact hr
646 have hrc := checkAllRows_at colMasks caRows 0 r hrows hr'
647 simp only [Nat.zero_add] at hrc
648 have hclen : (caRows.getD r []).length = 18 := by
649 rw [checkRowWalk_len r (caRows.getD r []) colMasks hrc, hmlen]
650 refine ⟨hclen, ?_⟩
651 intro c hc
652 exact (checkRowWalk_entry r (caRows.getD r []) colMasks c hrc (by rw [hclen]; exact hc)).1
653 · intro c0 c1 c2 c3 h01 h12 h23 h3k p0 p1 p2 p3 hp0 hp1 hp2 hp3
654 have htup := chkL4_sound colMasks c0 c1 c2 c3 ca_all_tuples_covered h01 h12 h23 (by rw [hmlen]; exact h3k)
655 have hne := chkTuple_sound htup p0 p1 p2 p3 hp0 hp1 hp2 hp3
656 have hc0k : c0 < colMasks.length := by rw [hmlen]; omega
657 have hm0_lt : getSym (colMasks.getD c0 (0, 0, 0)) p0 < 2 ^ 270 :=
658 checkMasksLt_sound (2 ^ 270) colMasks c0 ca_masks_lt hc0k p0 hp0
659 have hlt : (((getSym (colMasks.getD c0 (0, 0, 0)) p0 &&& getSym (colMasks.getD c1 (0, 0, 0)) p1) &&& getSym (colMasks.getD c2 (0, 0, 0)) p2) &&& getSym (colMasks.getD c3 (0, 0, 0)) p3) < 2 ^ 270 :=
660 land_lt_pow2 (land_lt_pow2 (land_lt_pow2 hm0_lt))
661 obtain ⟨r, hr, hbit⟩ := exists_testBit_of_ne_zero 270 _ hlt hne
662 have h123 := testBit_land_true hbit
663 have h12' := testBit_land_true h123.1
664 have h01' := testBit_land_true h12'.1
665 have hrc := checkAllRows_at colMasks caRows 0 r hrows (by rw [hlen]; exact hr)
666 simp only [Nat.zero_add] at hrc
667 have hclen : (caRows.getD r []).length = 18 := by
668 rw [checkRowWalk_len r (caRows.getD r []) colMasks hrc, hmlen]
669 have he0 := (checkRowWalk_entry r (caRows.getD r []) colMasks c0 hrc (by rw [hclen]; omega)).2 p0 hp0 h01'.1
670 have he1 := (checkRowWalk_entry r (caRows.getD r []) colMasks c1 hrc (by rw [hclen]; omega)).2 p1 hp1 h01'.2
671 have he2 := (checkRowWalk_entry r (caRows.getD r []) colMasks c2 hrc (by rw [hclen]; omega)).2 p2 hp2 h12'.2
672 have he3 := (checkRowWalk_entry r (caRows.getD r []) colMasks c3 hrc (by rw [hclen]; omega)).2 p3 hp3 h123.2
673 exact ⟨r, hr, he0, he1, he2, he3⟩
674
675theorem ca_270_4_18_3_beats_live_2026 : 270 < 271 := by decide
676
677-- 6 Literal Broken-Model Negative Controls (neg_ctrl_*)
678def rowHits (row : List Nat) (c0 c1 c2 c3 p0 p1 p2 p3 : Nat) : Bool :=
679 (row.getD c0 3 == p0) && (row.getD c1 3 == p1) &&
680 (row.getD c2 3 == p2) && (row.getD c3 3 == p3)
681
682def anyRowHits (rows : List (List Nat)) (c0 c1 c2 c3 p0 p1 p2 p3 : Nat) : Bool :=
683 rows.any (fun row => rowHits row c0 c1 c2 c3 p0 p1 p2 p3)
684
685theorem anyRowHits_false_no_hit :
686 ∀ rows c0 c1 c2 c3 p0 p1 p2 p3,
687 anyRowHits rows c0 c1 c2 c3 p0 p1 p2 p3 = false →
688 ∀ r, r < rows.length →
689 ¬ ((rows.getD r []).getD c0 3 = p0 ∧
690 (rows.getD r []).getD c1 3 = p1 ∧
691 (rows.getD r []).getD c2 3 = p2 ∧
692 (rows.getD r []).getD c3 3 = p3) := by
693 intro rows
694 induction rows with
695 | nil => intro _ _ _ _ _ _ _ _ _ r hr; cases hr
696 | cons row rest ih =>
697 intro c0 c1 c2 c3 p0 p1 p2 p3 h r hr
698 simp only [anyRowHits, List.any_cons, Bool.or_eq_false_iff] at h
699 cases r with
700 | zero =>
701 intro hhit
702 simp only [List.getD_cons_zero] at hhit
703 have ht : rowHits row c0 c1 c2 c3 p0 p1 p2 p3 = true := by
704 simp only [rowHits, hhit.1, hhit.2.1, hhit.2.2.1, hhit.2.2.2, beq_self_eq_true, Bool.and_self]
705 rw [h.1] at ht; cases ht
706 | succ j =>
707 simp only [List.getD_cons_succ]
708 exact ih c0 c1 c2 c3 p0 p1 p2 p3 h.2 j (Nat.lt_of_succ_lt_succ hr)
709
710/-- Negative Control 1: Dropping last row breaks 4-way coverage. -/
711theorem neg_ctrl_drop_last_row : ¬ IsCoveringArray4 269 18 3 (caRows.take 269) := by
712 intro hca
713 have hmiss : anyRowHits (caRows.take 269) 0 1 4 15 1 2 0 2 = false := by decide
714 obtain ⟨r, hr, hhit⟩ := hca.2.2 0 1 4 15 (by decide) (by decide) (by decide) (by decide)
715 1 2 0 2 (by decide) (by decide) (by decide) (by decide)
716 exact anyRowHits_false_no_hit (caRows.take 269) 0 1 4 15 1 2 0 2 hmiss r (by rw [hca.1]; exact hr) hhit
717
718/-- Negative Control 2: Replacing row 0 with all-zeros breaks 4-way coverage. -/
719theorem neg_ctrl_zero_row0 : ¬ IsCoveringArray4 270 18 3 (List.replicate 18 0 :: caRows.tail) := by
720 intro hca
721 have hmiss : anyRowHits (List.replicate 18 0 :: caRows.tail) 0 1 2 10 2 1 1 0 = false := by decide
722 obtain ⟨r, hr, hhit⟩ := hca.2.2 0 1 2 10 (by decide) (by decide) (by decide) (by decide)
723 2 1 1 0 (by decide) (by decide) (by decide) (by decide)
724 exact anyRowHits_false_no_hit (List.replicate 18 0 :: caRows.tail) 0 1 2 10 2 1 1 0 hmiss r (by rw [hca.1]; exact hr) hhit
725
726/-- Negative Control 3: Duplicating row 0 over last row breaks 4-way coverage. -/
727theorem neg_ctrl_dup_row0 : ¬ IsCoveringArray4 270 18 3 (caRows.take 269 ++ [caRows.getD 0 []]) := by
728 intro hca
729 have hmiss : anyRowHits (caRows.take 269 ++ [caRows.getD 0 []]) 0 1 4 15 1 2 0 2 = false := by decide
730 obtain ⟨r, hr, hhit⟩ := hca.2.2 0 1 4 15 (by decide) (by decide) (by decide) (by decide)
731 1 2 0 2 (by decide) (by decide) (by decide) (by decide)
732 exact anyRowHits_false_no_hit (caRows.take 269 ++ [caRows.getD 0 []]) 0 1 4 15 1 2 0 2 hmiss r (by rw [hca.1]; exact hr) hhit
733
734/-- Negative Control 4: Setting column 0 to constant 0 breaks 4-way coverage. -/
735theorem neg_ctrl_const_col0 : ¬ IsCoveringArray4 270 18 3 (caRows.map (fun r => 0 :: r.tail)) := by
736 intro hca
737 have hmiss : anyRowHits (caRows.map (fun r => 0 :: r.tail)) 0 1 2 3 1 0 0 0 = false := by decide
738 obtain ⟨r, hr, hhit⟩ := hca.2.2 0 1 2 3 (by decide) (by decide) (by decide) (by decide)
739 1 0 0 0 (by decide) (by decide) (by decide) (by decide)
740 exact anyRowHits_false_no_hit (caRows.map (fun r => 0 :: r.tail)) 0 1 2 3 1 0 0 0 hmiss r (by rw [hca.1]; exact hr) hhit
741
742
743theorem neg_ctrl_wrong_nrows : ¬ IsCoveringArray4 269 18 3 caRows := by
744 intro hca
745 have h1 : caRows.length = 270 := by decide
746 have h2 := hca.1
747 omega
748
749theorem neg_ctrl_wrong_alphabet : ¬ IsCoveringArray4 270 18 2 caRows := by
750 intro hca
751 have hbad : (caRows.getD 2 []).getD 0 2 = 2 := by decide
752 have hlt := (hca.2.1 2 (by decide)).2 0 (by decide)
753 omega
754
755#print axioms ca_270_4_18_3_covers_all
756#print axioms ca_270_4_18_3_beats_live_2026
757#print axioms neg_ctrl_drop_last_row
758#print axioms neg_ctrl_zero_row0
759#print axioms neg_ctrl_dup_row0
760#print axioms neg_ctrl_const_col0
761#print axioms neg_ctrl_wrong_nrows
762#print axioms neg_ctrl_wrong_alphabet
763
764end CanWorldRecordsW2a