From 3cc1593266e2467277a90838bfd9c675d32a6ba4 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 00:05:54 -0400 Subject: [PATCH 01/41] Prove in Lean that Palmer's 168 is a self-interpreter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Blc/SelfintProof.lean: one induction on the source term (open or closed) gives the β-contract intL C ( ++ N) ->β* C (λz. M) N for every closed M and any C, N, and discharges the head-reduction obligations Selfint.lean stated as open Props (ParserStatement, L1, L2). The VAR engine is induction on the unary selector, skipvar is l l l -> rest, and sixteen machine runs are kernel replays on placeholder terms, lifted because head steps are stable under substitution. Axioms: propext, Quot.sound. --- lean/Blc.lean | 1 + lean/Blc/Selfint.lean | 20 +- lean/Blc/SelfintProof.lean | 1016 ++++++++++++++++++++++++++++++++++++ lean/README.md | 26 +- 4 files changed, 1051 insertions(+), 12 deletions(-) create mode 100644 lean/Blc/SelfintProof.lean diff --git a/lean/Blc.lean b/lean/Blc.lean index 03164a14..5e7fd603 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -14,3 +14,4 @@ import Blc.Rigid import Blc.NormalOrder import Blc.Wire import Blc.Selfint +import Blc.SelfintProof diff --git a/lean/Blc/Selfint.lean b/lean/Blc/Selfint.lean index 932326c5..893594af 100644 --- a/lean/Blc/Selfint.lean +++ b/lean/Blc/Selfint.lean @@ -11,8 +11,10 @@ interpreter) and |E_q| = |intL I| = 174 — and the quote-size identity measured quote linearity, now kernel-checked. STATED here as named Props (round-4-ratified statements, thread -`qblc-selfint`, job cx-20260804-155021-14ee; obligations open, per -SPEC-BISIM §7): the extensional translation contract `Implements` — +`qblc-selfint`, job cx-20260804-155021-14ee) and PROVED in +`Blc/SelfintProof.lean` (`parserStatement`, `l1Statement`, +`l2Statement`, beside the β-contract `selfint_contract`): the +extensional translation contract `Implements` — P[·] is a CLASS of implementing closures, not a syntax function [Codex r3], with the dead-suffix/seed non-inspection captured extensionally by the ∀-tail quantification in the VAR clause — and @@ -157,8 +159,8 @@ theorem quote_length (p : Term) : simpa [quote, h] using this -- --------------------------------------------------------------------------- --- The translation contract and the L1/L2 statements (v0 drafts — --- obligations, not theorems; SPEC-BISIM §7). +-- The translation contract and the L1/L2 statements (SPEC-BISIM §7; +-- proved in Blc/SelfintProof.lean). /-- `ρ_R(Δ̂)` (SPEC-BISIM §3): environments as cons'-lists, list head = innermost binder (wire index 1, our `var 0`). -/ @@ -202,19 +204,19 @@ def ParserResult (M R Q U : Term) : Prop := /-- The induction motor: every finite term's wire parses — no closedness hypothesis; environment adequacy lives in `Implements`. -Open obligation (SPEC-BISIM §7, L1's general form). -/ +Proved: `parserStatement` (Blc/SelfintProof.lean). -/ def ParserStatement : Prop := ∀ (M R : Term), ∃ Q U, ParserResult M R Q U /-- L1 (parser correctness — SPEC-BISIM §2): the closed public -corollary of `ParserStatement`. Open obligation. -/ +corollary of `ParserStatement`. Proved: `l1Statement`. -/ def L1Statement : Prop := ∀ (M : Term), FreeUnder 0 M → ∀ (R : Term), ∃ Q U, ParserResult M R Q U /-- L2 (selector / formal poisoned-seed — SPEC-BISIM §3): the VAR -engine, proved separately by induction on the unary selector, then -used to discharge C-VAR inside `ParserStatement`'s induction. Open -obligation. -/ +engine as a parse. Proved: `l2Statement`; the engine itself is +`engine` (induction on the unary selector), which discharges C-VAR +inside `parse`'s induction (Blc/SelfintProof.lean). -/ def L2Statement : Prop := ∀ (i : Nat) (R : Term), ∃ Q U, ParserResult (.var i) R Q U diff --git a/lean/Blc/SelfintProof.lean b/lean/Blc/SelfintProof.lean new file mode 100644 index 00000000..e06a08d5 --- /dev/null +++ b/lean/Blc/SelfintProof.lean @@ -0,0 +1,1016 @@ +/- +Palmer's 168-bit interpreter IS a self-interpreter. Kernel-checked +here, for `E = intL` (the constant `wire_intL` pins to the 168-bit +wire), are both forms of the contract: + +* `selfint_contract` — the contract of + `docs/classical/self-interpreter/interpreter.md` §1 as a β-REDUCTION + (not merely a conversion), for every closed M and ANY terms C, N: + + E C (⌜M⌝ ++ N) →β* C (λz. M) N. + +* `parserStatement`, `l1Statement`, `l2Statement` — the + strategy-faithful obligations stated in `Blc/Selfint.lean` + (`ParserStatement`, `L1Statement`, `L2Statement`): under HEAD + reduction the configuration `intL C (⌜M⌝ ++ R)` reaches `C Q U`, + with `Q` an implementing closure (`Implements Q M`) and the + residual `U` head-reducing to `R`; for every term M, open or closed. + +One induction (`parse`) carries both. For every term M and every tail +R it produces one closure `λ.B` and one residual `U`, uniform in the +continuation, with + +* `Den M B` — the closure denotes M under β: substituting any cons' + environment for its argument, under any number of extra binders, + reduces to M with each free variable replaced by its entry; +* `Implements (λ.B) M` — the head-reduction semantics of + `Selfint.lean`; +* `SpineReds U R` and the parse itself as SPINE head reduction (every + source state is an application), which is what lets a residual be + reduced in place when the parser recurses on it (APP's second parse). + +Ingredients: the VAR engine (`engine`/`engineS`, induction on the unary index: +each wire '1' skips one cons' cell, the closing '0' selects), the skip +identity (`skip`: `l l l → rest` via `l l → K rest`), and sixteen +concrete machine runs (`run_*`): kernel replays (`decide`) of head-step +chains on terms whose free variables stand for the continuation, the +stream tail and the parsed closures, lifted to arbitrary terms because +head steps are stable under substitution (`spineReds_instN`). + +No `sorry`; the axioms are `propext` and `Quot.sound`. +-/ + +import Blc.Selfint +import Blc.Beta + +namespace Blc +open Term + +-- --------------------------------------------------------------------------- +-- §0. Shift/substitution algebra beyond Blc/Subst.lean. + +private theorem veq {m n : Nat} (h : m = n) : Term.var m = Term.var n := + congrArg Term.var h + +/-- The var-case finisher (a local twin of Subst.lean's `var_bash`). -/ +macro "vcase" : tactic => + `(tactic| + repeat' first + | rfl + | (exact veq (by omega)) + | (exfalso; omega) + | (simp only [Term.shift, Term.substDec]) + | split) + +theorem shift_zero : ∀ (t : Term) (c : Nat), shift 0 c t = t := by + intro t + induction t with + | var n => intro c; vcase + | lam b ih => intro c; simp only [shift]; rw [ih] + | app f a ihf iha => intro c; simp only [shift]; rw [ihf, iha] + +/-- Two lifts compose when the second cut lies in the gap the first +opens. -/ +theorem shift_shift_add : ∀ (t : Term) (a b c c' : Nat), c ≤ c' → c' ≤ c + b → + shift a c' (shift b c t) = shift (a + b) c t := by + intro t + induction t with + | var n => intro a b c c' h1 h2; vcase + | lam x ih => + intro a b c c' h1 h2 + simp only [shift] + rw [ih a b (c + 1) (c' + 1) (by omega) (by omega)] + | app f x ihf ihx => + intro a b c c' h1 h2 + simp only [shift] + rw [ihf a b c c' h1 h2, ihx a b c c' h1 h2] + +/-- Commuting lifts: an outer cut above an inner one. -/ +theorem shift_shift_comm : ∀ (t : Term) (d m c c' : Nat), c' ≤ c → + shift d (c + m) (shift m c' t) = shift m c' (shift d c t) := by + intro t + induction t with + | var n => intro d m c c' h; vcase + | lam x ih => + intro d m c c' h + simp only [shift] + have e : c + m + 1 = (c + 1) + m := by omega + rw [e, ih d m (c + 1) (c' + 1) (by omega)] + | app f x ihf ihx => + intro d m c c' h + simp only [shift] + rw [ihf d m c c' h, ihx d m c c' h] + +/-- Substituting into the gap a lift opened just closes one slot of it. -/ +theorem substDec_shift_mid : ∀ (t s : Term) (m c j : Nat), c ≤ j → j < c + m → + substDec j s (shift m c t) = shift (m - 1) c t := by + intro t + induction t with + | var n => intro s m c j h1 h2; vcase + | lam x ih => + intro s m c j h1 h2 + simp only [shift, substDec] + rw [ih (shift 1 0 s) m (c + 1) (j + 1) (by omega) (by omega)] + | app f x ihf ihx => + intro s m c j h1 h2 + simp only [shift, substDec] + rw [ihf s m c j h1 h2, ihx s m c j h1 h2] + +/-- Re-binding the slot a lift opened: `(↑_{c+1} t)[var c / c] = t`. -/ +theorem substDec_var_shift : ∀ (t : Term) (c : Nat), + substDec c (.var c) (shift 1 (c + 1) t) = t := by + intro t + induction t with + | var n => intro c; vcase + | lam x ih => + intro c + simp only [shift, substDec] + rw [if_pos (Nat.zero_le c), ih (c + 1)] + | app f x ihf ihx => + intro c + simp only [shift, substDec] + rw [ihf c, ihx c] + +theorem shift_shift0 (a b c : Nat) (t : Term) (h : c ≤ b) : + shift a c (shift b 0 t) = shift (a + b) 0 t := + shift_shift_add t a b 0 c (Nat.zero_le c) (by omega) + +theorem substDec_shift0 (j m : Nat) (s t : Term) (h : j < m) : + substDec j s (shift m 0 t) = shift (m - 1) 0 t := + substDec_shift_mid t s m 0 j (Nat.zero_le j) (by omega) + +theorem shift_shift_comm0 (t : Term) (d m : Nat) : + shift d m (shift m 0 t) = shift m 0 (shift d 0 t) := by + have h := shift_shift_comm t d m 0 0 (Nat.le_refl 0) + simpa using h + +-- --------------------------------------------------------------------------- +-- §1. Spine head reduction; stability under substitution. + +/-- Head reduction whose every source state is not a λ — so it lifts +into the function position of any application (`spineReds_appL`). +Every machine phase of the interpreter has this shape. -/ +inductive SpineReds : Term → Term → Prop where + | refl (t : Term) : SpineReds t t + | step {t u v : Term} (nl : ¬ IsLam t) (h : HeadStep t u) (hs : SpineReds u v) : + SpineReds t v + +theorem spineReds_trans {t u v : Term} (h₁ : SpineReds t u) (h₂ : SpineReds u v) : + SpineReds t v := by + induction h₁ with + | refl => exact h₂ + | step nl h _ ih => exact SpineReds.step nl h (ih h₂) + +theorem spineReds_appL {f f' : Term} (a : Term) (h : SpineReds f f') : + SpineReds (.app f a) (.app f' a) := by + induction h with + | refl t => exact SpineReds.refl _ + | step nl h _ ih => exact SpineReds.step (fun h => h) (HeadStep.appL a (notLam_ne nl) h) ih + +theorem headReduces_of_spineReds {t u : Term} (h : SpineReds t u) : HeadReduces t u := by + induction h with + | refl t => exact ⟨0, HeadReds.refl t⟩ + | step _ h _ ih => + obtain ⟨n, hn⟩ := ih + exact ⟨n + 1, HeadReds.head h hn⟩ + +theorem betas_of_spineReds {t u : Term} (h : SpineReds t u) : Betas t u := by + induction h with + | refl t => exact Betas.refl t + | step _ h _ ih => exact Betas.head (beta_of_headStep h) ih + +theorem not_isLam_of_ne {f : Term} (h : ∀ b, f ≠ .lam b) : ¬ IsLam f := by + cases f with + | lam b => exact absurd rfl (h b) + | var n => exact fun h => h + | app g x => exact fun h => h + +/-- A non-λ that head-steps is an application, and stays one under +substitution. -/ +theorem not_isLam_substDec {t u : Term} (nl : ¬ IsLam t) (h : HeadStep t u) + (j : Nat) (s : Term) : ¬ IsLam (substDec j s t) := by + cases t with + | var n => cases h + | lam b => exact absurd trivial nl + | app f a => exact fun h => h + +/-- Head steps are stable under substitution: replacing variables never +moves the head redex. -/ +theorem headStep_substDec {t u : Term} (h : HeadStep t u) : + ∀ (j : Nat) (s : Term), HeadStep (substDec j s t) (substDec j s u) := by + induction h with + | beta b a => + intro j s + simp only [substDec] + rw [substDec_contract] + exact HeadStep.beta _ _ + | appL a nonlam h ih => + intro j s + simp only [substDec] + exact HeadStep.appL _ + (notLam_ne (not_isLam_substDec (not_isLam_of_ne nonlam) h j s)) (ih j s) + | under _ ih => + intro j s + simp only [substDec] + exact HeadStep.under (ih _ _) + +theorem spineReds_substDec {t u : Term} (h : SpineReds t u) (j : Nat) (s : Term) : + SpineReds (substDec j s t) (substDec j s u) := by + induction h with + | refl t => exact SpineReds.refl _ + | step nl hs _ ih => + exact SpineReds.step (not_isLam_substDec nl hs j s) (headStep_substDec hs j s) ih + +/-- Simultaneous instantiation of the placeholders `var j, var j+1, …` +by a list of terms (each read in the context outside the +placeholders). -/ +def instN : List Term → Nat → Term → Term + | [], _, t => t + | a :: as, j, t => substDec j (shift j 0 a) (instN as (j + 1) t) + +theorem spineReds_instN : ∀ (as : List Term) (j : Nat) {t u : Term}, + SpineReds t u → SpineReds (instN as j t) (instN as j u) := by + intro as + induction as with + | nil => intro j t u h; exact h + | cons a as ih => + intro j t u h + exact spineReds_substDec (ih (j + 1) h) j _ + +/-- Executable spine stepper: `n` head steps, refusing a λ source. -/ +def spineSteps : Nat → Term → Option Term + | 0, t => some t + | n + 1, t => if IsLam t then none else (headStep t).bind (spineSteps n) + +theorem spineReds_of_spineSteps : + ∀ (n : Nat) {t u : Term}, spineSteps n t = some u → SpineReds t u := by + intro n + induction n with + | zero => intro t u h; cases h; exact SpineReds.refl _ + | succ m ih => + intro t u h + simp only [spineSteps] at h + split at h + · cases h + · rename_i hl + simp only [Option.bind_eq_some_iff] at h + obtain ⟨v, hv, hrest⟩ := h + exact SpineReds.step hl (headStep_sound hv) (ih hrest) + +/-- A single outer β-step from an application is a spine step. -/ +theorem spine_beta (b a : Term) : SpineReds (.app (.lam b) a) (contract b a) := + SpineReds.step (fun h => h) (HeadStep.beta b a) (SpineReds.refl _) + +theorem betas_app {f f' a a' : Term} (hf : Betas f f') (ha : Betas a a') : + Betas (.app f a) (.app f' a') := + betas_trans (betas_appL a hf) (betas_appR f' ha) + +-- --------------------------------------------------------------------------- +-- §2. The interpreter, named by its parts. + +/-- `\args \arg. exp (cons' arg args)` with `exp` free at index 0 +outside its two binders. -/ +def absVt : Term := + .lam (.lam (.app (.var 2) (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 3))))))) + +/-- `\args. exp args (exp2 args)`, `exp2` and `exp` free at 0 and 1. -/ +def appVt : Term := .lam (.app (.app (.var 2) (.var 0)) (.app (.var 1) (.var 0))) + +/-- The floated zero-branch continuation +`\bit1. intL (\exp. bit1 (cont ABS) (intL (\exp2. cont APP)))`. -/ +def nextT : Term := + .lam (.app (.var 2) (.lam (.app (.app (.var 1) (.app (.var 2) absVt)) + (.app (.var 3) (.lam (.app (.var 3) appVt)))))) + +/-- `\bit0 \list1. bit0 (list1 next) (cont list1 (list1 list1 list1))`. -/ +def handlerT : Term := + .lam (.lam (.app (.app (.var 1) (.app (.var 0) (.var 3))) + (.app (.app (.var 4) (.var 0)) (.app (.app (.var 0) (.var 0)) (.var 0))))) + +/-- `\intL \cont. (\next \list. list H) NEXT`. -/ +def bodyT : Term := .lam (.lam (.app (.lam (.lam (.app (.var 0) handlerT))) nextT)) + +/-- The knot's generator `\x. body (x x)`. -/ +def knotW : Term := .lam (.app bodyT (.app (.var 0) (.var 0))) + +/-- The parser: `intL`'s first head reduct, and the value of every +recursive call. -/ +def parser : Term := .app knotW knotW + +theorem intL_eq : intL = .app (.lam (.app (.var 0) (.var 0))) knotW := by decide + +theorem parser_closed : Closed parser := by decide + +theorem shift_parser (d c : Nat) : shift d c parser = parser := + shift_closed d c parser_closed + +theorem substDec_parser (j : Nat) (s : Term) : substDec j s parser = parser := + substDec_closed j s parser_closed + +theorem shift_churchTrue (d c : Nat) : shift d c churchTrue = churchTrue := + shift_closed d c (by decide) + +theorem shift_churchFalse (d c : Nat) : shift d c churchFalse = churchFalse := + shift_closed d c (by decide) + +theorem substDec_churchTrue (j : Nat) (s : Term) : + substDec j s churchTrue = churchTrue := + substDec_closed j s (by decide) + +theorem substDec_churchFalse (j : Nat) (s : Term) : + substDec j s churchFalse = churchFalse := + substDec_closed j s (by decide) + +theorem shift_churchBit (d c : Nat) (b : Bool) : shift d c (churchBit b) = churchBit b := by + cases b + · exact shift_churchTrue d c + · exact shift_churchFalse d c + +/-- The zero branch's `next`, with `cont` free at index 2 (under the +handler's `\bit0 \list1`) and `intL` resolved to the parser. -/ +def nextc : Term := + .lam (.app parser (.lam (.app (.app (.var 1) (.app (.var 4) absVt)) + (.app parser (.lam (.app (.var 5) appVt)))))) + +/-- The handler the parser applies the stream to, `cont` free at 0. -/ +def hndc : Term := + .lam (.lam (.app (.app (.var 1) (.app (.var 0) nextc)) + (.app (.app (.var 2) (.var 0)) (.app (.app (.var 0) (.var 0)) (.var 0))))) + +/-- The first parse's continuation, with `cont` free at index 0 and the +second tag bit `b` substituted. -/ +def kont (b : Term) : Term := + .lam (.app (.app b (.app (.var 1) absVt)) (.app parser (.lam (.app (.var 2) appVt)))) + +/-- APP's second continuation, `cont` free at 0 and `exp` at 1. -/ +def kont2 : Term := + .lam (.app (.var 1) (.lam (.app (.app (.var 3) (.var 0)) (.app (.var 1) (.var 0))))) + +/-- ABS's value with `exp` free at index 1. -/ +def absVc : Term := + .lam (.lam (.app (.var 3) (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 3))))))) + +/-- APP's value with `exp`, `exp2` free at 1, 2. -/ +def appVc : Term := .lam (.app (.app (.var 2) (.var 0)) (.app (.var 3) (.var 0))) + +theorem substDec_hndc (j : Nat) (s : Term) (h : 1 ≤ j) : substDec j s hndc = hndc := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +theorem substDec_kontT (j : Nat) (s : Term) (h : 1 ≤ j) : + substDec j s (kont churchTrue) = kont churchTrue := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +theorem substDec_kontF (j : Nat) (s : Term) (h : 1 ≤ j) : + substDec j s (kont churchFalse) = kont churchFalse := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +theorem substDec_kont2 (j : Nat) (s : Term) (h : 2 ≤ j) : + substDec j s kont2 = kont2 := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +/-- The handler, closed over `cont = K`. -/ +def hnd (K : Term) : Term := substDec 0 K hndc + +/-- ABS's continuation, closed over `cont = K`. -/ +def kA (K : Term) : Term := substDec 0 K (kont churchTrue) + +/-- APP's first continuation, closed over `cont = K`. -/ +def kB (K : Term) : Term := substDec 0 K (kont churchFalse) + +/-- APP's second continuation, closed over `cont = K` and `exp = e`. -/ +def kC (K e : Term) : Term := instN [K, e] 0 kont2 + +/-- ABS's value `\args \arg. e (cons' arg args)`. -/ +def absV (e : Term) : Term := .lam (.lam (.app (shift 2 0 e) (consP (.var 0) (.var 1)))) + +/-- APP's value `\args. e args (e₂ args)`. -/ +def appV (e e₂ : Term) : Term := + .lam (.app (.app (shift 1 0 e) (.var 0)) (.app (shift 1 0 e₂) (.var 0))) + +-- --------------------------------------------------------------------------- +-- §3. The machine runs, replayed by the kernel on placeholder terms. + +/-- The knot: `intL` head-steps to the parser. -/ +theorem run_knot : spineSteps 1 intL = some parser := by decide + +/-- The parser unfolds and applies the stream to its handler. -/ +theorem run_unfold : + spineSteps 5 (.app (.app parser (.var 0)) (.var 1)) = some (.app (.var 1) hndc) := by + decide + +/-- Tag `1`: VAR returns `cont list1 (list1 list1 list1)`. -/ +theorem run_var : + spineSteps 5 (.app (pairT churchFalse (.var 1)) hndc) + = some (.app (.app (.var 0) (.var 1)) (.app (.app (.var 1) (.var 1)) (.var 1))) := by + decide + +/-- Tags `00`: ABS parses its body under the ABS continuation. -/ +theorem run_lam : + spineSteps 7 (.app (pairT churchTrue (pairT churchTrue (.var 1))) hndc) + = some (.app (.app parser (kont churchTrue)) (.var 1)) := by + decide + +/-- Tags `01`: APP parses its function under the APP continuation. -/ +theorem run_app : + spineSteps 7 (.app (pairT churchTrue (pairT churchFalse (.var 1))) hndc) + = some (.app (.app parser (kont churchFalse)) (.var 1)) := by + decide + +/-- ABS returns its value. -/ +theorem run_retLam : + spineSteps 3 (.app (.app (kont churchTrue) (.var 1)) (.var 2)) + = some (.app (.app (.var 0) absVc) (.var 2)) := by + decide + +/-- APP's first parse continues into the second. -/ +theorem run_retApp1 : + spineSteps 3 (.app (.app (kont churchFalse) (.var 1)) (.var 2)) + = some (.app (.app parser kont2) (.var 2)) := by + decide + +/-- APP returns its value. -/ +theorem run_retApp2 : + spineSteps 1 (.app (.app kont2 (.var 2)) (.var 3)) + = some (.app (.app (.var 0) appVc) (.var 3)) := by + decide + +/-- A stream cell meets its reader. -/ +theorem run_pair : + spineSteps 1 (.app (pairT (.var 0) (.var 1)) (.var 2)) + = some (.app (.app (.var 2) (.var 0)) (.var 1)) := by + decide + +/-- A cons' cell read by TRUE returns its entry. -/ +theorem run_cell0 : + spineSteps 4 (.app (.app (consP (.var 0) (.var 1)) churchTrue) (.var 2)) = some (.var 0) := by + decide + +/-- A cons' cell read by FALSE passes its tail to the continuation. -/ +theorem run_cellS : + spineSteps 4 (.app (.app (consP (.var 0) (.var 1)) churchFalse) (.var 2)) + = some (.app (.var 2) (.var 1)) := by + decide + +theorem run_true1 : spineSteps 1 (.app churchTrue (.var 0)) = some (.lam (.var 1)) := by decide + +theorem run_true2 : spineSteps 2 (.app (.app churchTrue (.var 0)) (.var 1)) = some (.var 0) := by + decide + +theorem run_false2 : + spineSteps 2 (.app (.app churchFalse (.var 0)) (.var 1)) = some (.var 1) := by + decide + +/-- An ABS closure applied to an environment and an argument enters its +body under the extended environment. -/ +theorem run_absImpl : + spineSteps 2 (.app (.app (absV (.var 0)) (.var 1)) (.var 2)) + = some (.app (.var 0) (consP (.var 2) (.var 1))) := by + decide + +/-- An APP closure applied to an environment spreads it to both parts. -/ +theorem run_appImpl : + spineSteps 1 (.app (appV (.var 0) (.var 1)) (.var 2)) + = some (.app (.app (.var 0) (.var 2)) (.app (.var 1) (.var 2))) := by + decide + +-- --------------------------------------------------------------------------- +-- §4. The runs, lifted to arbitrary continuations, tails and closures. + +theorem spine_unfold (K s : Term) : + SpineReds (.app (.app parser K) s) (.app s (hnd K)) := by + have h := spineReds_instN [K, s] 0 (spineReds_of_spineSteps _ run_unfold) + simpa [instN, hnd, substDec, shift, substDec_parser, substDec_hndc, substDec_shift0, + shift_zero] using h + +/-- Tag `1`: `(1:r) (hnd K) → K r (r r r)`. -/ +theorem spine_var (K r : Term) : + SpineReds (.app (pairT churchFalse r) (hnd K)) (.app (.app K r) (.app (.app r r) r)) := by + have h := spineReds_instN [K, r] 0 (spineReds_of_spineSteps _ run_var) + simpa [instN, hnd, pairT, substDec, shift, shift_churchFalse, substDec_churchFalse, + substDec_hndc, shift_shift0, substDec_shift0, shift_zero] using h + +/-- Tags `00`: `(0:0:r) (hnd K) → P (kA K) r`. -/ +theorem spine_lam (K r : Term) : + SpineReds (.app (pairT churchTrue (pairT churchTrue r)) (hnd K)) + (.app (.app parser (kA K)) r) := by + have h := spineReds_instN [K, r] 0 (spineReds_of_spineSteps _ run_lam) + simpa [instN, hnd, kA, pairT, substDec, shift, shift_parser, substDec_parser, + shift_churchTrue, substDec_churchTrue, substDec_hndc, substDec_kontT, shift_shift0, + substDec_shift0, shift_zero] using h + +/-- Tags `01`: `(0:1:r) (hnd K) → P (kB K) r`. -/ +theorem spine_app (K r : Term) : + SpineReds (.app (pairT churchTrue (pairT churchFalse r)) (hnd K)) + (.app (.app parser (kB K)) r) := by + have h := spineReds_instN [K, r] 0 (spineReds_of_spineSteps _ run_app) + simpa [instN, hnd, kB, pairT, substDec, shift, shift_parser, substDec_parser, + shift_churchTrue, substDec_churchTrue, shift_churchFalse, substDec_churchFalse, + substDec_hndc, substDec_kontF, shift_shift0, substDec_shift0, shift_zero] using h + +theorem ret_lam (K e u : Term) : + SpineReds (.app (.app (kA K) e) u) (.app (.app K (absV e)) u) := by + have h := spineReds_instN [K, e, u] 0 (spineReds_of_spineSteps _ run_retLam) + simpa [instN, kA, absV, absVc, consP, substDec, shift, substDec_kontT, + shift_shift0, substDec_shift0, shift_zero] using h + +theorem ret_app1 (K e u : Term) : + SpineReds (.app (.app (kB K) e) u) (.app (.app parser (kC K e)) u) := by + have h := spineReds_instN [K, e, u] 0 (spineReds_of_spineSteps _ run_retApp1) + simpa [instN, kB, kC, substDec, shift, substDec_parser, substDec_kontF, substDec_kont2, + shift_shift0, substDec_shift0, shift_zero] using h + +theorem ret_app2 (K e e₂ u : Term) : + SpineReds (.app (.app (kC K e) e₂) u) (.app (.app K (appV e e₂)) u) := by + have h := spineReds_instN [K, e, e₂, u] 0 (spineReds_of_spineSteps _ run_retApp2) + simpa [instN, kC, appV, appVc, substDec, shift, substDec_kont2, + shift_shift0, substDec_shift0, shift_zero] using h + +theorem spine_pairT (A P X : Term) : + SpineReds (.app (pairT A P) X) (.app (.app X A) P) := by + have h := spineReds_instN [A, P, X] 0 (spineReds_of_spineSteps _ run_pair) + simpa [instN, pairT, substDec, shift, shift_shift0, substDec_shift0, shift_zero] using h + +theorem spine_cell0 (a ρ T : Term) : + SpineReds (.app (.app (consP a ρ) churchTrue) T) a := by + have h := spineReds_instN [a, ρ, T] 0 (spineReds_of_spineSteps _ run_cell0) + simpa [instN, consP, substDec, shift, shift_churchTrue, substDec_churchTrue, + shift_shift0, substDec_shift0, shift_zero] using h + +theorem spine_cellS (a ρ T : Term) : + SpineReds (.app (.app (consP a ρ) churchFalse) T) (.app T ρ) := by + have h := spineReds_instN [a, ρ, T] 0 (spineReds_of_spineSteps _ run_cellS) + simpa [instN, consP, substDec, shift, shift_churchFalse, substDec_churchFalse, + shift_shift0, substDec_shift0, shift_zero] using h + +theorem spine_true1 (X : Term) : SpineReds (.app churchTrue X) (.lam (shift 1 0 X)) := by + have h := spineReds_instN [X] 0 (spineReds_of_spineSteps _ run_true1) + simpa [instN, substDec, shift, substDec_churchTrue, shift_zero] using h + +theorem spine_true2 (X Y : Term) : SpineReds (.app (.app churchTrue X) Y) X := by + have h := spineReds_instN [X, Y] 0 (spineReds_of_spineSteps _ run_true2) + simpa [instN, substDec, shift, substDec_churchTrue, substDec_shift0, shift_zero] using h + +theorem spine_false2 (X Y : Term) : SpineReds (.app (.app churchFalse X) Y) Y := by + have h := spineReds_instN [X, Y] 0 (spineReds_of_spineSteps _ run_false2) + simpa [instN, substDec, shift, substDec_churchFalse, substDec_shift0, shift_zero] using h + +theorem spine_absImpl (e ρ a : Term) : + SpineReds (.app (.app (absV e) ρ) a) (.app e (consP a ρ)) := by + have h := spineReds_instN [e, ρ, a] 0 (spineReds_of_spineSteps _ run_absImpl) + simpa [instN, absV, consP, substDec, shift, shift_shift0, substDec_shift0, shift_zero] using h + +theorem spine_appImpl (e e₂ ρ : Term) : + SpineReds (.app (appV e e₂) ρ) (.app (.app e ρ) (.app e₂ ρ)) := by + have h := spineReds_instN [e, e₂, ρ] 0 (spineReds_of_spineSteps _ run_appImpl) + simpa [instN, appV, substDec, shift, shift_shift0, substDec_shift0, shift_zero] using h + +-- --------------------------------------------------------------------------- +-- §5. Streams, environments, the VAR engine, and skipvar. + +/-- The wire suffix after a variable's first `1`: `1^i 0`. -/ +def vbits (i : Nat) : List Bool := List.replicate i true ++ [false] + +theorem vbits_succ (j : Nat) : vbits (j + 1) = true :: vbits j := by + simp [vbits, List.replicate_succ] + +theorem code_var (i : Nat) : blcCode (.var i) = true :: vbits i := by + simp [blcCode, vbits, List.replicate_succ] + +theorem streamOf_cons (b : Bool) (bs : List Bool) (R : Term) : + streamOf (b :: bs) R = pairT (churchBit b) (streamOf bs R) := rfl + +theorem streamOf_append (xs ys : List Bool) (R : Term) : + streamOf (xs ++ ys) R = streamOf xs (streamOf ys R) := by + simp [streamOf, List.foldr_append] + +theorem stream_vbits_zero (R : Term) : streamOf (vbits 0) R = pairT churchTrue R := rfl + +theorem stream_vbits_succ (j : Nat) (R : Term) : + streamOf (vbits (j + 1)) R = pairT churchFalse (streamOf (vbits j) R) := by + rw [vbits_succ]; rfl + +theorem envList_cons (a : Term) (env : List Term) (R : Term) : + envList (a :: env) R = consP a (envList env R) := rfl + +theorem shift_pairT (d c : Nat) (A P : Term) : + shift d c (pairT A P) = pairT (shift d c A) (shift d c P) := by + unfold pairT + simp only [shift] + rw [shift_shift_comm A d 1 c 0 (Nat.zero_le c), shift_shift_comm P d 1 c 0 (Nat.zero_le c)] + simp + +theorem shift_consP (d c : Nat) (A P : Term) : + shift d c (consP A P) = consP (shift d c A) (shift d c P) := by + unfold consP + simp only [shift] + have hA := shift_shift_comm A d 2 c 0 (Nat.zero_le c) + have hP := shift_shift_comm P d 2 c 0 (Nat.zero_le c) + have e : c + 1 + 1 = c + 2 := by omega + rw [e, hA, hP] + simp + +theorem shift_streamOf (d c : Nat) (bits : List Bool) (R : Term) : + shift d c (streamOf bits R) = streamOf bits (shift d c R) := by + induction bits with + | nil => rfl + | cons b bs ih => + rw [streamOf_cons, streamOf_cons, shift_pairT, shift_churchBit, ih] + +theorem shift_envList (d c : Nat) (env : List Term) (R : Term) : + shift d c (envList env R) = envList (env.map (shift d c)) (shift d c R) := by + induction env with + | nil => rfl + | cons a env ih => + rw [envList_cons, shift_consP, ih] + rfl + +/-- The VAR engine's last step: the closing `0` selects the head. -/ +theorem engine0 (a : Term) (env : List Term) (Renv T : Term) : + SpineReds (.app (.app (envList (a :: env) Renv) churchTrue) T) a := + spine_cell0 a _ T + +/-- The VAR engine (L2), by induction on the unary index: each wire `1` +skips one cons' cell. -/ +theorem engineS : ∀ (j : Nat) (a : Term) (env : List Term) (Renv T v : Term), + env[j]? = some v → + SpineReds (.app (.app (envList (a :: env) Renv) churchFalse) (streamOf (vbits j) T)) v := by + intro j + induction j with + | zero => + intro a env Renv T v h + cases env with + | nil => simp at h + | cons a' env' => + simp at h + subst h + rw [envList_cons, stream_vbits_zero] + refine spineReds_trans (spine_cellS a _ _) ?_ + exact spineReds_trans (spine_pairT _ _ _) (engine0 _ env' Renv T) + | succ j ih => + intro a env Renv T v h + cases env with + | nil => simp at h + | cons a' env' => + simp at h + rw [envList_cons, stream_vbits_succ] + refine spineReds_trans (spine_cellS a _ _) ?_ + exact spineReds_trans (spine_pairT _ _ _) (ih a' env' Renv T v h) + +/-- A variable's value, the stream `1^i 0 ++ T` after its first `1`, +looks itself up: applied to an environment it returns entry `i`. -/ +theorem engine (i : Nat) (env : List Term) (Renv T v : Term) (h : env[i]? = some v) : + SpineReds (.app (streamOf (vbits i) T) (envList env Renv)) v := by + cases i with + | zero => + cases env with + | nil => simp at h + | cons a env' => + simp at h + subst h + rw [stream_vbits_zero] + exact spineReds_trans (spine_pairT _ _ _) (engine0 _ env' Renv T) + | succ j => + cases env with + | nil => simp at h + | cons a env' => + simp at h + rw [stream_vbits_succ] + exact spineReds_trans (spine_pairT _ _ _) (engineS j a env' Renv T v h) + +/-- `l l → K rest` for a variable stream `l = 1^i 0 ++ rest`. -/ +theorem skip_self : ∀ (i : Nat) (T : Term), + SpineReds (.app (streamOf (vbits i) T) (streamOf (vbits i) T)) (.lam (shift 1 0 T)) := by + intro i + induction i with + | zero => + intro T + rw [stream_vbits_zero] + refine spineReds_trans (spine_pairT _ _ _) ?_ + refine spineReds_trans (spineReds_appL T (spine_pairT _ _ _)) ?_ + refine spineReds_trans (spineReds_appL T (spine_true2 churchTrue T)) ?_ + exact spine_true1 T + | succ j ih => + intro T + rw [stream_vbits_succ] + refine spineReds_trans (spine_pairT _ _ _) ?_ + refine spineReds_trans (spineReds_appL _ (spine_pairT _ _ _)) ?_ + refine spineReds_trans (spineReds_appL _ (spine_false2 churchFalse _)) ?_ + exact ih T + +/-- skipvar: `l l l → rest`. -/ +theorem skip (i : Nat) (T : Term) : + SpineReds (.app (.app (streamOf (vbits i) T) (streamOf (vbits i) T)) (streamOf (vbits i) T)) T := by + refine spineReds_trans (spineReds_appL _ (skip_self i T)) ?_ + have h := spine_beta (shift 1 0 T) (streamOf (vbits i) T) + have e : contract (shift 1 0 T) (streamOf (vbits i) T) = T := substDec_shift T _ 0 + rw [e] at h + exact h + +-- --------------------------------------------------------------------------- +-- §6. Denotation: what a parsed closure computes under β. + +/-- Lifting a substitution under a binder. -/ +def up (σ : Nat → Term) : Nat → Term + | 0 => .var 0 + | n + 1 => shift 1 0 (σ n) + +/-- Simultaneous substitution. -/ +def inst (σ : Nat → Term) : Term → Term + | .var n => σ n + | .lam b => .lam (inst (up σ) b) + | .app f a => .app (inst σ f) (inst σ a) + +theorem inst_id : ∀ (t : Term) (σ : Nat → Term), (∀ n, σ n = .var n) → inst σ t = t := by + intro t + induction t with + | var n => intro σ h; exact h n + | lam b ih => + intro σ h + simp only [inst] + rw [ih (up σ) (by + intro n + cases n with + | zero => rfl + | succ n => simp [up, h, shift])] + | app f a ihf iha => + intro σ h + simp only [inst] + rw [ihf σ h, iha σ h] + +/-- `Den M B`: the closure `λ.B` denotes `M`. Substituting any cons' +environment for the closure's argument — under any number `k` of +extra binders, and whatever the environment's tail — reduces to `M` +with each free variable `i < d` replaced by the environment's entry +`i`. -/ +def Den (M B : Term) : Prop := + ∀ (d k : Nat) (env : List Term) (R : Term) (σ : Nat → Term), + FreeUnder d M → (∀ i, i < d → env[i]? = some (σ i)) → + Betas (substDec 0 (envList env R) (shift k 1 B)) (inst σ M) + +theorem pair_body_subst (A P ρ : Term) (k : Nat) : + substDec 0 ρ (shift k 1 (.app (.app (.var 0) (shift 1 0 A)) (shift 1 0 P))) + = .app (.app ρ (shift k 0 A)) (shift k 0 P) := by + simp only [shift] + rw [shift_shift_comm0 A k 1, shift_shift_comm0 P k 1] + simp [substDec, substDec_shift] + +theorem den_var0 (R : Term) : + Den (.var 0) (.app (.app (.var 0) (shift 1 0 churchTrue)) (shift 1 0 R)) := by + intro d k env R' σ hfree hagree + rw [pair_body_subst, shift_churchTrue] + have h := hagree 0 hfree + cases env with + | nil => simp at h + | cons a env' => + simp at h + subst h + exact betas_of_spineReds (engine0 _ env' R' _) + +theorem den_varS (j : Nat) (R : Term) : + Den (.var (j + 1)) + (.app (.app (.var 0) (shift 1 0 churchFalse)) (shift 1 0 (streamOf (vbits j) R))) := by + intro d k env R' σ hfree hagree + rw [pair_body_subst, shift_churchFalse, shift_streamOf] + have h := hagree (j + 1) hfree + cases env with + | nil => simp at h + | cons a env' => + simp at h + exact betas_of_spineReds (engineS j a env' R' _ _ h) + +theorem consP_var01_subst (ρ : Term) : + substDec 1 ρ (consP (.var 0) (.var 1)) = consP (.var 0) ρ := by + simp [consP, substDec, shift, shift_shift0] + +/-- ABS's closure body under a substituted environment. -/ +theorem absV_subst (e ρ : Term) (k : Nat) : + substDec 0 ρ (shift k 1 (.lam (.app (shift 2 0 e) (consP (.var 0) (.var 1))))) + = .lam (.app (shift (k + 1) 0 e) (consP (.var 0) (shift 1 0 ρ))) := by + have hc : shift k 2 (consP (.var 0) (.var 1)) = consP (.var 0) (.var 1) := + shift_of_freeUnder k _ 2 2 (by decide) (Nat.le_refl 2) + have h1 : shift k 1 (.lam (.app (shift 2 0 e) (consP (.var 0) (.var 1)))) + = .lam (.app (shift (k + 2) 0 e) (consP (.var 0) (.var 1))) := by + show Term.lam (.app (shift k 2 (shift 2 0 e)) (shift k 2 (consP (.var 0) (.var 1)))) = _ + rw [hc, shift_shift_add e k 2 0 2 (Nat.zero_le 2) (Nat.le_refl 2)] + rw [h1] + show Term.lam (.app (substDec 1 (shift 1 0 ρ) (shift (k + 2) 0 e)) + (substDec 1 (shift 1 0 ρ) (consP (.var 0) (.var 1)))) = _ + rw [substDec_shift0 1 (k + 2) _ _ (by omega), consP_var01_subst] + have hk : k + 2 - 1 = k + 1 := by omega + rw [hk] + +/-- APP's closure body under a substituted environment. -/ +theorem appV_subst (e₁ e₂ ρ : Term) (k : Nat) : + substDec 0 ρ (shift k 1 (.app (.app (shift 1 0 e₁) (.var 0)) (.app (shift 1 0 e₂) (.var 0)))) + = .app (.app (shift k 0 e₁) ρ) (.app (shift k 0 e₂) ρ) := by + have hv : substDec 0 ρ (shift k 1 (.var 0)) = ρ := by simp [shift, substDec] + show Term.app (.app (substDec 0 ρ (shift k 1 (shift 1 0 e₁))) (substDec 0 ρ (shift k 1 (.var 0)))) + (.app (substDec 0 ρ (shift k 1 (shift 1 0 e₂))) (substDec 0 ρ (shift k 1 (.var 0)))) = _ + rw [shift_shift_comm0 e₁ k 1, shift_shift_comm0 e₂ k 1, substDec_shift, substDec_shift, hv] + +theorem den_lam {M B : Term} (h : Den M B) : + Den (.lam M) (.lam (.app (shift 2 0 (.lam B)) (consP (.var 0) (.var 1)))) := by + intro d k env R σ hfree hagree + rw [absV_subst, shift_envList] + show Betas (.lam (.app (.lam (shift (k + 1) 1 B)) + (envList (.var 0 :: env.map (shift 1 0)) (shift 1 0 R)))) (.lam (inst (up σ) M)) + refine betas_lam (Betas.head (Beta.beta _ _) ?_) + refine h (d + 1) (k + 1) _ (shift 1 0 R) (up σ) hfree ?_ + intro i hi + cases i with + | zero => rfl + | succ i => + have := hagree i (by omega) + simp [List.getElem?_map, this, up] + +theorem den_app {M₁ M₂ B₁ B₂ : Term} (h₁ : Den M₁ B₁) (h₂ : Den M₂ B₂) : + Den (.app M₁ M₂) + (.app (.app (shift 1 0 (.lam B₁)) (.var 0)) (.app (shift 1 0 (.lam B₂)) (.var 0))) := by + intro d k env R σ hfree hagree + rw [appV_subst] + show Betas (.app (.app (.lam (shift k 1 B₁)) (envList env R)) + (.app (.lam (shift k 1 B₂)) (envList env R))) (.app (inst σ M₁) (inst σ M₂)) + exact betas_app (Betas.head (Beta.beta _ _) (h₁ d k env R σ hfree.1 hagree)) + (Betas.head (Beta.beta _ _) (h₂ d k env R σ hfree.2 hagree)) + +-- --------------------------------------------------------------------------- +-- §7. The parser theorem. + +/-- The open parser theorem: for every term `M` (closed or not) and +every tail `R`, one closure `λ.B` and one residual `U` such that `B` +denotes `M` under β, `λ.B` implements `M` under head reduction, `U` +spine-reduces to `R`, and, for EVERY continuation `K`, the stream +applied to the handler spine-reduces to `K (λ.B) U`. -/ +theorem parse : ∀ (M R : Term), ∃ B U, + Den M B ∧ Implements (.lam B) M ∧ SpineReds U R ∧ + ∀ K, SpineReds (.app (streamOf (blcCode M) R) (hnd K)) (.app (.app K (.lam B)) U) := by + intro M + induction M with + | var i => + intro R + rw [code_var, streamOf_cons] + have himpl : Implements (streamOf (vbits i) R) (.var i) := by + intro env R' h + exact headReduces_of_spineReds (engine i env R' R _ (List.getElem?_eq_getElem h)) + cases i with + | zero => + exact ⟨_, _, den_var0 R, himpl, skip 0 R, fun K => spine_var K (streamOf (vbits 0) R)⟩ + | succ j => + rw [stream_vbits_succ] at himpl ⊢ + have hs := skip (j + 1) R + rw [stream_vbits_succ] at hs + have hv : ∀ K, SpineReds (.app (pairT churchFalse + (pairT churchFalse (streamOf (vbits j) R))) (hnd K)) _ := fun K => by + have h := spine_var K (streamOf (vbits (j + 1)) R) + rw [stream_vbits_succ] at h + exact h + exact ⟨_, _, den_varS j R, himpl, hs, hv⟩ + | lam M ih => + intro R + obtain ⟨B, U, hD, hI, hU, hK⟩ := ih R + refine ⟨_, U, den_lam hD, ?_, hU, fun K => ?_⟩ + · refine ⟨.lam B, hI, fun ρ a => ?_⟩ + exact headReduces_of_spineReds (spine_absImpl (.lam B) ρ a) + · show SpineReds (.app (pairT churchTrue (pairT churchTrue (streamOf (blcCode M) R))) (hnd K)) _ + refine spineReds_trans (spine_lam K _) ?_ + refine spineReds_trans (spine_unfold (kA K) _) ?_ + exact spineReds_trans (hK (kA K)) (ret_lam K (.lam B) U) + | app M N ihM ihN => + intro R + obtain ⟨B₁, U₁, hD₁, hI₁, hU₁, hK₁⟩ := ihM (streamOf (blcCode N) R) + obtain ⟨B₂, U₂, hD₂, hI₂, hU₂, hK₂⟩ := ihN R + refine ⟨_, U₂, den_app hD₁ hD₂, ?_, hU₂, fun K => ?_⟩ + · refine ⟨.lam B₁, .lam B₂, hI₁, hI₂, fun ρ => ?_⟩ + exact headReduces_of_spineReds (spine_appImpl (.lam B₁) (.lam B₂) ρ) + · show SpineReds (.app + (pairT churchTrue (pairT churchFalse (streamOf (blcCode M ++ blcCode N) R))) (hnd K)) _ + rw [streamOf_append] + refine spineReds_trans (spine_app K _) ?_ + refine spineReds_trans (spine_unfold (kB K) _) ?_ + refine spineReds_trans (hK₁ (kB K)) ?_ + refine spineReds_trans (ret_app1 K (.lam B₁) U₁) ?_ + refine spineReds_trans (spine_unfold (kC K (.lam B₁)) U₁) ?_ + refine spineReds_trans (spineReds_appL _ hU₁) ?_ + exact spineReds_trans (hK₂ (kC K (.lam B₁))) (ret_app2 K (.lam B₁) (.lam B₂) U₂) + +/-- The whole configuration: `intL C (⌜M⌝ ++ R)` spine-reduces to +`C (λ.B) U`. -/ +theorem intL_parse (M R : Term) : ∃ B U, + Den M B ∧ Implements (.lam B) M ∧ SpineReds U R ∧ + ∀ C, SpineReds (.app (.app intL C) (streamOf (blcCode M) R)) (.app (.app C (.lam B)) U) := by + obtain ⟨B, U, hD, hI, hU, hK⟩ := parse M R + refine ⟨B, U, hD, hI, hU, fun C => ?_⟩ + refine spineReds_trans + (spineReds_appL _ (spineReds_appL _ (spineReds_of_spineSteps _ run_knot))) ?_ + exact spineReds_trans (spine_unfold C _) (hK C) + +-- --------------------------------------------------------------------------- +-- §8. The contract, and the obligations of Blc/Selfint.lean. + +/-- **The self-interpreter contract.** For every closed `M` and any +terms `C`, `N`: `intL C (⌜M⌝ ++ N) →β* C (λz. M) N`. -/ +theorem selfint_contract (M : Term) (hM : Closed M) (C N : Term) : + Betas (.app (.app intL C) (streamOf (blcCode M) N)) (.app (.app C (.lam M)) N) := by + obtain ⟨B, U, hD, _, hU, hK⟩ := intL_parse M N + have hB : Betas B M := by + have h := hD 0 1 [] (.var 0) Term.var hM (fun i hi => absurd hi (Nat.not_lt_zero i)) + have e : substDec 0 (envList [] (.var 0)) (shift 1 1 B) = B := substDec_var_shift B 0 + rw [e, inst_id M Term.var (fun _ => rfl)] at h + exact h + exact betas_trans (betas_of_spineReds (hK C)) + (betas_app (betas_appR C (betas_lam hB)) (betas_of_spineReds hU)) + +/-- The contract on quoted programs, `⌜M⌝ = stream(M, FALSE)`. -/ +theorem selfint_quote (M : Term) (hM : Closed M) (C : Term) : + Betas (.app (.app intL C) (quote M)) (.app (.app C (.lam M)) falseT) := + selfint_contract M hM C falseT + +/-- The 174-bit `E_q = intL I` runs quoted programs: `E_q ⌜p⌝ →β* p` +for every closed `p`. -/ +theorem intLI_quote (p : Term) (hp : Closed p) : Betas (.app intLI (quote p)) p := by + have h := selfint_quote p hp (.lam (.var 0)) + have e1 : contract (.var 0) (.lam p) = .lam p := rfl + have e2 : contract p falseT = p := substDec_closed 0 falseT hp + have s1 := Beta.appL falseT (Beta.beta (.var 0) (.lam p)) + have s2 := Beta.beta p falseT + rw [e1] at s1 + rw [e2] at s2 + exact betas_trans h (Betas.head s1 (Betas.head s2 (Betas.refl _))) + +/-- `ParserStatement` of `Blc/Selfint.lean`: every finite term's wire +parses, under head reduction, uniformly in the continuation. -/ +theorem parserStatement : ParserStatement := by + intro M R + obtain ⟨B, U, _, hI, hU, hK⟩ := intL_parse M R + exact ⟨.lam B, U, hI, headReduces_of_spineReds hU, fun C => headReduces_of_spineReds (hK C)⟩ + +/-- `L1Statement` of `Blc/Selfint.lean` (parser correctness, closed +programs). -/ +theorem l1Statement : L1Statement := fun M _ R => parserStatement M R + +/-- `L2Statement` of `Blc/Selfint.lean` (the VAR engine as a parse). -/ +theorem l2Statement : L2Statement := fun i R => parserStatement (.var i) R + +/-- L1 in the form of `docs/quantum/bisimulation.md` §2, with the residual +reduced in argument position: `intL C stream(M,R) →β* C Q R` for an +implementing closure `Q ⊨ P[M]`, every term `M`, every tail `R`. -/ +theorem l1_beta (M R C : Term) : ∃ Q, Implements Q M ∧ + Betas (.app (.app intL C) (streamOf (blcCode M) R)) (.app (.app C Q) R) := by + obtain ⟨B, U, _, hI, hU, hK⟩ := intL_parse M R + exact ⟨.lam B, hI, betas_trans (betas_of_spineReds (hK C)) (betas_appR _ (betas_of_spineReds hU))⟩ + +/-- The contract for open programs: `intL C (⌜M⌝ ++ N) →β* C Q U` with +`U →β* N`, where `Q` applied to any cons' environment covering M's free +variables reduces to M instantiated by that environment. -/ +theorem selfint_open (M : Term) (d : Nat) (hM : FreeUnder d M) (C N : Term) : + ∃ Q U, Betas (.app (.app intL C) (streamOf (blcCode M) N)) (.app (.app C Q) U) ∧ + Betas U N ∧ + ∀ (env : List Term) (R : Term) (σ : Nat → Term), + (∀ i, i < d → env[i]? = some (σ i)) → + Betas (.app Q (envList env R)) (inst σ M) := by + obtain ⟨B, U, hD, _, hU, hK⟩ := intL_parse M N + refine ⟨.lam B, U, betas_of_spineReds (hK C), betas_of_spineReds hU, ?_⟩ + intro env R σ hagree + have h := hD d 0 env R σ hM hagree + rw [shift_zero] at h + exact Betas.head (Beta.beta _ _) h + +-- --------------------------------------------------------------------------- +-- §9. The contract as a predicate, and the size question it poses. + +/-- β-convertibility, as joinability (equivalent by Church–Rosser, +`betas_confluent`). -/ +def BetaJoin (t u : Term) : Prop := ∃ w, Betas t w ∧ Betas u w + +/-- The self-interpreter contract of +`docs/classical/self-interpreter/interpreter.md` §1: a closed `E` with +`E C (⌜M⌝ ++ N) =β C (λz. M) N` for every closed `M`, where `C` and `N` +are rigid free variables (here `var 0`, `var 1`; any terms follow by +substitution). This is the weakest form the battery tests. -/ +def IsSelfInterpreter (E : Term) : Prop := + Closed E ∧ ∀ M : Term, Closed M → + BetaJoin (.app (.app E (.var 0)) (streamOf (blcCode M) (.var 1))) + (.app (.app (.var 0) (.lam M)) (.var 1)) + +/-- Palmer's 168 meets the contract. -/ +theorem isSelfInterpreter_intL : IsSelfInterpreter intL := + ⟨by decide, fun M hM => + ⟨_, selfint_contract M hM (.var 0) (.var 1), Betas.refl _⟩⟩ + +theorem intL_length : (blcCode intL).length = 168 := by + rw [wire_intL]; exact intL_size + +/-- `SelfintSizeBound n`: every self-interpreter has at least `n` bits. +Optimality of Palmer's interpreter is `SelfintSizeBound 168` (open); +the bound cannot go higher. -/ +def SelfintSizeBound (n : Nat) : Prop := + ∀ E : Term, IsSelfInterpreter E → n ≤ (blcCode E).length + +/-- The upper-bound half of optimality: no bound above 168 holds. -/ +theorem not_selfintSizeBound_169 : ¬ SelfintSizeBound 169 := by + intro h + have := h intL isSelfInterpreter_intL + rw [intL_length] at this + omega + +end Blc diff --git a/lean/README.md b/lean/README.md index cf032cfc..fa7a5e61 100644 --- a/lean/README.md +++ b/lean/README.md @@ -14,10 +14,15 @@ theorem RatchetCert.noNormalForm : theorem argKill : headSteps k t = some s → headStep s = none → hnfArgB a s = true → ¬ HasNormalForm a → ¬ HasNormalForm t -- propext, Quot.sound +theorem selfint_contract : Closed M → + Betas (intL C (streamOf (blcCode M) N)) (C (λ M) N) -- propext, Quot.sound +theorem parserStatement : ParserStatement -- propext, Quot.sound ``` The 32-bit term that the reference busy-beaver ledger excludes by hand has no -normal form under arbitrary β-reduction. The **general bridge** holds for +normal form under arbitrary β-reduction. Palmer's 168-bit `intL` (pinned to its +wire by `wire_intL`) is a self-interpreter: for every closed `M` and any terms +`C`, `N`, `intL C (⌜M⌝ ++ N)` β-reduces to `C (λz. M) N`. The **general bridge** holds for every term, so any head-divergence certificate concludes no-normal-form with no side conditions. The **class assemblies** turn certificate *data* into that conclusion mechanically, and the **rigid-head argument bridge** lifts a spine @@ -156,8 +161,23 @@ qBLC self-interpretation: - `Blc/Selfint.lean` — the pure fragment of `docs/quantum/bisimulation.md`: proves `intL`'s wire identity, `|E_q| = |intL I| = 174`, and the quote-size identity `|stream(M,R)| = 14·|M| + zeros(M) + |R|`; states the translation - contract `Implements` and the parser obligations as named `Prop`s, which - remain open. + contract `Implements` and the parser obligations (`ParserStatement`, L1, L2) + as named `Prop`s. +- `Blc/SelfintProof.lean` — proves them, and the classical contract. + `parse` is one induction on the source term (open or closed): the stream + applied to the parser's handler spine-reduces (head reduction through + application states only) to `K (λ.B) U` for every continuation `K`, where + `λ.B` denotes `M` under β (`Den`: any cons' environment, under any number of + binders, yields `M` instantiated) and implements it under head reduction + (`Implements`), and the residual `U` reduces to the tail. The VAR engine is + induction on the unary selector (`engine`), skipvar is `l l l → rest` + (`skip`), and sixteen machine runs of the 168's control are kernel replays + of head-step chains on placeholder terms, instantiated because head steps + are stable under substitution. Corollaries: `selfint_contract` (β-reduction + for closed `M`, any `C`, `N`), `selfint_open`, `l1_beta`, `parserStatement`, + `l1Statement`, `l2Statement`, and `isSelfInterpreter_intL` with + `not_selfintSizeBound_169` (the upper-bound half of optimality; the lower + bound `SelfintSizeBound 168` is stated, open). Generated: From f5c63154c63c9329eb48ca1b3713d54feffc05f7 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 00:15:18 -0400 Subject: [PATCH 02/41] Prove in Lean that the 165-bit interpreter is a self-interpreter Selfint.lean pins intL165 to its 165-bit wire (wire_intL165, intL165_size); intL, and with it qBLC's E_q, is unchanged. SelfintProof.lean factors its corollaries through Parses E, the parse's conclusion for an arbitrary interpreter: contract_of_parses, l1_beta_of_parses, open_of_parses and isSelfInterpreter_of_parses. The 168 theorems keep their statements and now derive through them. Selfint165.lean proves Parses intL165. The 165 differs from the 168 only in its reader, s H (s s s) with H = \bit0. bit0 (\unused \r. r next) cont: the third argument reaches the stream past the first 0 (pastZero), and VAR returns it as the residual. parse165 therefore quantifies over every third argument that spine-reduces there, and pastZero_self covers APP's second parse, where it is U1 U1 U1 for an unreduced residual. Closures, the VAR engine, skip_self and every run that does not name the parser are shared; eight runs are new. Corollaries: selfint_contract165, selfint_open165, parserStatement165, isSelfInterpreter_intL165 and not_selfintSizeBound_166. Axioms are propext and Quot.sound. --- lean/Blc.lean | 1 + lean/Blc/Selfint.lean | 18 +- lean/Blc/Selfint165.lean | 387 +++++++++++++++++++++++++++++++++++++ lean/Blc/SelfintProof.lean | 83 ++++++-- lean/README.md | 36 +++- 5 files changed, 497 insertions(+), 28 deletions(-) create mode 100644 lean/Blc/Selfint165.lean diff --git a/lean/Blc.lean b/lean/Blc.lean index 5e7fd603..c9f7e712 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -15,3 +15,4 @@ import Blc.NormalOrder import Blc.Wire import Blc.Selfint import Blc.SelfintProof +import Blc.Selfint165 diff --git a/lean/Blc/Selfint.lean b/lean/Blc/Selfint.lean index 893594af..2f44385b 100644 --- a/lean/Blc/Selfint.lean +++ b/lean/Blc/Selfint.lean @@ -6,7 +6,9 @@ this layer). PROVED here, zero sorries: the artifact pins — intL's wire identity (`wire_intL`, the kernel vouches the constant IS Palmer's 168-bit -interpreter) and |E_q| = |intL I| = 174 — and the quote-size identity +interpreter), |E_q| = |intL I| = 174, and the same pin for the 165-bit +interpreter `intL165` (`wire_intL165`; its self-interpreter proof is +`Blc/Selfint165.lean`, and qBLC stays on `intL`) — and the quote-size identity |stream(M,R)| = 14·|M| + zeros(M) + |R| (`streamOf_length`): the measured quote linearity, now kernel-checked. @@ -90,6 +92,15 @@ def intL : Term := .app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.lam (.lam def intLWire : List Bool := [false, true, false, false, false, true, true, false, true, false, false, false, false, true, false, false, false, false, false, true, false, false, false, false, false, true, true, false, false, false, false, false, false, true, false, true, true, true, false, false, true, true, false, true, true, true, true, false, false, true, false, true, true, true, true, true, true, false, true, false, false, true, false, true, true, false, true, false, true, false, false, false, false, true, true, true, true, false, false, false, false, true, false, true, true, true, false, false, true, true, true, true, false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, false, true, false, true, true, true, false, true, true, true, false, false, true, true, false, true, true, true, true, false, false, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, false, true, true, true, true, false, true, false, false, true, true, true, false, true, false, false, true, true, false, true, false] +/-- The 165-bit self-interpreter: Palmer's 168 with a shorter reader +(`\list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)` +in place of `\list. list (\bit0 \list1. bit0 (list1 next) (cont list1 +(list1 list1 list1)))`), 0-indexed de Bruijn. `wire_intL165` pins it to its +wire; `Blc/Selfint165.lean` proves it a self-interpreter. -/ +def intL165 : Term := .app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.lam (.lam (.app (.lam (.lam (.app (.app (.var 0) (.lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (.var 4))))) (.var 3)))) (.app (.app (.var 0) (.var 0)) (.var 0))))) (.lam (.app (.var 2) (.lam (.app (.app (.var 1) (.app (.var 2) (.lam (.lam (.app (.var 2) (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 3)))))))))) (.app (.var 3) (.lam (.app (.var 3) (.lam (.app (.app (.var 2) (.var 0)) (.app (.var 1) (.var 0)))))))))))))) (.app (.var 0) (.var 0)))) + +def intL165Wire : List Bool := [false, true, false, false, false, true, true, false, true, false, false, false, false, true, false, false, false, false, false, true, false, false, false, false, false, true, false, true, true, false, false, false, false, true, false, true, true, false, false, false, false, false, false, true, true, false, true, true, true, true, true, false, true, true, true, true, false, false, true, false, true, true, false, true, false, true, false, false, false, false, true, true, true, true, false, false, false, false, true, false, true, true, true, false, false, true, true, true, true, false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, false, true, false, true, true, true, false, true, true, true, false, false, true, true, false, true, true, true, true, false, false, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, false, true, true, true, true, false, true, false, false, true, true, true, false, true, false, false, true, true, false, true, false] + /-- `E_q = intL I`: the measured 174-bit qBLC self-interpreter. -/ def intLI : Term := .app intL (.lam (.var 0)) @@ -106,6 +117,11 @@ theorem intL_size : intLWire.length = 168 := by decide /-- |E_q| = 174 — the self-interpretation constant, kernel-checked. -/ theorem intLI_size : (blcCode intLI).length = 174 := by decide +/-- The 165's transcription, vouched for by the kernel. -/ +theorem wire_intL165 : blcCode intL165 = intL165Wire := by decide + +theorem intL165_size : intL165Wire.length = 165 := by decide + -- --------------------------------------------------------------------------- -- Closedness plumbing for the size identity. diff --git a/lean/Blc/Selfint165.lean b/lean/Blc/Selfint165.lean new file mode 100644 index 00000000..d0026658 --- /dev/null +++ b/lean/Blc/Selfint165.lean @@ -0,0 +1,387 @@ +/- +The 165-bit interpreter `intL165` (`Blc/Selfint.lean`, pinned to its +wire by `wire_intL165`) IS a self-interpreter: `selfint_contract165`, +for every closed M and any terms C, N, + + intL165 C (⌜M⌝ ++ N) →β* C (λz. M) N, + +with `isSelfInterpreter_intL165` and `not_selfintSizeBound_166`. The +proof establishes `Parses intL165` (`Blc/SelfintProof.lean`), from which +every corollary follows exactly as for Palmer's 168. + +The 165 is the 168 with a different reader. Where the 168 applies the +stream `s` to `\bit0 \list1. bit0 (list1 next) (cont list1 (list1 list1 +list1))`, the 165 runs `s H (s s s)` with `H = \bit0. bit0 (\unused \r. +r next) cont`. With `s = cons b r`, the third argument `S = s s s` is +the stream past the first `0`: + +* `b = 0`: `s s → K r`, so `S → r`, and `s H S → S next → r next`, the + 168's zero branch; +* `b = 1` (a variable, `r = 1^i 0 ++ N`): `s s → r r → K N` (`skip_self`), + so `S → N`, and `s H S → cont r S` — the 168's VAR value `r`, with + residual `S` in place of the 168's `r r r`. + +Because the residual is reduced in place only when the parser recurses +on it (APP's second parse), `S` there is `U₁ U₁ U₁` for an unreduced +`U₁`. So `parse165` quantifies over every argument `S` that +spine-reduces to the stream past the first `0` (`pastZero`), and +`pastZero_self` shows `U U U` qualifies whenever `U` spine-reduces to +the stream. The closures — VAR's stream cell, ABS's and APP's values — +are the 168's, so `Den` and `Implements` reuse its lemmas, as do the +NEXT/ABS/APP/cell machine runs that do not name the parser. New here +are the parts that do: the knot, unfold, the reader (`run_var165`, +`run_zero165`), the zero branch's `next` (`run_lam165`, `run_app165`), +and the two continuations that call the parser again. + +No `sorry`; the axioms are `propext` and `Quot.sound`. +-/ + +import Blc.SelfintProof + +namespace Blc +open Term + +-- --------------------------------------------------------------------------- +-- §1. The 165, named by its parts. + +/-- The 165's reader `\bit0. bit0 (\unused \r. r next) cont`, under +`\intL \cont \next \list`. -/ +def handler165 : Term := + .lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (.var 4))))) (.var 3)) + +/-- `\intL \cont. (\next \list. list H (list list list)) NEXT`; NEXT is +the 168's `nextT`. -/ +def bodyT165 : Term := + .lam (.lam (.app (.lam (.lam (.app (.app (.var 0) handler165) + (.app (.app (.var 0) (.var 0)) (.var 0))))) nextT)) + +/-- The knot's generator `\x. body (x x)`. -/ +def knotW165 : Term := .lam (.app bodyT165 (.app (.var 0) (.var 0))) + +/-- The parser: `intL165`'s first head reduct, and the value of every +recursive call. -/ +def parser165 : Term := .app knotW165 knotW165 + +theorem intL165_eq : intL165 = .app (.lam (.app (.var 0) (.var 0))) knotW165 := by decide + +theorem parser165_closed : Closed parser165 := by decide + +theorem shift_parser165 (d c : Nat) : shift d c parser165 = parser165 := + shift_closed d c parser165_closed + +theorem substDec_parser165 (j : Nat) (s : Term) : substDec j s parser165 = parser165 := + substDec_closed j s parser165_closed + +/-- The zero branch's `next`, with `cont` free at index `c` and `intL` +resolved to the parser. -/ +def next165 (c : Nat) : Term := + .lam (.app parser165 (.lam (.app (.app (.var 1) (.app (.var (c + 2)) absVt)) + (.app parser165 (.lam (.app (.var (c + 3)) appVt)))))) + +/-- The reader the parser applies the stream to, `cont` free at 0. -/ +def hndc165 : Term := + .lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (next165 3))))) (.var 1)) + +/-- The first parse's continuation, with `cont` free at index 0 and the +second tag bit `b` substituted (the 168's `kont`, calling this parser). -/ +def kont165 (b : Term) : Term := + .lam (.app (.app b (.app (.var 1) absVt)) (.app parser165 (.lam (.app (.var 2) appVt)))) + +theorem substDec_hndc165 (j : Nat) (s : Term) (h : 1 ≤ j) : substDec j s hndc165 = hndc165 := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +theorem substDec_next165 (j : Nat) (s : Term) (h : 1 ≤ j) : + substDec j s (next165 0) = next165 0 := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +theorem substDec_kont165T (j : Nat) (s : Term) (h : 1 ≤ j) : + substDec j s (kont165 churchTrue) = kont165 churchTrue := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +theorem substDec_kont165F (j : Nat) (s : Term) (h : 1 ≤ j) : + substDec j s (kont165 churchFalse) = kont165 churchFalse := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +/-- The reader, closed over `cont = K`. -/ +def hnd165 (K : Term) : Term := substDec 0 K hndc165 + +/-- The zero branch's `next`, closed over `cont = K`. -/ +def nxt165 (K : Term) : Term := substDec 0 K (next165 0) + +/-- ABS's continuation, closed over `cont = K`. -/ +def kA165 (K : Term) : Term := substDec 0 K (kont165 churchTrue) + +/-- APP's first continuation, closed over `cont = K`. -/ +def kB165 (K : Term) : Term := substDec 0 K (kont165 churchFalse) + +-- --------------------------------------------------------------------------- +-- §2. The machine runs, replayed by the kernel on placeholder terms. + +/-- The knot: `intL165` head-steps to the parser. -/ +theorem run_knot165 : spineSteps 1 intL165 = some parser165 := by decide + +/-- The parser unfolds and runs the stream on the reader and `s s s`. -/ +theorem run_unfold165 : + spineSteps 5 (.app (.app parser165 (.var 0)) (.var 1)) + = some (.app (.app (.var 1) hndc165) (.app (.app (.var 1) (.var 1)) (.var 1))) := by + decide + +/-- Tag `1`: VAR returns `cont list S`. -/ +theorem run_var165 : + spineSteps 4 (.app (.app (pairT churchFalse (.var 1)) hndc165) (.var 2)) + = some (.app (.app (.var 0) (.var 1)) (.var 2)) := by + decide + +/-- Tag `0`: the reader hands `next` to `S`. -/ +theorem run_zero165 : + spineSteps 6 (.app (.app (pairT churchTrue (.var 1)) hndc165) (.var 2)) + = some (.app (.var 2) (next165 0)) := by + decide + +/-- Tags `00`: ABS parses its body under the ABS continuation. -/ +theorem run_lam165 : + spineSteps 2 (.app (pairT churchTrue (.var 1)) (next165 0)) + = some (.app (.app parser165 (kont165 churchTrue)) (.var 1)) := by + decide + +/-- Tags `01`: APP parses its function under the APP continuation. -/ +theorem run_app165 : + spineSteps 2 (.app (pairT churchFalse (.var 1)) (next165 0)) + = some (.app (.app parser165 (kont165 churchFalse)) (.var 1)) := by + decide + +/-- ABS returns its value. -/ +theorem run_retLam165 : + spineSteps 3 (.app (.app (kont165 churchTrue) (.var 1)) (.var 2)) + = some (.app (.app (.var 0) absVc) (.var 2)) := by + decide + +/-- APP's first parse continues into the second. -/ +theorem run_retApp1_165 : + spineSteps 3 (.app (.app (kont165 churchFalse) (.var 1)) (.var 2)) + = some (.app (.app parser165 kont2) (.var 2)) := by + decide + +-- --------------------------------------------------------------------------- +-- §3. The runs, lifted to arbitrary continuations, tails and closures. + +theorem spine_unfold165 (K s : Term) : + SpineReds (.app (.app parser165 K) s) (.app (.app s (hnd165 K)) (.app (.app s s) s)) := by + have h := spineReds_instN [K, s] 0 (spineReds_of_spineSteps _ run_unfold165) + simpa [instN, hnd165, substDec, shift, substDec_parser165, substDec_hndc165, substDec_shift0, + shift_zero] using h + +/-- Tag `1`: `(1:r) (hnd K) S → K r S`. -/ +theorem spine_var165 (K r S : Term) : + SpineReds (.app (.app (pairT churchFalse r) (hnd165 K)) S) (.app (.app K r) S) := by + have h := spineReds_instN [K, r, S] 0 (spineReds_of_spineSteps _ run_var165) + simpa [instN, hnd165, pairT, substDec, shift, shift_churchFalse, substDec_churchFalse, + substDec_hndc165, shift_shift0, substDec_shift0, shift_zero] using h + +/-- Tag `0`: `(0:r) (hnd K) S → S (next K)`. -/ +theorem spine_zero165 (K r S : Term) : + SpineReds (.app (.app (pairT churchTrue r) (hnd165 K)) S) (.app S (nxt165 K)) := by + have h := spineReds_instN [K, r, S] 0 (spineReds_of_spineSteps _ run_zero165) + simpa [instN, hnd165, nxt165, pairT, substDec, shift, shift_churchTrue, substDec_churchTrue, + substDec_hndc165, substDec_next165, shift_shift0, substDec_shift0, shift_zero] using h + +/-- Tags `00`: `(0:r) (next K) → P (kA K) r`. -/ +theorem spine_lam165 (K r : Term) : + SpineReds (.app (pairT churchTrue r) (nxt165 K)) (.app (.app parser165 (kA165 K)) r) := by + have h := spineReds_instN [K, r] 0 (spineReds_of_spineSteps _ run_lam165) + simpa [instN, nxt165, kA165, pairT, substDec, shift, shift_parser165, substDec_parser165, + shift_churchTrue, substDec_churchTrue, substDec_next165, substDec_kont165T, shift_shift0, + substDec_shift0, shift_zero] using h + +/-- Tags `01`: `(1:r) (next K) → P (kB K) r`. -/ +theorem spine_app165 (K r : Term) : + SpineReds (.app (pairT churchFalse r) (nxt165 K)) (.app (.app parser165 (kB165 K)) r) := by + have h := spineReds_instN [K, r] 0 (spineReds_of_spineSteps _ run_app165) + simpa [instN, nxt165, kB165, pairT, substDec, shift, shift_parser165, substDec_parser165, + shift_churchFalse, substDec_churchFalse, substDec_next165, substDec_kont165F, shift_shift0, + substDec_shift0, shift_zero] using h + +theorem ret_lam165 (K e u : Term) : + SpineReds (.app (.app (kA165 K) e) u) (.app (.app K (absV e)) u) := by + have h := spineReds_instN [K, e, u] 0 (spineReds_of_spineSteps _ run_retLam165) + simpa [instN, kA165, absV, absVc, consP, substDec, shift, substDec_kont165T, + shift_shift0, substDec_shift0, shift_zero] using h + +theorem ret_app1_165 (K e u : Term) : + SpineReds (.app (.app (kB165 K) e) u) (.app (.app parser165 (kC K e)) u) := by + have h := spineReds_instN [K, e, u] 0 (spineReds_of_spineSteps _ run_retApp1_165) + simpa [instN, kB165, kC, substDec, shift, substDec_parser165, substDec_kont165F, substDec_kont2, + shift_shift0, substDec_shift0, shift_zero] using h + +-- --------------------------------------------------------------------------- +-- §4. The third argument: `s s s` is the stream past the first `0`. + +/-- The stream past the first `0` of M's code: the tail itself after a +variable `1^(i+1) 0`, the code's own tail after a `0` tag. -/ +def pastZero : Term → Term → Term + | .var _, R => R + | .lam M, R => streamOf (false :: blcCode M) R + | .app M N, R => streamOf (true :: (blcCode M ++ blcCode N)) R + +/-- A stream opening with `0`, self-applied twice, is its tail: `s s → K t`. -/ +theorem self_true {U t : Term} (h : SpineReds U (pairT churchTrue t)) : + SpineReds (.app (.app U U) U) t := by + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ h)) ?_ + refine spineReds_trans (spineReds_appL _ (spine_pairT _ _ _)) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ (spineReds_appL _ h))) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ (spine_pairT _ _ _))) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ (spine_true2 _ _))) ?_ + exact spine_true2 _ _ + +/-- A variable stream `1 1^i 0 ++ R`, self-applied twice, is `R`: +`s s → r r → K R`. -/ +theorem self_false (i : Nat) {U R : Term} + (h : SpineReds U (pairT churchFalse (streamOf (vbits i) R))) : + SpineReds (.app (.app U U) U) R := by + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ h)) ?_ + refine spineReds_trans (spineReds_appL _ (spine_pairT _ _ _)) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ (spineReds_appL _ h))) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ (spine_pairT _ _ _))) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ (spine_false2 _ _))) ?_ + refine spineReds_trans (spineReds_appL _ (skip_self i R)) ?_ + have hb := spine_beta (shift 1 0 R) U + have e : contract (shift 1 0 R) U = R := substDec_shift R _ 0 + rw [e] at hb + exact hb + +/-- Anything that spine-reduces to M's stream, self-applied twice, +spine-reduces to the stream past its first `0`. -/ +theorem pastZero_self (M R U : Term) (h : SpineReds U (streamOf (blcCode M) R)) : + SpineReds (.app (.app U U) U) (pastZero M R) := by + cases M with + | var i => + rw [code_var, streamOf_cons] at h + exact self_false i h + | lam M => exact self_true h + | app M N => exact self_true h + +-- --------------------------------------------------------------------------- +-- §5. The parser theorem. + +/-- The open parser theorem for the 165: for every term `M` and tail +`R`, one closure `λ.B` denoting and implementing `M`, and for every +third argument `S` that reaches the stream past the first `0`, one +residual `U` spine-reducing to `R` such that, for EVERY continuation +`K`, the stream run on the reader and `S` spine-reduces to `K (λ.B) U`. -/ +theorem parse165 : ∀ (M R : Term), ∃ B, Den M B ∧ Implements (.lam B) M ∧ + ∀ S, SpineReds S (pastZero M R) → ∃ U, SpineReds U R ∧ + ∀ K, SpineReds (.app (.app (streamOf (blcCode M) R) (hnd165 K)) S) + (.app (.app K (.lam B)) U) := by + intro M + induction M with + | var i => + intro R + rw [code_var, streamOf_cons] + have himpl : Implements (streamOf (vbits i) R) (.var i) := by + intro env R' h + exact headReduces_of_spineReds (engine i env R' R _ (List.getElem?_eq_getElem h)) + cases i with + | zero => + exact ⟨_, den_var0 R, himpl, fun S hS => + ⟨S, hS, fun K => spine_var165 K (streamOf (vbits 0) R) S⟩⟩ + | succ j => + rw [stream_vbits_succ] at himpl ⊢ + exact ⟨_, den_varS j R, himpl, fun S hS => + ⟨S, hS, fun K => spine_var165 K _ S⟩⟩ + | lam M ih => + intro R + obtain ⟨B, hD, hI, hP⟩ := ih R + refine ⟨_, den_lam hD, ⟨.lam B, hI, fun ρ a => + headReduces_of_spineReds (spine_absImpl (.lam B) ρ a)⟩, fun S hS => ?_⟩ + obtain ⟨U, hU, hK⟩ := hP _ (pastZero_self M R _ (SpineReds.refl _)) + refine ⟨U, hU, fun K => ?_⟩ + have hS' : SpineReds S (pairT churchTrue (streamOf (blcCode M) R)) := hS + show SpineReds (.app (.app (pairT churchTrue (pairT churchTrue (streamOf (blcCode M) R))) + (hnd165 K)) S) _ + refine spineReds_trans (spine_zero165 K _ S) ?_ + refine spineReds_trans (spineReds_appL _ hS') ?_ + refine spineReds_trans (spine_lam165 K _) ?_ + refine spineReds_trans (spine_unfold165 (kA165 K) _) ?_ + exact spineReds_trans (hK (kA165 K)) (ret_lam165 K (.lam B) U) + | app M N ihM ihN => + intro R + obtain ⟨B₁, hD₁, hI₁, hP₁⟩ := ihM (streamOf (blcCode N) R) + obtain ⟨B₂, hD₂, hI₂, hP₂⟩ := ihN R + refine ⟨_, den_app hD₁ hD₂, ⟨.lam B₁, .lam B₂, hI₁, hI₂, fun ρ => + headReduces_of_spineReds (spine_appImpl (.lam B₁) (.lam B₂) ρ)⟩, fun S hS => ?_⟩ + obtain ⟨U₁, hU₁, hK₁⟩ := hP₁ _ (pastZero_self M _ _ (SpineReds.refl _)) + obtain ⟨U₂, hU₂, hK₂⟩ := hP₂ _ (pastZero_self N R U₁ hU₁) + refine ⟨U₂, hU₂, fun K => ?_⟩ + have hS' : SpineReds S + (pairT churchFalse (streamOf (blcCode M) (streamOf (blcCode N) R))) := by + have e : pastZero (.app M N) R + = pairT churchFalse (streamOf (blcCode M) (streamOf (blcCode N) R)) := by + simp only [pastZero, streamOf_cons, streamOf_append]; rfl + rw [← e]; exact hS + show SpineReds (.app (.app + (pairT churchTrue (pairT churchFalse (streamOf (blcCode M ++ blcCode N) R))) + (hnd165 K)) S) _ + rw [streamOf_append] + refine spineReds_trans (spine_zero165 K _ S) ?_ + refine spineReds_trans (spineReds_appL _ hS') ?_ + refine spineReds_trans (spine_app165 K _) ?_ + refine spineReds_trans (spine_unfold165 (kB165 K) _) ?_ + refine spineReds_trans (hK₁ (kB165 K)) ?_ + refine spineReds_trans (ret_app1_165 K (.lam B₁) U₁) ?_ + refine spineReds_trans (spine_unfold165 (kC K (.lam B₁)) U₁) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ hU₁)) ?_ + exact spineReds_trans (hK₂ (kC K (.lam B₁))) (ret_app2 K (.lam B₁) (.lam B₂) U₂) + +/-- The whole configuration: `intL165 C (⌜M⌝ ++ R)` spine-reduces to +`C (λ.B) U` — the 165 parses. -/ +theorem intL165_parse : Parses intL165 := by + intro M R + obtain ⟨B, hD, hI, hP⟩ := parse165 M R + obtain ⟨U, hU, hK⟩ := hP _ (pastZero_self M R _ (SpineReds.refl _)) + refine ⟨B, U, hD, hI, hU, fun C => ?_⟩ + refine spineReds_trans + (spineReds_appL _ (spineReds_appL _ (spineReds_of_spineSteps _ run_knot165))) ?_ + exact spineReds_trans (spine_unfold165 C _) (hK C) + +-- --------------------------------------------------------------------------- +-- §6. The contract, and the size bound it moves. + +/-- **The self-interpreter contract for the 165.** For every closed `M` +and any terms `C`, `N`: `intL165 C (⌜M⌝ ++ N) →β* C (λz. M) N`. -/ +theorem selfint_contract165 (M : Term) (hM : Closed M) (C N : Term) : + Betas (.app (.app intL165 C) (streamOf (blcCode M) N)) (.app (.app C (.lam M)) N) := + contract_of_parses intL165_parse M hM C N + +/-- The strategy-faithful parser statement for the 165 (the shape of +`ParserStatement`, whose `ParserResult` names `intL`): under head +reduction `intL165 C (⌜M⌝ ++ R)` reaches `C Q U` with `Q ⊨ P[M]` and +`U` head-reducing to `R`, for every term `M`, uniformly in `C`. -/ +theorem parserStatement165 (M R : Term) : ∃ Q U, Implements Q M ∧ HeadReduces U R ∧ + ∀ C, HeadReduces (.app (.app intL165 C) (streamOf (blcCode M) R)) (.app (.app C Q) U) := by + obtain ⟨B, U, _, hI, hU, hK⟩ := intL165_parse M R + exact ⟨.lam B, U, hI, headReduces_of_spineReds hU, fun C => headReduces_of_spineReds (hK C)⟩ + +/-- The open-program contract for the 165. -/ +theorem selfint_open165 (M : Term) (d : Nat) (hM : FreeUnder d M) (C N : Term) : + ∃ Q U, Betas (.app (.app intL165 C) (streamOf (blcCode M) N)) (.app (.app C Q) U) ∧ + Betas U N ∧ + ∀ (env : List Term) (R : Term) (σ : Nat → Term), + (∀ i, i < d → env[i]? = some (σ i)) → + Betas (.app Q (envList env R)) (inst σ M) := + open_of_parses intL165_parse M d hM C N + +/-- The 165 meets the contract. -/ +theorem isSelfInterpreter_intL165 : IsSelfInterpreter intL165 := + isSelfInterpreter_of_parses (by decide) intL165_parse + +theorem intL165_length : (blcCode intL165).length = 165 := by + rw [wire_intL165]; exact intL165_size + +/-- No bound above 165 holds: optimality is `SelfintSizeBound 165`. -/ +theorem not_selfintSizeBound_166 : ¬ SelfintSizeBound 166 := by + intro h + have := h intL165 isSelfInterpreter_intL165 + rw [intL165_length] at this + omega + +end Blc diff --git a/lean/Blc/SelfintProof.lean b/lean/Blc/SelfintProof.lean index e06a08d5..9e4d5ef6 100644 --- a/lean/Blc/SelfintProof.lean +++ b/lean/Blc/SelfintProof.lean @@ -37,6 +37,13 @@ chains on terms whose free variables stand for the continuation, the stream tail and the parsed closures, lifted to arbitrary terms because head steps are stable under substitution (`spineReds_instN`). +The corollaries run through `Parses E` (end of §7), the parse's +conclusion stated for an arbitrary interpreter `E`: `contract_of_parses`, +`l1_beta_of_parses`, `open_of_parses`, and `isSelfInterpreter_of_parses` +need nothing else. `Blc/Selfint165.lean` proves `Parses intL165` for the +165-bit interpreter on top of §0–§6 and the runs here that do not name +the parser. + No `sorry`; the axioms are `propext` and `Quot.sound`. -/ @@ -904,14 +911,26 @@ theorem intL_parse (M R : Term) : ∃ B U, (spineReds_appL _ (spineReds_appL _ (spineReds_of_spineSteps _ run_knot))) ?_ exact spineReds_trans (spine_unfold C _) (hK C) +/-- `Parses E`: what `intL_parse` provides, for any interpreter `E` — +for every term `M` and tail `R`, one closure `λ.B` that denotes and +implements `M`, one residual `U` spine-reducing to `R`, and, for every +continuation `C`, `E C (⌜M⌝ ++ R)` spine-reducing to `C (λ.B) U`. The +corollaries below (`*_of_parses`) need nothing else, so they serve the +165-bit interpreter of `Blc/Selfint165.lean` as well. -/ +def Parses (E : Term) : Prop := + ∀ M R : Term, ∃ B U, Den M B ∧ Implements (.lam B) M ∧ SpineReds U R ∧ + ∀ C, SpineReds (.app (.app E C) (streamOf (blcCode M) R)) (.app (.app C (.lam B)) U) + +theorem parses_intL : Parses intL := intL_parse + -- --------------------------------------------------------------------------- -- §8. The contract, and the obligations of Blc/Selfint.lean. -/-- **The self-interpreter contract.** For every closed `M` and any -terms `C`, `N`: `intL C (⌜M⌝ ++ N) →β* C (λz. M) N`. -/ -theorem selfint_contract (M : Term) (hM : Closed M) (C N : Term) : - Betas (.app (.app intL C) (streamOf (blcCode M) N)) (.app (.app C (.lam M)) N) := by - obtain ⟨B, U, hD, _, hU, hK⟩ := intL_parse M N +/-- The contract from a parse: `E C (⌜M⌝ ++ N) →β* C (λz. M) N` for every +closed `M`. -/ +theorem contract_of_parses {E : Term} (hE : Parses E) (M : Term) (hM : Closed M) (C N : Term) : + Betas (.app (.app E C) (streamOf (blcCode M) N)) (.app (.app C (.lam M)) N) := by + obtain ⟨B, U, hD, _, hU, hK⟩ := hE M N have hB : Betas B M := by have h := hD 0 1 [] (.var 0) Term.var hM (fun i hi => absurd hi (Nat.not_lt_zero i)) have e : substDec 0 (envList [] (.var 0)) (shift 1 1 B) = B := substDec_var_shift B 0 @@ -920,6 +939,33 @@ theorem selfint_contract (M : Term) (hM : Closed M) (C N : Term) : exact betas_trans (betas_of_spineReds (hK C)) (betas_app (betas_appR C (betas_lam hB)) (betas_of_spineReds hU)) +/-- L1 from a parse, the residual reduced in argument position. -/ +theorem l1_beta_of_parses {E : Term} (hE : Parses E) (M R C : Term) : ∃ Q, Implements Q M ∧ + Betas (.app (.app E C) (streamOf (blcCode M) R)) (.app (.app C Q) R) := by + obtain ⟨B, U, _, hI, hU, hK⟩ := hE M R + exact ⟨.lam B, hI, betas_trans (betas_of_spineReds (hK C)) (betas_appR _ (betas_of_spineReds hU))⟩ + +/-- The open-program contract from a parse. -/ +theorem open_of_parses {E : Term} (hE : Parses E) (M : Term) (d : Nat) (hM : FreeUnder d M) + (C N : Term) : + ∃ Q U, Betas (.app (.app E C) (streamOf (blcCode M) N)) (.app (.app C Q) U) ∧ + Betas U N ∧ + ∀ (env : List Term) (R : Term) (σ : Nat → Term), + (∀ i, i < d → env[i]? = some (σ i)) → + Betas (.app Q (envList env R)) (inst σ M) := by + obtain ⟨B, U, hD, _, hU, hK⟩ := hE M N + refine ⟨.lam B, U, betas_of_spineReds (hK C), betas_of_spineReds hU, ?_⟩ + intro env R σ hagree + have h := hD d 0 env R σ hM hagree + rw [shift_zero] at h + exact Betas.head (Beta.beta _ _) h + +/-- **The self-interpreter contract.** For every closed `M` and any +terms `C`, `N`: `intL C (⌜M⌝ ++ N) →β* C (λz. M) N`. -/ +theorem selfint_contract (M : Term) (hM : Closed M) (C N : Term) : + Betas (.app (.app intL C) (streamOf (blcCode M) N)) (.app (.app C (.lam M)) N) := + contract_of_parses parses_intL M hM C N + /-- The contract on quoted programs, `⌜M⌝ = stream(M, FALSE)`. -/ theorem selfint_quote (M : Term) (hM : Closed M) (C : Term) : Betas (.app (.app intL C) (quote M)) (.app (.app C (.lam M)) falseT) := @@ -955,9 +1001,8 @@ theorem l2Statement : L2Statement := fun i R => parserStatement (.var i) R reduced in argument position: `intL C stream(M,R) →β* C Q R` for an implementing closure `Q ⊨ P[M]`, every term `M`, every tail `R`. -/ theorem l1_beta (M R C : Term) : ∃ Q, Implements Q M ∧ - Betas (.app (.app intL C) (streamOf (blcCode M) R)) (.app (.app C Q) R) := by - obtain ⟨B, U, _, hI, hU, hK⟩ := intL_parse M R - exact ⟨.lam B, hI, betas_trans (betas_of_spineReds (hK C)) (betas_appR _ (betas_of_spineReds hU))⟩ + Betas (.app (.app intL C) (streamOf (blcCode M) R)) (.app (.app C Q) R) := + l1_beta_of_parses parses_intL M R C /-- The contract for open programs: `intL C (⌜M⌝ ++ N) →β* C Q U` with `U →β* N`, where `Q` applied to any cons' environment covering M's free @@ -967,13 +1012,8 @@ theorem selfint_open (M : Term) (d : Nat) (hM : FreeUnder d M) (C N : Term) : Betas U N ∧ ∀ (env : List Term) (R : Term) (σ : Nat → Term), (∀ i, i < d → env[i]? = some (σ i)) → - Betas (.app Q (envList env R)) (inst σ M) := by - obtain ⟨B, U, hD, _, hU, hK⟩ := intL_parse M N - refine ⟨.lam B, U, betas_of_spineReds (hK C), betas_of_spineReds hU, ?_⟩ - intro env R σ hagree - have h := hD d 0 env R σ hM hagree - rw [shift_zero] at h - exact Betas.head (Beta.beta _ _) h + Betas (.app Q (envList env R)) (inst σ M) := + open_of_parses parses_intL M d hM C N -- --------------------------------------------------------------------------- -- §9. The contract as a predicate, and the size question it poses. @@ -992,17 +1032,22 @@ def IsSelfInterpreter (E : Term) : Prop := BetaJoin (.app (.app E (.var 0)) (streamOf (blcCode M) (.var 1))) (.app (.app (.var 0) (.lam M)) (.var 1)) +theorem isSelfInterpreter_of_parses {E : Term} (hc : Closed E) (hE : Parses E) : + IsSelfInterpreter E := + ⟨hc, fun M hM => ⟨_, contract_of_parses hE M hM (.var 0) (.var 1), Betas.refl _⟩⟩ + /-- Palmer's 168 meets the contract. -/ theorem isSelfInterpreter_intL : IsSelfInterpreter intL := - ⟨by decide, fun M hM => - ⟨_, selfint_contract M hM (.var 0) (.var 1), Betas.refl _⟩⟩ + isSelfInterpreter_of_parses (by decide) parses_intL theorem intL_length : (blcCode intL).length = 168 := by rw [wire_intL]; exact intL_size /-- `SelfintSizeBound n`: every self-interpreter has at least `n` bits. -Optimality of Palmer's interpreter is `SelfintSizeBound 168` (open); -the bound cannot go higher. -/ +The 168 refutes every bound above 168 (`not_selfintSizeBound_169`); the +165-bit `intL165` refutes every bound above 165 +(`not_selfintSizeBound_166`, `Blc/Selfint165.lean`), so optimality is +`SelfintSizeBound 165` (open). -/ def SelfintSizeBound (n : Nat) : Prop := ∀ E : Term, IsSelfInterpreter E → n ≤ (blcCode E).length diff --git a/lean/README.md b/lean/README.md index fa7a5e61..8aa2ae8f 100644 --- a/lean/README.md +++ b/lean/README.md @@ -17,12 +17,19 @@ theorem argKill : headSteps k t = some s → headStep s = none → theorem selfint_contract : Closed M → Betas (intL C (streamOf (blcCode M) N)) (C (λ M) N) -- propext, Quot.sound theorem parserStatement : ParserStatement -- propext, Quot.sound +theorem selfint_contract165 : Closed M → + Betas (intL165 C (streamOf (blcCode M) N)) (C (λ M) N) + -- propext, Quot.sound +theorem not_selfintSizeBound_166 : ¬ SelfintSizeBound 166 + -- propext, Quot.sound ``` The 32-bit term that the reference busy-beaver ledger excludes by hand has no normal form under arbitrary β-reduction. Palmer's 168-bit `intL` (pinned to its wire by `wire_intL`) is a self-interpreter: for every closed `M` and any terms -`C`, `N`, `intL C (⌜M⌝ ++ N)` β-reduces to `C (λz. M) N`. The **general bridge** holds for +`C`, `N`, `intL C (⌜M⌝ ++ N)` β-reduces to `C (λz. M) N`. So is the 165-bit +`intL165` (`wire_intL165`), so no self-interpreter size bound above 165 +holds. The **general bridge** holds for every term, so any head-divergence certificate concludes no-normal-form with no side conditions. The **class assemblies** turn certificate *data* into that conclusion mechanically, and the **rigid-head argument bridge** lifts a spine @@ -156,13 +163,14 @@ Busy-beaver proofs (`docs/classical/certificates/busy-beaver.md`): - `Blc/BB35Large.lean` — GENERATED by `tools/certificates/bb35_large.py`; a shared syntax graph proves the other large halter has 4,186,155,666 bits. -qBLC self-interpretation: +Self-interpretation: - `Blc/Selfint.lean` — the pure fragment of `docs/quantum/bisimulation.md`: proves `intL`'s wire identity, `|E_q| = |intL I| = 174`, and the quote-size identity `|stream(M,R)| = 14·|M| + zeros(M) + |R|`; states the translation contract `Implements` and the parser obligations (`ParserStatement`, L1, L2) - as named `Prop`s. + as named `Prop`s. It also pins the 165-bit interpreter `intL165` to its + wire (`wire_intL165`); qBLC's `E_q` stays on `intL`. - `Blc/SelfintProof.lean` — proves them, and the classical contract. `parse` is one induction on the source term (open or closed): the stream applied to the parser's handler spine-reduces (head reduction through @@ -173,11 +181,23 @@ qBLC self-interpretation: induction on the unary selector (`engine`), skipvar is `l l l → rest` (`skip`), and sixteen machine runs of the 168's control are kernel replays of head-step chains on placeholder terms, instantiated because head steps - are stable under substitution. Corollaries: `selfint_contract` (β-reduction - for closed `M`, any `C`, `N`), `selfint_open`, `l1_beta`, `parserStatement`, - `l1Statement`, `l2Statement`, and `isSelfInterpreter_intL` with - `not_selfintSizeBound_169` (the upper-bound half of optimality; the lower - bound `SelfintSizeBound 168` is stated, open). + are stable under substitution. `Parses E` states the parse's conclusion for + any interpreter `E`, and the corollaries derive from it alone + (`*_of_parses`): `selfint_contract` (β-reduction for closed `M`, any `C`, + `N`), `selfint_open`, `l1_beta`, `parserStatement`, `l1Statement`, + `l2Statement`, and `isSelfInterpreter_intL` with `not_selfintSizeBound_169`. +- `Blc/Selfint165.lean` — the 165-bit interpreter: the 168 with the reader + `\list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)`. + Its third argument `s s s` is the stream past the first `0` (`pastZero`; + for a variable it reduces through `skip_self`), and VAR returns it as the + residual. `parse165` therefore quantifies over every third argument that + spine-reduces there (`pastZero_self` covers APP's second parse, where it is + `U₁ U₁ U₁` for an unreduced residual `U₁`). The closures, the VAR engine, + and every run that does not name the parser are the 168's; eight runs are + new. It proves `Parses intL165`, hence `selfint_contract165`, + `selfint_open165`, `parserStatement165`, `isSelfInterpreter_intL165`, and + `not_selfintSizeBound_166` (the upper-bound half of optimality; the lower + bound `SelfintSizeBound 165` is stated, open). Generated: From 11e0aaa64669a2f53640020975b8e404f0e44ddc Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 00:30:32 -0400 Subject: [PATCH 03/41] Record the 165-bit self-interpreter: sources, searches and variants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit data/self-interpreter/machines/: the 165 (Codex's reader: skipvar applied to the whole stream before dispatch serves both arms, and the Scott list hands list1 to the variable arm), and the 175/187 universal machines around it. Searches around the 165: letopt to three cuts (unique minimum), the βη component at slack 20 and the contextual component at slack 16 (nothing smaller, no tie), the reader slots (sketches.py, sketches_165.log), and the joint searches run in Codex consults (searches_165.json: commands and totals). merges.py measures the 165, its nearest variants and the 175/187 machines, with two negative controls. --- .../component_165_contextual16.log | 24 ++++++ .../component_165_slack20.log | 20 +++++ data/self-interpreter/letopt_165.log | 9 ++ data/self-interpreter/machines/int165.blc | 1 + data/self-interpreter/machines/int165.lam | 13 +++ data/self-interpreter/machines/uni175.blc | 1 + data/self-interpreter/machines/uni175.lam | 9 ++ data/self-interpreter/machines/uni187.blc | 1 + data/self-interpreter/machines/uni187.lam | 9 ++ data/self-interpreter/searches_165.json | 85 +++++++++++++++++++ data/self-interpreter/sketches_165.log | 16 ++++ tools/self-interpreter/merges.py | 60 +++++++++++++ tools/self-interpreter/sketches.py | 17 ++++ 13 files changed, 265 insertions(+) create mode 100644 data/self-interpreter/component_165_contextual16.log create mode 100644 data/self-interpreter/component_165_slack20.log create mode 100644 data/self-interpreter/letopt_165.log create mode 100644 data/self-interpreter/machines/int165.blc create mode 100644 data/self-interpreter/machines/int165.lam create mode 100644 data/self-interpreter/machines/uni175.blc create mode 100644 data/self-interpreter/machines/uni175.lam create mode 100644 data/self-interpreter/machines/uni187.blc create mode 100644 data/self-interpreter/machines/uni187.lam create mode 100644 data/self-interpreter/searches_165.json create mode 100644 data/self-interpreter/sketches_165.log diff --git a/data/self-interpreter/component_165_contextual16.log b/data/self-interpreter/component_165_contextual16.log new file mode 100644 index 00000000..1b6e243a --- /dev/null +++ b/data/self-interpreter/component_165_contextual16.log @@ -0,0 +1,24 @@ +start 165 bits, slack 16, au=true eta=true contextual=true descend=false, 4 threads + layer 1: +201 new, 202 total, 0.0s + layer 2: +12852 new, 13054 total, 0.0s + layer 3: +28111 new, 41165 total, 1.7s + layer 4: +85419 new, 126584 total, 5.5s + layer 5: +148942 new, 275526 total, 17.8s + layer 6: +262730 new, 538256 total, 41.0s + layer 7: +335111 new, 873367 total, 86.2s + layer 8: +420904 new, 1294271 total, 143.5s + layer 9: +396705 new, 1690976 total, 227.0s + layer 10: +351366 new, 2042342 total, 307.9s + layer 11: +251623 new, 2293965 total, 382.3s + layer 12: +143044 new, 2437009 total, 434.7s + layer 13: +76902 new, 2513911 total, 463.3s + layer 14: +24785 new, 2538696 total, 478.6s + layer 15: +8515 new, 2547211 total, 484.4s + layer 16: +2617 new, 2549828 total, 486.5s + layer 17: +583 new, 2550411 total, 487.1s + layer 18: +259 new, 2550670 total, 487.2s + layer 19: +6 new, 2550676 total, 487.3s + layer 20: +2 new, 2550678 total, 487.3s + layer 21: +0 new, 2550678 total, 487.3s +component under the limit: 2550678 states, 326937 distinct terms; size histogram (delta:count) 0:1 1:2 2:2 3:8 4:14 5:17 6:122 7:316 8:503 9:1207 10:2323 11:3619 12:7828 13:20561 14:43923 15:81842 16:164649 +0 term(s) below 165, 0 tie(s) diff --git a/data/self-interpreter/component_165_slack20.log b/data/self-interpreter/component_165_slack20.log new file mode 100644 index 00000000..bd3d7da8 --- /dev/null +++ b/data/self-interpreter/component_165_slack20.log @@ -0,0 +1,20 @@ +start 165 bits, slack 20, au=true eta=true contextual=false descend=false, 6 threads + layer 1: +202 new, 203 total, 0.0s + layer 2: +19772 new, 19975 total, 0.0s + layer 3: +100382 new, 120357 total, 0.7s + layer 4: +171891 new, 292248 total, 3.9s + layer 5: +481149 new, 773397 total, 9.6s + layer 6: +361193 new, 1134590 total, 25.3s + layer 7: +539630 new, 1674220 total, 37.6s + layer 8: +295216 new, 1969436 total, 57.5s + layer 9: +122008 new, 2091444 total, 67.3s + layer 10: +59457 new, 2150901 total, 71.4s + layer 11: +24736 new, 2175637 total, 73.5s + layer 12: +7056 new, 2182693 total, 74.3s + layer 13: +256 new, 2182949 total, 74.5s + layer 14: +43 new, 2182992 total, 74.5s + layer 15: +35 new, 2183027 total, 74.5s + layer 16: +24 new, 2183051 total, 74.5s + layer 17: +0 new, 2183051 total, 74.5s +component under the limit: 2183051 states, 2183051 distinct terms; size histogram (delta:count) 0:1 2:1 3:5 4:1 5:7 6:98 7:91 8:179 9:592 10:629 11:1162 12:5994 13:10019 14:17666 15:42189 16:66523 17:110372 18:246573 19:609432 20:1071517 +0 term(s) below 165, 0 tie(s) diff --git a/data/self-interpreter/letopt_165.log b/data/self-interpreter/letopt_165.log new file mode 100644 index 00000000..b577b185 --- /dev/null +++ b/data/self-interpreter/letopt_165.log @@ -0,0 +1,9 @@ +input 165 bits; core 181 bits (64 nodes); 512 candidate cuts (14 shared) +k=1: 512 valid, 0 invalid, 0.0s; smallest sizes 168:1 170:1 172:3 173:7 174:3 175:1 +k=2: 104471 valid, 26345 invalid, 0.0s; smallest sizes 165:1 167:1 168:4 169:1 170:4 171:10 + 165 [[45]->60 [9, 29]->61] + (\a. a a) (\a. (\b c. (\d e. e (\f. f (\g h. h d) c) (e e e)) (\d. b (\e. d (c (\f g. e (\h i. h g (i f)))) (b (\f. c (\g. e g (f g))))))) (a a)) + 010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 +k=3: 12419437 valid, 9819283 invalid, 9.4s; smallest sizes 170:2 171:5 172:18 173:24 174:41 175:85 +smallest rendering over 0..=3 cuts: 165 bits +best 165 010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/machines/int165.blc b/data/self-interpreter/machines/int165.blc new file mode 100644 index 00000000..5c37eb3e --- /dev/null +++ b/data/self-interpreter/machines/int165.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/machines/int165.lam b/data/self-interpreter/machines/int165.lam new file mode 100644 index 00000000..2861fca0 --- /dev/null +++ b/data/self-interpreter/machines/int165.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/machines/uni175.blc b/data/self-interpreter/machines/uni175.blc new file mode 100644 index 00000000..110f6d90 --- /dev/null +++ b/data/self-interpreter/machines/uni175.blc @@ -0,0 +1 @@ +0101000110100001000001000001011000010110000001101111101111001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001101000011010 diff --git a/data/self-interpreter/machines/uni175.lam b/data/self-interpreter/machines/uni175.lam new file mode 100644 index 00000000..4f28d8d8 --- /dev/null +++ b/data/self-interpreter/machines/uni175.lam @@ -0,0 +1,9 @@ +-- 175-bit universal machine (non-strict): U ( ++ N) = M N for closed M. +-- Tromp's intL dbl wiring around the 165's parser. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) (\x. x x) diff --git a/data/self-interpreter/machines/uni187.blc b/data/self-interpreter/machines/uni187.blc new file mode 100644 index 00000000..30bf7c8a --- /dev/null +++ b/data/self-interpreter/machines/uni187.blc @@ -0,0 +1 @@ +0100010110000100000100000101100001011000000110111110111100101101010000111100001011100111100000011110000001011101110011011110011111000011111000010111101001110100110100001100111011000011010 diff --git a/data/self-interpreter/machines/uni187.lam b/data/self-interpreter/machines/uni187.lam new file mode 100644 index 00000000..ef24df9b --- /dev/null +++ b/data/self-interpreter/machines/uni187.lam @@ -0,0 +1,9 @@ +-- 187-bit strict universal machine: Tromp's strict wiring (base environment +-- Omega, so applying a free index diverges) around the 165's parser. +(\a. a (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) (\b. b (a a))) (\a. a a) diff --git a/data/self-interpreter/searches_165.json b/data/self-interpreter/searches_165.json new file mode 100644 index 00000000..1e6e81c4 --- /dev/null +++ b/data/self-interpreter/searches_165.json @@ -0,0 +1,85 @@ +{ + "interpreter": "data/self-interpreter/machines/int165.lam", + "probes": "91 (blam selfint hole default), exact contract", + "searches": [ + { + "scope": "reader: handler H x skip S jointly, |H|+|S| <= 36 (H must mention next, cont; S must mention list); interpreters <= 164 bits", + "by": "Codex", + "result": "total 6348020 fill pairs in 19.4s: 0 survivors, 738854 unknown", + "parts": [ + { + "log": "joint.log", + "scope": "H<=28,S<=12", + "pairs": 6348020, + "seconds": 19.4, + "survivors": 0, + "unknown": 738854 + }, + { + "log": "joint_large_handler.log", + "scope": "29<=H<=34,S<=7", + "pairs": 18051790, + "seconds": 89.7, + "survivors": 0, + "unknown": 2504627 + }, + { + "log": "joint_large_skip.log", + "scope": "13<=S<=27,H<=23", + "pairs": 7966562, + "seconds": 88.2, + "survivors": 0, + "unknown": 808695 + } + ], + "note": "--escalate 0; a candidate stops after three capped probes, so 'unknown' is not a refutation" + }, + { + "scope": "cell <= 23 bits in the 165, unrestricted frame", + "by": "Codex", + "result": "total 103547 fills in 0.1s: 0 survivors, 0 unknown" + }, + { + "scope": "APP lift <= 18 bits in the 165, unrestricted frame", + "by": "Codex", + "result": "total 5131 fills in 0.1s: 0 survivors, 0 unknown" + }, + { + "scope": "joint cell (<= 26, must arg) x APP value body (<= 19, must exp, exp2), sum <= 40", + "by": "Codex", + "result": "total 47303158 fill pairs in 106.8s: 0 survivors, 0 unknown", + "command": "blam selfint hole 0100011010000100000100000101100001011000000110111110111100101101010000111100001011100111100000011110_011111000011111000~011010 --max-size 26 --must 1 --max2 19 --must2 2,3 --max-sum 40 --threads 2" + }, + { + "scope": "whole APP <= 34 bits in the 165 (must exp, cont); 5 caps refuted by I I", + "by": "Codex", + "result": "total 21555108 fills in 321.9s: 0 survivors, 218 unknown" + }, + { + "scope": "contextual component of the 165 without eta, slack 16", + "by": "Codex", + "result": "0 term(s) below 165, 0 tie(s)" + }, + { + "scope": "contextual component of the 165 without eta, slack 18", + "by": "Codex", + "result": "0 term(s) below 165, 0 tie(s)" + }, + { + "scope": "universal machine: wirings around the 165's 143-bit body, machines <= 174 bits", + "by": "Codex", + "result": "TOTAL 14856126 survivors 0 unknown 68017", + "note": "16,144 caps certified divergent; 51,873 remain unexcluded (uni/REPORT.md)" + }, + { + "scope": "universal machine U175: let structure through three cuts", + "by": "Codex", + "result": "smallest rendering over 0..=3 cuts: 175 bits" + }, + { + "scope": "universal machine U175: beta-eta component, slack 16", + "by": "Codex", + "result": "0 term(s) below 175, 2 tie(s)" + } + ] +} \ No newline at end of file diff --git a/data/self-interpreter/sketches_165.log b/data/self-interpreter/sketches_165.log new file mode 100644 index 00000000..ba466908 --- /dev/null +++ b/data/self-interpreter/sketches_165.log @@ -0,0 +1,16 @@ +165 zero arm + `_` frame [bit0 list next cont intL x] + 151 fixed bits; --max-size 14 + total 522 fills in 0.3s: 1 survivors, 8 unknown + SURVIVOR 14 bits 00000110111110 + interpreter 165 bits +165 skip + `_` frame [list next cont intL x] + 155 fixed bits; --max-size 10 + total 61 fills in 0.0s: 1 survivors, 0 unknown + SURVIVOR 10 bits 0101101010 + interpreter 165 bits +165 handler + `_` frame [list next cont intL x] + 138 fixed bits; --max-size 24 + total 177555 fills in 212.0s: 0 survivors, 7790 unknown diff --git a/tools/self-interpreter/merges.py b/tools/self-interpreter/merges.py index 2c3541fe..142a2500 100644 --- a/tools/self-interpreter/merges.py +++ b/tools/self-interpreter/merges.py @@ -27,7 +27,67 @@ def knot(body): (\next. \list.list (\bit0\list1.bit0 (list1 next) {VAR})) (\bit1.intL (\exp.bit1 {ABS} {APP}))""") + +def body165(reader): + return rf"""\cont. + (\next. \list. list {reader} (list list list)) + (\bit1.intL (\exp.bit1 {ABS} {APP}))""" + + +def int165(reader): + return knot(body165(reader)) + + +READER165 = r"(\bit0. bit0 (\unused \r. r next) cont)" +INT165 = int165(READER165) +GEN165 = rf"(\x. (\intL. {body165(READER165)}) (x x))" + VARIANTS = [ + # interpreter.md §1–§3: the 165 and its nearest variants. + ("165 (whole-stream skip)", INT165, False, 165, True), + ("control: 165 zero arm with one binder", int165(r"(\bit0. bit0 (\r. r next) cont)"), + False, 162, False), + ("165 with an explicit list1 binder", int165( + r"(\bit0 \list1. bit0 (\r. r next) (cont list1))"), False, 171, True), + ("165 zero arm built from bit0 (= K there)", int165( + r"(\bit0. bit0 (bit0 (\r. r next)) cont)"), False, 166, True), + ("165 zero arm reading the first tail", int165( + r"(\bit0. bit0 (\r \unused. r next) cont)"), False, 166, True), + ("165 + select-first", knot(rf"""\cont. + (\next. \list. list {READER165} (list list list)) + (\bit1.intL (bit1 (\exp. {ABS}) (\exp. {APP})))"""), False, 166, True), + ("165 + K-repair cell", int165(READER165).replace( + r"\zx\zy. zx arg (zy args)", r"\zx. zx (\u. arg) (\zy. zy args)"), + False, 166, True), + ("165, next inlined", knot(rf"""\cont. \list. list + (\bit0. bit0 (\unused \r. r (\bit1.intL (\exp.bit1 {ABS} {APP}))) cont) + (list list list)"""), False, 170, True), + ("165, next inside \\list", knot(rf"""\cont. \list. + (\next. list {READER165} (list list list)) + (\bit1.intL (\exp.bit1 {ABS} {APP}))"""), False, 172, True), + ("165, next takes list1: next = \\l. l B, zero arm \\u. next", knot(rf"""\cont. + (\next. \list. list (\bit0. bit0 (\u. next) cont) (list list list)) + (\l. l (\bit1.intL (\exp.bit1 {ABS} {APP})))"""), False, 168, True), + ("165, next takes both copies: next = \\u \\r. r B", knot(rf"""\cont. + (\next. \list. list (\bit0. bit0 next cont) (list list list)) + (\u \r. r (\bit1.intL (\exp.bit1 {ABS} {APP})))"""), False, 171, True), + ("165 + optional second parse, no-input parser \\k. k k", knot(r"""\cont. + (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1.intL (\exp. bit1 (\k. k k) intL (\exp2. cont (\args. bit1 + (\arg. exp (\zx\zy. zx arg (zy args))) (exp args (exp2 args))))))"""), + False, 175, True), + ("165 + function environment, variable value \\e. e list1", knot(r"""\cont. + (\next. \list. list (\bit0. bit0 (\unused \r. r next) (\l. cont (\e. e l))) + (list list list)) + (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\s. s (\b. b (\u. arg) args)))) + (intL (\exp2.cont (\args.exp args (exp2 args))))))"""), + False, 181, True), + ("universal machine 175, non-strict (intL dbl around the 165)", + f"({INT165}) (\\x. x x)", True, 175, True), + ("universal machine 187, strict wiring around the 165", + rf"(\a. a {GEN165} (\b. b (a a))) (\a. a a)", True, 187, True), + ("control: partially applied 165 parser as universal continuation", + rf"(\x. x x (x x x)) {GEN165}", True, 177, False), # name, source, universal-machine contract?, expected bits, should pass ("168 (tromp/AIT 2cfa384)", INT168, False, 168, True), ("control: APP operands swapped", INT168.replace("exp args (exp2 args)", diff --git a/tools/self-interpreter/sketches.py b/tools/self-interpreter/sketches.py index 6ff0c9d7..86a0e5a3 100644 --- a/tools/self-interpreter/sketches.py +++ b/tools/self-interpreter/sketches.py @@ -147,6 +147,23 @@ def interp(var=r"cont list1 (list1 list1 list1)", }) +def interp165(zero=r"\unused r. r next", skip="list list list", handler=None): + """The 165 with part of its reader replaced (NEXT is the 168's).""" + handler = handler or rf"\bit0. bit0 ({zero}) cont" + nexth = (r"\bit1. intL (\exp. bit1 (cont (\args arg. exp (\zx zy. zx arg (zy args))))" + r" (intL (\exp2. cont (\args. exp args (exp2 args)))))") + return (rf"(\x.x x)(\x.(\intL. \cont. (\next. \list. list ({handler}) ({skip}))" + rf" ({nexth}))(x x))") + + +# The 165's reader slots (interpreter.md §4, "The reader"). +SKETCHES.update({ + "165 zero arm": (interp165(zero="_"), "--max-size 14"), + "165 skip": (interp165(skip="_"), "--max-size 10"), + "165 handler": (interp165(handler="_"), "--max-size 24"), +}) + + def run(name, src, flags): t = parse(src) b = bits(t) From cce583eb6ac360d377e95b5b0987e5546981c9ef Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 00:30:33 -0400 Subject: [PATCH 04/41] Rewrite the self-interpreter record around the 165 interpreter.md now describes the 165: its reader and why it works, the Lean proofs, the searches around it, the 168's neighbourhood and module grammar (which still bound the NEXT region the two share), the unconditional facts every interpreter obeys (head shape, a duplicated binder, no forced knot), the exclusions at every size, and what is open. universal.md records the 175/187 machines; STATUS, README and the qBLC bisimulation notes follow. The PR kit folds the 165 and its carry-overs (uni.lam, int4, ko2kp, nf, pairup_Kp) into the golf PR, whose branch on the fork now has those six commits. --- README.md | 19 +- contrib/PR_KIT.md | 98 ++- docs/STATUS.md | 68 +- .../classical/self-interpreter/interpreter.md | 794 ++++++++---------- docs/classical/self-interpreter/universal.md | 58 +- docs/quantum/bisimulation.md | 19 +- 6 files changed, 531 insertions(+), 525 deletions(-) diff --git a/README.md b/README.md index c20159ac..b89c6eb7 100644 --- a/README.md +++ b/README.md @@ -116,13 +116,14 @@ proven. and time spectra, with post-certificate open mass below 3.19×10⁻¹² on the β clock. - **The self-interpreter** ([interpreter](docs/classical/self-interpreter/interpreter.md)): - nothing below Sean Palmer's 168 bits in any searched space — exact let - structure, the βη component to +24, parametric and contextual slot - searches, joint two-hole searches, and over a hundred protocol changes — - and a conditional lower bound: each of its seven modules is the unique - minimum of its own law, and the minima sum to exactly 168. The universal - machine has nothing below Tromp's 178 (non-strict) and 190 (strict) in the - searched wirings ([universal](docs/classical/self-interpreter/universal.md)). + 165 bits, three below Sean Palmer's 168, by computing the variable skip once + on the whole stream, where it is right for both dispatch arms. Lean proves + it, and the 168, a self-interpreter for every closed program. Nothing smaller + appears in its let structure, βη and contextual components, or any slot of + its reader, and the 168's modular lower bound still pins the part the two + share. The same reader gives universal machines of 175 (non-strict) and 187 + (strict) bits, against Tromp's 178 and 190 + ([universal](docs/classical/self-interpreter/universal.md)). - **The rest of tromp/AIT** ([golf](docs/classical/golf.md)): the IOCCC BLC8 universal machine shrinks from 43 bytes to 41 (strict) and 38 (non-strict), the bytewise BLC2 machine from 500 to 399 bits, the programs @@ -353,7 +354,7 @@ says how to get them rather than pretending they do not exist. | `qalc run` / `gram` / `compile` / `fixtures` | exact qALC evolution, Gram audits, the H/T/CNOT circuit compiler, and fixture regeneration | | `qalc census` | exact finite-clock `p h t` census with Ω brackets, optional sparse `M` output, and the `--speed` arrival spectrum with certified Ω_speed brackets | | `slots` *(lab)* | exhaustive self-interpreter slot searches | -| `selfint ctx` / `hole` / `wiring` *(lab)* | searches below the 168 and the universal machine: contextual slots, one- or two-hole sketches of any interpreter, every wiring around the parser | +| `selfint ctx` / `hole` / `wiring` *(lab)* | searches below the self-interpreter and the universal machine: contextual slots, one- or two-hole sketches of any interpreter, every wiring around the parser | ```bash cargo build --release # everything not marked (lab) @@ -430,7 +431,7 @@ guarantees, and records of what the measurements and searches establish. | classical engine | [architecture](docs/classical/architecture.md), [running programs: notation, blc, uni](docs/classical/programs.md), [speed prior](docs/classical/speed.md) | | classical results | [bits of Ω](docs/classical/omega.md), [coding theorem](docs/classical/coding.md), [AIT golf](docs/classical/golf.md) | | certificates | [specification](docs/classical/certificates/specification.md), [frontier maps](docs/classical/certificates/frontier.md), [BB(33/34/35)](docs/classical/certificates/busy-beaver.md), [Lean](lean/README.md) | -| self-interpreter | [the 168](docs/classical/self-interpreter/interpreter.md), [universal machine](docs/classical/self-interpreter/universal.md), [slot searches](docs/classical/self-interpreter/slots.md) | +| self-interpreter | [the 165](docs/classical/self-interpreter/interpreter.md), [universal machine](docs/classical/self-interpreter/universal.md), [slot searches](docs/classical/self-interpreter/slots.md) | | qBLC | [architecture](docs/quantum/architecture.md), [frontier adjudication](docs/quantum/escalation.md), [Galois structure](docs/quantum/galois.md), [odd-sector search](docs/quantum/oddmin.md), [bisimulation](docs/quantum/bisimulation.md) | | qALC | [architecture](docs/quantum-algebraic/architecture.md), [token machine](docs/quantum-algebraic/token.md), [kernel register](docs/quantum-algebraic/kernel.md), [instance identity](docs/quantum-algebraic/instance-identity.md), [objects](docs/quantum-algebraic/objects.md), [speed prior](docs/quantum-algebraic/speed.md), [Rust pillar](docs/quantum-algebraic/rust-pillar.md), [reference and proof records](qalc/README.md) | diff --git a/contrib/PR_KIT.md b/contrib/PR_KIT.md index 56b732c9..1f96bac0 100644 --- a/contrib/PR_KIT.md +++ b/contrib/PR_KIT.md @@ -8,12 +8,16 @@ instrumental, so they can be written out in full when the PRs go up. - Two branches on the a9lim/AIT fork, each cut from upstream master: - `uni-rs`: one commit, `uni.rs` at the repo root. - - `golf`: eight commits, one program each, so Tromp can take any subset. + - `golf`: fourteen commits, one program each, so Tromp can take any subset: + the original eight, then six that move the self-interpreter's reader to + `int.lam`, `uni.lam`, `int4`, `ko2kp`, `nf` and `pairup_Kp`. - Open each PR from its branch into `tromp/AIT` `master`. Both branches are three commits behind the fork's master (upstream moved since they were cut), so rebase each onto current upstream first. - blam 3.0.0 is released: point every link in the PRs and the letter at the - `v3.0.0` tag (stable permalinks), not at `dev`. + `v3.0.0` tag (stable permalinks), not at `dev`. The 165's record and the + Lean self-interpreter proofs came after 3.0.0, so link those at a commit + permalink on `dev` or cut a release first. - The fork's `master` is unchanged: upstream plus `uni.rs`. blam's `ref/AIT` pins it, and blam's CI checks that it only *adds* files over upstream. - `golf` modifies upstream files, so it must not land on the fork's master. @@ -35,6 +39,10 @@ instrumental, so they can be written out in full when the PRs go up. - the identity continuation behind the non-strict variant is Codex's. - `uni28`: Codex (one reader for the parser, the delimiter and the digits). - `int4`, `ko2kp`, `nf`: Claude, porting the `int.lam` parser. + - The 165-bit `int.lam` reader (skip the whole stream before dispatch): + Codex, in a fresh-context consult. Carrying it into `uni.lam`, `int4`, + `ko2kp`, `nf` and `pairup_Kp`, the verification, and the Lean proofs that + the 168 and the 165 are self-interpreters: Claude. - The pairup programs: Codex (keep the old loop only to record `ps`). - The size-search tools and the verification behind every number: Claude, in blam (`blam golf`, `docs/classical/golf.md`). Since 3.0.0 a plain @@ -76,25 +84,37 @@ instrumental, so they can be written out in full when the PRs go up. ## PR 2: `golf` -**Title:** Smaller sources for uni8, uni28, int4, ko2kp, nf and the pairup -programs +**Title:** A 165-bit self-interpreter, and smaller sources for uni8, uni28, +int4, ko2kp, nf and the pairup programs - **Shape of the PR.** - - Eight independent commits, one per program; each commit message carries - its own design note and verification. + - Fourteen commits, one per program and change; each commit message + carries its own design note and verification. The last six depend only + on their own program's earlier commit (`int.lam`, `uni.lam` on none). - Every size is what the current `blc` toolchain gives the new source. | program | before | after | |---|---:|---:| | `uni8` (BLC8 universal machine) | 355 (IOCCC uni8.Blc: 344) | 321 (41 bytes); non-strict 300 (38 bytes) | | `uni28` (BLC2 universal machine) | 500 | 416; non-strict 393 | - | `int4` | 189 | 178 | - | `ko2kp` | 615 | 569, so KP(x) ≤ KO(x) + 569 | - | `nf` | 600 | 562 | + | `int.lam` (self-interpreter) | 168 | 165 | + | `uni.lam` (universal machine) | 190; non-strict 178 | 187; non-strict 175 | + | `int4` | 189 | 178, then 175 | + | `ko2kp` | 615 | 569, then 566, so KP(x) ≤ KO(x) + 566 | + | `nf` | 600 | 562, then 559 | | `pairupKP` | 778 | 774 | | `pairupK_p` | 657 | 653 | - | `pairup_Kp` | 1402 | 1360 | - + | `pairup_Kp` | 1402 | 1360, then 1357 | + +- **The self-interpreter's reader.** `skipvar` (`\l. l l l`) skips past the + first 0 of any stream. Applied to the whole input before the tag is read, + it is right for both cases: after a leading 0 it gives the stream past the + tag, which the zero branch reads, and after a leading 1 the rest past the + variable, which the variable returns. And `list H (skipvar list)` hands + `list1` to the variable case, which becomes `cont` itself: + `\list. list (\bit0. bit0 (\list1\rest. rest next) cont) (skipvar list)`. + One λ more, one application fewer, one bit less of index: 3 bits. Every + program that embeds `int.lam`'s reader drops 3 bits the same way. - **The two universal machines.** One bit reader, `get`, serves every read. In uni8 a refill always lands on a fresh 8-bit byte, so the reader needs no recursion. @@ -110,7 +130,12 @@ programs - ko2kp and nf: every closed program up to 13 bits plus data bits; - pairup: 60 contract-valid inputs in every IF_DIRTY/IFCPS setting; pairupKP also on raw pairs of closed programs; - - int4: the exact self-interpreter contract on 236 programs. + - int4: the exact self-interpreter contract on 236 programs; + - int.lam: the exact contract on every closed program through 21 bits + (3,341), and a Lean proof for every closed program + (`lean/Blc/Selfint165.lean` in blam; the 168's is + `lean/Blc/SelfintProof.lean`); uni.lam: the universal-machine contract on + 667 programs, and strictness probes. No differences, and no input halting on only one side. - **Caveat.** `pairupK_p` and `pairup_Kp` agree with the originals on every @@ -124,21 +149,23 @@ programs optimizer never does) finds smaller β-convertible terms for 45 programs in the repo, 470 bits in all. Examples outside this PR: `tweet` 2230 → 2168, `uniK` 903 → 854, `primes256` 286 → 252. - - The β-only descents of six of this PR's programs go further still: nf - 541, ko2kp 557, uni28 399 (non-strict 382), pairupKP 771, pairupK_p 651, - pairup_Kp 1325. + - The β-only descents of six of this PR's programs (measured before the + reader change) go further still: nf 541, ko2kp 557, uni28 399 + (non-strict 382), pairupKP 771, pairupK_p 651, pairup_Kp 1325. - These exist only as terms so far. Offer to turn any of them into source. - **Credit:** see above. ## Letter to John -**Subject:** two PRs, and what we learned trying to beat the 168 +**Subject:** two PRs, including a 165-bit self-interpreter - **Who:** a9, building a Rust engine for BLC/AIT experiments (github.com/a9lim/blam); say up front that Claude and Codex did most of the work. - **The two PRs.** - `uni.rs`: byte-identical with uni.py, about 18× faster. + - `golf`: int.lam 168 → 165, uni.lam 190 → 187 (non-strict 178 → 175), and + the smaller uni8/uni28/int4/ko2kp/nf/pairup sources. - **His tools in blam (3.0.0).** `blam blc ACTION FILE` is his `blc`, all 31 actions, without GHC; `blam uni` is his universal machine. - Checked byte for byte against his own `blc`, built from AIT with GHC @@ -151,27 +178,32 @@ programs - Maybe useful to him: a GHC-free `blc` for people trying the repo. - The golf sources: the BLC8 machine is down to 41 bytes, and int.lam's parser is now in ko2kp, nf, int4 and the pairup programs. -- **The 168 (Palmer's self-interpreter): nothing smaller found.** - - What was searched: - - every let structure up to four cuts; - - βη rewrites to +24 bits; - - every single slot, and joint pairs of slots, exhaustively; - - over a hundred hand-designed protocol changes. - - A conditional theorem: split the 168 into seven modules and each one is - the unique smallest term satisfying its own law. The minima reassemble - into the 168 bit for bit, so a smaller interpreter has to fuse control, - share work across modules, change the binder layout, or entangle the - knot with the body. +- **The self-interpreter: 165 bits.** + - Palmer's 168 with one change to the reader: skipvar applied to the whole + stream before the tag is read is right for both cases (the stream past a + 0-tag; the rest past a variable), and `list H (skipvar list)` hands + `list1` to the variable case, which becomes `cont` itself. 3 bits. + - Found by Codex in a fresh-context consult. Before that, a long search had + found nothing below the 168 and produced a conditional theorem: split the + 168 into seven modules, each the unique smallest term meeting its law, + minima summing to exactly 168. The 165 fuses three of those modules + (dispatch, variable, skip), the one assumption the theorem flagged. + - The same reader: uni.lam 187 strict / 175 non-strict, int4 175, and 3 + bits off ko2kp, nf and pairup_Kp. + - Kernel-checked in Lean: both the 168 and the 165 are self-interpreters, + as a β-reduction E C (⌜M⌝ ++ N) →β* C (λz.M) N for every closed M. + - Nothing smaller around the 165: its let structure, βη and contextual + rewrites, every slot of the new reader, and joint searches through + 164-bit interpreters. - **A uniform handler is impossible.** "One handler for both tag bits" is ruled out at any size. `I I` and `(K I) I` normalize to the same thing but leave the input in different places. - - **Near misses:** - - a 180-bit universal machine that uses the parser as its own - continuation; - - a 164-bit candidate that fails, because the identity's value - `λz.I` is the same six bits as the input symbol `1`. + - **Near misses:** a 164-bit candidate that fails, because the identity's + value `λz.I` is the same six bits as the input symbol `1`; the 168's + parser as its own continuation gave a 180-bit universal machine (it no + longer works with the new reader). - Pointer: `docs/classical/self-interpreter/interpreter.md` (and - `universal.md` for the 178/190). + `universal.md` for the 175/187). - **Busy-beaver and Ω results** (if still worth mentioning): - BBλ(33) = 1,812, BBλ(34) = 327,686, BBλ(35) = 38,127,987,424,941: his BB.txt hand arguments for the programs the census leaves open, formalized diff --git a/docs/STATUS.md b/docs/STATUS.md index 508c5aa0..5a0366d9 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -131,8 +131,10 @@ closures, and `bb_halts.tsv` eight halters with exact normal-form sizes, from two seeds. `lake build Certs BusyBeaver` checks all 415 exclusions, the eight halting -certificates, and their wire identities; the Lean development has no sorries -or mathlib, and its axioms are `propext` and `Quot.sound`. +certificates, and their wire identities; `lake build` also checks the +self-interpreter proofs (`Blc/Selfint165.lean`, `Blc/SelfintProof.lean`). The +Lean development has no sorries or mathlib, and its axioms are `propext` and +`Quot.sound`. `scripts/bb-regen.sh` audits the BB registry's axioms, refreshes the frontier, and recomputes the exact bounds. A fresh census 4..40 is bit-identical to every canonical row. Both release suites pass: 368 tests @@ -140,25 +142,35 @@ with all features (three opt-in tests ignored) and 328 with default features. ### Self-interpreter and universal machine -- **The 168** (Sean Palmer's `int.lam`, one let-float of Tromp's 170) has - nothing below it in any searched space: exact let structure to four cuts, - βη component to +24 and contextual moves to +18, parametric and contextual - slot searches, joint two-hole searches, a module lower bound whose unique - per-module minima sum to exactly 168, and over a hundred measured protocol - changes (`classical/self-interpreter/interpreter.md`). The module bound is - conditional on its grammar; a smaller interpreter must fuse control across - modules, share work, change the capture layout (worth at most 8 bits), or - entangle the knot with the body. Unsearched: the dispatch handler without a - direct `cont` at 36–41 bits. +- **The 165** (`classical/self-interpreter/interpreter.md`, + `data/self-interpreter/machines/int165.lam`), Codex's design: Palmer's 168 + with a reader that computes the skip `list list list` once on the whole + stream, where it is right for both dispatch arms, and lets the Scott list + hand `list1` to the variable arm, which becomes `cont` itself (L 17, A 25, + X 29). Lean proves it, and the 168, correct for every closed program as a + β-reduction (`selfint_contract165`, `selfint_contract`). Nothing below 165 + in its neighbourhood: let structure to three cuts (unique minimum), βη + component to +20 (2,183,051 terms) and contextual to +16, every reader slot + singly and handler × skip jointly through 164-bit interpreters (32,366,372 + pairs, no survivor, 4,052,176 capped), whole APP ≤ 34 bits, and the 168's + near misses rebuilt on it (≥ 166; `merges.py`). The 168's module bound + (minima summing to 168) is conditional on opaque modules, the clause the 165 + breaks; it still bounds the NEXT region the two share. Unconditionally, + every interpreter has head normal form `λc s. c A B` or `λc s. s A⃗` and a + duplicated binder, and a β-normal correct interpreter exists, so no knot is + forced; a proof at 165 bits needs a decomposition theorem that does not yet + exist. - **The universal machine** (`classical/self-interpreter/universal.md`): - Tromp's 178 (non-strict) and 190 (strict) stand. Every wiring around the - 168's parser body gives no non-strict machine below 178 (four 178s tie, one - new) and no strict one below 185, conditional on 3,961 and 2,375,084 capped - contexts respectively. A 179-bit alternating parser and a 180-bit - partially-applied-parser machine are correct; joint U-specific searches + Tromp's wirings around the 165's body give 175 (non-strict) and 187 + (strict), against 178 and 190 around the 168's. Wirings around the new body + give no non-strict machine below 175 (14,856,126 contexts, 68,017 capped, + 16,144 of those certified divergent); around the old body no non-strict + machine below 178 and no strict one below 185, conditional on 3,961 and + 2,375,084 capped contexts. Joint U-specific searches around the old body screened 2,207,444,203 assignments below 178 with no survivor and 1,462,818 - caps (`data/self-interpreter/universal.json`). Unsearched: the strict - contexts of 39..43 bits (about 31 billion). + caps (`data/self-interpreter/universal.json`). The partially applied parser + is no longer a universal continuation with the 165's reader. Unsearched: the + strict contexts of 39..43 bits around either body. ### AIT golf @@ -229,7 +241,13 @@ GHC 9.10.3; `uni.rs` with rustc), all three harnesses in 11 minutes: 8. **Discrete Solomonoff induction:** measure Church bit-list decode coverage and build prefix-tree conditional predictions under `m` and `S`. Infinite streams belong to the separate monotone-machine `ref/AIT` lane. -9. **`blam uni` throughput:** within 4× of `uni.c` on byte streams. The next +9. **The self-interpreter below 165** (`classical/self-interpreter/interpreter.md` + §7): readers not of the `list H S` shape, knots entangled with the reader, + and the capped fills of the reader searches. Look for another shared + computation of the kind the reader is, by reasoning first; an unconditional + lower bound needs a decomposition theorem. Upstreaming the 165, 175 and 187 + to tromp/AIT is a9's call (`contrib/PR_KIT.md`). +10. **`blam uni` throughput:** within 4× of `uni.c` on byte streams. The next lever is allocation: a slab with index-based reference counts (or the open global-allocator decision) would remove most of malloc/free and the thread-local accounting from the lazy machine's hot path. @@ -307,8 +325,10 @@ weight-30 slice, so pruning must reduce mid-ladder states. agree at the complete effect-tree level through 24 bits (`blam q selfint 24`: 19,014 programs verified, 34 skipped as unresolved, 0 trace or pure-NF mismatches; witness45 and the poisoned-seed canary pass), and Lean pins the -wire identities and quote linearity; the bisimulation obligations are open -(`quantum/bisimulation.md`). The ≤24 sweep takes 1.5 s wall and 18 CPU-seconds +wire identities and quote linearity and proves the pure-fragment obligations +L1 and L2; the quantum obligations L3, L4 and B1–B5 are open +(`quantum/bisimulation.md`). The 165 would give a 171-bit `intL165 I`, not yet +checked against the qBLC contract. The ≤24 sweep takes 1.5 s wall and 18 CPU-seconds on the M5 Max. `blam q census --cond-k K` implements the conditional family `G_k`, but no @@ -327,7 +347,9 @@ designated-output convention, derive explicit comparison constants with counterpart is measured, and `quantum::scalar::speed_units` is the shared rounding. 4. Complete the complement sweep at sizes 52 and 53. -5. Continue the odd-sector pruning program (α-normalize `BindId`, stronger +5. Check the 171-bit `intL165 I` against the qBLC self-interpretation contract + (`blam q selfint`). +6. Continue the odd-sector pruning program (α-normalize `BindId`, stronger ε/canonical-port quotienting, a simulation-preorder antichain, the component-scoped post-fixpoint with a trusted checker, then the ladder to 44) and the bisimulation proof. CNOT belongs to the separate Pauli-string diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index 8c8d0a1f..d73e410c 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -1,10 +1,12 @@ -# The 168-bit self-interpreter +# The 165-bit self-interpreter This is the record of what is known about the size of BLC's -self-interpreter: its anatomy, every search run against it, and the exact -boundary of what those searches prove. The universal machine, whose contract -differs, has its own record in `universal.md`; the parametric slot searches -are specified in `slots.md`. Logs are in `data/self-interpreter/`. +self-interpreter: its anatomy, its formal proofs, every search run against it +and its predecessor, and the exact boundary of what those searches prove. The +universal machine, whose contract differs, has its own record in +`universal.md`; the parametric slot searches are specified in `slots.md`. +Logs are in `data/self-interpreter/`, the interpreters themselves in +`data/self-interpreter/machines/`. ## 1. The object @@ -15,508 +17,428 @@ E C (⌜M⌝ ++ N) = C (λz. M) N ``` for closed `M`, a rigid continuation `C`, and a rigid remainder `N`. The -current minimum is Sean Palmer's 168-bit `int.lam` (tromp/AIT `2cfa384`). -It is one β-expansion of Tromp's 170: the zero-branch continuation -`\bit1. …` is let-floated out from under `\list \bit0 \list1` to sit just -inside `\cont`. The let costs one λ and one application (+6 bits) and saves -8 bits of de Bruijn depth, so the size identity `|M| = 2L + 4A + 2 + X` reads -`L = 16, A = 26, X = 30` against the 170's `15, 25, 38`. - -**Nothing below 168 is known.** The let-structure, βη, module, and joint-hole -searches also find no other 168. The evidence, by lane, is §3–§5. It is not an -unconditional optimality proof: the module bound of §4 is a theorem only -inside a module grammar, and §6 lists what remains unsearched. - -`tools/self-interpreter/battery.py` is the exact contract check: rigid -continuation and tail, every closed program through 18 bits plus deep-index -extras. Of its 668 programs, the one whose expected result has no normal form -is skipped and 667 must pass. It compares β-normal forms, so an interpreter -correct only up to η fails it (one with arguments before environments -measures 237 and passes a separate βη audit). Every complete interpreter size -below is measured (compiled, then the battery) unless marked otherwise, and -`tools/self-interpreter/merges.py` re-measures the nearest variants. +current minimum is 165 bits (`machines/int165.lam`), Codex's design: -## 2. Anatomy +```text +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +``` + +It is Sean Palmer's 168-bit `int.lam` (tromp/AIT `2cfa384`) with a new +reader; everything from `next` inward is the 168's. The 168 is itself one +β-expansion of Tromp's 170: the zero-branch continuation `\bit1. …` is +let-floated out from under `\list \bit0 \list1` to sit just inside `\cont`. +In the size identity `|M| = 2L + 4A + 2 + X` the three read `(17, 25, 29)`, +`(16, 26, 30)` and `(15, 25, 38)`. + +**Both are proved correct.** `lean/Blc/Selfint165.lean` and +`lean/Blc/SelfintProof.lean` prove in Lean, for the 165 and the 168 pinned to +their wire bits, that `E C (⌜M⌝ ++ N)` β-*reduces* to `C (λz. M) N` for every +closed `M` and any terms `C`, `N` (`selfint_contract165`, `selfint_contract`), +divergent programs included, together with the head-reduction parser +statements of `Blc/Selfint.lean` for every term, open or closed. The axioms are +`propext` and `Quot.sound`. One induction on the source term carries +everything: the parsed closure denotes the term under any cons' environment +(`Den`), implements it under head reduction (`Implements`), and leaves a +residual that spine-reduces to the tail; the variable engine is an induction on +the unary index, and the control is a set of kernel-replayed machine runs on +placeholder terms, lifted because head steps are stable under substitution. + +**Nothing below 165 is known.** §3 lists everything searched around it, §5 the +lower bounds. None is an unconditional optimality proof; §7 says what remains. + +`tools/self-interpreter/battery.py` is the exact contract check used for every +measured size: rigid continuation and tail, every closed program through 18 +bits plus deep-index extras. Of its 668 programs, the one whose expected +result has no normal form is skipped and 667 must pass. It compares β-normal +forms, so an interpreter correct only up to η fails it (one with arguments +before environments measures 237 and passes a separate βη audit). The 165 +also passes 3,341 programs through 21 bits, and its suffix extraction +`E (λv r. r) (⌜M⌝ ++ n)` normalizes to `n` on divergent `M`. +`tools/self-interpreter/merges.py` re-measures the 165, its nearest variants, +and the 168's protocol variants of §6. -Itemized, the 168 spends its bits as follows: +## 2. Anatomy | part | bits | |---|---:| | knot and `intL = x x` let | 22 | -| `\cont`, the `next` let, `\list`, `list H` | 12 | -| dispatch `bit0 (list1 next) ·` | 20 | -| VAR `cont list1 (list1 list1 list1)` | 22 | +| `\cont`, the `next` let, `\list` | 8 | +| reader `list H S`: two applications and `list` | 6 | +| handler `\bit0. bit0 Z cont` around its zero arm | 13 | +| zero arm `Z = \unused \r. r next` | 14 | +| skip `S = list list list` | 10 | | NEXT header `\bit1. intL (\exp. bit1 · ·)` | 17 | | ABS (the `cons'` cell alone is 24) | 40 | | APP | 35 | -Each of the 26 applications does a distinct, necessary job: - -- knot: 3, plus 1 for the shared `intL` let; -- reading and dispatching: read bit0 1, dispatch 2, read bit1 1, the `next` - let 1, first recursive parse 1, dispatch on bit1 2; -- ABS: return 1, enter the body 1, build the cell 3; -- APP: second parse 1, return 1, `exp args (exp2 args)` 3; -- VAR: return 2, skip 2. - -The 16 λs are likewise forced: the knot's two, the two lets, the parser's -`cont` and `list`, the handler's two, `bit1`, `exp`, the λ-value's `args` and -`arg`, the cell's `zx` and `zy`, and APP's `exp2` and `args`. - -The index sum splits as cell 6, the rest of ABS 4, APP 9, NEXT header 3, -dispatch 8. The conventions it rests on are fixed by the contract and the -stream encoding: +The 25 applications: knot 3 and the `intL` let 1; the `next` let 1; the reader +2, its skip 2, the handler's dispatch 2, the zero arm's read of the second bit +1; the first parse 1 and the dispatch on `bit1` 2; ABS 5 (return, enter the +body, build the cell 3); APP 5 (second parse, return, `exp args (exp2 args)` +3). The 17 λs: the knot's two, the two lets, `cont` and `list`, `bit0`, the +zero arm's two, `bit1` and `exp`, the λ-value's `args` and `arg`, the cell's +`zx` and `zy`, and APP's `exp2` and `args`. -- the continuation's `(exp, rest)` order and `\args` before `\arg` come from - `E C (⌜M⌝:N) = C (λz.M) N`; -- the cell's `zx`/`zy` order comes from the stream's bit polarity; -- `cont` before `list` is what lets three η-reductions happen. +### The reader -A let costs 6 bits, so it must save at least 7 in depth to pay off. A smaller -interpreter must therefore delete an operation, rearrange the term along a -path that climbs well above 168 (§3), or change a protocol (§5). +With `s = cons b r` the whole input stream, -## 3. Neighbourhood searches - -These searches stay inside the 168's algorithm: every move preserves -β- or βη-equivalence, so a smaller term found would be correct by -construction (and would still face the battery). +```text +s H S = H b r S S = s s s +``` -### Let structure (`blam golf letopt`) +and `S` is the rest after the first 0 of the *whole* stream: `s s = K r'` +where `r'` is that rest (for a 0-tag, `cons K r s = K K r r = K r`; for a +leading 1, `s s = r r`, and by induction a unary code `1^k 0 ++ N` gives +`K N`). So one skip, computed before the dispatch, is right in both arms: + +- **0-tag:** `S = r` (the stream after the tag), and + `H K r S = Z r S = S next = r next`, the 168's zero branch. +- **Variable** `1^n 0 ++ N`: `S = N`, and `H F r S = cont r S = cont r N`, + the 168's `cont list1 (list1 list1 list1)`. + +Two moves make this pay. The skip is *hoisted*: the 168 computed it inside the +variable arm from `list1`; the 165 computes it once on the whole stream, +where its value happens to be what both arms need. And the Scott list's own +application `H b r S` *supplies* `list1` to the variable arm, so that arm is +`cont` itself and its return application disappears. Against the 168 this is +one λ more, one application fewer, and one bit less of index: `+2 − 4 − 1`. +The 168's module bound (§5) kept dispatch, VAR and skip in separate opaque +modules, which is exactly the boundary this crosses. + +The zero arm receives `list1` twice and must drop a copy; that is the extra λ. +Dropping it through `bit0`, which is `K` in that arm, costs one bit more +(166). Applying the copy to anything leaves an argument that reaches the rigid +`C`, and re-dispatching it through `H` runs into the uniform-handler +impossibility of §5. + +### The NEXT region + +From `next` inward the 165 is the 168, at the same binder stack +`[cont, intL, x]`, and on genuine streams both readers satisfy the same parser +law. So a change confined to NEXT has the same size change and the same +battery outcome on both interpreters (select-first and the K-repair cell are ++1 on each in `merges.py`), and the 168's slot and module results for the +header, ABS, APP, the cell and the lift (§4, `slots.md`) bound the 165's NEXT +region too. + +## 3. Searches around the 165 + +Every search here is exact against the contract; "capped" means a candidate +exhausted its budget without failing a probe, which is not a refutation. + +| search | scope | result | evidence | +|---|---|---|---| +| let structure (`blam golf letopt`) | 181-bit core, 512 cuts, 0–3 cuts: 512 / 104,471 / 12,419,437 configurations | 165 unique minimum (two cuts); one 167; three cuts ≥ 170 | `letopt_165.log` | +| βη component (`blam golf component`) | slack 20, ceiling 185 | 2,183,051 terms, none below 165, no tie | `component_165_slack20.log` | +| contextual component | slack 16 with η: 326,937 terms; slack 18 without η: 654,379 | none below 165, no tie | `component_165_contextual16.log`, `searches_165.json` | +| zero arm | ≤ 14 bits, frame `[bit0 list next cont intL x]` | unique; 8 capped are re-parse loops such as `next bit0 list` | `sketches_165.log` | +| skip | ≤ 10 bits | unique, none capped | `sketches_165.log` | +| handler | ≤ 24 bits | 177,555 fills, no survivor, 7,790 capped | `sketches_165.log` | +| handler × skip jointly | `\list. list H S`, `|H| + |S| ≤ 36` (interpreters ≤ 164) | 32,366,372 pairs, no survivor, 4,052,176 capped | `searches_165.json` | +| cell; APP lift | ≤ 23; ≤ 18 bits, unrestricted frame | 103,547 and 5,131 fills, no survivor, none capped | `searches_165.json` | +| cell × APP value body | sum ≤ 40 | 47,303,158 pairs, no survivor, none capped | `searches_165.json` | +| whole APP | ≤ 34 bits | 21,555,108 fills, no survivor; 218 capped, 5 refuted by `I I` | `searches_165.json` | + +The nearest complete variants (`merges.py`): 166 with the zero arm built from +`bit0` as `bit0 (\r. r next)`; 166 with the zero arm reading the first tail, +`\r \unused. r next`; 166 with select-first or the K-repair cell; 171 with +`\list1` bound and `cont list1` written out; and the zero arm with one binder +(`\r. r next`, 162) fails all 667 programs. Near misses that touch the reader +get worse than they were against the 168, because NEXT's body has four +references above `\cont` and the 14-bit zero arm makes `next` dearer to move: +`next` inside `\list` 172 (+7, against +2 on the 168), the optional second +parse 175 (+10, against +9), the function environment 181 (+16, against +9, +since VAR loses its η), `next` inlined 170, `next = \l. l B` with the zero arm +`\u. next` 168, `next = \u \r. r B` 171. + +Unknown here: readers under the current `next` protocol that are not of the +`list H S` shape, and the capped counts above. + +## 4. The 168's neighbourhood + +These searches stay inside the 168's algorithm, so a smaller term found would +be correct by construction. They also bound the NEXT region the 165 shares. + +### Let structure and βη Inlining every let except the knot gives a 179-bit core with `x x` at both recursive call sites. A *cut* moves the subterm at one or more core positions into a let bound just above an ancestor node; any name the moved subterm needs that is not in scope there becomes a parameter, so one cut is let-floating and -λ-lifting together. Identical binder-free positions may share a cut, which is -how `intL = x x` arises, and cuts nest freely. Each configuration is rendered -at its exact optimum: parameters ordered by use count, η-peelable ones -dropped, lets sharing a node tried in every order. A sampling test inlines -20,000 random renderings back to the core and checks exact equality and the -size accounting, so every rendering is β-equal to the core. - -The core has 468 candidate cuts (12 shared). Exhaustively, with no size -ceiling along the way (`letopt_168.log`): +λ-lifting together. Each configuration is rendered at its exact optimum, and a +sampling test inlines 20,000 random renderings back to the core and checks +exact equality. Over the core's 468 candidate cuts (`letopt_168.log`): | cuts | valid configurations | smallest | |---:|---:|---:| | 0 | 1 | 179 (the core) | -| 1 | 468 | **170**, Tromp's interpreter (the `x x` share) | -| 2 | 89,785 | **168**, Palmer's, uniquely | +| 1 | 468 | 170, Tromp's interpreter (the `x x` share) | +| 2 | 89,785 | 168, Palmer's, uniquely | | 3 | 10,181,950 | 173 | | 4 | 789,542,687 | 179 | -Around the 168 (`--around 4`, `letopt_168_around.log`), its own two cuts plus -one to four more give at least 173, 179, 185, and 192 bits over 182,418,093 -configurations at +4. Each further let or λ-lift on the 168 costs 5–7 bits. - -### βη component (`blam golf component`) - -The component search explores a term's connected component under single -moves, keeping every term at or below `|T0| + slack` bits: - -- **reduce** any β-redex, duplicating if it must; **η−** and **η+**; -- **abstract** one occurrence, or all occurrences, of a subterm whose free - variables point above some node `N`: `N → (\v. N[S := v]) S` (the let-float - that produced the 168); -- **anti-unify** two subterms under `N` that share a skeleton `G`: - `N → (\g. N[S₁ := g A₁…, S₂ := g A₂…]) (\x⃗. G)`, a macro for two - abstractions and a CSE, so helpers in the style of `cons'` and `skipvar` - are one step away instead of about 15 bits uphill. - -Each expansion is checked by reducing the redex it introduced back to the -exact predecessor. From the 170 the 168 lies in the component at slack 0. -From the 168: - -| slack | ceiling | component | below 168 | ties | -|---:|---:|---:|---:|---:| -| 4 | 172 | 10 | 0 | 0 | -| 8 | 176 | 227 | 0 | 0 | -| 12 | 180 | 2,717 | 0 | 0 | -| 16 | 184 | 115,182 | 0 | 0 | -| 20 | 188 | 2,011,848 | 0 | 0 | -| 24 | 192 | 25,405,902 | 0 | 0 | - -Slack 16 takes 1.5 s, slack 20 40 s, and slack 24 7.8 minutes of search -(33 minutes wall in all, 4.5 GB peak footprint). -An arithmetic pre-check (per-position free-index histograms) skips -out-of-ceiling abstractions and anti-unifications without building them. -`tools/self-interpreter/beta_search.py` is the Python reference: it reproduces -the components through slack 16 exactly (`betasearch_168.log`), and a Rust -regression test pins the first three. Anti-unification contributes 1 term at -slack 16 and 25 at slack 20; growth per 4 bits of slack is 42×, 17×, then -12.6×. - -The 168's nearest neighbours sit at +2: the 170, one reduction away, and a -term binding `intL = a a` inside the floated continuation instead of around -`\cont`, reached by inlining that binding (171) and re-sharing it one level -down. - -`--contextual` flags the 168's boolean binders (`bit0`, `bit1`, `zx`; a test -pins exactly these three) and adds four move kinds for a flagged `b`: -`(b X Y) Z <~> b (X Z) (Y Z)`, `F (b X Y) <~> b (F X) (F Y)`, -`\v. b X Y <~> b (\v. X) (\v. Y)`, and branch specialization. These -equalities hold on the inputs the interpreter actually receives, not in βη. - -| slack | distinct terms | flag-carrying states | -|---:|---:|---:| -| 4 | 42 | 42 | -| 8 | 843 | 2,338 | -| 12 | 15,518 | 116,832 | -| 16 | 537,227 | 4,162,503 | -| 18 | 2,156,068 | 16.8 million | - -Three 169-bit neighbours appear at slack 4; nothing goes below 168 and there -is no tie (`component_168_contextual*.log`). - -The component is blind by construction to anything not βη-equal to the 168, -including data-representation changes like the 206 → 170 `cons'`/`skipvar` -rewrite and internal calling-convention permutations that keep the external -contract but change the β-class. - -### The knot (`tools/self-interpreter/search_fix.py`) - -With the interpreter body as an opaque zero-cost atom `H`, every closed BLC -context around it was enumerated. The 7,458 contexts below 20 bits contain no -weak-head self-reproducing knot; among the 14,803 through 20 bits the only one -is the 168's own `(\a.a a)(\a.H(a a))`. The scope is contexts whose weak-head -reduction exposes `H Y` with `Y` equal to an earlier state on the path; knots -entangled with the body are not covered (§5 attacks those). - -## 4. Slot and module bounds - -### Parametric slots - -VAR, ABS, and APP are each the unique survivor of an exhaustive search in the -168's own frames, with no residual unknowns (`slots.md`). - -### Contextual slots (`blam selfint ctx`) - -Parametric searches exclude fragments that work only because of what the -frame variables are at run time: in the ABS branch `bit1` is `true`, in APP it -is `false`, `x x` is `intL`, and in VAR `list` is `(false : list1)`, so -`list bit0` is `list1`. `ctx` splices each candidate into the 168 and accepts -it only if the interpreter then meets the exact contract on 91 probe -programs: every closed term of 4..14 bits plus the battery's deep-index and -reducible extras. The check normalizes `\c \n. E' c (⌜M⌝ ++ n)` against the -reference's normal form with `c` and `n` rigid. Enumeration requires only the -frame variables whose information cannot reach the result any other way: -`cont`, the sole route to the rigid continuation, and `exp` in ABS/APP, the -sole route to the parsed subterm (each slot's `must` in `ctx.rs`). - -Candidates strictly smaller than the reference: - -| slot | frame | reference | candidates | survivors | unknown | -|---|---:|---:|---:|---:|---:| -| VAR, with a direct `cont` | 7 | 22 | 2,433 | 0 | 1 | -| VAR, unrestricted | 7 | 22 | 56,703 | 0 | 81 | -| APP's value `\args. exp args (exp2 args)` | 6 | 19 | 1,158 | 0 | 0 | -| `cons'` cell | 7 | 24 | 30,428 | 0 | 0 | -| APP | 5 | 35 | 21,555,108 | 0 | 3 | -| ABS | 5 | 40 | 558,135,222 | 0 | 1,983 | -| dispatch handler, with a direct `cont` | 5 | 42 | 2,563,792,977 | 0 | 162,309,366* | -| dispatch handler, unrestricted, through 35 bits | 5 | 42 | 163,041,847 | 0 | 12,071,331 | - -"Unknown" means the candidate passed or ran out of budget on every probe, -after 512× the reference's budget plus the divergence oracle and the -escalation engine; it is not a survivor. The VAR unknowns re-parse the same -stream forever with a growing continuation. Of the APP unknowns, -`cont (intL intL (intL exp) intL)` is refuted by Church–Rosser: on a -top-level application it returns `c X ⌜N⌝++n`, never `c (λz. M N) n`. The -other two, `intL intL (intL exp) intL cont` and its `exp`/`cont` swap, halt -correctly on application-free programs and exhaust the escalation engine at -10× its capacity and 4× its work meter on `(\1 1)(\\1)`. The ABS unknowns -sampled are Ω-shaped self-applications of `intL` partials, such as -`(\l. l l) (intL (intL exp) (intL cont))`. - -In VAR and the handler `next` is in scope and captures `cont`, so requiring a -direct `cont` there narrows the search; the unrestricted rows are the sound -contextual statement, and the handler's runs only through 35 bits -(interpreters ≤ 161). \* The restricted handler run stops a candidate after -three budget-exhausted probes and does not escalate a size with more than -20,000 unknowns, so its unknowns are "no failing probe before three caps", -mostly handlers that ignore the stream and recurse. - -### A conditional lower bound (`tools/self-interpreter/module_bound.py`) - -Split the 168 into modules along the partition of §2, and enumerate each -module exhaustively at its own de Bruijn depth: every term up to the -reference size, redexes and discarded code included. Neighbouring modules are -replaced by fresh rigid symbols, and a module passes when its β-normal forms -on rigid probes equal the law it must satisfy. - -| module | law (neighbours rigid) | generated | minimum | -|---|---|---:|---:| -| VAR | `c s n` on the unary suffixes `0`, `10`, `110` | 56,703 | **22** | -| dispatch | `D[K, s] = s next`, `D[F, s] = VAR`, two binders | 7,475 | **16 + 4** | -| cell | `T(a,e) K n = a`, `T(a, T(b,e)) F (0:n) = b` | 97,435 | **24** | -| lift | `L e = f e (g e)` | 9,182 | **19** | -| ABS around the cell | `c (\env \arg. f (R arg env))` | 1,967 | **16 + 24** | -| APP around the lift | `p (\g. c (V f g))` | 4,324 | **16 + 19** | -| NEXT around ABS, APP | `p (\f. A f)` / `p (\f. B f)` by tag | 6,426 | **15 + 2** | -| administration | `\c \list. list (H c (J c))` | 122 | **12** | -| knot around an opaque body | keeps weak-head-unfolding the body forever | 14,803 | **20 + 2** | - -Every minimum is unique and is the 168's own module. `module_bound.py -assemble` fills the minima into one another and reproduces the 168 bit for -bit, so the bound has no gap: +Around the 168 (`--around 4`, `letopt_168_around.log`), one to four more cuts +give at least 173, 179, 185 and 192 bits over 182,418,093 configurations. + +The βη component (`blam golf component`) explores a term's connected component +under reduction, η± , abstraction (let-floating) and anti-unification (a macro +for two abstractions and a CSE, so `cons'`- and `skipvar`-style helpers are +one step away), keeping every term within `|T0| + slack` bits. From the 168: + +| slack | ceiling | component | below 168 | +|---:|---:|---:|---:| +| 16 | 184 | 115,182 | 0 | +| 20 | 188 | 2,011,848 | 0 | +| 24 | 192 | 25,405,902 | 0 | + +`tools/self-interpreter/beta_search.py` reproduces the components through +slack 16 (`betasearch_168.log`). `--contextual` adds boolean commuting and +specialization moves for `bit0`, `bit1` and `zx`, equalities that hold on the +interpreter's actual inputs: through slack 18 (2,156,068 terms) there are +three 169-bit neighbours (K-repair, select-first, the η-handler) and nothing +smaller (`component_168_contextual*.log`). The 165 is the η-handler with its +skip hoisted and both arms η-reduced: the component is blind to it because the +hoisted skip is not β-equal to the 168's on arbitrary streams. + +The knot: with the body opaque, the only weak-head self-reproducing context +through 20 bits is the 168's own `(\a.a a)(\a.H(a a))` +(`tools/self-interpreter/search_fix.py`). + +### Slots + +VAR, ABS and APP are each the unique survivor of an exhaustive parametric +search in the 168's frames (`slots.md`). The contextual searches +(`blam selfint ctx`) splice candidates into the 168 and accept a candidate only +if it meets the exact contract on 91 probe programs; strictly smaller than the +reference: + +| slot | reference | candidates | survivors | unknown | +|---|---:|---:|---:|---:| +| VAR, unrestricted | 22 | 56,703 | 0 | 81 | +| APP's value `\args. exp args (exp2 args)` | 19 | 1,158 | 0 | 0 | +| `cons'` cell | 24 | 30,428 | 0 | 0 | +| APP | 35 | 21,555,108 | 0 | 3 | +| ABS | 40 | 558,135,222 | 0 | 1,983 | +| dispatch handler, unrestricted, through 35 bits | 42 | 163,041,847 | 0 | 12,071,331 | + +The VAR unknowns re-parse the same stream forever with a growing continuation. +Of the APP unknowns, `cont (intL intL (intL exp) intL)` is refuted by +Church–Rosser: on a top-level application it returns `c X ⌜N⌝++n`. The other +two, `intL intL (intL exp) intL cont` and its `exp`/`cont` swap, halt correctly +on application-free programs and exhaust the escalation engine at 10× its +capacity and 4× its work meter on `(\1 1)(\\1)`. The ABS unknowns sampled are +Ω-shaped self-applications of `intL` partials. + +### Joint holes + +`blam selfint hole TEMPLATE` enumerates every fill of one hole `_`, or two +holes `_` and `~` jointly, under the same exact contract; +`tools/self-interpreter/sketches.py` holds the templates and +`sketches_168.log` the results. In the 168 every joint search — variable value +× cell (795,310 pairs), cell × APP value body (78,240,524), VAR × APP value +body (2,830,368), whole NEXT structure × VAR (651,844,225), dispatch reader × +APP continuation (271,637,651), whole dispatch × APP continuation +(776,816,521), administration's reader × VAR (213,338) — finds only the 168's +own pair. Ten alternative cells (leaky, Scott and flipped, selK, `cons'` flips) +against every variable value and every VAR up to 24 bits find only selK, at +170. + +### The module grammar + +Split the 168 into modules and enumerate each exhaustively at its own de Bruijn +depth, every term up to the reference size, with its neighbours replaced by +fresh rigid symbols; a module passes when its β-normal forms on rigid probes +equal its law (`tools/self-interpreter/module_bound.py`, +`module_bound/`). Every minimum is unique and is the 168's own module, and the +minima reassemble into the 168 bit for bit: ```text -22 + 12 + 20 + 22 + 17 + 40 + 35 = 168 +knot 22 + administration 12 + dispatch 20 + VAR 22 + NEXT 17 + + ABS 40 (16 + cell 24) + APP 35 (16 + lift 19) = 168 ``` -All searches are exact, with no unresolved reduction; a repeated -normal-order state counts as a proof of looping. `audit` re-normalizes every -probe with an independent normalizer and a sample with the Rust machine -(70,645 and 543 checks, no disagreement). Results are in -`data/self-interpreter/module_bound/`. - -The cell law is the weakest one reachable: it asks only for the two -behaviours that `λx.x` and `λx.λy.x` expose, on a real unary suffix and a -self-built environment. APP's lift needs 19 bits even when tested only on -closed subterms: the parser forces their values to be `K F` and `K G`, and -four closed pairs reject all 5,131 smaller candidates. - -**The grammar is narrower than all interpreters, and the gap is exact.** - -- modules are opaque; -- neighbours are rigid when a module's law is checked, which is stronger than - the public contract; -- the capture layout is the 168's: `next` named, the handler under - `\list \bit0 \list1`; -- the knot treats the body as opaque. - -A smaller interpreter must break one clause: fuse control across modules, -share work between them, change the capture layout, or entangle the knot with -the body. It need not abandon CPS, stream-valued variables, or the public -contract. The capture layout is worth at most 8 bits: re-searching five -modules with only their own live variables in scope (`*_packed`) gives 160 in -all, - -| module | in the 168 | own variables only | extra depth in the 168 | -|---|---:|---:|---| -| VAR | 22 | 19 | `cont` crosses 3 binders | -| dispatch | 20 | 19 | `next` crosses `list` | -| NEXT | 17 | 16 | `intL` crosses `cont` | -| ABS | 40 | 39 | `cont` crosses `bit1` | -| APP | 35 | 33 | `intL`, `cont` cross `bit1` | - -but these frames cannot coexist in one lexical tree, and `letopt` has priced -every let structure of up to four cuts that trades on this tax (§3). - -### Joint holes (`blam selfint hole`) - -`blam selfint hole TEMPLATE` takes the wire bits of any interpreter with a -`_` hole, and optionally a second hole `~` searched jointly, and enumerates -every fill under the same exact contract as `ctx`, with goldens from the 168. -A hand-made protocol change in one place can thus be paired with an -exhaustive search for the compensating fragment elsewhere. -`tools/self-interpreter/sketches.py` holds 41 sketches (one control, 37 -single-hole variants, and three joint searches); their log is -`sketches_168.log`. - -| sketch | fills | result | -|---|---:|---| -| 12 variable values (`list`, `list1 list1`, `bit0 list1`, `list1 next`, …) × cell ≤ 25 | 110,510 each | only `list bit0` (= `list1` in context): cell 24, and the 25-bit K-repair | -| 10 cells (leaky, Scott and flipped, selK, `cons'` flips, `\zx. zx arg`, …) × variable value ≤ 14 | 533 each | only selK, at 170 | -| the same 10 cells × whole VAR ≤ 24 | 16,096 each | only selK, at 170 | -| 169 K-repair frame × APP value ≤ 17, × VAR ≤ 21 | 2,904; 2,433 | only the frame's own APP value (169); no VAR, 1 capped | -| 169 η-handler frame × VAR function ≤ 21, × zero branch ≤ 11 | 4,382; 102 | no VAR function, 18 capped; only the frame's own zero branch (169) | -| 169 select-first frame × APP continuation ≤ 34 | 25,452,149 | nothing below 168 | -| **joint** variable value ≤ 12 × cell, sum ≤ 26 | 795,310 pairs | only the 168's (2 + 24) | -| **joint** cell × APP value body, sum ≤ 41 | 78,240,524 pairs | only the 168's (24 + 17) | -| **joint** VAR × APP value body, sum ≤ 39 | 2,830,368 pairs | only the 168's (22 + 17) | -| whole NEXT structure × VAR | 651,844,225 pairs | only the 168's; 379,648 capped | -| dispatch reader × APP continuation | 271,637,651 pairs | only the 168's; 23 capped, all discharged | -| whole dispatch × APP continuation | 776,816,521 pairs | only the 168's; 5,724,457 capped | -| administration's reader × VAR | 213,338 pairs | only the 168's; 8,998 capped | - -The environment, lookup and application protocols are therefore optimal -jointly as well as singly. The capped fills are the re-parsing loops `ctx` -already meets; the 23 discharged caps omit `cont` from APP's continuation, so -their normal forms cannot be headed by `C`. - -## 5. Protocol changes - -A protocol change alters what an operation passes or expects, so it leaves -the 168's βη class and every search above. Over a hundred have been built and -measured; none goes below 168. +The grammar assumes four clauses: modules are opaque; neighbours are rigid when +a law is checked; the capture layout is the 168's; and the knot treats the +body as opaque. Re-searching five modules with only their own live variables in +scope gives 160, so the 168's shared lexical layout pays 8 bits (VAR 3, +dispatch 1, NEXT 1, ABS 1, APP 2). The 165 breaks the first clause: its reader +fuses administration, dispatch, VAR and skip. The laws of NEXT, ABS, APP, the +cell and the lift are untouched by it. + +## 5. Lower bounds + +### What holds for every interpreter + +Standard tools (Church–Rosser, solvability, head normal forms) give the +following for any closed `E` meeting the contract. + +**Head shape.** `E`'s principal head normal form is `λc s. c A B` or +`λc s. s A1 … Ak` (`k ≥ 1`). *Proof:* the contract instance's right side is +solvable, so `E` is, with closed hnf `λx1 … xn. xi P⃗`. With `n ≥ 3`, applying +two arguments leaves an outer λ, which no reduct of `C (λz.M) N` has; with +`n = 1` the head is `c`, the supplied stream is its last argument and arity +forces it to equal `N`, but `⌜M⌝ ++ N ≠β N`. So `n = 2`; head `c` forces +exactly two arguments, and head `s` needs one to consume the stream's outer λ. +Both shapes occur: the 165 and 168 are `s`-headed; parsing twice, +`λc s. c (E (λv r. v) s) (E (λv r. r) s)`, is a correct `c`-headed +interpreter. + +**Duplication.** Some binder of `E` occurs at least twice. *Proof:* the stream +cells and both booleans are affine, and β preserves affineness, so an affine +`E` would make `E C ⌜λx. x x⌝N` affine, while its required β-normal form +`C (λz. λx. x x) N` is not. + +**No knot is forced.** A correct interpreter can be β-normal. Mark every +application of a correct `E0` with a fresh `b`, `(U V)ᵇ = b Uᵇ b Vᵇ`, so `E0ᵇ` +is normal and `E0ᵇ[b := K] →* E0`; then `λc s. s (λb r. b E0ᵇ b c s)` is +β-normal and correct, because every closed program's first bit is 0 (`K`). +Built on the 165 it is 712 bits (on the 168, 753), and both pass the battery. So any argument that a +small interpreter must contain a fixed-point combinator, a syntactic `x x`, or +an infinite Böhm tree needs a quantitative step; correctness alone does not +supply one. + +**Search cost.** There are about `1.02 × 10^44` closed terms of 167 bits. The +property "is a self-interpreter" is Π⁰₂-complete in general, so no total +decision procedure exists; at a fixed size bound the theorem is a finite +conjunction, and if it is true some finite set of programs separates every +smaller term, but nothing bounds that set or makes its β-disequalities +decidable. A prototype sound demand-driven search (narrowing over terms with +holes, pruned by reachability, exact loop detection and a size-canonicity rule +for affine redexes; not in the tree) estimates its own tree at about `10^34` +nodes from scratch and `10^12` with the 168's frame fixed except the three +semantic slots. A proof at this size therefore needs a decomposition theorem — +a way to localize the interpreter's roles in separately priced subterms — and +the 165 shows that the natural decomposition is false. + +### Exclusions at every size + +- **One handler for both tag bits is impossible.** Using `H c` for the first + bit and `H (A c)` for the second would delete `next`. That forces + `E c (0:s) = E (A c) s` and `E c (1:s) = c s (s s s)`. Then `λx.x` gives + `A (A c) (0:N) N = c (λz.I) N`. Both `I I` and `(K I) I` normalize to `I`, so + each requires `A c (λz.I) N` to equal `c (λz.I) R`; but they leave different + remainders `R` after the misread variable. +- **`E E = E` is impossible:** the identity program refutes it. +- **A contract-preserving continuation that is also its own knot driver is + impossible:** M = Ω refutes it. +- **A shared head cannot carry the only tag dependence.** If + `next b s = P (λf r. (b C P) (H[C,P,f,s,r]) r) s` with `H` independent of + `b`, take `R = ⌜I⌝ ++ N` and `S = ⌜I⌝ ++ R`: the ABS program `λx.I` with tail + `R` and the APP program `I I` with tail `N` reach the same payload `H0`, ABS + forces `H0 = K (K I)`, and APP then returns `I` instead of `C (K I) N`. +- **A mode-free ABS/APP value builder is impossible:** a `W` with + `W f K e = λa. f (cell a e)` and `W f g e = f e (g e)` for every value `g` + meets `f = K (K I)`, `g = K Ω`: APP requires `I`, ABS `K (K I)`, and the + genericity lemma forbids telling the unsolvable `K Ω` apart from `K`. +- **A destructured rest cannot reach the root:** a protocol whose + continuations receive the rest as `k v b r` needs an adapter at the root, + because the contract's final rest is the rigid `N`, which no term + destructures; without one it fails every program. +- **Handler-only knots stay `C`-headed:** `H H → C next C`, and every + application tree of two or more copies of the 165's handler reduces to a + `C`-headed term, so replicating the handler alone cannot make an internal + parser while `C` is public and rigid. + +## 6. Protocol changes + +A protocol change alters what an operation passes or expects, so it leaves the +βη class and every search of §4. Over a hundred have been built and measured +against the 168; none goes below it, and those confined to NEXT keep their +size change on the 165 (§2). ### Operation merges | idea | saves | obstacle | |---|---:|---| -| Return the rest as a thunk: `list1 list1` is literally `K rest`, so VAR could be `cont list1 (list1 list1)` | 4 | Every term ends in a variable, so every rest becomes a thunk. `intL` then needs a uniform force `D` with `D b l h = h b l` in `list D H`; even a one-leaf `D` costs an application and a leaf (≥ 4 bits), so the trade breaks even at best. And `C` must receive `N`, not `K N`. | +| Return the rest as a thunk: `list1 list1` is literally `K rest` | 4 | Every rest becomes a thunk; `intL` then needs a uniform force costing ≥ 4 bits, and `C` must receive `N`, not `K N`. | | Scott-pair environment `\f. f arg args` | ~12 | Stream-driven lookup flips orientation each step; a self-passing lookup helper costs ~45+. | -| Leaky cell `\zx. zx arg (\zy. zy args)` | 2 | Lookup returns `x rest`. Absorbing it needs K-wrapped values, but λ-values escape to `C` and must be genuine functions of raw arguments. The repairs `\zx. zx (\u. arg) (\zy. zy args)` and `\zx. zx (zx arg) (\zy. zy args)` are 169 and 170. | -| Variable value `list` (keep the leading 1) | — | Off by one in the environment; the repair costs a second cell. The zero branch still binds `list1`, so even a free repair saves nothing. | -| Destructured rest (`cont exp b l`), dropping `\list. list H` | 6 | `next` loses its η over the tail (+6 plus depth), and `E` needs adapters on both sides of the contract. | -| Parse under the binder: direct values, so APP is `f a` and the variable is `list1 env` | large in APP/VAR | Threading the environment and reparsing ABS bodies cost more; as a universal machine it measures 226 against 178. | -| Share one combinator between the cell and APP (both have skeleton `a b (c d)`) | 5 | The let plus a four-λ definition costs ~32. | -| Select the ABS/APP continuation before the first parse | — | 169. | -| η-reduce the handler: `\bit0. bit0 (\l. l next) (\l. cont l (l l l))` | — | 169. | - -The binding constraint is the contract, twice over. λ-values must be genuine -functions, which rules out every cheaper cell; and `C` must receive the real +| Leaky cell `\zx. zx arg (\zy. zy args)` | 2 | Lookup returns `x rest`; absorbing it needs K-wrapped values, but λ-values escape to `C` as genuine functions. Repairs measure 169 and 170. | +| Variable value `list` (keep the leading 1) | — | Off by one in the environment; the repair costs a second cell. | +| Parse under the binder: direct values | large in APP/VAR | Threading the environment and reparsing ABS bodies cost more (226 as a universal machine against 178). | +| Share one combinator between the cell and APP (skeleton `a b (c d)`) | 5 | The let plus a four-λ definition costs ~32. | + +The binding constraint is the contract, twice over: λ-values must be genuine +functions, which rules out every cheaper cell, and `C` must receive the real `N`, which rules out the thunk. ### Measured protocol variants -Unless marked, each passes the battery and is larger. +Unless marked, each passes the battery and is larger than the 168. | idea | bits | obstacle | |---|---:|---| | **Stream and bits** | | | -| Right-associated skip `l (l l)` | 168, *fails* | returns `N r`; the identity program already fails | -| Skip's ignored argument `bit0` / `next` / `cont` / `intL` | 169–173 | deeper reference than `list1` | -| Read both tag bits before dispatch (with or without `next`) | 193 | VAR still needs `list1`, so `list2` is extra | -| Delay the tag read: `list1 bit0` with bit0 = K | 178 | the tail still needs its own projection | +| Right-associated skip `l (l l)` | 168, *fails* | returns `N r` | +| Read both tag bits before dispatch | 193 | VAR still needs `list1` | | Rest as a thunk `l l`, forced at APP and at the boundary | 202 | forcing sites and an output adapter | -| Thunked parser inputs too | 217 | thunk constructors plus adapters | | Raw suffix returned, skip at parser entry | 247 | sentinels for first parses, two adapters | -| `intL exp` as APP's second continuation | 142, *fails* | an environment reader is not an application continuation | | `r intL = bit1 value rest`: read with the parser | 164, *fails* | keeps the value for ABS, the rest for APP; loses one each | | **Values and environments** | | | -| Bare leaky cell | 166, *fails* | `λx.x` alone leaks the rigid `N` into a neutral application | -| Leaky cell, `bit1` (= K in ABS) as the thunk | 174 | `bit1` is deep | -| Leaky cell, environment applied after selection | 171 | `\zx\zy. zx (\u.arg) zy args` | -| Cells ≤ 27 bits that the battery accepts | 168–171 | only the four known forms | +| Bare leaky cell | 166, *fails* | `λx.x` alone leaks the rigid `N` | | Function environment `\s. s (\b. b (\u.a) e)`, value `\e. e list1` | 177 | no lookup helper needed; the value adapter costs 7 | -| Environment applied to the code | 183 | adapters on both sides | -| Leading-1-aware environment | 180 | sentinel parameter and forwarding | -| Variable value `list` with `cons'` cells | 170, *fails* | lookup starts one cell too far | -| K-thunked environments / K-wrapped values / CPS values | 191 / 225 / 242 | forcing everywhere and an external decoder | | Scott cells with a shared lookup (two orders) | 236 / 243 | a 12-bit cheaper cell, a recursive lookup | | Indices parsed into Scott selectors by `intL` | 222 | zero/successor parsing and accessors | | Absolute de Bruijn levels | 449 | depth state and runtime append | -| Lookup fused with skipping the variable code | 296 | larger cells, dummy extensions while scanning | -| Values that also return their code suffix (ABS captures it) | 273 | cell 24 → 36, APP value 19 → 52 | -| … and APP really parsing its argument from that suffix | 286 | runtime parsing machinery | -| APP reparses the captured argument code at evaluation | 199 | a second parser call and its closures | -| Self-skipping semantic capsules (`p p = K R`, `p p p = R`) | 332 | projections and repacking | -| Whole ABS values with leading-1, transposed and self-passing VARs | — | 10,092,839 fills: no survivor, 169 capped | -| Cell/APP alias: APP's value `\args. args exp exp2`, since `cell a e (K M) (K P) = M P` | 164, *fails* | fails 577 programs: at the root the environment is the contract's arbitrary `z`, and inside an environment `λz.I` equals the input bit `1`, so one call cannot be both a lookup and an application; no cell of any size repairs the alias, and none of 402,644 cells up to 27 bits does | +| Values that also return their code suffix | 273 | cell 24 → 36, APP value 19 → 52 | +| Cell/APP alias: APP's value `\args. args exp exp2`, since `cell a e (K M) (K P) = M P` | 164, *fails* | fails 577 programs: at the root the environment is the contract's arbitrary `z`, and inside an environment `λz.I` equals the input bit `1`; no cell up to 27 bits repairs it | | **Control and calling convention** | | | | `next` inside `\list` | 170 | +2 of depth | | Parser takes the stream first | 201–208 | recursive calls lose η over the stream | -| Handler signatures with `cont` (all orders) | 192–255 | adapters between stream fields | | Continuation gets `rest, value` | 214 | ABS keeps its rest; boundary flip | -| Parser returns a cell `\c. c value rest` (either field order) | 211 / 226 | explicit rest binders and rebuilt cells | +| Parser returns a cell `\c. c value rest` | 211 / 226 | explicit rest binders and rebuilt cells | | ABS's return and APP's second parse share `(bit1 cont intL)` | 172 | one λ fewer, one application more, +2 depth | -| Decide before parsing and η the handler, together | 170 | the two +1s add | | Optional second parse, no-input parser `\k. k k` | 177 | the tag is still decided inside the value | -| Branch transformers for the ABS/APP continuation | 176 | transformer binders and applications | | Direct evaluation plus a separate syntax skipper | 293 | two recursive bodies and retained code pointers | -| Explicit mode flags, tag-first dispatch, two continuation slots, `bit1 = KI` as a skipping continuation | 203–219 | the variants that escape the uniform-handler impossibility below | +| Explicit mode flags, tag-first dispatch, two continuation slots | 203–219 | the variants that escape the uniform-handler impossibility | | **Recursion** | | | | Self-passing `next` with a shared parser, best of 72 orders | 182 | carrier plumbing exceeds the knot | -| Self-passing `next` sharing the handler | 206 | stream-to-handler adapters | -| Recursion inside the bit handler (24 argument orders) | 202 | recursive entry needs an adapter | -| Recursor passed through continuations, before / after the value | 206 / 204 | callback arguments plus a public adapter | -| Saturated parser passed through callbacks | 200 | keeps the knot, adds plumbing | -| Recursor carried in a Scott cell with the rest or the value | 223–262 | packing, unpacking, restoring the rest | +| Recursion inside the bit handler | 202 | recursive entry needs an adapter | +| Recursor passed through continuations | 204 / 206 | callback arguments plus a public adapter | | A cell holding F performs the knot: `cell(a,e) cell(a,e) = λk. a a (k e e)` | 199 | the continuation receives two extra arguments | -| Knot shared with skip's self-application | 168 | optimization returns the 168 itself | -| Knot shared as a triple self-application | 176, *fails*; 181 | the third self-argument reaches the body | -| Known leading 0 of closed programs at entry | 201 | the specialised entry does not pay for itself | | Both recursive call heads replaced, with the knot removed | — | 221,930,567 pairs (34 free bits): no survivor | -The last row is the strongest test of recursion without the knot. Two holes -replace both recursive call heads; they can use the stream, its tail, both -tags, the continuation and the first expression, and may build any -self-application within 34 bits. The two pairs that ran out of budget are -excluded analytically: each loses its head normal form before a callback -runs. Two cheaper variants are also clean: with the knot but without the -`intL` let (8,884 pairs), and with `next` inlined too (131,345). Joint -searches that change the knot generator together with the cell, VAR, or the -APP value (873,378, 1,176,245 and 56,803 pairs) find nothing. Two proposed -free carriers erase what they carry: +## 7. Boundaries -```text -V_M R = M a closed value's environment slot -(s s) R = N skip's ignored argument -``` +The 165 is pinned locally from every direction searched: its let structure, βη +and contextual components, every slot of its reader singly and the handler and +skip jointly through interpreters of 164 bits, and the NEXT region it shares +with the 168. A sub-165 would need another fusion of the kind the reader is: +work that two parts of the interpreter need, computed once where its value is +right for both, or a Scott structure whose own application supplies an +argument. -### Exclusions that hold at every size +Open: -- **One handler for both tag bits is impossible.** Using `H c` for the first - bit and `H (A c)` for the second would delete `next`. That forces - `E c (0:s) = E (A c) s` and `E c (1:s) = c s (s s s)`. Then `λx.x` gives - `A (A c) (0:N) N = c (λz.I) N`. Both `I I` and `(K I) I` normalize to `I`, - so each requires `A c (λz.I) N` to equal `c (λz.I) R`; but they leave - different remainders R after the misread variable, so no `A` satisfies - both. -- **`E E = E` is impossible:** the identity program refutes it. -- **A contract-preserving continuation that is also its own knot driver is - impossible:** M = Ω refutes it. +- readers under the current `next` protocol that are not of the `list H S` + shape, and readers with a different `next` protocol beyond the handful + priced in §3; +- knots entangled with the 165's reader (the stream's own `list list list`, the + handler diagonal `H H → C next C`); +- the capped fills of §3 (4,052,176 in the joint reader search, 7,790 in the + handler, 218 in whole APP) and of §4; +- an unconditional lower bound beyond small sizes: §5 states the structure + every interpreter has, and why a proof at this size needs a decomposition + theorem that does not yet exist. -### Fused control and stream algebra - -- **Grammars** with an abstract CPS parser oracle leave only the original - ordering at each level: first-parse scheduling (1,167,608 well-scoped - candidates); first-bit dispatch, second-bit read and first parse jointly - (7,495,488 candidates from 121,080,960 trees); and the same region with ABS - and APP continuations λ-lifted (2,949,120 candidates, where only - select-first, at 169, survives). -- **Concrete holes** with `intL` and `x` exposed: reader, post-parse - selector, whole NEXT, and both orders of the 172's payload, up to 5.4 - million fills each. After two-cut `letopt` every survivor is the 168, a 169, - or the 172, and the 172 under contextual polishing without η to slack 16 - (188,587 states) has nothing smaller. -- **Stream algebra.** Write `l = 1^k0 ++ N`, with head `b` and tail `r`. Then - `{l, K N, N-headed spines}` is closed under application: - - ```text - l l = K N l (K N) = N r (K N) X = N - ``` - - So no pure self-application of a stream yields the tag or the first tail on - its own. A catalogue of 197 applications of `l` alone gives nothing new, and - `(l l) l` is the unique two-application skip. The 2,419,280 dispatch bodies - built from applications of `l`, `cont` and `next`, through every size below - the reference's, include none that handles both `00…` and `10…`. - -### Tromp's 170 and its families - -The 170 is the one-cut optimum of §3. Its own rearrangement families were -measured in its frame: two-level knot binding `a a` only inside the non-VAR -branch 173 (moving that binding through its five scope positions gives 170, -173, 174, 174, 173), selector-self-absorbing cons 172, shared `cont` via -branch transformers 176, optional-second-parse construction with one `cont` -occurrence 179, direct open-self knot 179. None of these families contains -the 168: binder placement there moved only the existing `intL = a a` binding, -not the zero-branch continuation. - -## 6. Boundaries - -Everything searched pins the 168 from independent directions: its parts -(each module the unique minimum of its law, summing to 168), its -neighbourhood (βη to +24, contextual moves to +18, let structure to four -cuts, single and joint slots), and over a hundred protocol changes. A sub-168 -would need a specific new identity involving the knot variable, the stream -encoding, or semantic values, of the kind `cons'` and `skipvar` were. - -Not searched: - -- the dispatch handler without a direct `cont`, at 36–41 bits. Going through - `next` can only deliver ABS- or APP-shaped values to `cont`, so a survivor - there would be surprising, but the range is open; -- co-designed protocols beyond every search above: a handler and - continuation designed together with the knot, or explicit modes with - separate continuation slots. The variants measured in those directions - (explicit modes 203–219, handler recursion 202–206) cost 34 bits or more - over the 168. - -## 7. Reproduce +## 8. Reproduce | instrument | what it runs | |---|---| +| `tools/self-interpreter/battery.py` | the exact contract on 668 programs (`--max-bits`, `--uni`) | +| `tools/self-interpreter/merges.py` | the 165, its nearest variants, and the 168's protocol variants | +| `blam golf letopt`, `blam golf component` (lab) | let structure and βη component (`--contextual`) | +| `blam selfint hole` (lab), `tools/self-interpreter/sketches.py` | one- and two-hole searches, including the 165's reader slots | +| `blam selfint ctx` (lab) | contextual slot searches in the 168 | | `blam slots var168\|abs168\|app168` (lab) | parametric slot searches (`slots.md`) | -| `blam selfint ctx` (lab) | contextual slot searches | -| `blam selfint hole` (lab), `tools/self-interpreter/sketches.py` | one- and two-hole sketch searches | -| `blam golf letopt`, `blam golf component` (lab) | let structure and βη component | -| `tools/self-interpreter/module_bound.py` | the module lower bound (`assemble`, `audit`) | -| `tools/self-interpreter/merges.py` | the nearest protocol variants, against `battery.py` | +| `tools/self-interpreter/module_bound.py` | the 168's module grammar (`assemble`, `audit`) | | `tools/self-interpreter/search_fix.py` | the knot search | | `tools/self-interpreter/beta_search.py` | the Python βη component reference | -| `tools/self-interpreter/harness.py`, `lc.py`, `db.py` | compile, splice, and the 10-program battery | +| `lake build` in `lean/` | `Blc/Selfint165.lean`, `Blc/SelfintProof.lean` | +| `data/self-interpreter/searches_165.json` | commands and totals of the joint searches of §3 | diff --git a/docs/classical/self-interpreter/universal.md b/docs/classical/self-interpreter/universal.md index a6512431..b3fa2b48 100644 --- a/docs/classical/self-interpreter/universal.md +++ b/docs/classical/self-interpreter/universal.md @@ -7,20 +7,25 @@ machine rather than the self-interpreter: U (⌜M⌝ ++ N) =β M N for closed M ``` -Tromp gives two (`ref/AIT/ait/uni.lam`): +Tromp's two wirings (`ref/AIT/ait/uni.lam`) are ```text -178, non-strict: (\x. x x) F (\x. x x) = intL dbl -190, strict: (\a. a F (\b. b (a a))) (\a. a a) = intL (\z. z Ω) +non-strict: (\x. x x) F (\x. x x) = intL dbl +strict: (\a. a F (\b. b (a a))) (\a. a a) = intL (\z. z Ω) F = \x. (\intL. B) (x x) ``` -`B` is the 168's parser body `\cont. …` (146 bits), whose only free variable -is `intL`, used twice. *Strict* means, in BLC.tex's words, that "any attempt -to apply free indices diverges", so the machine forces closed programs; the -190 gets this from an Ω base environment. **No machine below 178, and no -strict machine below 190, is known.** This record states what has been -searched; the self-interpreter's own record is `interpreter.md`. +where `B` is a parser body `\cont. …` whose only free variable is `intL`, used +twice. Around the 165's body (143 bits, `interpreter.md`) they are **175** and +**187** bits (`data/self-interpreter/machines/uni175.lam`, `uni187.lam`); +around the 168's body (146 bits) they are Tromp's 178 and 190. *Strict* means, +in BLC.tex's words, that "any attempt to apply free indices diverges", so the +machine forces closed programs; the strict wiring gets this from an Ω base +environment, which the 165's reader leaves untouched, since it changes only how +the code is read. **No machine below 175, and no strict machine below 187, is +known.** This record states what has been searched; the self-interpreter's own +record is `interpreter.md`. Most of the searches below were run around the +168's body, so their bounds are 178 and 190; §1 and §2 say which. U's contract leaves the output boundary to the machine: there is no `λz` and no external `C`. So a protocol that lost for the self-interpreter only at @@ -35,7 +40,14 @@ base environment, and any sharing. `wiring` holds `B` fixed and enumerates every closed context `C[·]` with one hole. The hole's `intL` may be bound to any enclosing binder, the k-th costing 2k bits. Each `C[B]` must meet `\n. C[B] (⌜M⌝ ++ n) = \n. M n` on 91 programs, with the reference's normal -forms as goldens. The 178 is a 32-bit context. +forms as goldens. The 178 is a 32-bit context. Unless marked, the counts below +are around the 168's body. + +**Around the 165's body.** Every context giving a machine of at most 174 bits, +14,856,126 in all, fails or is capped (68,017 capped, of which 16,144 are +certified divergent), so no non-strict machine of this shape is below 175 +conditional on the remaining caps (`searches_165.json`). The four 32-bit +wirings below survive with the new body as four 175-bit ties. **Non-strict.** All 28,373,474 contexts of at most 32 bits were searched. None of at most 31 bits survives (14.9 million contexts, with the capped ones @@ -86,6 +98,13 @@ nil-terminated probes. Logs: `wiring_uni.log`, `wiring_uni_strict.log`. +The six probes are a filter, not a proof of strictness: a machine whose base +environment has no normal form can still return garbage on an open program +whose nil tail discharges the apparent recursion. The 187 and the 190 owe their +strictness to their base environment Ω, supplied by the top continuation +`λv. v Ω`: a free index looks itself up in Ω and diverges at the head. The +probes only corroborate it. + ## 2. βη and let structure `letopt` detects knots anywhere and lets identical subterms, knot heads @@ -95,12 +114,15 @@ candidate cuts) the best size is 180, 178, 178 at one, two, and three cuts: 190 (528 candidate cuts) it is 196, 192, 190, with the 190 itself at three cuts. `component` to slack 20 has 8,527,620 terms from the 178, nothing below it and the two sharing forms as its only ties, and 5,563,972 terms from -the 190, nothing below it and no tie (`component_uni.log`). +the 190, nothing below it and no tie (`component_uni.log`). Around the 165's +body the 175's let structure through three cuts has minimum 175, and its +component at slack 16 has nothing below 175 and two ties +(`searches_165.json`). ## 3. Protocol constructions -Every construction below is a complete machine, measured against the exact -contract. None goes below 178. +Every construction below is a complete machine around the 168's body, +measured against the exact contract. None goes below 178. | construction | bits | result | |---|---:|---| @@ -119,7 +141,11 @@ contract. None goes below 178. The 180 works because every partially applied parser is a universal continuation: `F y c (λz.M) N = M N`, since a value applied to the handler -gives M. +gives M. The 165's reader breaks this: it applies the stream to the handler and +then to `s s s`, so a value read as a stream gives `P c (λz.M) = M (M (λz.M))`, +and `(\x. x x (x x x)) F` around the 165's body (177 bits) fails 648 of 667 +programs (`merges.py`). Constructions that feed a value to the parser as its +input do not carry over to the new body. **The alternating parser.** Let `B p` denote the parser body with recursive entry `p`, and define @@ -234,6 +260,8 @@ Open: - the strict contexts of 39..43 bits around `B` (30,967,305,647); - the 282 capped fills in the arbitrary-context-around-`G` family, and the capped assignments of §4; +- the 51,873 unexcluded caps among the wirings around the 165's body, and the + strict wirings around it beyond Tromp's; - a coordinated representation that exploits reachable relationships between control and values. The experiments above narrow several specific - implementations of that idea; they do not prove 178 minimal. + implementations of that idea; they do not prove 175 minimal. diff --git a/docs/quantum/bisimulation.md b/docs/quantum/bisimulation.md index 227908e5..c9338f3b 100644 --- a/docs/quantum/bisimulation.md +++ b/docs/quantum/bisimulation.md @@ -294,8 +294,8 @@ why census-ladder equivalence is deliberately NOT claimed. | id | statement | status | | --- | ------------------------------------------- | ------ | -| L1 | parser correctness, extensional form (§2) | open | -| L2 | selector / poisoned-seed contract (§3) | open | +| L1 | parser correctness, extensional form (§2) | proved, pure fragment | +| L2 | selector / poisoned-seed contract (§3) | proved, pure fragment | | L3 | weak-head / ArgView preservation (§5) | open | | L4 | readback collapse for ℛ_k (§6) | open | | B1–B5 | the exhibited ℛ is a bisimulation (§4–§5) | open | @@ -303,8 +303,10 @@ why census-ladder equivalence is deliberately NOT claimed. Falsifier: any effect-order, label, mass, or fate mismatch between `p σ⃗` and `E_q ⌜p⌝ σ⃗` on any program — none observed at any size -swept. L1 and L2 are the first mechanization target (pure λ-calculus, no -store); the quantum clauses ride on them. `lean/Blc/Selfint.lean` +swept. L1 and L2 are proved over pure λ-terms (no store) in +`lean/Blc/SelfintProof.lean` (`l1Statement`, `l2Statement`, +`parserStatement`, from one structural induction `parse`); the quantum +clauses L3, L4 and B1–B5 ride on them and remain open. `lean/Blc/Selfint.lean` kernel-pins `intL` by wire identity, checks `|E_q| = 174` and the §2 size identities, and defines `Implements` under head reduction. Its machine-level parser target is `ParserResult M R Q U`: `int.lam`'s VAR branch passes @@ -314,15 +316,14 @@ statement therefore exposes the residual tail `U ⇒ R`, with the continuation quantified inside. The τ*-forms above (KN, which does normalize the residual) are unchanged. Over pure terms the mechanized statement is the β-non-forcing theorem; the effectful poisoned-seed remains its -qBLC lifting. Proof order: L2 by induction on -the unary selector, then `ParserStatement` by structural induction, -closed L1 as corollary. +qBLC lifting. ## 8. The parked sub-174 lane With the 168-bit `intL` opaque, sub-174 is impossible: any closed invocation -pays the six-bit `App + I`, and nothing below 168 is known for the interpreter -itself (`../classical/self-interpreter/interpreter.md`). Below that, a winner +pays the six-bit `App + I`. The classical self-interpreter is 165 bits +(`../classical/self-interpreter/interpreter.md`), so `intL165 I` is a 171-bit +candidate; it has not been checked against the qBLC contract. Below that, a winner must reorganize the recursive knot and root entry jointly. The narrow lane, parked until the theorem contract is stable: freeze `cons'` and the three certified recursive branch meanings; one generic recursive entry + one From fcb94dae1b0b656aeecb8a88043a576cb74e82b2 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 00:31:45 -0400 Subject: [PATCH 05/41] Carry the 165's reader into int4, ko2kp, nf and pairup_Kp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every program that embeds int.lam's parser drops 3 bits the same way: int4 178 -> 175 (236 of 236 on the exact four-primitive contract), ko2kp 569 -> 566 and nf 562 -> 559 before β-descent (identical normal forms on every closed program through 13 and 16 bits), pairup_Kp 1360 -> 1357 (identical except on raw pairs whose first program is β- or η-equal to λx. x, not a valid description). golf.md, the golf table and STATUS follow; the int4 artifact is now the 175. --- data/golf/machines/int4.blc | 2 +- data/golf/machines/int4.lam | 6 +++--- docs/STATUS.md | 2 +- docs/classical/golf.md | 29 +++++++++++++++++++---------- tools/golf/table.py | 4 +++- 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/data/golf/machines/int4.blc b/data/golf/machines/int4.blc index 13c4a995..d68a2ba5 100644 --- a/data/golf/machines/int4.blc +++ b/data/golf/machines/int4.blc @@ -1 +1 @@ -0100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100000011110000001011101110011000000110111111001111100001111100001011110100111010011010 \ No newline at end of file +0100011010000100000100000101100001011000000110111110111100101101010000111100001011100111100000011110000001011101110011000000110111111001111100001111100001011110100111010011010 \ No newline at end of file diff --git a/data/golf/machines/int4.lam b/data/golf/machines/int4.lam index 64083deb..b24c7b45 100644 --- a/data/golf/machines/int4.lam +++ b/data/golf/machines/int4.lam @@ -1,6 +1,7 @@ -- Self-interpreter for binary LC with four primitives (tromp/AIT int4.lam: -- 00 = lambda, 01 = application, 10 = variable zero, 11 = successor), --- rebuilt on the 2025-12 design of int.lam: 189 -> 178 bits. +-- rebuilt on the design of int.lam: 189 -> 175 bits (178 with the 168's +-- reader; 175 with the 165's, which applies skipvar to the whole stream). -- intL cont bits = cont (\free.parsed) unparsed_bits, as before. -- A variable's code after its tag bit reads 1^(2n-2) 0, so skipvar -- (\l. l l l, which skips every 1 and the first 0) carries over unchanged; @@ -19,6 +20,5 @@ let let next = (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (cons4 arg args))) (intL (\exp2.cont (\args.exp args (exp2 args)))))) - in \list.list (\bit0\list1.bit0 (list1 next) - (cont list1 (skipvar list1)))); + in \list.list (\bit0.bit0 (\list1\rest. rest next) cont) (skipvar list)); in intL diff --git a/docs/STATUS.md b/docs/STATUS.md index 5a0366d9..5124cdde 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -179,7 +179,7 @@ programs by 470 bits in all (`data/golf/sweep.tsv`; e.g. `tweet` 2230 → 2168, `uniK` 903 → 854). Hand redesigns take the IOCCC BLC8 machine from 344 bits (43 bytes) to 321 strict (41 bytes) and 300 non-strict (38 bytes), and `uni28` from 500 to 399 strict and 382 non-strict. Ports of the 2025-12 parser -shrink `int4` 189 → 178, `ko2kp` 615 → 557, `nf` 600 → 541, and the pairup +shrink `int4` 189 → 175 (with the 165's reader), `ko2kp` 615 → 557, `nf` 600 → 541, and the pairup programs (771, 651, 1325; the last two on contract-valid inputs only). Artifacts are in `data/golf/machines/`. diff --git a/docs/classical/golf.md b/docs/classical/golf.md index ca250d92..023eb0da 100644 --- a/docs/classical/golf.md +++ b/docs/classical/golf.md @@ -78,7 +78,7 @@ packed `.blc8`. | `uni8` (BLC8 machine) | 344 (IOCCC; 355 compiled) | **321** | **300** | | `uni28` (BLC2 over bytes) | 500 | **399** | **382** | | `uni2` (BLC2 machine) | 340 | **333** | **321** (from 324) | -| `int4` (self-interpreter, 4-primitive code) | 189 | **178** | | +| `int4` (self-interpreter, 4-primitive code) | 189 | **175** | | | `ko2kp` (KP ≤ KO + c) | 615 | **557** | | | `nf` (normal-form printer) | 600 | **541** | | | `pairupKP` (symmetry of information) | 778 | **771** | | @@ -202,10 +202,14 @@ They read plain bit streams, so the redesign drops in. ABS builds stream itself, does the lookup in any environment. The HOAS constructors (`abs`/`app` in `ko2kp`, `L`/`A` in `nf`) are untouched. -| program | original | port | after β-descent | -|---|---:|---:|---:| -| `ko2kp` | 615 | 569 | **557** | -| `nf` | 600 | 562 | **541** | +| program | original | port | with the 165's reader | after β-descent of the port | +|---|---:|---:|---:|---:| +| `ko2kp` | 615 | 569 | 566 | **557** | +| `nf` | 600 | 562 | 559 | **541** | + +The 165's reader (`self-interpreter/interpreter.md`) drops in as well: the +whole-stream skip `xs xs xs` serves both dispatch arms, 3 bits each. The +β-descents started from the ports before that change. `int4.lam` is Tromp's self-interpreter for a four-primitive code: `00` λ, `01` application, `10` variable zero, `11` successor. After its tag bit, a @@ -216,10 +220,11 @@ variable's code reads `1^(2n-2) 0`, unary with every other bit a tag. - **Lookup.** The lookup carries over once each environment cell also swallows the tag bit that follows a 1: `\zx \zy. zx x (zy (\_ \l. l xs))`. -The rest is the 168 verbatim, and the result is 178 bits, against 189. -`battery.py --int4` checks the exact self-interpreter contract on every -closed term of 4..16 bits plus deep-index extras: 236 of 236 for both the -original and the port. As a negative control, `int.lam` under `--int4` fails +With the rest of the 168 verbatim the result is 178 bits, against 189; with +the 165's reader, 175, since `l l l` on the whole stream still stops right +after a variable. `battery.py --int4` checks the exact self-interpreter +contract on every closed term of 4..16 bits plus deep-index extras: 236 of +236 for the original, the 178 and the 175. As a negative control, `int.lam` under `--int4` fails 19 of the 40 programs of the 4..12-bit battery. `golf check --io progs` compares normal forms on every closed program, @@ -247,6 +252,10 @@ by certified β-descent: | `pairupK_p` | 657 | 655 | 653 | **651** | | `pairup_Kp` | 1402 | 1372 | 1360 | **1325** | +`pairup_Kp` also takes the 165's reader, 1360 → 1357 before descent; against +the 1360 it differs on 24 of 182 raw pairs, each starting with a first +program β- or η-equal to `λx. x`, which is not a valid description. + Verification: - **Valid inputs.** All three match on 60 contract-valid inputs each: payload @@ -348,4 +357,4 @@ Demos (excluded): - `rosetta/forloops.lam` (139 → 129): applies the artifact to sample data - `rosetta/variadicY.lam` (256 → 249): applies the artifact to sample data -No gain from β-golf: `BB/BB40.lam`, `BB/BB_Xi.lam`, `Sample.lam`, `ait/Aint.lam`, `ait/Y.lam`, `ait/allA.lam`, `ait/bcl.lam`, `ait/beavers.lam`, `ait/blc.lam`, `ait/decoders.lam`, `ait/delimit2.lam`, `ait/int.lam`, `ait/int4.lam` (by hand: 178), `ait/mlatu.lam`, `ait/quine.lam`, `ait/readlen.lam`, `ait/uni.lam`, `ait/vararg.lam`, `ait/wtf.lam`, `ait/zot.lam`, `characteristic_sequences/all.lam`, `characteristic_sequences/even.lam`, `characteristic_sequences/none.lam`, `characteristic_sequences/odd.lam`, `characteristic_sequences/primes.lam`, `characteristic_sequences/thue-morse.lam`, `fast_growing_and_conjectures/BBE0.lam`, `fast_growing_and_conjectures/BO.lam`, `fast_growing_and_conjectures/E0.lam`, `fast_growing_and_conjectures/ackermann.lam`, `fast_growing_and_conjectures/bms.lam`, `fast_growing_and_conjectures/collatz.lam`, `fast_growing_and_conjectures/gAckerman.lam`, `fast_growing_and_conjectures/goldbach.lam`, `fast_growing_and_conjectures/goodstein.lam`, `fast_growing_and_conjectures/graham.lam`, `fast_growing_and_conjectures/laver0.lam`, `fast_growing_and_conjectures/melo.lam`, `fast_growing_and_conjectures/oddperfect.lam`, `fast_growing_and_conjectures/perfect.lam`, `fast_growing_and_conjectures/w1CK.lam`, `fast_growing_and_conjectures/w218.lam`, `fast_growing_and_conjectures/wCubed.lam`, `lists/cat.lam`, `lists/fold.lam`, `lists/length.lam`, `lists/map.lam`, `lists/reverse.lam`, `misc/id.lam`, `misc/truth.lam`, `numerals/div.lam`, `numerals/divides.lam`, `numerals/eq.lam`, `numerals/fac.lam`, `numerals/fib.lam`, `numerals/gcd.lam`, `numerals/half.lam`, `numerals/leq.lam`, `numerals/lt.lam`, `numerals/mod.lam`, `numerals/tri.lam`, `rosetta/catstrings.lam`, `rosetta/mutrec.lam`, `rosetta/swap.lam`. +No gain from β-golf: `BB/BB40.lam`, `BB/BB_Xi.lam`, `Sample.lam`, `ait/Aint.lam`, `ait/Y.lam`, `ait/allA.lam`, `ait/bcl.lam`, `ait/beavers.lam`, `ait/blc.lam`, `ait/decoders.lam`, `ait/delimit2.lam`, `ait/int.lam` (by hand: 165), `ait/int4.lam` (by hand: 175), `ait/mlatu.lam`, `ait/quine.lam`, `ait/readlen.lam`, `ait/uni.lam` (by hand: 187 strict / 175 non-strict), `ait/vararg.lam`, `ait/wtf.lam`, `ait/zot.lam`, `characteristic_sequences/all.lam`, `characteristic_sequences/even.lam`, `characteristic_sequences/none.lam`, `characteristic_sequences/odd.lam`, `characteristic_sequences/primes.lam`, `characteristic_sequences/thue-morse.lam`, `fast_growing_and_conjectures/BBE0.lam`, `fast_growing_and_conjectures/BO.lam`, `fast_growing_and_conjectures/E0.lam`, `fast_growing_and_conjectures/ackermann.lam`, `fast_growing_and_conjectures/bms.lam`, `fast_growing_and_conjectures/collatz.lam`, `fast_growing_and_conjectures/gAckerman.lam`, `fast_growing_and_conjectures/goldbach.lam`, `fast_growing_and_conjectures/goodstein.lam`, `fast_growing_and_conjectures/graham.lam`, `fast_growing_and_conjectures/laver0.lam`, `fast_growing_and_conjectures/melo.lam`, `fast_growing_and_conjectures/oddperfect.lam`, `fast_growing_and_conjectures/perfect.lam`, `fast_growing_and_conjectures/w1CK.lam`, `fast_growing_and_conjectures/w218.lam`, `fast_growing_and_conjectures/wCubed.lam`, `lists/cat.lam`, `lists/fold.lam`, `lists/length.lam`, `lists/map.lam`, `lists/reverse.lam`, `misc/id.lam`, `misc/truth.lam`, `numerals/div.lam`, `numerals/divides.lam`, `numerals/eq.lam`, `numerals/fac.lam`, `numerals/fib.lam`, `numerals/gcd.lam`, `numerals/half.lam`, `numerals/leq.lam`, `numerals/lt.lam`, `numerals/mod.lam`, `numerals/tri.lam`, `rosetta/catstrings.lam`, `rosetta/mutrec.lam`, `rosetta/swap.lam`. diff --git a/tools/golf/table.py b/tools/golf/table.py index 7902e6cb..8616b188 100644 --- a/tools/golf/table.py +++ b/tools/golf/table.py @@ -22,7 +22,9 @@ MACHINES = { "ait/uni8.lam": "321 strict / 300 non-strict (vs the IOCCC 344)", "ait/uni28.lam": "399 / 382", - "ait/int4.lam": "178", + "ait/int.lam": "165", + "ait/uni.lam": "187 strict / 175 non-strict", + "ait/int4.lam": "175", "ait/ko2kp.lam": "557", "ait/nf.lam": "541", "ait/pairupKP.lam": "771", From ea7313b57b455daff4d6422d6afad2419fb19879 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 01:19:48 -0400 Subject: [PATCH 06/41] Record the reasoning consults on the 165: shape bounds, exclusions, a seventh strict probe Nine Codex consults found no sub-165. Their proofs bound the 165 within its own reader shape (zero arm >= 14, APP lift >= 19), extend the knot and value-protocol exclusions to every size, and record the reader's diagonal R Z ->* next next as the open lead. Their 21 constructions join merges.py. Codex's open program 1 K F refutes two 186/188-bit universal machines that pass the six strict probes; it is now the seventh probe in both blam selfint wiring --strict and the new battery.py --uni --strict. --- data/self-interpreter/reasoning_165/BRIEF.md | 34 ++ data/self-interpreter/reasoning_165/README.md | 16 + .../reasoning_165/algebra/REPORT.txt | 267 +++++++++++ .../reasoning_165/algebra/SUMMARY.md | 142 ++++++ .../reasoning_165/algebra/arity_switch.log | 6 + .../reasoning_165/algebra/arity_switch.py | 33 ++ .../algebra/arity_switch_failed.blc | 1 + .../algebra/arity_switch_failed.lam | 8 + .../reasoning_165/algebra/balanced_skip.blc | 1 + .../reasoning_165/algebra/balanced_skip.lam | 8 + .../reasoning_165/algebra/battery.log | 2 + .../reasoning_165/algebra/check.py | 27 ++ .../reasoning_165/algebra/identities.log | 39 ++ .../reasoning_165/algebra/identities.py | 71 +++ .../reasoning_165/algebra/shared_delta.blc | 1 + .../reasoning_165/algebra/shared_delta.lam | 8 + .../reasoning_165/bounds/RESULT.md | 441 ++++++++++++++++++ .../reasoning_165/bounds/SUMMARY.md | 72 +++ .../reasoning_165/bounds/proof_check.py | 164 +++++++ .../reasoning_165/bounds/reference165.lam | 13 + .../reasoning_165/fresh/REPORT.md | 229 +++++++++ .../reasoning_165/fresh/SUMMARY.md | 128 +++++ .../reasoning_165/fresh/battery.log | 4 + .../reasoning_165/fresh/identities.log | 5 + .../reasoning_165/fresh/late_zero_discard.blc | 1 + .../reasoning_165/fresh/late_zero_discard.lam | 1 + .../fresh/reader_diagonal_knot.blc | 1 + .../fresh/reader_diagonal_knot.lam | 1 + .../reasoning_165/fresh/return_stream.blc | 1 + .../reasoning_165/fresh/return_stream.lam | 1 + .../fresh/return_stream_shared_cont.blc | 1 + .../fresh/return_stream_shared_cont.lam | 1 + .../reasoning_165/fresh/suffix.log | 4 + .../reasoning_165/knot/SUMMARY.md | 136 ++++++ .../reasoning_165/knot/check.py | 28 ++ .../reasoning_165/knot/derivations.txt | 253 ++++++++++ .../reasoning_165/knot/identities.py | 104 +++++ .../reasoning_165/knot/one_binder_carrier.lam | 11 + .../reasoning_165/knot/reader_knot.blc | 1 + .../reasoning_165/knot/reader_knot.lam | 12 + .../reasoning_165/knot/root_next.blc | 1 + .../reasoning_165/knot/root_next.lam | 12 + .../reasoning_165/nextfuse/REPORT.md | 265 +++++++++++ .../reasoning_165/nextfuse/SUMMARY.md | 76 +++ .../nextfuse/check_identities.py | 127 +++++ .../reasoning_165/nextfuse/identities.json | 70 +++ .../nextfuse/independent_projections.blc | 1 + .../nextfuse/independent_projections.lam | 8 + .../reasoning_165/nextfuse/investigate.py | 111 +++++ .../reasoning_165/nextfuse/non_strict.json | 42 ++ .../nextfuse/projection_final_retry.json | 7 + .../nextfuse/projection_retries.json | 37 ++ .../reasoning_165/nextfuse/results.json | 83 ++++ .../nextfuse/tag_after_parse.blc | 1 + .../nextfuse/tag_after_parse.lam | 5 + .../nextfuse/tag_after_parse_handler.blc | 1 + .../nextfuse/tag_after_parse_handler.lam | 5 + .../nextfuse/tag_after_parse_hoisted.blc | 1 + .../nextfuse/tag_after_parse_hoisted.lam | 5 + .../reasoning_165/protocol/REPORT.txt | 162 +++++++ .../reasoning_165/protocol/SUMMARY.md | 28 ++ .../reasoning_165/protocol/battery.json | 22 + .../reasoning_165/protocol/check.py | 50 ++ .../protocol/reparse_selected.blc | 1 + .../protocol/reparse_selected.lam | 7 + .../reasoning_165/protocol/reparse_shared.blc | 1 + .../reasoning_165/protocol/reparse_shared.lam | 7 + .../protocol/targeted_checks.json | 70 +++ .../reasoning_165/reader/RESULTS.txt | 182 ++++++++ .../reasoning_165/reader/SUMMARY.md | 57 +++ .../reasoning_165/reader/check.py | 99 ++++ .../reasoning_165/reader/spine3_bare.lam | 3 + .../reasoning_165/reader/spine3_repaired.lam | 4 + .../reasoning_165/universal/REPORT.md | 98 ++++ .../reasoning_165/universal/SUMMARY.md | 67 +++ .../reasoning_165/universal/candidates.log | 16 + .../universal/check_candidates.py | 24 + .../universal/check_identities.py | 50 ++ .../reasoning_165/universal/identities.log | 12 + .../universal/int166_skip_next.blc | 1 + .../universal/int166_skip_next.lam | 3 + .../universal/strictness_witness.nf.blc | 1 + .../universal/uni186_skip_next_Kparser.blc | 1 + .../universal/uni186_skip_next_Kparser.lam | 3 + .../uni188_skip_next_parser_parser.blc | 1 + .../uni188_skip_next_parser_parser.lam | 3 + .../reasoning_165/values/REPORT.txt | 218 +++++++++ .../reasoning_165/values/SUMMARY.md | 104 +++++ .../values/abs_driver.battery.txt | 2 + .../reasoning_165/values/abs_driver.blc | 1 + .../reasoning_165/values/abs_driver.lam | 12 + .../reasoning_165/values/bit_or_cell.blc | 1 + .../reasoning_165/values/bit_or_cell.lam | 1 + .../values/bit_or_cell_shared.blc | 1 + .../values/bit_or_cell_shared.lam | 1 + .../reasoning_165/values/check.py | 31 ++ .../values/common_generator_nf.blc | 1 + .../reasoning_165/values/identities.py | 131 ++++++ .../reasoning_165/values/identities.txt | 17 + .../values/tagged_optional.battery.txt | 2 + .../reasoning_165/values/tagged_optional.blc | 1 + .../reasoning_165/values/tagged_optional.lam | 12 + docs/STATUS.md | 19 +- .../classical/self-interpreter/interpreter.md | 137 +++++- docs/classical/self-interpreter/universal.md | 27 +- src/cli/selfint/wiring.rs | 34 +- tools/self-interpreter/battery.py | 31 +- tools/self-interpreter/merges.py | 30 ++ 108 files changed, 4880 insertions(+), 42 deletions(-) create mode 100644 data/self-interpreter/reasoning_165/BRIEF.md create mode 100644 data/self-interpreter/reasoning_165/README.md create mode 100644 data/self-interpreter/reasoning_165/algebra/REPORT.txt create mode 100644 data/self-interpreter/reasoning_165/algebra/SUMMARY.md create mode 100644 data/self-interpreter/reasoning_165/algebra/arity_switch.log create mode 100644 data/self-interpreter/reasoning_165/algebra/arity_switch.py create mode 100644 data/self-interpreter/reasoning_165/algebra/arity_switch_failed.blc create mode 100644 data/self-interpreter/reasoning_165/algebra/arity_switch_failed.lam create mode 100644 data/self-interpreter/reasoning_165/algebra/balanced_skip.blc create mode 100644 data/self-interpreter/reasoning_165/algebra/balanced_skip.lam create mode 100644 data/self-interpreter/reasoning_165/algebra/battery.log create mode 100644 data/self-interpreter/reasoning_165/algebra/check.py create mode 100644 data/self-interpreter/reasoning_165/algebra/identities.log create mode 100644 data/self-interpreter/reasoning_165/algebra/identities.py create mode 100644 data/self-interpreter/reasoning_165/algebra/shared_delta.blc create mode 100644 data/self-interpreter/reasoning_165/algebra/shared_delta.lam create mode 100644 data/self-interpreter/reasoning_165/bounds/RESULT.md create mode 100644 data/self-interpreter/reasoning_165/bounds/SUMMARY.md create mode 100644 data/self-interpreter/reasoning_165/bounds/proof_check.py create mode 100644 data/self-interpreter/reasoning_165/bounds/reference165.lam create mode 100644 data/self-interpreter/reasoning_165/fresh/REPORT.md create mode 100644 data/self-interpreter/reasoning_165/fresh/SUMMARY.md create mode 100644 data/self-interpreter/reasoning_165/fresh/battery.log create mode 100644 data/self-interpreter/reasoning_165/fresh/identities.log create mode 100644 data/self-interpreter/reasoning_165/fresh/late_zero_discard.blc create mode 100644 data/self-interpreter/reasoning_165/fresh/late_zero_discard.lam create mode 100644 data/self-interpreter/reasoning_165/fresh/reader_diagonal_knot.blc create mode 100644 data/self-interpreter/reasoning_165/fresh/reader_diagonal_knot.lam create mode 100644 data/self-interpreter/reasoning_165/fresh/return_stream.blc create mode 100644 data/self-interpreter/reasoning_165/fresh/return_stream.lam create mode 100644 data/self-interpreter/reasoning_165/fresh/return_stream_shared_cont.blc create mode 100644 data/self-interpreter/reasoning_165/fresh/return_stream_shared_cont.lam create mode 100644 data/self-interpreter/reasoning_165/fresh/suffix.log create mode 100644 data/self-interpreter/reasoning_165/knot/SUMMARY.md create mode 100644 data/self-interpreter/reasoning_165/knot/check.py create mode 100644 data/self-interpreter/reasoning_165/knot/derivations.txt create mode 100644 data/self-interpreter/reasoning_165/knot/identities.py create mode 100644 data/self-interpreter/reasoning_165/knot/one_binder_carrier.lam create mode 100644 data/self-interpreter/reasoning_165/knot/reader_knot.blc create mode 100644 data/self-interpreter/reasoning_165/knot/reader_knot.lam create mode 100644 data/self-interpreter/reasoning_165/knot/root_next.blc create mode 100644 data/self-interpreter/reasoning_165/knot/root_next.lam create mode 100644 data/self-interpreter/reasoning_165/nextfuse/REPORT.md create mode 100644 data/self-interpreter/reasoning_165/nextfuse/SUMMARY.md create mode 100644 data/self-interpreter/reasoning_165/nextfuse/check_identities.py create mode 100644 data/self-interpreter/reasoning_165/nextfuse/identities.json create mode 100644 data/self-interpreter/reasoning_165/nextfuse/independent_projections.blc create mode 100644 data/self-interpreter/reasoning_165/nextfuse/independent_projections.lam create mode 100644 data/self-interpreter/reasoning_165/nextfuse/investigate.py create mode 100644 data/self-interpreter/reasoning_165/nextfuse/non_strict.json create mode 100644 data/self-interpreter/reasoning_165/nextfuse/projection_final_retry.json create mode 100644 data/self-interpreter/reasoning_165/nextfuse/projection_retries.json create mode 100644 data/self-interpreter/reasoning_165/nextfuse/results.json create mode 100644 data/self-interpreter/reasoning_165/nextfuse/tag_after_parse.blc create mode 100644 data/self-interpreter/reasoning_165/nextfuse/tag_after_parse.lam create mode 100644 data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_handler.blc create mode 100644 data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_handler.lam create mode 100644 data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_hoisted.blc create mode 100644 data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_hoisted.lam create mode 100644 data/self-interpreter/reasoning_165/protocol/REPORT.txt create mode 100644 data/self-interpreter/reasoning_165/protocol/SUMMARY.md create mode 100644 data/self-interpreter/reasoning_165/protocol/battery.json create mode 100644 data/self-interpreter/reasoning_165/protocol/check.py create mode 100644 data/self-interpreter/reasoning_165/protocol/reparse_selected.blc create mode 100644 data/self-interpreter/reasoning_165/protocol/reparse_selected.lam create mode 100644 data/self-interpreter/reasoning_165/protocol/reparse_shared.blc create mode 100644 data/self-interpreter/reasoning_165/protocol/reparse_shared.lam create mode 100644 data/self-interpreter/reasoning_165/protocol/targeted_checks.json create mode 100644 data/self-interpreter/reasoning_165/reader/RESULTS.txt create mode 100644 data/self-interpreter/reasoning_165/reader/SUMMARY.md create mode 100644 data/self-interpreter/reasoning_165/reader/check.py create mode 100644 data/self-interpreter/reasoning_165/reader/spine3_bare.lam create mode 100644 data/self-interpreter/reasoning_165/reader/spine3_repaired.lam create mode 100644 data/self-interpreter/reasoning_165/universal/REPORT.md create mode 100644 data/self-interpreter/reasoning_165/universal/SUMMARY.md create mode 100644 data/self-interpreter/reasoning_165/universal/candidates.log create mode 100644 data/self-interpreter/reasoning_165/universal/check_candidates.py create mode 100644 data/self-interpreter/reasoning_165/universal/check_identities.py create mode 100644 data/self-interpreter/reasoning_165/universal/identities.log create mode 100644 data/self-interpreter/reasoning_165/universal/int166_skip_next.blc create mode 100644 data/self-interpreter/reasoning_165/universal/int166_skip_next.lam create mode 100644 data/self-interpreter/reasoning_165/universal/strictness_witness.nf.blc create mode 100644 data/self-interpreter/reasoning_165/universal/uni186_skip_next_Kparser.blc create mode 100644 data/self-interpreter/reasoning_165/universal/uni186_skip_next_Kparser.lam create mode 100644 data/self-interpreter/reasoning_165/universal/uni188_skip_next_parser_parser.blc create mode 100644 data/self-interpreter/reasoning_165/universal/uni188_skip_next_parser_parser.lam create mode 100644 data/self-interpreter/reasoning_165/values/REPORT.txt create mode 100644 data/self-interpreter/reasoning_165/values/SUMMARY.md create mode 100644 data/self-interpreter/reasoning_165/values/abs_driver.battery.txt create mode 100644 data/self-interpreter/reasoning_165/values/abs_driver.blc create mode 100644 data/self-interpreter/reasoning_165/values/abs_driver.lam create mode 100644 data/self-interpreter/reasoning_165/values/bit_or_cell.blc create mode 100644 data/self-interpreter/reasoning_165/values/bit_or_cell.lam create mode 100644 data/self-interpreter/reasoning_165/values/bit_or_cell_shared.blc create mode 100644 data/self-interpreter/reasoning_165/values/bit_or_cell_shared.lam create mode 100644 data/self-interpreter/reasoning_165/values/check.py create mode 100644 data/self-interpreter/reasoning_165/values/common_generator_nf.blc create mode 100644 data/self-interpreter/reasoning_165/values/identities.py create mode 100644 data/self-interpreter/reasoning_165/values/identities.txt create mode 100644 data/self-interpreter/reasoning_165/values/tagged_optional.battery.txt create mode 100644 data/self-interpreter/reasoning_165/values/tagged_optional.blc create mode 100644 data/self-interpreter/reasoning_165/values/tagged_optional.lam diff --git a/data/self-interpreter/reasoning_165/BRIEF.md b/data/self-interpreter/reasoning_165/BRIEF.md new file mode 100644 index 00000000..e4625b7b --- /dev/null +++ b/data/self-interpreter/reasoning_165/BRIEF.md @@ -0,0 +1,34 @@ +# Last push: a sub-165 BLC self-interpreter, by reasoning + +Repo: /Users/a9lim/Work/blam. READ FIRST: docs/classical/self-interpreter/interpreter.md — the current record +of the 165-bit self-interpreter: its anatomy, why its reader works, everything already searched around it and +around Palmer's 168 (let structure, βη/contextual components, every reader slot, joint searches, ~100 protocol +variants), and the exclusions proved at every size. Do not re-propose anything it lists. + +Contract (fixed): <λM> = 00, = 01, = 1^n 0 (n >= 1). Streams cons b r = λf. f b r, +bit '0' = λx.λy.x, bit '1' = λx.λy.y. A self-interpreter is a closed E with E C ( ++ N) =β C (λz. M) N for +every closed M (C, N rigid), including M without a normal form. Size: var n costs n+1 bits, λ and app 2 bits. + +The 165 (data/self-interpreter/machines/int165.lam; L 17, A 25, X 29): + (\x. x x) (\x. (\intL. \cont. + (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +It beat the 168 by two moves the old module bound had assumed away: HOIST work several branches need to a point +where one expression is right for all of them (the whole-stream skip), and let a Scott structure's OWN APPLICATION +supply an argument (the stream hands list1 to cont, deleting VAR's return application). A sub-165 most likely +needs another move of that kind, found by thinking, not by enumeration. + +HOW TO WORK — this matters: reason first. Derive identities by hand, write proofs, design constructions on paper, +then check them. Light, highly targeted computation only: battery runs on candidates you designed +(python3 tools/self-interpreter/battery.py FILE.lam — lets written as explicit redexes, compiled without optimizer, +so the printed size is exactly the term as written; ~2 s), normalizing specific terms, or a hole search over at +most a few thousand fills when reasoning has already narrowed it. NO long or blunt searches: no exhaustive sweeps, +no run longer than about two minutes, at most 2 threads. The machine is shared. + +Write files only under your own directory (given below); never modify the repo. Report: every complete +interpreter you built (bits, battery line, one-line idea); every new exact identity with its proof; any +impossibility or lower-bound argument with its proof; and your honest read of where a sub-165 could hide. +A sub-165 claim needs a file and a passing battery line. Overclaiming is a failure; so is giving up without +having tried the real problem. diff --git a/data/self-interpreter/reasoning_165/README.md b/data/self-interpreter/reasoning_165/README.md new file mode 100644 index 00000000..080dec10 --- /dev/null +++ b/data/self-interpreter/reasoning_165/README.md @@ -0,0 +1,16 @@ +# Reasoning consults on the 165 + +Nine Codex consults (2026-10-20), each given one perspective on a sub-165 +self-interpreter and told to reason first, with only light targeted checks. +None found one. `BRIEF.md` is the shared brief; each directory holds one +consult's summary (`SUMMARY.md`), its full report, the complete constructions +it built (`.lam`, `.blc`), and the scripts behind its identity checks. + +What the record keeps from them is in +`docs/classical/self-interpreter/interpreter.md` (§2 identities, §5 shape +bounds and exclusions, §6 variants) and `universal.md` §1 (the seventh strict +probe). `tools/self-interpreter/merges.py` re-measures every construction. + +The proofs are handwritten; none is in Lean. The scripts were run from the +consults' scratch directories with `target/release/blam`; `values/` expects a +frozen copy of it named `blam-frozen` beside the scripts. diff --git a/data/self-interpreter/reasoning_165/algebra/REPORT.txt b/data/self-interpreter/reasoning_165/algebra/REPORT.txt new file mode 100644 index 00000000..41fde605 --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/REPORT.txt @@ -0,0 +1,267 @@ +VERDICT + +No sub-165 interpreter found. Two complete, correct constructions were built: +169-bit balanced skip and 176-bit shared diagonal. A different reader shape +at 167 bits was constructed and refuted on the identity program. The main +new exclusion is for application trees mixing the current reader partials +and handlers, extending the record's handler-only exclusion. This is a +paper proof, not a new Lean theorem or a global size lower bound. + +All files are in this directory. No repository files were edited. All +computation was targeted: two 667-case batteries (two workers, about 2.5 s +each), 38 symbolic normal-form equalities (0.23 s), and one explicit negative +witness. No enumeration or hole search was run. + +NOTATION + +K = lambda x y. x; F = lambda x y. y; I = lambda x. x. +[a,r] = lambda f. f a r. +U_n(N) = [F,[F,...[F,[K,N]]...]], with n leading F cells. +E denotes the current 165, P_C = E C. Define + + Q_C = lambda b. E (lambda f. + b (C (lambda e a. f (lambda x y. x a (y e)))) + (E (lambda g. C (lambda e. f e (g e))))) + V_C = lambda r. r Q_C + Z_C = lambda u r. r Q_C = K V_C + H_C = lambda b. b Z_C C + R_C = lambda s. s H_C (s s s). + +One unfolding of E gives P_C ->* R_C. All displayed equalities below are +beta equalities; the reductions establishing them never use eta. Statements +with rigid C or D keep them rigid throughout. + +1. CROSS-APPLICATION OF STREAMS + +For arbitrary b,d,r,t: + + [b,r] [d,t] ->* b d t r. + +Proof: [b,r] [d,t] -> [d,t] b r -> b d t r. +Consequently + + [K,r] [K,t] = K r, + [K,r] [F,t] = I, + [F,r] [d,t] = t r. + +In particular, if s=[b,r], then + + s K = b; s F = r; + s (s K) = b b r = K if b=K, r if b=F. + +If s=[K,[d,t]] and r=[d,t], then + + s (s F) = d r = K r for tag 00, I for tag 01. + +This is an actual arity switch: 00 gives a constant function retaining the +second-bit stream; 01 gives identity. It does not directly provide the +semantic ABS/APP selector: applying K r selects the stream r, not an +arbitrary ABS payload. Reading the second bit is still required to turn r +into the desired computation. + +2. COMPLETE CROSS-UNARY LAW + +The cross-stream identity gives + + U_(i+1)(N) U_(j+1)(M) = U_j(M) U_i(N). + +Repeatedly apply this swap-and-decrement rule. Its three boundary cases are + + U_0(N) U_0(M) = K N; + U_0(N) U_(j+1)(M) = I; + U_(i+1)(N) U_0(M) = M U_i(N). + +Therefore the exact general answer is + + i=j: K N if i is even, K M if i is odd; + ij: M U_(i-j-1)(N) if j is even, I if j is odd. + +These cases, together with the recurrence, are an induction proof for all +natural i,j and arbitrary tails. In particular, equal-depth unary streams +with distinct tails give a parity-controlled constant. This extends the +known same-stream skip identity; it does not give a usable new skip by +itself, because the interpreter has only one cheaply available stream of +the required depth. + +3. TWO VALID COMPLETE CONSTRUCTIONS + +Taking N=M in the preceding law gives s s = K N, hence + + (s s) (s s) ->* N + Delta (s s) ->* N, where Delta = lambda x. x x. + +The first replacement changes only the 165's skip from (s s s) to +((s s) (s s)). The second binds one Delta outside the whole interpreter and +uses it both as the existing knot driver and to force the skip thunk. + + 169 bits ok=667 skip=1 fail=0 balanced_skip.lam 2.447s + 176 bits ok=667 skip=1 fail=0 shared_delta.lam 2.512s + +Full output is battery.log. The exact unoptimized wire encodings are in +balanced_skip.blc and shared_delta.blc; check.py reproduces both batteries +with threads=2. These are the only complete interpreters constructed here. +The skipped battery program is the standard non-normalizing case, not a +passing divergence test. + +Correctness beyond the battery follows on paper from the 165's parser +invariant: every parser input starts with a finite run of F cells followed +by K, whether the represented source normalizes or diverges. All three skip +expressions reduce to the identical tail on that input. The shared-Delta +term beta-reduces to the balanced-skip term after inlining Delta and reducing +its uses on skip thunks. + +Cost: balanced skip is 14 bits versus 10 (+4). In the shared construction, +Delta is index 6 inside the reader, so Delta (s s) is 15 bits (+5); binding +Delta outside the knot adds another 6. Thus sharing two mathematically +identical diagonal operations loses 11 bits against the current 165. This +is a concrete test of a knot/reader fusion, not a claim of optimality for +all possible fusions. + +4. CROSS-APPLICATION OF CONS-PRIME ENVIRONMENT CELLS + +Write B(a,e) = lambda x y. x a (y e). Then + + B(a,e) B(b,d) = lambda k. a b (k e d). + +Proof: + B(a,e) B(b,d) + -> lambda k. B(b,d) a (k e) + -> lambda k. a b ((k e) d). + +The known self-application formula is its diagonal a=b, e=d. The cross +version simultaneously applies the heads and passes the two environments +to k. This is potentially useful only with a different denotation protocol: +it produces a b, whereas the current APP requires f e (g e). Substituting +it directly does not implement APP. No interpreter claiming otherwise was +built. + +5. PARSER PARTIALS ON NON-STREAM ARGUMENTS + +Directly from R_C s = s H_C (s s s): + + R_C K = H_C; + R_C F = F; + R_C I = V_C; + R_C (K a) = a (a (K a)). + +Proofs: + K K K=K, so R_C K=K H_C K=H_C. + F F F=F, so R_C F=F H_C F=F. + I I I=I, so R_C I=H_C I=Z_C C=V_C. + With t=K a, t H_C=a and t t t=a t, so + R_C t=a (a t). + +Derived projections are R_C K F=C and R_C I I=Q_C. These projections +identify stored components, but replacing a component's own definition by +its projection from R_C would be circular rather than a finite definition. + +The last law gives an exact impossibility at every adapter size: +NO continuation-only adapter A can make the unchanged 165 accept a thunked +input K s. E (A C) (K s) ->* s (s (K s)), independent of C and even of the +entire NEXT definition. Fix a source stream s without C and a normalizing +closed source M. The required C (K M) N has a normal form containing rigid +C, whereas the C-free result cannot reduce to it. Forcing or otherwise +changing the input path is necessary. This exclusion concerns the fixed +165 reader, not every possible thunk protocol. + +6. MIXED READER/HANDLER APPLICATION TREES CANNOT SUPPLY A KNOT + +For arbitrary component payloads Q_C and Q_D, direct beta calculation gives + + H_C H_D = D Q_C C; + R_C H_D = C Q_D D (D Q_D D H_D); + H_C R_D = Q_C Q_C C; + R_C R_D = D Q_C C (C Q_C C H_C) (R_D R_D R_D). + +Proofs: + H_C H_D = H_D Z_C C = Z_C Z_D D C = D Q_C C. + R_C H_D = H_D H_C (H_D H_D H_D); use the previous law twice. + H_C R_D = R_D Z_C C. + Z_C H_D=V_C and Z_C Z_C Z_C=V_C, hence + R_D Z_C=V_C V_C=Q_C Q_C. + R_C R_D = R_D H_C (R_D R_D R_D); use the reader/handler law + with C and D interchanged. + +The only right side not visibly headed by C or D is Q_C Q_C C. For the +ACTUAL NEXT, Q_C b = E J_(C,b), so + + Q_C Q_C C ->* E J_(C,Q_C) C + ->* C H_J (C C C). + +Thus it too has rigid head C. This step requires the actual NEXT protocol; +it would be false for arbitrary rigid Q_C. + +Theorem. Let C_i be rigid continuations, and form any binary application +tree with leaves chosen from H_(C_i), R_(C_i). If it has at least two leaves, +it head-reduces to some C_i applied to at least two arguments. + +Proof by induction on the tree. The two-leaf cases are exactly the four +identities above plus the NEXT unfolding. If the left subtree has at least +two leaves, its rigid head persists when an argument is appended. Otherwise +the left subtree is H_C or R_C. If the right subtree B has at least two +leaves, it has a rigid continuation head by induction; H_C B = B Z_C C and +R_C B = B H_C (B B B) preserve that head. The case of two leaves was already +settled. The minimum arity is preserved in every case. + +Consequences: such a tree cannot be beta-convertible to a parser or NEXT +partial (which has an outer lambda), and applying it to an input stream +adds a third or later rigid-continuation argument rather than starting a +parse. This extends the record's handler-only obstruction to arbitrary +mixed trees of handlers and reader partials, including mixtures with +different rigid continuations. It does not cover new lambdas, bare Q_C +leaves, non-rigid continuations, or reader transformations. + +7. A DIFFERENT READER SHAPE, CONSTRUCTED AND REFUTED + +The arity switch s(s K) suggests removing the ordinary bit handler: + + R'_C(s) = (s (s K)) (lambda r. r Q'_C) C (s s s), + +where Q'_C is the unchanged NEXT formula, with recursive calls to E'. This +is arity_switch_failed.lam, 167 bits. It has the correct zero case: +with s=[K,r], s(s K)=K and s s s=r, so R'_C(s)=r Q'_C. +The variable case is wrong. + +Exact counterexample: take M=I, any rigid C, and + + N = lambda a b c d. I. + +The outer 00 branch is correct and recursively parses variable 1 under +some continuation D. Put u=[K,N], t=[F,u]. Then + + R'_D(t) = u (lambda r. r Q'_D) D N + = Q'_D D N + = E' J N + = N (N K) (lambda r. r Q'_J) J (N N N) + -> I. + +The exact choice of J is irrelevant; N discards all four supplied arguments. +The required answer is C (K I) N, whose normal form has rigid head C. +arity_switch.py checked this exact counterexample on the Rust normalizer: + + got: lambda c. I bits 000010 + required: lambda c. c (lambda z. I) N + +See arity_switch.log for both normal-form wire strings. No expensive full +battery was run on an already refuted candidate. + +8. WHERE A SUB-165 COULD STILL HIDE + +The cross-cell identity is the most interesting positive algebraic fact: +application of two cons-prime cells combines both payloads and environments. +To save bits it would need a denotation protocol designed for that operation, +not a replacement within the already-exhausted cell/APP slots. I have no +complete small construction for such a protocol. + +For the reader, s(s F) distinguishes 00/01 by arity while retaining a tail. +A useful construction would have to consume that retained second-bit stream +in a semantic operation already required elsewhere. The simple arity-switch +reader is refuted; turning K r into an arbitrary ABS value merely reinstates +an adapter. I have not proved every such fusion impossible. + +The mixed-tree theorem closes a concrete family of proposed knot fusions. +It leaves fusions involving the NEXT object itself, a transformed stream, +or non-rigid internal continuations. Those are meaningful remaining scope, +not evidence that any of them is smaller. There is no new unconditional +lower bound and no sub-165 claim. diff --git a/data/self-interpreter/reasoning_165/algebra/SUMMARY.md b/data/self-interpreter/reasoning_165/algebra/SUMMARY.md new file mode 100644 index 00000000..3fe16b37 --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/SUMMARY.md @@ -0,0 +1,142 @@ +( •̀_•́) **No sub-165 result.** Two complete constructions pass. The strongest new result excludes knot constructions made from arbitrary application trees mixing the current reader partials and handlers. + +Full proofs, sources, encodings, and reproducible checks are in [REPORT.txt](REPORT.txt). + +| Construction | Result | Idea | +|---|---|---| +| [balanced_skip.lam](balanced_skip.lam) | **169 bits — `ok=667 skip=1 fail=0`** | Replace `s s s` by `(s s) (s s)`. | +| [shared_delta.lam](shared_delta.lam) | **176 bits — `ok=667 skip=1 fail=0`** | Share `Δ = λx.x x` between the knot driver and forcing `s s`. | +| [arity_switch_failed.lam](arity_switch_failed.lam) | **167 bits — refuted** | Use `s (s K)` to change arity between constructor and variable cases. | + +Both batteries used two workers and took about 2.5 seconds each. Separately, 38 targeted symbolic normal-form equalities passed. No enumeration or long search was run. The proofs below are hand proofs, not new Lean formalizations. + +**Stream identities.** Write `[b,r] = λf.f b r`, with `K=0`, `F=1`. Then + +```text +[b,r] [d,t] →* b d t r + +[K,r] [K,t] = K r +[K,r] [F,t] = I +[F,r] [d,t] = t r +``` + +The first line follows by two stream applications; Boolean reduction gives the remaining lines. Consequently, + +```text +s K = b +s F = r +s (s K) = b b r = K when b=K, r when b=F. +``` + +For `s=[K,[d,t]]`, writing `r=[d,t]` gives + +```text +s (s F) = d r = K r for 00, I for 01. +``` + +Thus `s (s F)` distinguishes the two constructor tags by arity while retaining a tail. Its limitation is precise: the constant branch retains **the stream `r`**, so another operation must turn that stream into the ABS computation. + +**Cross-unary identity.** Let `U_n(N)=1^n0 ++ N`. The stream identity gives + +```text +U_(i+1)(N) U_(j+1)(M) = U_j(M) U_i(N). +``` + +Repeated swapping and decrementing yields: + +```text +i=j: K N if i is even + K M if i is odd + +ij: M U_(i-j-1)(N) if j is even + I if j is odd +``` + +Proof: the terminal cases are `U_0(N)U_0(M)=K N`, `U_0(N)U_(j+1)(M)=I`, and `U_(i+1)(N)U_0(M)=M U_i(N)`. These and the recurrence constitute an induction. + +Taking identical streams gives `s s = K N`, hence both `(s s)(s s)` and `Δ(s s)` reduce to `N`. This proves the skip replacements correct on every parser input, including code for divergent source terms. The balanced skip costs four extra bits. Sharing Δ loses eleven: five in its reader occurrence and six in the outer binding. + +**Cross-application of environment cells.** For `B(a,e)=λx y.x a(y e)`, + +```text +B(a,e) B(b,d) +→ λk. B(b,d) a (k e) +→ λk. a b (k e d). +``` + +This extends the recorded diagonal identity. It simultaneously applies payloads and combines environments. It does **not** implement the present APP law: it produces `a b`, whereas APP needs `f e (g e)`. Exploiting it would require a different denotation protocol. + +**Parser projections and thunk exclusion.** Let `Q_C` be the actual NEXT, and define + +```text +V_C = λr.r Q_C +Z_C = λu r.r Q_C +H_C = λb.b Z_C C +R_C = λs.s H_C (s s s). +``` + +One unfolding gives `E C →* R_C`. Direct reduction establishes + +```text +R_C K = H_C +R_C F = F +R_C I = V_C +R_C (K a) = a (a (K a)). +``` + +For the last identity, set `t=K a`: `t H_C=a` and `t t t=a t`. The other three follow immediately from `K K K=K`, `F F F=F`, and `I I I=I`. Derived projections are `R_C K F=C` and `R_C I I=Q_C`. + +The last law proves an exclusion at **every adapter size**: no continuation-only adapter can make the unchanged 165 accept thunked input. For every `A`, + +```text +E (A C) (K s) →* s (s (K s)), +``` + +independent of rigid `C`. For a fixed stream without `C`, this cannot equal the required normal form containing `C`. The input path must change; adapting only the continuation cannot repair it. + +**Mixed reader/handler knot exclusion.** Exact reductions give + +```text +H_C H_D = D Q_C C + +R_C H_D = C Q_D D (D Q_D D H_D) + +H_C R_D = Q_C Q_C C + +R_C R_D = + D Q_C C (C Q_C C H_C) (R_D R_D R_D). +``` + +For example, `H_C H_D = H_D Z_C C = Z_C Z_D D C = D Q_C C`. Substituting this into the reader definition proves the second and fourth identities. For the third, `H_C R_D=R_D Z_C C`; both `Z_C H_D` and `Z_C Z_C Z_C` reduce to `V_C`, so `R_D Z_C=V_C V_C=Q_C Q_C`. + +For the actual NEXT, `Q_C b=E J_(C,b)` for a continuation `J`. Therefore the remaining case also becomes continuation-headed: + +```text +Q_C Q_C C →* E J C →* C H_J (C C C). +``` + +**Theorem:** any binary application tree with at least two leaves chosen from `H_(C_i)` and `R_(C_i)`, for rigid continuations `C_i`, head-reduces to some `C_i` with at least two arguments. + +Proof by induction: the four two-leaf cases are above. A nontrivial left subtree preserves its rigid head under further application. If the left leaf is a handler or reader and the right subtree is `B`, their reductions are `B Z_C C` and `B H_C (B B B)`, respectively; these preserve `B`’s rigid head. + +Such trees cannot supply a parser or NEXT partial, which requires an outer lambda. Applying a stream instead adds a third continuation argument. This extends the recorded handler-only exclusion. It does **not** exclude bare NEXT objects, new lambdas, transformed streams, or non-rigid continuations. + +**The failed 167-bit reader** was + +```text +R'_C(s) = (s (s K)) (λr.r Q'_C) C (s s s). +``` + +Its zero case is correct. Its variable case fails decisively: for `M=I` and `N=λa b c d.I`, reduction reaches + +```text +E' J N = N (N K) (λr.r Q'_J) J (N N N) → I. +``` + +The Rust normalizer confirmed `λc.I`, whereas the contract requires `λc.c (λz.I) N`. No full battery was run after this exact refutation. + +My read: the cross-cell identity offers a concrete operation around which to design a different value protocol. The constructor arity switch also retains useful information, but needs a semantic use for its retained stream. Simple reader/handler application trees are now excluded more broadly; NEXT-bearing constructions remain outside that proof. **There is no new global lower bound and no evidence here of a sub-165 interpreter.** + diff --git a/data/self-interpreter/reasoning_165/algebra/arity_switch.log b/data/self-interpreter/reasoning_165/algebra/arity_switch.log new file mode 100644 index 00000000..46c04eb9 --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/arity_switch.log @@ -0,0 +1,6 @@ +167 bits: exact I-program counterexample, rigid C; N = lambda a b c d. I +got normal form: lambda c. I +required normal form: lambda c. c (lambda z. I) N +got bits: 000010 +required bits: 00010110000010000000000010 +No full battery was run on this refuted candidate. diff --git a/data/self-interpreter/reasoning_165/algebra/arity_switch.py b/data/self-interpreter/reasoning_165/algebra/arity_switch.py new file mode 100644 index 00000000..515117c4 --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/arity_switch.py @@ -0,0 +1,33 @@ +import os +from pathlib import Path +import sys +ROOT = Path('/Users/a9lim/Work/blam') +HERE = Path(__file__).resolve().parent +os.environ['TMPDIR'] = str(HERE) +sys.path.insert(0, str(ROOT / 'tools/self-interpreter')) +import battery as b +base = (ROOT / 'data/self-interpreter/machines/int165.lam').read_text() +base = '\n'.join(line for line in base.splitlines() if not line.startswith('--')) +old = 'list (\\bit0. bit0 (\\unused \\r. r next) cont) (list list list)' +new = '(list (list (\\a. \\b. a))) (\\r. r next) cont (list list list)' +assert base.count(old) == 1 +src = '-- 167-bit failed arity-switch candidate; see REPORT.txt for the exact identity-program refutation.\n' + base.replace(old,new) + '\n' +path = HERE / 'arity_switch_failed.lam' +path.write_text(src) +E = b.compile_lam(src) +I = ('L', ('V', 0)) +N = b.compile_lam('\\a. \\b. \\c. \\d. (\\x. x)') +stream = b.bitlist(b.enc(I), N) +got = ('L', ('A', ('A', b.shift(E,1), ('V',0)), stream)) +want = ('L', ('A', ('A', ('V',0), ('L',I)), N)) +g = b.normalize(b.enc(got), 4096) +w = b.normalize(b.enc(want), 4096) +expected_wrong = b.enc(('L', I)) +assert g == expected_wrong and g != w +print(f'{len(b.enc(E))} bits: exact I-program counterexample, rigid C; N = lambda a b c d. I') +print('got normal form: lambda c. I') +print('required normal form: lambda c. c (lambda z. I) N') +print('got bits:', g) +print('required bits:', w) +print('No full battery was run on this refuted candidate.') +(HERE / 'arity_switch_failed.blc').write_text(b.enc(E) + '\n') diff --git a/data/self-interpreter/reasoning_165/algebra/arity_switch_failed.blc b/data/self-interpreter/reasoning_165/algebra/arity_switch_failed.blc new file mode 100644 index 00000000..c657f685 --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/arity_switch_failed.blc @@ -0,0 +1 @@ +01000110100001000001000001010101100110000011000011011101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_165/algebra/arity_switch_failed.lam b/data/self-interpreter/reasoning_165/algebra/arity_switch_failed.lam new file mode 100644 index 00000000..fc464df0 --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/arity_switch_failed.lam @@ -0,0 +1,8 @@ +-- 167-bit failed arity-switch candidate; see REPORT.txt for the exact identity-program refutation. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + (list (list (\a. \b. a))) (\r. r next) cont (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_165/algebra/balanced_skip.blc b/data/self-interpreter/reasoning_165/algebra/balanced_skip.blc new file mode 100644 index 00000000..21c1c12c --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/balanced_skip.blc @@ -0,0 +1 @@ +0100011010000100000100000101100001011000000110111110111100101101001101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_165/algebra/balanced_skip.lam b/data/self-interpreter/reasoning_165/algebra/balanced_skip.lam new file mode 100644 index 00000000..00ba40ec --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/balanced_skip.lam @@ -0,0 +1,8 @@ +-- 169-bit complete interpreter; exact derivation in REPORT.txt and battery in battery.log. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) ((list list) (list list))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) \ No newline at end of file diff --git a/data/self-interpreter/reasoning_165/algebra/battery.log b/data/self-interpreter/reasoning_165/algebra/battery.log new file mode 100644 index 00000000..fb73d34a --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/battery.log @@ -0,0 +1,2 @@ + 169 bits ok=667 skip=1 fail=0 algebra/balanced_skip.lam 2.447s + 176 bits ok=667 skip=1 fail=0 algebra/shared_delta.lam 2.512s diff --git a/data/self-interpreter/reasoning_165/algebra/check.py b/data/self-interpreter/reasoning_165/algebra/check.py new file mode 100644 index 00000000..88098554 --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/check.py @@ -0,0 +1,27 @@ +import os +from pathlib import Path +import sys +import time +ROOT = Path('/Users/a9lim/Work/blam') +HERE = Path(__file__).resolve().parent +os.environ['TMPDIR'] = str(HERE) +os.environ['RAYON_NUM_THREADS'] = '2' +sys.path.insert(0, str(ROOT / 'tools/self-interpreter')) +import battery as b + +base = (ROOT / 'data/self-interpreter/machines/int165.lam').read_text() +base = '\n'.join(line for line in base.splitlines() if not line.startswith('--')) +assert '(list list list)' in base +balanced = base.replace('(list list list)', '((list list) (list list))') +shared = '(\\diag. ' + base.replace('(\\x. x x)', 'diag', 1).replace('(list list list)', '(diag (list list))') + ') (\\x. x x)\n' +for name, src in [('balanced_skip', balanced), ('shared_delta', shared)]: + src = '-- Correct construction from the 165; exact unoptimized size and battery in battery.log.\n' + src + path = HERE / (name + '.lam') + path.write_text(src) + term = b.compile_lam(src) + start = time.monotonic() + ok, skip, bad = b.check(term, threads=2) + print(f'{len(b.enc(term)):5d} bits ok={ok} skip={skip} fail={len(bad)} {path} {time.monotonic()-start:.3f}s', flush=True) + for item in bad[:5]: + print(' ', item, flush=True) + (HERE / (name + '.blc')).write_text(b.enc(term) + '\n') diff --git a/data/self-interpreter/reasoning_165/algebra/identities.log b/data/self-interpreter/reasoning_165/algebra/identities.log new file mode 100644 index 00000000..43d17164 --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/identities.log @@ -0,0 +1,39 @@ +PASS cross-stream +PASS bit-projection +PASS tail-projection +PASS nested-bit-projection +PASS 00-arity-selector +PASS 01-arity-selector +PASS equal-unary-cross-0 +PASS balanced-skip-0 +PASS equal-unary-cross-1 +PASS balanced-skip-1 +PASS equal-unary-cross-2 +PASS balanced-skip-2 +PASS equal-unary-cross-3 +PASS balanced-skip-3 +PASS equal-unary-cross-4 +PASS balanced-skip-4 +PASS equal-unary-cross-5 +PASS balanced-skip-5 +PASS equal-unary-cross-6 +PASS balanced-skip-6 +PASS unequal-unary-cross-0-1 +PASS unequal-unary-cross-1-0 +PASS unequal-unary-cross-1-2 +PASS unequal-unary-cross-2-1 +PASS unequal-unary-cross-2-3 +PASS unequal-unary-cross-3-2 +PASS unequal-unary-cross-0-3 +PASS unequal-unary-cross-3-0 +PASS unequal-unary-cross-2-5 +PASS unequal-unary-cross-5-2 +PASS cons-prime-cross +PASS reader-K +PASS reader-F +PASS reader-I +PASS reader-constant-thunk +PASS handler-handler +PASS reader-handler +PASS handler-reader +38 targeted normal-form equalities passed; no enumeration; unoptimized terms. diff --git a/data/self-interpreter/reasoning_165/algebra/identities.py b/data/self-interpreter/reasoning_165/algebra/identities.py new file mode 100644 index 00000000..b2bfa02b --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/identities.py @@ -0,0 +1,71 @@ +import os +from pathlib import Path +import sys +import re +ROOT = Path('/Users/a9lim/Work/blam') +HERE = Path(__file__).resolve().parent +os.environ['TMPDIR'] = str(HERE) +os.environ['RAYON_NUM_THREADS'] = '2' +sys.path.insert(0, str(ROOT / 'tools/self-interpreter')) +import battery as bt +K = '(\\x y. x)' +F = '(\\x y. y)' +I = '(\\x. x)' +def pair(a, b): + return f'(\\h. h ({a}) ({b}))' +def unary(n, tail): + out = pair(K, tail) + for _ in range(n): + out = pair(F, out) + return out +def z(q): + return f'(\\unused localrest. localrest ({q}))' +def h(c, q): + return f'(\\b. b {z(q)} ({c}))' +def p(c, q): + return f'(\\s. s {h(c,q)} (s s s))' +def cell(a, e): + return f'(\\x y. x ({a}) (y ({e})))' +count = 0 +def check(name, lhs, rhs): + global count + # All otherwise free identifiers are kept rigid under these lambdas. + prefix = '\\a b c d e n m q v r t. ' + def norm(src): + src = prefix + '(' + src + ')' + src = re.sub(r'\\([A-Za-z_]+(?: [A-Za-z_]+)+)\.', lambda m: ''.join('\\' + n + '.' for n in m[1].split()), src) + term = bt.compile_lam(src) + out = bt.normalize(bt.enc(term), 16384) + assert out is not None, ('not normalized', name, src) + return out + assert norm(lhs) == norm(rhs), (name, lhs, rhs) + count += 1 + print('PASS', name) + +check('cross-stream', f'{pair("b", "r")} {pair("d", "t")}', 'b d t r') +s = pair('b', 'r') +check('bit-projection', f'{s} {K}', 'b') +check('tail-projection', f'{s} {F}', 'r') +check('nested-bit-projection', f'{s} ({s} {K})', 'b b r') +check('00-arity-selector', f'{pair(K, pair(K,"t"))} ({pair(K, pair(K,"t"))} {F})', f'{K} {pair(K,"t")}') +check('01-arity-selector', f'{pair(K, pair(F,"t"))} ({pair(K, pair(F,"t"))} {F})', I) +for k in range(7): + u, w = unary(k,'n'), unary(k,'m') + check(f'equal-unary-cross-{k}', f'{u} {w}', f'{K} ' + ('n' if k % 2 == 0 else 'm')) + check(f'balanced-skip-{k}', f'({u} {u}) ({u} {u})', 'n') +for i, j in [(0,1),(1,0),(1,2),(2,1),(2,3),(3,2),(0,3),(3,0),(2,5),(5,2)]: + u, w = unary(i,'n'), unary(j,'m') + if i < j: + rhs = I if i % 2 == 0 else f'n {unary(j-i-1,"m")}' + else: + rhs = f'm {unary(i-j-1,"n")}' if j % 2 == 0 else I + check(f'unequal-unary-cross-{i}-{j}', f'{u} {w}', rhs) +check('cons-prime-cross', f'{cell("a","e")} {cell("b","d")}', '\\t. a b (t e d)') +check('reader-K', f'{p("c","q")} {K}', h('c','q')) +check('reader-F', f'{p("c","q")} {F}', F) +check('reader-I', f'{p("c","q")} {I}', '(\\r. r q)') +check('reader-constant-thunk', f'{p("c","q")} ({K} a)', f'a (a ({K} a))') +check('handler-handler', f'{h("c","q")} {h("d","v")}', 'd q c') +check('reader-handler', f'{p("c","q")} {h("d","v")}', f'c v d (d v d {h("d","v")})') +check('handler-reader', f'{h("c","q")} {p("d","v")}', 'q q c') +print(f'{count} targeted normal-form equalities passed; no enumeration; unoptimized terms.') diff --git a/data/self-interpreter/reasoning_165/algebra/shared_delta.blc b/data/self-interpreter/reasoning_165/algebra/shared_delta.blc new file mode 100644 index 00000000..7758f24b --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/shared_delta.blc @@ -0,0 +1 @@ +01000110000100000100000101100001011000000110111110111100111111100110100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001101000011010 diff --git a/data/self-interpreter/reasoning_165/algebra/shared_delta.lam b/data/self-interpreter/reasoning_165/algebra/shared_delta.lam new file mode 100644 index 00000000..60fc8be8 --- /dev/null +++ b/data/self-interpreter/reasoning_165/algebra/shared_delta.lam @@ -0,0 +1,8 @@ +-- 176-bit complete interpreter; exact derivation in REPORT.txt and battery in battery.log. +(\diag. diag (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (diag (list list))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x))) (\x. x x) diff --git a/data/self-interpreter/reasoning_165/bounds/RESULT.md b/data/self-interpreter/reasoning_165/bounds/RESULT.md new file mode 100644 index 00000000..5c6ce245 --- /dev/null +++ b/data/self-interpreter/reasoning_165/bounds/RESULT.md @@ -0,0 +1,441 @@ +# A hand-proved 165-bit bound for a curried-selector reader class + +No sub-165 interpreter was found or claimed. No new complete interpreter was +constructed. The sole complete interpreter checked was an unchanged copy of +the current 165-bit reference. The work below is a mathematical lower bound +for an explicitly restricted class, not a new exhaustive search and not an +unconditional optimality result. + +## Verified artifacts + +`proof_check.py` checks the exact BLC prices and the explicitly derived beta +identities below. It contains no term enumeration. It then checks the copied +reference at two threads, using the repository's unoptimized compiler and +battery. The observed runtime for the entire script was 2.29 seconds. + +```text +two-argument diagonal arm, second copy: 14 bits +two-argument diagonal arm, first copy: 15 bits +one-argument diagonal arm: 12 bits +zero-argument diagonal arm: 10 bits +handler m=0: 27 bits +handler m=1: 33 bits +handler m=2: 40 bits +skip: 10 bits +reference reader body: 43 bits +APP lift: 19 bits +cell m=0: 25 bits +cell m=1: 24 bits +explicit cost and beta-identity checks: PASS (no enumeration) + 165 bits ok=667 skip=1 fail=0 .../bounds/reference165.lam +``` + +The passing line is for the existing reference, not a new candidate. Later +focused checks also verified the 15-bit known-K repair and all 18 explicit +application-only cases of the strengthened zero-arm proof below. The +lower-bound proofs themselves are the arguments below; the Python checks +verify their witnesses, arithmetic, and those cases, not every quantified +assertion. These are hand proofs, not Lean formalizations. + +## 1. Definitions and the scope of the main theorem + +Write K = lambda a b. a and F = lambda a b. b. Use j for `next`, c for +`cont`, and s for the whole stream. The reader's ambient frame, innermost +first, is exactly + +```text +[s, j, c, p, x]. +``` + +Consider readers `s H S` satisfying all of the following: + +1. S has the stop-at-first-zero law: for every k >= 0 and fresh rigid T, + with s = `1^k 0 ++ T`, S reduces to T. All other ambient variables are + independent rigid symbols when this law is checked. +2. H is a curried, single-case selector: + + ```text + H = lambda b r1 ... rm. b A B. + ``` + + A and B may be arbitrary lambda terms, including beta redexes and further + occurrences of the tag b. They may use their available r_i and ambient + variables. There are no common arguments after `b A B`. +3. The handler laws are parametric: + + ```text + H K R R =beta R j + H F R T =beta c R T + ``` + + Here R and T are fresh independent rigid variables, and s, j, c, p, x + are also independent rigid variables. In particular, the handler cannot + exploit s being a Scott cell, or R containing T as a stream suffix. + +The 165's reader belongs to this class. Its zero-branch law is diagonal: +the two supplied tails are the same R. They are NOT assumed independent. + +**Theorem.** Every reader in this class costs at least 43 bits. With the +165's remaining syntax unchanged, every such complete interpreter costs at +least 165 bits. The reference attains both bounds. + +This class is narrower than arbitrary `s H S` readers, and much narrower +than all readers using the current NEXT interface. The restrictions above +are assumptions, not consequences of the interpreter contract. + +## 2. Elementary cost facts + +For any term, including an open one, let L and A count its abstraction and +application nodes and X be the sum of zero-based variable indices. Then + +```text +size = 2 L + 4 A + 2 + X. +``` + +A required free ambient variable at 1-based position d contributes at least +d-1 to X, even if its occurrence has been moved outside all local binders. +Beta reduction cannot introduce an absent free variable. + +Two small facts handle possible beta-compressed branches: + +* A term with at most one syntactic abstraction cannot normalize to two + leading abstractions. If it has a beta redex, that redex consumes its only + abstraction and its argument contains no abstraction to copy; if it has + no redex the claim is immediate. The same argument shows that a NON-normal + term normalizing to even one abstraction must contain at least two + abstraction nodes. +* A non-normal term whose normal form has an application must have at least + two application nodes. With only one, the redex consumes the sole + application, and there is no application in its body or argument to copy. + +Applying a term to fresh rigid variables cannot conceal non-normalization +inside its resulting normal form. After its leading abstractions are +consumed, substitution of rigid variables merely renames variable leaves; +it creates no beta redex. This also holds for a non-injective renaming such +as replacing two variables by the same fresh R. Thus the normal forms in +the following classifications are forced by the stated laws. + +## 3. The diagonal arm: an exact normal-form classification + +Suppose Z has no free R and + +```text +Z R R =beta R j +``` + +for fresh rigid R, with j and every other ambient symbol rigid. Then Z has +exactly one of the following beta-normal forms: + +```text +lambda u v. u j +lambda u v. v j. +``` + +Proof: a normal form with no leading lambda cannot acquire the fresh head +R. With one leading lambda, the second supplied R is the final argument of +the result, whereas the required final argument is j. Three or more leading +lambdas leave a lambda after the two applications. With exactly two, the +body must have one of their bound variables at the head and exactly the +single argument j. Identifying the two variables admits exactly the two +displayed bodies. + +In the actual arm frame `[b,s,j,c,p,x]`, those forms cost 15 and 14 bits. +No non-normal representative is shorter: it needs L >= 2, A >= 2, and the +required j occurrence gives X >= 2, hence size >= 16. Therefore the exact +minimum is **14**, achieved by `lambda u v. v j`. + +This proves a precise version of “the duplicate must be consumed”: under +the rigid, source-independent arm law, both leading lambdas are forced in +normal form, and introducing beta redexes cannot make the arm cheaper. +The next argument also covers borrowing lambdas from the known tag K. + +For use below, the corresponding one-argument diagonal law is + +```text +Z R =beta R j, +``` + +where Z may already contain the free R. Its normal forms are exactly +`lambda t. R j` and `lambda t. t j`. In the frame `[r,b,s,j,c,p,x]` their +costs are 13 and 12. A non-normal representative has L >= 1, A >= 2, +X >= 3, hence size >= 15. The exact minimum is **12**. + +With both r and t in scope, requiring `A[t:=r] =beta r j` forces the +normal form to be `r j` or `t j`. The exact minimum in +`[t,r,b,s,j,c,p,x]` is **10**, attained by `t j`. The same bound follows +just from the necessary j leaf, a necessary r-or-t leaf, and an application. + +### Borrowing K from the tag does not lower these minima + +Now allow the arm to contain b, specialized to K in the zero branch. +Other ambient variables remain rigid, including s. The 14-bit bound still +holds. Here is a complete small-syntax argument, with no term enumeration. + +For a hypothetical arm of size at most 13, the required j occurrence gives +X>=2, hence `2L+4A<=9`. If the arm does not contain b, the previous proof +applies. If it does contain b, both b and j must be leaves, so A>=1. + +* A=1: b and j are the only two leaves, and every explicit local lambda is + vacuous. The term is an outer chain of vacuous lambdas around an + application of two such chains, ending in b and j in either order. If + the function-side chain ends in j, the result is j-headed. If it ends + in b and has a lambda, the j argument is erased. Otherwise its head is + K and it returns a constant abstraction chain ending in j. None can + return `R j` after two fresh R arguments. +* A=2: the cost inequality forces L=0. The two non-j leaves have combined + cost at most five, so they are b,b or b,s. For b,b,j the six trees + `(b b) j`, `(b j) b`, `(j b) b`, `b (b j)`, `b (j b)`, `j (b b)`, + after b:=K, reduce respectively to K, j, `j K K`, a constant two-lambda + function returning j, a constant function returning `j K`, or + `j (K K)`. None satisfies the diagonal law. For b,s,j there is only + one K in an application-only tree over rigid s and j. If K is the + head it is applied at least once, leaving at most one leading lambda; + otherwise the head is rigid s or j. It cannot have the two-lambda + normal form forced by the diagonal law. + +These exhaust the possible costs. Thus reuse of K still cannot beat 14. +The known repair `b (lambda v.v j)` costs 15, consistent with the bound. + +For the one-argument arm, a hypothetical size at most 11 has X>=3 and +therefore `2L+4A<=6`. A term mentioning both b and j must have exactly +one application, with those two leaves. The same vacuous-chain argument +rules it out. The tag-free case was already bounded by 12. Thus the +12-bit minimum also survives arbitrary use of b:=K. The nullary 10-bit +minimum uses only required free-leaf costs, so allowing b changes nothing. + +Consequently the next table allows arbitrary additional tag occurrences +inside both arms. In the one branch b:=F, only the required independent +free leaves are used to establish the B bounds. + +### Stronger standalone result: the whole zero cell does not beat 14 either + +Keep the actual arm frame `[b,s,j,c,p,x]`, but now substitute BOTH + +```text +b := K, +s := cons K R = lambda f. f K R, +``` + +where R,j,c,p,x are independent rigid variables. Any arm Z satisfying + +```text +Z[b:=K,s:=cons K R] R R =beta R j +``` + +still costs at least **14 bits**. This lets the arm exploit the actual +whole input cell and its already-stored R, as well as the known K. + +The same budget inequality `2L+4A<=9` holds below 14. Cases with neither +b nor s use the original rigid proof. A one-application term involving s +has precisely the leaves s,j, so again all its explicit lambdas are +vacuous. A lambda on the function side that ends in s erases the j +argument. Without that lambda, s applied to `lambda^k.j` reduces to +`j K R`, `j R`, or j for k=0,1,2. Other orientations are j-headed. +Outer vacuous lambdas cannot change any of these into `R j`. + +For two applications, L=0 and the only possibilities are the six b,b,j +trees already treated and the twelve b,s,j trees. Four latter trees have +j as their function head immediately. The other eight reduce as follows, +before supplying the final R,R: + +| Tree | Reduct after substituting K and cons K R | +|---|---| +| `(b s) j` | `cons K R` (j erased) | +| `(b j) s` | `j` | +| `b (s j)` | `lambda u. j K R` | +| `b (j s)` | `lambda u. j (cons K R)` | +| `(s b) j` | `K j` | +| `(s j) b` | `j K R K` | +| `s (b j)` | `j R` | +| `s (j b)` | `j K K R` | + +All retain a wrong rigid head after the final applications, except the +first, which has erased the required j. This exhausts the costs below +14. The existing `lambda u v.v j` attains 14. The 18 application-only +cases were directly normalized as a focused check of this hand case split. + +This stronger standalone result does not make j or the recursive parser +non-rigid, and it does not resolve the variable branch's stream/suffix +correlation. It therefore does not remove the scope restrictions of the +full reader theorem. + +## 4. Price every currying cut of the handler + +There are only three possible cuts. m >= 3 leaves an outer lambda after +applying H to b, R, and T, contradicting either handler law. + +| m | Cheapest zero arm A | Cheapest one arm B | Dispatch/prefix | A | B | H | +|---|---|---|---:|---:|---:|---:| +| 0 | `lambda u v. v j` | `c` | 8 | 14 | 5 | **27** | +| 1 | `lambda t. t j` | `c r` | 11 | 12 | 10 | **33** | +| 2 | `t j` | `c r t` | 14 | 10 | 16 | **40** | + +The zero-arm prices, including reuse of b:=K, were proved in section 3. +The one-arm bounds do not +assume normal syntax: the laws require, respectively, the free leaves c; +c and r; and c, r, t. Their exact leaf prices plus the necessary number of +application nodes give 5, 10, and 16. Each displayed B attains the bound. +The prefix price is the literal cost of its m+1 lambdas, tag occurrence, +and two applications. + +Thus currying one tail into H costs at least six extra bits; currying both +costs at least thirteen. Allowing arbitrary beta redexes INSIDE the arms +does not evade these bounds. This is a costed separation statement for the +two roles, rather than an assumption that the arms have the reference form. + +More generally, if j and c occupy ambient positions d_j and d_c before b +is bound, the three handler minima are + +```text +22 + d_j + d_c, +28 + d_j + d_c, +35 + d_j + d_c. +``` + +At the reference positions d_j=2, d_c=3 these are 27, 33, and 40. + +## 5. The skip costs at least ten bits, without a normal-form restriction + +Every term below ten bits has at most one application, by the size formula. +A syntactic outer lambda cannot return the fresh rigid suffix T. An atom +cannot do so either: s is a Scott cell, and other ambient atoms are rigid +and different from T. + +If there is one application U V, each of U and V is a chain of lambdas +ending in a variable. A lambda-headed U can only leave a lambda or return +one of those variable/abstraction-chain values; none is the hidden T. +A rigid U other than s gets stuck with the wrong head. Thus only `s Q` +remains, where Q costs at most five bits. + +Test just s = `0:T`. If Q is an ambient rigid variable q, the result is +`q K T`; if Q=s, the result is `K T`. The other possibilities within five +bits are `lambda u.u` and `lambda u.s`; they yield `K T` and `T K T`, +respectively. None is T. This proves the lower bound ten. + +At ten bits, a two-application term has L=X=0, so its three leaves must +all be s. The two possibilities are `(s s) s` and `s (s s)`. On `0:T`, +the latter is `T T`, so fails. With one application, the only additional +candidate that passes `0:T` is `s F`; it returns the immediate tail and +fails `10:T`. Hence `(s s) s` is the unique solution through ten bits. + +For completeness its law is proved by induction on k, not by the finite +checks: for s=`0:T`, `s s ->* K T`; for s=`1:r`, `s s ->* r r`. +Consequently `s s ->* K T` for every `1^k0:T`, and `(s s) s ->* T`. + +The reader's two applications and source occurrence cost six bits. +Sections 4 and 5 therefore give **6 + 27 + 10 = 43**. All other syntax in +the 165 costs 122, yielding the claimed conditional **165** bound. + +## 6. An independent 19-bit bound for the fully parametric APP lift + +In the actual lift frame `[g,f,b,c,p,x]`, suppose a term V satisfies + +```text +V E =beta f E (g E) +``` + +for a fresh rigid E, with all frame variables rigid. Then **size(V) >= 19**, +with no syntax restriction on V. + +First, V has the unique normal form `lambda e. f e (g e)`. It must normalize +because application to a fresh variable normalizes. With zero leading +lambdas its final supplied argument would be E, whereas the required final +argument is `g E`; with two leading lambdas one would remain. One leading +lambda forces the displayed body. Its size is 19. + +For a possible non-normal V, at least two lambda nodes are necessary by +the elementary fact in section 2. At least three application nodes are +also necessary. To see this without assuming size-monotone beta reduction, +if x occurs q times in B, contracting `(lambda x.B) Q` changes the number +of application nodes by + +```text +-1 + (q-1) A(Q). +``` + +An increase would require q>=2 and A(Q)>=1, hence at least +`1 + (q-1) + A(Q) >= 3` applications already in the redex. Therefore terms +with at most two applications cannot normalize to a form with three. +Finally the required free f has ambient index 2, so X>=1. Consequently + +```text +size(V) >= 2*2 + 4*3 + 2 + 1 = 19. +``` + +This supplies an analytic proof of the parametric lift minimum, rather +than relying on its exhaustive-search record. It does NOT show that a +contextual APP replacement, or a changed value representation, costs 19. + +## 7. A second costed comparison: the cell currying cut + +The single-case grammar with b used only at its outer dispatch, now in +frame `[a,e]`, gives a small exact +comparison for cells satisfying + +```text +D K N =beta a, +D F R =beta R e, +``` + +with a,e,N,R independent rigid variables. Require +`D = lambda b r1 ... rm. b A B`, with b used only at this dispatch. +Only m=0,1 are possible. Their exact prices are: + +| m | A | B | Prefix | A | B | D | +|---|---|---|---:|---:|---:|---:| +| 0 | `lambda u.a` | `lambda r.r e` | 8 | 6 | 11 | **25** | +| 1 | `a` | `r e` | 11 | 4 | 9 | **24** | + +The nullary-arm minima are forced by required free-leaf occurrence costs. +For m=0, the normal forms of the two arms are forced as displayed. +Non-normal representatives of the first arm cost at least 9 (a lambda, +an application, and the required a occurrence); those of the second cost +at least 14 (a lambda, two applications, and the required e occurrence). +Thus neither improves the listed prices. + +The cell and reader favor different cuts: binding the remaining argument +before dispatch saves one bit in the cell, but costs six in the reader. +This explains a concrete limitation on reusing a single curried selector +shape for those two jobs. It is not a theorem against every shared helper. + +## 8. Exactly where the broad proof attempt stops + +The unresolved step is NOT optimizing A or B inside this class; their +prices above are proved even with beta redexes. It is showing that an +arbitrary cheaper reader can be brought into the single-case grammar +without increasing its BLC size. I do not have such a theorem. + +In particular, the main result does not cover: + +* use of s as a Scott cell inside an arm; +* dependence on the real variable-tail relation `R=1^(n-1)0:T`; +* extra common arguments after `b A B`, or a different outer reader head; +* using the real parser or NEXT implementation where the proof assumes a + rigid neighbour; +* moving, sharing, or changing syntax outside the 43-bit reader. + +Several of those are exactly the ways the 165 escaped the old module +grammar. In particular the current proof does not discharge the record's +capped joint-reader candidates. Nor does it establish a decomposition +theorem for every self-interpreter. + +Additional tag occurrences inside A and B ARE covered: borrowing K from +the zero tag cannot lower either diagonal-arm minimum at these budgets. + +My read: simply changing the number of tails bound before dispatch, or +beta-compressing the independent arms, is mathematically closed in this +class. A sub-165 reader needs a correlation that those laws deliberately +erase, or shared syntax crossing the selector boundary. The most concrete +remaining correlation is that the same Scott stream supplies both a value +selector and the stop-at-zero tail. That is a target for a construction, +not evidence that one exists. + +## 9. Complete-interpreter ledger + +| File | Bits | Observed battery | Idea/status | +|---|---:|---|---| +| `reference165.lam` | 165 | `ok=667 skip=1 fail=0` | Unchanged copy of the known hoisted-skip reader; witness for the conditional bound only. | + +No other complete interpreter was constructed. No sweep, hole search, +external consult, package installation, or repository modification was +performed. All created files are in the assigned scratch directory. diff --git a/data/self-interpreter/reasoning_165/bounds/SUMMARY.md b/data/self-interpreter/reasoning_165/bounds/SUMMARY.md new file mode 100644 index 00000000..cba1cca6 --- /dev/null +++ b/data/self-interpreter/reasoning_165/bounds/SUMMARY.md @@ -0,0 +1,72 @@ +(•̀ᴗ•́) **No sub-165 construction. I obtained a conditional 165-bit lower bound, a stronger 14-bit zero-arm bound, and an analytic 19-bit APP-lift bound.** These are hand proofs, with targeted computational checks—not Lean formalizations. + +Full proofs and boundaries: [RESULT.md](RESULT.md). Checks: [proof_check.py](proof_check.py). + +**The reader theorem.** In the actual frame `[s,next,cont,intL,x]`, consider readers +```text +s H S +H = λb r1 … rm. b A B +``` +where: + +- `S` satisfies the stop-at-first-zero law; +- `A` and `B` are arbitrary terms, including β-redexes and further uses of `b`; +- there are no common arguments following `b A B`; +- the handler satisfies the parametric laws + ```text + H K R R =β R next + H F R T =β cont R T + ``` + with independent rigid neighbours, `R`, and `T`. + +Then the exact handler minima are: + +| Tails bound before dispatch | Zero arm | Variable arm | Handler | +|---|---:|---:|---:| +| 0 | 14 | 5 | **27** | +| 1 | 12 | 10 | **33** | +| 2 | 10 | 16 | **40** | + +Three or more leave an unwanted outer lambda. The skip costs at least **10**, and the reader’s two applications plus `s` cost **6**. Thus the reader costs at least **43**, and retaining the other 122 bits gives **165**. + +This class includes the 165 and permits β-compression inside both arms. It does not cover arbitrary reader shapes or exploitation of the variable-tail correlation. + +**The zero-arm result is stronger than that theorem requires.** In frame `[b,s,next,cont,intL,x]`, even allowing +```text +b := K +s := cons K R +``` +an arm satisfying +```text +Z R R =β R next +``` +for rigid `R,next,cont,intL,x` cannot cost below **14**. + +The proof starts with the exact classification, when `R` is absent from `Z` and neighbours are rigid: +```text +Z R R =β R next +⇒ NF(Z) ∈ { λu v. u next, λu v. v next }. +``` +Their costs are 15 and 14. A non-normal representative needs at least two lambdas, two applications, and the required `next` occurrence, costing at least 16. + +Borrowing the known `K` or whole zero cell requires a separate argument. Below 14, the required `next` occurrence forces +```text +2L + 4A ≤ 9. +``` +One-application terms involving the supplied structures have only two leaves and vacuous local lambdas; they either erase `next` or produce the wrong head. Two-application terms have no lambdas and reduce to precisely six trees using `b,b,next` and twelve using `b,s,next`. All fail; their reductions are listed in the report and directly checked. The existing 14-bit arm attains the bound. + +Consequently, **reusing the known zero tag or whole zero cell alone cannot buy the missing bit while NEXT and recursion remain rigid.** + +Two additional results: + +- **APP lift ≥19 bits**, without a syntax restriction, under `V E =β f E (g E)` with independent rigid variables. Its unique normal form costs 19. A non-normal representative needs at least two lambdas and three applications; the captured `f` contributes at least one index bit, giving `2·2 + 4·3 + 2 + 1 = 19`. The application bound follows because terms with at most two application nodes cannot increase that count under β-reduction. +- **Cell currying costs 25 versus 24 bits** in the outer-selector grammar with the tag used only at that dispatch. Thus the cell benefits from binding its remaining argument before dispatch, whereas the reader pays six extra bits for doing so. This is a precise limitation on sharing that particular selector structure. + +**Complete-interpreter ledger:** no new complete interpreter was constructed. The unchanged reference was copied as [reference165.lam](reference165.lam), providing the attaining witness: +```text +165 bits ok=667 skip=1 fail=0 +``` +The initial identity checks plus this two-thread battery took 2.29 seconds. Later checks covered the strengthened zero-arm cases. No searches or repository modifications were performed. + +**Where the broader proof fails:** I cannot show that an arbitrary smaller reader admits the displayed selector decomposition without increasing its size. The live possibilities therefore remain shared arguments crossing that dispatch, exploitation of the variable selector/suffix relationship, a different reader head, and fusion with the actual NEXT or recursive implementation. The proved zero-arm bound makes the variable-side correlation a sharper target than independently repairing the duplicated zero tail. + diff --git a/data/self-interpreter/reasoning_165/bounds/proof_check.py b/data/self-interpreter/reasoning_165/bounds/proof_check.py new file mode 100644 index 00000000..930b528b --- /dev/null +++ b/data/self-interpreter/reasoning_165/bounds/proof_check.py @@ -0,0 +1,164 @@ +#!/usr/bin/env python3 +"""Check only the explicitly derived witnesses; no term enumeration. + +All BLC compilation is unoptimized. The only complete interpreter checked is +an unchanged copy of the repository's 165-bit reference, at two threads. +""" +import os +from pathlib import Path +import sys + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = Path('/Users/a9lim/Work/blam') +os.environ['TMPDIR'] = str(HERE) +os.environ['RAYON_NUM_THREADS'] = '2' +sys.path[:0] = [str(ROOT / 'tools/self-interpreter'), str(ROOT / 'tools')] +import lc +import battery + + +def V(name): + return ('V', name) + + +def A(f, *xs): + for x in xs: + f = ('A', f, x) + return f + + +def L(*xs): + body = xs[-1] + for name in reversed(xs[:-1]): + body = ('L', name, body) + return body + + +def db(t, frame): + if t[0] == 'V': + return ('V', frame.index(t[1])) + if t[0] == 'L': + return ('L', db(t[2], [t[1]] + frame)) + return ('A', db(t[1], frame), db(t[2], frame)) + + +GLOBAL = ['R', 'T', 'N', 's', 'j', 'c', 'p', 'x', 'a', 'e', 'f', 'g'] + + +def normal(t): + return lc.nf(db(t, GLOBAL), [10000]) + + +def equal(left, right): + assert normal(left) == normal(right) + + +def priced(label, t, frame, want): + term = db(t, frame) + got = lc.size(term) + assert got == want, (label, got, want) + print(f'{label}: {got} bits') + return got + + +K = L('ka', 'kb', V('ka')) +F = L('fa', 'fb', V('fb')) + + +def cons(b, r): + return L('cs', A(V('cs'), b, r)) + + +def stream(bits, tail): + for bit in reversed(bits): + tail = cons(K if bit == '0' else F, tail) + return tail + + +s, j, c = map(V, ['s', 'j', 'c']) +R, T, N = map(V, ['R', 'T', 'N']) +frame = ['s', 'j', 'c', 'p', 'x'] + +Z0 = L('u', 'v', A(V('v'), j)) +Z0_first = L('u', 'v', A(V('u'), j)) +Z1 = L('t', A(V('t'), j)) +Z2 = A(V('t'), j) +priced('two-argument diagonal arm, second copy', Z0, + ['b'] + frame, 14) +priced('two-argument diagonal arm, first copy', Z0_first, + ['b'] + frame, 15) +priced('one-argument diagonal arm', Z1, + ['r', 'b'] + frame, 12) +priced('zero-argument diagonal arm', Z2, + ['t', 'r', 'b'] + frame, 10) +equal(A(Z0, R, R), A(R, j)) +equal(A(Z0_first, R, R), A(R, j)) +ZK = A(V('b'), L('v', A(V('v'), j))) +priced('known-K repair arm', ZK, ['b'] + frame, 15) +equal(A(L('b', ZK), K, R, R), A(R, j)) + +# Six explicitly derived application-only cases in the known-K proof. +b = V('b') +small_K_cases = [A(b, b, j), A(b, j, b), A(j, b, b), + A(b, A(b, j)), A(b, A(j, b)), A(j, A(b, b))] +for term in small_K_cases: + assert normal(A(L('b', term), K, R, R)) != normal(A(R, j)) + +# The twelve additional cost-13 cases when s is the actual cons K R. +small_K_source_cases = [ + A(b, s, j), A(b, j, s), A(s, b, j), A(s, j, b), + A(j, b, s), A(j, s, b), + A(b, A(s, j)), A(b, A(j, s)), + A(s, A(b, j)), A(s, A(j, b)), + A(j, A(b, s)), A(j, A(s, b)), +] +for term in small_K_cases + small_K_source_cases: + assert lc.size(db(term, ['b'] + frame)) <= 13 + probe = A(L('b', 's', term), K, cons(K, R), R, R) + assert normal(probe) != normal(A(R, j)) +print('source-aware zero-arm cases: PASS (18 explicitly derived terms)') + +H0 = L('b', A(V('b'), Z0, c)) +H1 = L('b', 'r', A(V('b'), Z1, A(c, V('r')))) +H2 = L('b', 'r', 't', A(V('b'), Z2, A(c, V('r'), V('t')))) +for m, h, bits in [(0, H0, 27), (1, H1, 33), (2, H2, 40)]: + priced(f'handler m={m}', h, frame, bits) + equal(A(h, K, R, R), A(R, j)) + equal(A(h, F, R, T), A(c, R, T)) + +skip = A(s, s, s) +priced('skip', skip, frame, 10) +for k in range(8): + sk = stream('1' * k + '0', N) + equal(A(sk, sk), L('ignored', N)) + equal(A(sk, sk, sk), N) +priced('reference reader body', A(s, H0, skip), frame, 43) + +# The lifted APP has the fully parametric law Lift E = f E (g E). +lift = L('env', A(V('f'), V('env'), A(V('g'), V('env')))) +priced('APP lift', lift, ['g', 'f', 'b', 'c', 'p', 'x'], 19) +equal(A(lift, V('e')), A(V('f'), V('e'), A(V('g'), V('e')))) + +# The corresponding one-dispatch cell class has two possible currying cuts. +cell0 = L('b', A(V('b'), L('u', V('a')), + L('r', A(V('r'), V('e'))))) +cell1 = L('b', 'r', A(V('b'), V('a'), A(V('r'), V('e')))) +for m, cell, bits in [(0, cell0, 25), (1, cell1, 24)]: + priced(f'cell m={m}', cell, ['a', 'e'], bits) + equal(A(cell, K, N), V('a')) + equal(A(cell, F, R), A(R, V('e'))) + +print('explicit cost and beta-identity checks: PASS (no enumeration)') + +if '--identities-only' in sys.argv: + raise SystemExit(0) + +reference = ROOT / 'data/self-interpreter/machines/int165.lam' +copy = HERE / 'reference165.lam' +copy.write_bytes(reference.read_bytes()) +E = battery.compile_lam(copy.read_text()) +assert len(battery.enc(E)) == 165 +ok, skipped, bad = battery.check(E, threads=2) +print(f'{len(battery.enc(E)):5d} bits ok={ok} skip={skipped} fail={len(bad)} {copy}') +assert (ok, skipped, len(bad)) == (667, 1, 0) diff --git a/data/self-interpreter/reasoning_165/bounds/reference165.lam b/data/self-interpreter/reasoning_165/bounds/reference165.lam new file mode 100644 index 00000000..2861fca0 --- /dev/null +++ b/data/self-interpreter/reasoning_165/bounds/reference165.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_165/fresh/REPORT.md b/data/self-interpreter/reasoning_165/fresh/REPORT.md new file mode 100644 index 00000000..fff680ec --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/REPORT.md @@ -0,0 +1,229 @@ +# Fresh-reader consult: no sub-165 result + +Read `docs/classical/self-interpreter/interpreter.md` and the current STATUS +before working. No enumeration, no subagents or consults, no repository edits. +Four complete terms were constructed by hand and checked with the repository +battery at two threads. The longest battery took 2.551 seconds. + +## Complete constructions + +All sources and unoptimized wire encodings are beside this report. + +| File | Bits | Battery | Idea | +|---|---:|---|---| +| `return_stream.lam` | 191 | `ok=667 skip=1 fail=0` | Always invoke the second parser: ABS supplies a constant artificial stream which returns the completed ABS result, while APP supplies the actual remainder. | +| `return_stream_shared_cont.lam` | 207 | `ok=667 skip=1 fail=0` | Share the conditional continuation, whose ABS specialization is a constant function, then turn that continuation into the artificial return stream. | +| `late_zero_discard.lam` | 181 | `ok=667 skip=1 fail=0` | Move the zero arm's discarded duplicate beyond the second Scott cell, so its immediate zero arm has only one binder. This prices the delayed-discard idea; it does not improve the interpreter. | +| `reader_diagonal_knot.lam` | 199 | `ok=667 skip=1 fail=0` | Share the reader and use its own zero arm to generate the outer self-application instead of a separate diagonal combinator. | + +`battery.log` contains the exact lines and times. Each also passes the separate +divergent-program suffix probe + +``` +E (lambda value rest. rest) ( ++ N) =beta N +``` + +with rigid `N`; see `suffix.log`. This probe is supplementary evidence, not a +replacement for the all-program proof. + +## Notation and exact identities + +All equations below are beta reductions, with `n`, `c`, and `X` arbitrary +terms; binders are fresh. Define + +``` +Z_n = lambda u r. r n +J_n = lambda r. r n +H_n,c = lambda b. b Z_n c +R_n,c = lambda s. s H_n,c (s s s) +K X = lambda u. X +``` + +`R_n,c` is precisely the 165 reader with its NEXT parameter made explicit. + +### Constant streams are return instructions + +``` +R_n,c (K (K X)) ->* X. +``` + +Put `S = K (K X)`. Then `S H -> K X` and `S S S -> X`, so +`S H (S S S) ->* (K X) X -> X`. Neither NEXT nor the continuation is +evaluated. More generally, + +``` +R_n,c (K Q) ->* Q (Q (K Q)). +``` + +This explains why one constant wrapper is insufficient: for rigid `X`, +`R_n,c (K X)` is headed by `X` with one argument, rather than bare `X`. + +The 191-bit construction uses this law as follows. Write + +``` +L f = lambda env arg. f (lambda b r. b arg (r env)) +A f g = lambda env. f env (g env) +``` + +After the first subterm is parsed, its continuation is + +``` +lambda f rest. + E (lambda g. c (A f g)) + (b (lambda u v. c (L f) rest) rest). +``` + +For `b=K`, the second parser immediately returns `c (L f) rest`; for `b=F`, +it parses the second subterm. This is a valid fusion, but capturing the real +remainder and building the artificial stream raises the size to 191. + +For the 207-bit variant let + +``` +k = lambda g. b (c (L f) rest) (c (A f g)). +``` + +Then use `E k (b (K k) rest)`. In ABS, `k = K (c (L f) rest)`, so its input +is exactly the double-constant stream required above. In APP the input is +the real remainder and `k` is the ordinary APP continuation. Sharing costs +more than it saves. + +### The reader can generate the NEXT diagonal + +``` +R_n,c Z_n ->* n n +H_n,c R_n,c ->* n n c. +``` + +Proof: + +``` +Z_n H -> J_n +Z_n Z_n Z_n -> J_n Z_n -> Z_n n -> J_n +R_n,c Z_n ->* J_n J_n -> J_n n -> n n +H_n,c R_n,c -> R_n,c Z_n c ->* n n c. +``` + +This is a mixed-component identity, distinct from the documented handler +diagonal `H H -> c n c`. A plain extraction/shared-helper implementation is +the 199-bit construction. If `Q n c = R_n,c` and `G` is the usual generator +using `Q` for its reader, its outer expression is + +``` +(lambda g. Q g g (lambda u r. r g)) G + ->* G G. +``` + +Therefore the complete 199-bit term is beta-equivalent to the 165, not merely +consistent with the finite battery. The extra helper plumbing costs 34 bits. + +### Other exact evaluations used in the proofs + +``` +R_n,c I ->* J_n +R_n,c K ->* H_n,c +R_n,c F ->* F +R_n,c H_n,c ->* c n c (c n c H_n,c) +R_n,c R_n,c ->* + c n c (c n c H_n,c) (R_n,c R_n,c R_n,c). +``` + +The first three follow by substituting `I`, `K`, and `F` for `s`. For the +fourth use `H H -> c n c` in `H H (H H H)`. The last follows by unfolding the +outer reader once to `R H (R R R)` and applying the fourth identity. These are +finite reductions; the last expression has no full normal form when `c` is +rigid because the recursively retained argument cannot be erased. An initial +full-normal-form check of that equation exhausted fuel on both sides; it was +not a counterexample. `identities.log` distinguishes this head identity from +the four identities checked by normalizing closed abstractions. + +## Two proved restrictions + +### Application trees of the reader alone cannot provide the knot + +For rigid `c`, every application tree with at least two leaves, each a copy +of `R_n,c`, reduces to a `c`-headed spine with at least four arguments. + +Proof by induction on the tree. The two-leaf case is the final identity +above. For `U V`, if `U` has at least two leaves, its `c`-headed spine simply +gains the argument `V`. Otherwise `U=R`, and if `V` has at least two leaves, + +``` +R V -> V H (V V V), +``` + +so the inductively `c`-headed `V` gains two arguments. This covers all trees. +Further applications cannot remove arguments from rigid `c`. Consequently +such a tree cannot serve as the recursive parser or deliver the contract's +two-argument `c` result. This is an all-size restriction on this grammar, +not a lower bound for arbitrary interpreters. + +The restriction must NOT be extended to mixed reader/handler trees: +`H R -> n n c` is an explicit counterexample for arbitrary `n`. + +There is also a precise obstruction to using that mixed identity unchanged. +For the current NEXT protocol, write + +``` +n = lambda b. E k_b +k_b = lambda f. b (c (L f)) (E (lambda g. c (A f g))). +``` + +Then `n n c = E k_n c`: it parses the rigid public continuation as a stream. +Unfolding the reader gives `c H' (c c c)`. This already has a rigid `c` head, +so it cannot be the function `E c` awaiting a stream; another application +adds a third argument to `c`. A successful mixed knot must change NEXT's +protocol, not just substitute the diagonal into the existing one. + +### The constant-return stream is optimal through its eight-bit module + +Consider terms `S(X)` with `X` their sole free variable and require +`R_n,c S(X) =beta X` for arbitrary rigid `n,c,X`. In the frame `[X]`, the +eight-bit term `lambda u v. X` is minimal. + +The complete list below eight bits is + +``` +X 2 +I 4 +lambda u. X 5 +F 6 +X X 6 +K 7. +``` + +This list follows directly from the BLC size rules: an application involving +a lambda costs at least eight bits; a lambda containing an application also +costs at least eight; and three lambdas cost at least eight. The terms `X`, +`X X`, and `lambda u.X` produce rigid `X` with respectively two, three, and +one arguments. The other three produce `J_n`, `F`, and `H_n,c` as above. +None is beta-equal to bare rigid `X`. This is only a scoped module bound; +it allows no extra free NEXT/continuation variables or alternative protocol. + +## Correctness boundary and assessment + +The 181-bit delayed-discard construction uses the exact Scott-cell equation + +``` +(cons b tail) (lambda bit rest unused. P bit rest) original + ->* P b tail. +``` + +Thus moving the discard beneath the second cell preserves the zero branch. +The first two constructions preserve the ABS/APP parser equations by the +return-stream reductions above, while their variable branches are unchanged. +The ordinary induction on finite source syntax therefore transfers the +165's denotation/remainder invariant, without normalizing the interpreted +program. These are paper arguments, not newly checked Lean developments. +The 199-bit construction has the stronger whole-term beta-equivalence noted +above. All four have independently observed finite battery results. + +No sub-165 candidate was found. This does not improve any global lower bound. +The most concrete surviving seam from this pass is mixed use of the reader, +handler, and zero arm: they already generate `n n` and `n n c`. The scalar +NEXT interface currently makes that diagonal unusable as a parser. A smaller +construction would have to make NEXT or a related component serve both roles +while using the already-written reader code to carry the state. Merely +factoring a generic reader, or postponing its discard, demonstrably loses +bits in the constructions above. I do not have the necessary dual-purpose +NEXT construction. diff --git a/data/self-interpreter/reasoning_165/fresh/SUMMARY.md b/data/self-interpreter/reasoning_165/fresh/SUMMARY.md new file mode 100644 index 00000000..4213e105 --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/SUMMARY.md @@ -0,0 +1,128 @@ +(•̀ᴗ•́) **No sub-165 interpreter found.** The useful new results are exact reader/handler identities and an all-size exclusion for self-application trees made solely from the reader. + +All artifacts and detailed proofs are in [REPORT.md](REPORT.md). No repository files were changed; no enumeration was run. + +Every complete construction built: + +| File | Exact battery line | Idea | +|---|---|---| +| `return_stream.lam` | `191 bits ok=667 skip=1 fail=0` | ABS supplies an artificial stream that returns its completed result; APP supplies the actual remainder. | +| `return_stream_shared_cont.lam` | `207 bits ok=667 skip=1 fail=0` | Share the conditional continuation and derive the artificial stream from it. | +| `late_zero_discard.lam` | `181 bits ok=667 skip=1 fail=0` | Move the discarded duplicate below the second Scott-cell elimination. | +| `reader_diagonal_knot.lam` | `199 bits ok=667 skip=1 fail=0` | Share the reader and use its zero arm to generate the outer self-application. | + +Sources, `.blc` encodings, and logs are beside the report. Each battery used two threads and took 2.38–2.55 seconds. All four also passed the rigid-tail extraction probe on Ω. The 199-bit construction is β-equivalent to the 165 by the identities below; the others have paper-level parser-equation arguments and finite battery evidence, without new Lean proofs. + +Define, with fresh binders, + +```text +Z = λu r. r n +J = λr. r n +H = λb. b Z c +R = λs. s H (s s s) +``` + +Here `R` is exactly the 165’s reader, parameterized by NEXT `n` and continuation `c`. + +**1. Constant streams implement an exact return instruction.** + +```text +R (K Q) →* Q (Q (K Q)) +R (K (K X)) →* X +``` + +Proof: for `S = K Q`, `S H → Q` and `S S S → Q S`; hence `R S →* Q (Q S)`. Substitute `Q = K X` for the second identity. Neither `n` nor `c` is evaluated. + +The 191-bit interpreter uses this to replace the conditional second parse with + +```text +λf rest. + E (λg. c (APP f g)) + (b (λu v. c (ABS f) rest) rest). +``` + +For `b=K`, the artificial stream returns the completed ABS result. For `b=F`, the parser reads the second child normally. Capturing the real remainder makes this construction expensive. + +There is a small exact bound here: in the frame `[X]`, with no other free variables, the eight-bit stream `λu v.X` is minimal for uniformly satisfying `R S(X) =β X`. The complete list below eight bits is + +```text +X, I, λu.X, F, X X, K. +``` + +The three `X`-headed cases yield `X` with respectively two, one, and three arguments. The others yield `J`, `F`, and `H`. None equals bare rigid `X`. This is a scoped module bound only. + +**2. The reader and zero arm generate self-application.** + +```text +R Z →* n n +H R →* n n c +``` + +Proof: + +```text +Z H → J +Z Z Z → J Z → Z n → J +R Z →* J J → J n → n n +H R → R Z c →* n n c. +``` + +This differs materially from the recorded `H H → c n c`: mixing components exposes the NEXT diagonal. + +The 199-bit construction implements this literally. With `Q n c = R` and the usual generator `G` rewritten to use `Q`, its outer expression is + +```text +(λg. Q g g (λu r. r g)) G →* G G. +``` + +Thus it reconstructs the ordinary knot exactly, but sharing the helper costs 34 bits. + +**3. Reader-only knots are impossible at every size in this grammar.** + +The relevant exact reductions are + +```text +R I →* J +R K →* H +R F →* F +R H →* c n c (c n c H) +R R →* c n c (c n c H) (R R R). +``` + +The first three follow by substitution. For the fourth, expand `R H = H H (H H H)` and use `H H → c n c`. The fifth follows from `R R → R H (R R R)`. + +For rigid `c`, **every application tree containing at least two copies of `R` reduces to a `c`-headed spine with at least four arguments**: + +- `R R` supplies the base case above. +- If the left subtree is composite, its existing `c` spine gains one argument. +- Otherwise the tree is `R V` with composite `V`; unfolding gives `V H (V V V)`, so its `c` spine gains two arguments. + +Further applications cannot remove arguments from rigid `c`. These trees therefore cannot provide the recursive parser or the contract’s two-argument continuation result. This extends the recorded handler-only exclusion to reader-only trees. + +It **does not extend to mixed trees**: `H R → n n c` explicitly escapes it. + +There is nevertheless an obstruction under the unchanged NEXT protocol. Write + +```text +n = λb. E k_b. +``` + +Then + +```text +H R →* n n c → E k_n c. +``` + +This feeds the public continuation to the parser as its stream. Unfolding the reader gives `c H' (c c c)`, already rigidly `c`-headed; supplying a stream adds a third argument. Therefore the extracted diagonal cannot simply replace the existing recursive parser. + +The delayed-discard candidate uses the elementary identity + +```text +(cons b tail) (λbit rest unused. P bit rest) original + →* P b tail, +``` + +which preserves parsing but increases depth and size. + +My assessment: **mixed reader/handler/zero-arm use remains the concrete unresolved seam from this pass.** These components already manufacture `n n` and `n n c`. A gain would require NEXT, or a related component, to perform both its parsing role and the knot role while reusing the existing reader. The unchanged interface prevents that; straightforward helper extraction loses badly. I did not find the required construction, and none of these restrictions establishes optimality at 165. + diff --git a/data/self-interpreter/reasoning_165/fresh/battery.log b/data/self-interpreter/reasoning_165/fresh/battery.log new file mode 100644 index 00000000..dd68d2c6 --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/battery.log @@ -0,0 +1,4 @@ +191 bits ok=667 skip=1 fail=0 return_stream.lam wall=2.551s +207 bits ok=667 skip=1 fail=0 return_stream_shared_cont.lam wall=2.449s +181 bits ok=667 skip=1 fail=0 late_zero_discard.lam wall=2.397s +199 bits ok=667 skip=1 fail=0 reader_diagonal_knot.lam wall=2.381s diff --git a/data/self-interpreter/reasoning_165/fresh/identities.log b/data/self-interpreter/reasoning_165/fresh/identities.log new file mode 100644 index 00000000..29c151c6 --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/identities.log @@ -0,0 +1,5 @@ +constant_return: PASS +zero_arm_diagonal: PASS +identity_input: PASS +handler_reader_diagonal: PASS +reader_self_application: exact finite head reduction; full normal form does not exist (see report proof) diff --git a/data/self-interpreter/reasoning_165/fresh/late_zero_discard.blc b/data/self-interpreter/reasoning_165/fresh/late_zero_discard.blc new file mode 100644 index 00000000..64ea60ee --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/late_zero_discard.blc @@ -0,0 +1 @@ +0100011010000100000100000101100001011000011011110111100101101010000000010111111000010111110011111100000011110000001011101110011011110011111110000111111100001011110100111010110011010 diff --git a/data/self-interpreter/reasoning_165/fresh/late_zero_discard.lam b/data/self-interpreter/reasoning_165/fresh/late_zero_discard.lam new file mode 100644 index 00000000..99a09e36 --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/late_zero_discard.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\bit0. bit0 (\r. r next) cont) (list list list)) (\bit1 \rest \unused. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args))))) rest)) (x x)) diff --git a/data/self-interpreter/reasoning_165/fresh/reader_diagonal_knot.blc b/data/self-interpreter/reasoning_165/fresh/reader_diagonal_knot.blc new file mode 100644 index 00000000..df0eebe2 --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/reader_diagonal_knot.blc @@ -0,0 +1 @@ +0100010001010111010100000011011100001000001011111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010100110100000000101100001011000000110111111011100101101010 diff --git a/data/self-interpreter/reasoning_165/fresh/reader_diagonal_knot.lam b/data/self-interpreter/reasoning_165/fresh/reader_diagonal_knot.lam new file mode 100644 index 00000000..33f54a9c --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/reader_diagonal_knot.lam @@ -0,0 +1 @@ +(\reader. (\g. reader g g (\u \r. r g)) (\x. (\intL. \cont. reader (\bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args)))))) cont) (x x))) (\next \cont \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) diff --git a/data/self-interpreter/reasoning_165/fresh/return_stream.blc b/data/self-interpreter/reasoning_165/fresh/return_stream.blc new file mode 100644 index 00000000..ff12dd34 --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/return_stream.blc @@ -0,0 +1 @@ +01000110100001000001000001011000010110000001101111101111001011010100001111000000101111110000111111000010111110100111010010111100000010111111100000011111110000001011101110011011110111010011010 diff --git a/data/self-interpreter/reasoning_165/fresh/return_stream.lam b/data/self-interpreter/reasoning_165/fresh/return_stream.lam new file mode 100644 index 00000000..a2124e0c --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/return_stream.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) (\bit1. intL (\exp \rest. intL (\exp2. cont (\args. exp args (exp2 args))) (bit1 (\u \v. cont (\args \arg. exp (\zx \zy. zx arg (zy args))) rest) rest)))) (x x)) diff --git a/data/self-interpreter/reasoning_165/fresh/return_stream_shared_cont.blc b/data/self-interpreter/reasoning_165/fresh/return_stream_shared_cont.blc new file mode 100644 index 00000000..23e50841 --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/return_stream_shared_cont.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100000011011111011110010110101000011110000001000101111111010010111110001101100001011111001011111100000011111100000010111011100110111101100111111000010111110100111010011010 diff --git a/data/self-interpreter/reasoning_165/fresh/return_stream_shared_cont.lam b/data/self-interpreter/reasoning_165/fresh/return_stream_shared_cont.lam new file mode 100644 index 00000000..d813f1b5 --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/return_stream_shared_cont.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) (\bit1. intL (\exp \rest. (\k. intL k (bit1 (\u. k) rest)) (\exp2. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args))) rest) (cont (\args. exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_165/fresh/suffix.log b/data/self-interpreter/reasoning_165/fresh/suffix.log new file mode 100644 index 00000000..a3560b15 --- /dev/null +++ b/data/self-interpreter/reasoning_165/fresh/suffix.log @@ -0,0 +1,4 @@ +return_stream: divergent Omega suffix PASS +return_stream_shared_cont: divergent Omega suffix PASS +late_zero_discard: divergent Omega suffix PASS +reader_diagonal_knot: divergent Omega suffix PASS diff --git a/data/self-interpreter/reasoning_165/knot/SUMMARY.md b/data/self-interpreter/reasoning_165/knot/SUMMARY.md new file mode 100644 index 00000000..6537ad4d --- /dev/null +++ b/data/self-interpreter/reasoning_165/knot/SUMMARY.md @@ -0,0 +1,136 @@ +(•̀ᴗ•́) **No sub-165 result. A reader-carried knot does work:** I built a 192-bit interpreter whose only syntactic self-application is the existing `list list` inside the skip. + +Full derivations and reproducible checks are in [derivations.txt](derivations.txt). + +| Complete interpreter | Exact battery line | Idea | +|---|---|---| +| [reader_knot.lam](reader_knot.lam) | `192 bits ok=667 skip=1 fail=0` | The reader manufactures the recursive diagonal; no separate syntactic `x x` knot. | +| [root_next.lam](root_next.lam) | `214 bits ok=667 skip=1 fail=0` | Continuation-last NEXT lets the known-zero root use the Scott cell to supply the continuation application. | + +Both also return the rigid suffix correctly when parsing Ω. These are finite checks, supplemented by the paper arguments below; no new Lean proof was checked. + +A 189-bit attempted shrink, [one_binder_carrier.lam](one_binder_carrier.lam), exhausted the battery’s \(2^{20}\)-β budget on `I`. That is **unresolved**, not a refutation. + +The useful identities use +\[ +T_q=\lambda r.rq,\quad Z_q=\lambda u r.rq,\quad +H(q,c)=\lambda b.bZ_qc,\quad +R(q,c)=\lambda s.sH(q,c)(sss). +\] + +**The reader can diagonalize a generator encoded as a zero arm:** +\[ +R(q,c)Z_t\to^*tt. +\] +Indeed, +\[ +R(q,c)Z_t +\to Z_tH(q,c)(Z_tZ_tZ_t) +\to^*T_tT_t +\to^*tt. +\] +Neither \(q\) nor \(c\) is evaluated. The handler can even be replaced by arbitrary \(A(s)\): `Z_t` discards it. + +Consequently, for arbitrary reader instances, +\[ +H_iR_j\to R_jZ_{q_i}c_i\to^*q_iq_ic_i. +\] +This genuinely escapes the handler-only exclusion by mixing the handler with a reader. + +Two further extraction identities are: +\[ +H(q,c)(\mathrm{cons}\ b\ r)\to^*rqc, +\] +by expanding the Scott cell, and, for \(s=\mathrm{cons}\ K\ r\), +\[ +s(sH(q,c))\to^*q. +\] +For the latter, \(sH\to T_q\), hence \(s(sH)\to T_qKr\to q\). A leading-one cell instead gives \(crFr\). + +The cross-composition law is +\[ +H_iH_j\to^*c_jq_ic_i, +\] +because \(H_iH_j\to H_jZ_ic_i\to Z_iZ_jc_jc_i\). Therefore +\[ +R_iR_j\to^* +c_jq_ic_i\,(c_iq_ic_iH_i)\,(R_jR_jR_j). +\] +Expand \(R_iR_j\) to \(H_iH_j(H_iH_iH_i)(R_jR_jR_j)\), then apply the preceding identity twice. + +These identities were checked with small rigid-variable reductions; the unrestricted cross-composition law has the explicit proof above, since its final argument can prevent normalization. + +The **192-bit construction** follows directly. Let \(B\,p\) denote the 165’s body with recursive parser \(p\), and define +\[ +W=\lambda x.x\,I\,x\,Z_x,\qquad +G=\lambda x.B(Wx),\qquad E_*=WG. +\] +Then +\[ +WG\to GIGZ_G +\to B(WI)GZ_G +\to R(Q(WI,G),G)Z_G +\to^*GG +\to B(WG). +\] +Thus \(E_*\to^*BE_*\). The provisional parser \(WI\) is never called during this bootstrap. + +The usual structural parser induction therefore transfers, including divergent source programs. This does **not** assume that arbitrary fixed points are β-equal. Its cost is \((L,A,X)=(21,29,32)\): four extra lambdas, four extra applications and three index bits, totaling **+27 bits**. + +There are two useful obstructions. + +First, **a full parser cannot itself replace the encoded carrier** under this reader interface. For arbitrary +\[ +P=\lambda c s.sH_c(sss), +\] +put \(T=PPP\). Head reduction gives +\[ +T\to^*PH_PT\to^*T\,H_{H_P}\,(TTT). +\] +The same \(T\) returns at the head with additional arguments indefinitely. Head standardization therefore rules out a head normal form. Moreover, +\[ +R_iP\to PH_i(PPP)\to^*T\,H_{H_i}\,(TTT), +\] +so that also diverges at the head. After unfolding, both the current parser and current NEXT have this two-lambda reader shape. + +Second, **the current NEXT diagonal cannot replace \(E\,C\)**. Write +\[ +A(f)=\lambda e a.f(\mathrm{cell}\ a\ e),\quad +V(f,g)=\lambda e.fe(ge),\quad +a_f=\lambda g.CV(f,g). +\] +For current NEXT \(q=q_C\), +\[ +qq=Ek,\qquad kf=q(CA(f))(Ea_f)=Ed_f(Ea_f), +\] +where +\[ +d_f=\lambda g.CA(f)(CA(g))(Ea_g). +\] +The cross-reader identity gives +\[ +kf\to^* +C\,V(f,q_{d_f})\,d_f\, +(d_fq_{d_f}d_fH_{d_f})\, +((Ea_f)(Ea_f)(Ea_f)). +\] +On quoted `I` followed by \(N\), this produces **five arguments** at rigid head \(C\), versus the required two. β-reduction cannot remove that discrepancy. + +A concrete checked separator uses \(C=\lambda a b c d e.e\): `q q` on quoted `I` returns \(N\), whereas `E C` returns a three-argument projection. + +The shorter carrier \(T_t\) obeys a different law: +\[ +R(q,c)T_t\to^*tZ_qc(ttT_t). +\] +It retains the active handler rather than manufacturing just \(tt\). This explains why deleting the unused binder from the 192’s carrier does not preserve its fixed-point proof. + +The 214’s root shortcut is sound because every closed source starts with zero: +\[ +(\mathrm{cons}\ K\ r)Z_QC\to rQC. +\] +Its shared parser and continuation-last NEXT satisfy the ordinary syntax recursion, but the additional argument plumbing overwhelms the shortcut. + +My read is that **`R_i Z_t → t t` is a real remaining seam**. To beat 165, the generator carrier must also perform an existing semantic role—most naturally, the existing `Z_next` must serve as `Z_generator`. The obstructions above exclude using the current parser or NEXT unchanged. A successful construction would need different behavior on non-Boolean arguments while preserving NEXT’s Boolean cases and handling changing continuations. + +All checks used at most two workers and completed in seconds. No enumeration was run; the repository remains unchanged. + diff --git a/data/self-interpreter/reasoning_165/knot/check.py b/data/self-interpreter/reasoning_165/knot/check.py new file mode 100644 index 00000000..2b1dee23 --- /dev/null +++ b/data/self-interpreter/reasoning_165/knot/check.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +"""Small, single-candidate checks; two subprocess workers at most.""" +import os +from pathlib import Path +import sys +import tempfile +import time + +HERE = Path(__file__).resolve().parent +REPO = Path('/Users/a9lim/Work/blam') +sys.dont_write_bytecode = True +sys.path.insert(0, str(REPO / 'tools/self-interpreter')) +tempfile.tempdir = str(HERE) +os.environ['RAYON_NUM_THREADS'] = '2' + +import battery + +for name in sys.argv[1:]: + path = HERE / name + e = battery.compile_lam(path.read_text()) + bits = battery.enc(e) + (path.with_suffix('.blc')).write_text(bits + '\n') + start = time.monotonic() + ok, skip, bad = battery.check(e, threads=2) + print(f'{len(bits):5d} bits ok={ok} skip={skip} fail={len(bad)} {path.name}', flush=True) + print(f'elapsed={time.monotonic()-start:.3f}s threads=2', flush=True) + for term, verdict in bad[:5]: + print(term, verdict, flush=True) diff --git a/data/self-interpreter/reasoning_165/knot/derivations.txt b/data/self-interpreter/reasoning_165/knot/derivations.txt new file mode 100644 index 00000000..1200c0e2 --- /dev/null +++ b/data/self-interpreter/reasoning_165/knot/derivations.txt @@ -0,0 +1,253 @@ +KNOT ENTANGLEMENT CONSULT — NO SUB-165 RESULT + +The live interpreter record and STATUS were read before constructing anything. +No enumerations or component searches were run. All writes are in this directory. +There are two complete, battery-passing interpreters, both larger than 165. +The exact identities below are paper proofs, with small Rust-normalizer checks +where stated; no new Lean proof is claimed. + +COMPLETE INTERPRETERS + +192 bits ok=667 skip=1 fail=0 reader_knot.lam +elapsed=2.395s threads=2 +L=21, A=29, X=32. +Idea: the existing reader applied to an encoded generator manufactures the +recursive self-application. The source has no syntactic self-application except +the one list list inside the skip. This is a working reader-carried knot, at +27 bits of overhead relative to the 165. + +214 bits ok=667 skip=1 fail=0 root_next.lam +elapsed=2.428s threads=2 +L=23, A=30, X=46. +Idea: NEXT receives continuation last; the root uses its known initial zero to +call NEXT directly, with the Scott cell supplying the continuation application. +This prices a specific root shortcut, not a new recommendation of the already +recorded self-passing-NEXT architecture. It is uncompetitive. + +Both also passed the specific divergent-source suffix probe + E (lambda value rest. rest) (quote(Omega) ++ N) ->* N. +The normal-form batteries skip one divergent expected value. Correctness beyond +the battery follows from the paper unfolding/structural-parser arguments below, +not from treating those finite tests as a universal certificate. + +ADDITIONAL ATTEMPT + +189 bits, one_binder_carrier.lam: replace the carrier Z_x by T_x = lambda r.r x +in the 192. The I probe exhausted the battery's 2^20 beta budget (verdict fuel). +This is NOT a refutation and is NOT a correct-interpreter claim. No full battery +was run on it. Its altered reduction law is given below. + +NOTATION + + K = lambda x y.x F = lambda x y.y + I = lambda x.x + T_q = lambda r.r q + Z_q = lambda u r.r q + H(q,c) = lambda b.b Z_q c + R(q,c) = lambda s.s H(q,c) (s s s) + +Let B p c be the 165's body, with recursive parser p supplied as a parameter. +Thus B p c = R(Q(p,c), c), where + + A(f) = lambda env arg.f (lambda zx zy.zx arg (zy env)) + V(f,g) = lambda env.f env (g env) + a(c,f) = lambda g.c V(f,g) + Q(p,c) = lambda b.p (lambda f.b (c A(f)) (p a(c,f))). + +For the original interpreter E, write q_c=Q(E,c), H_c=H(q_c,c), R_c=E c. + +EXACT READER/CARRIER IDENTITIES + +1. R(q,c) Z_t ->* t t, for completely arbitrary q,c,t. + + R(q,c) Z_t + -> Z_t H(q,c) (Z_t Z_t Z_t) + -> T_t T_t + -> t t. + + The middle step uses Z_t H -> T_t and + Z_t Z_t Z_t -> T_t Z_t -> Z_t t -> T_t. + Neither q nor c is evaluated. In fact the first argument H(q,c) can be + replaced by any A(s): (lambda s.s A(s) (s s s)) Z_t ->* t t, because + Z_t discards it. This is stronger than the special t=q case. + A Rust normal-form check with q,c,t bound rigidly passed. + +2. H(q_i,c_i) R(q_j,c_j) ->* q_i q_i c_i. + + H_i R_j -> R_j Z_(q_i) c_i -> q_i q_i c_i by identity 1. + A rigid-variable normal-form check passed for the same-i,j specialization. + +3. For any Scott cell s=cons b r, H(q,c) s ->* r q c. + + H s -> s Z_q c -> Z_q b r c -> r q c. + + In particular, for s=cons K r, + s (s H(q,c)) ->* q. + Indeed s H -> Z_q r -> T_q, hence s(sH) -> T_q K r -> K q r -> q. + This extraction fails as a uniform parser operation on leading-one cells: + for s=cons F r it instead gives c r F r. + The zero-cell extraction passed a rigid-variable normal-form check. + +4. With i,j denoting arbitrary pairs (q_i,c_i), (q_j,c_j), + + H_i H_j ->* c_j q_i c_i. + + Proof: H_i H_j -> H_j Z_i c_i -> Z_i Z_j c_j c_i + -> c_j q_i c_i. + A rigid-variable normal-form check passed. + +5. Consequently, + + R_i R_j ->* + c_j q_i c_i (c_i q_i c_i H_i) (R_j R_j R_j). + + Proof: + R_i R_j -> R_j H_i (R_j R_j R_j) + -> H_i H_j (H_i H_i H_i) (R_j R_j R_j), + then apply identity 4 to the two H-pairs. + + The full right side need not have a normal form. A normal-form check used + c_j = lambda q c u v.marker q c; it discards the two latter arguments and + returned marker q_i c_i exactly. The displayed unrestricted identity is + justified by the explicit reductions, not by that single observation. + +READER-MEDIATED FIXED POINT: THE 192 + +Define + W = lambda x.x I x Z_x (28 bits) + G = lambda x.B (W x) + E_star = W G. + +Then there is a finite beta-reduction + + E_star = W G + -> G I G Z_G + -> B (W I) G Z_G + -> R(Q(W I,G),G) Z_G + -> G G + -> B (W G) + = B E_star. + +The fourth step is identity 1: the provisional recursive parser W I is never +called. This establishes the same unfolding equation used by the 165's parser. +The ordinary induction on source syntax therefore gives the same parse, +environment/closure, and remainder laws, including finite parsing of sources +without normal forms. No assertion that arbitrary fixed points are beta-equal +is being made; the transfer is by that structural parser induction. + +reader_knot.lam writes the above once each using explicit redexes. Its only +equal-child application node is the list list inside list list list, checked +directly on the unoptimized de Bruijn AST. In particular neither the root nor +the recursive intL binding contains x x. The interpreter really does obtain +its recursive diagonal from the reader's existing self-application. + +The source cost is (L,A,X)=(21,29,32), versus (17,25,29) for the 165: + +4 lambdas, +4 applications, +3 index bits = +27 bits. +This construction proves that the entanglement exists, not that it saves size. + +WHY THE RAW PARSER/NEXT CANNOT BE THE CARRIER + +Take any term with the exact reader shape + P = lambda c s.s H_c (s s s), +where H_c is arbitrary and may depend on c. Put T=P P P. Then + + T ->* P H_P T ->* T H_(H_P) (T T T). + +These are head reductions and the recursive copy of T is again at the head. +Repeating them gives an infinite head-reduction sequence, with two more spine +arguments each time. By head standardization T has no head normal form. + +Furthermore, for any fixed R_i, + R_i P -> P H_i (P P P) + -> T H_(H_i) (T T T), +so R_i P also has no head normal form. + +This rules out feeding a full parser directly into the reader to replace the +encoded carrier Z_t. It also rules out feeding the 165's current NEXT directly: +after unfolding E, q_c has this same two-lambda reader shape, with its first +parameter the tag bit. The result is conditional on this exact reader/skip +interface, not a lower bound for arbitrary interpreters. + +WHY THE CURRENT NEXT DIAGONAL DOES NOT REPLACE E c + +Let q=q_c. Define + k(f) = q (c A(f)) (E a(c,f)). +Then q q = E k. + +For a fixed f, set + d_f = lambda g.c A(f) (c A(g)) (E a(c,g)). +Expanding q gives + k(f) = E d_f (E a(c,f)). + +Apply identity 5 with i corresponding to d_f and j to a(c,f). With +q_d=Q(E,d_f), H_d=H(q_d,d_f), R_a=E a(c,f), this yields + + k(f) ->* + c V(f,q_d) d_f (d_f q_d d_f H_d) (R_a R_a R_a). + +On quote(I) ++ N, the correct first parse supplies v=lambda z.I, so + + q q (quote(I) ++ N) ->* + c V(v,q_d) d_v (d_v q_d d_v H_d) (R_a R_a R_a) N. + +There are FIVE arguments at the rigid c head, whereas the required c v N has +TWO. Beta-reduction cannot remove arguments from that rigid head. Thus q q +cannot replace E c under the fixed NEXT protocol. + +A closed observational check sets c=lambda a b c d e.e. With N bound rigidly, + lambda N.q q (quote(I) ++ N) normalizes to 0010 (lambda N.N), + lambda N.E c (quote(I) ++ N) normalizes to 0000000010 (lambda N a b c.c). +Both normal forms were checked by the Rust machine. + +Likewise, H(q,c) R(q,c) = q q c = E k c is c-headed immediately; applying an +ordinary input gives c H_k (c c c) input, with three c-head arguments. Thus +the tempting H R expression does not already implement the desired parser. + +THE ONE-BINDER CARRIER ATTEMPT + +For T_t=lambda r.r t, the exact law differs from identity 1: + + R(q,c) T_t + -> T_t H(q,c) (T_t T_t T_t) + -> H(q,c) t (t t T_t) + -> t Z_q c (t t T_t). + +It does not erase the active handler. Replacing Z_x by T_x in W gives the +189-bit candidate, but no fixed-point equation follows. For this W_T, + W_T I -> T_I, + W_T D -> D D, where D=lambda x.x x. +The latter follows from + D I D T_D -> I I D T_D -> D T_D -> T_D T_D -> D D. +This is an obstruction in the bootstrap calculation, not a proof that the +complete 189-bit candidate diverges. Its only measured verdict is the I-probe +fuel exhaustion stated above. + +ROOT-NEXT CONSTRUCTION + +The 214 uses a continuation-last NEXT Q and the shared parser + P_Q c s = s (lambda b.b (lambda u r.r Q c) c) (s s s). +Its fixed-point equation is + Q b s c = P_Q (lambda f.b (c A(f)) (P_Q a(c,f))) s. +The root is + E_root c s = s (lambda u r.r Q) c. +Every closed source begins with a zero tag. For s=cons K r, both E_root c s +and P_Q c s reduce to r Q c. The same syntax induction proves P_Q correct. +The boundary shortcut is sound, but the continuation-last plumbing and binding +depth dominate its savings. + +WHERE A SMALLER TERM COULD HIDE + +The new positive seam is the unrestricted R_i Z_t -> t t identity. It avoids +the handler-only C-headed exclusion by mixing the reader and the zero-arm +constructor. The 192 realizes this seam without a separate syntactic knot. + +To improve 165, the encoded-generator adapter would have to share a real +semantic role. The natural candidate is to make the existing Z_next also be +Z_generator, so that NEXT carries its own recursive generator. The raw parser +and current NEXT are excluded as direct carriers by the head-divergence result, +and current NEXT self-application is excluded by the rigid-head arity proof. +Such a design must therefore change NEXT's behavior on non-Boolean arguments +and how continuations are carried, while retaining its two Boolean cases. +That is an open construction problem here, not a claim of a near solution. + +No global or sub-165 optimality conclusion follows from this consult. diff --git a/data/self-interpreter/reasoning_165/knot/identities.py b/data/self-interpreter/reasoning_165/knot/identities.py new file mode 100644 index 00000000..19e24845 --- /dev/null +++ b/data/self-interpreter/reasoning_165/knot/identities.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 +"""Specific symbolic normal-form checks, never a search.""" +from pathlib import Path +import sys +import tempfile + +HERE = Path(__file__).resolve().parent +REPO = Path('/Users/a9lim/Work/blam') +sys.dont_write_bytecode = True +sys.path.insert(0, str(REPO / 'tools/self-interpreter')) +tempfile.tempdir = str(HERE) +import battery as b +import db + +def app(*args): + value = args[0] + for arg in args[1:]: + value = ('A', value, arg) + return value + +def check(label, left, right): + lhs = b.compile_lam(left) + rhs = b.compile_lam(right) + ln = b.normalize(b.enc(lhs), 4096) + rn = b.normalize(b.enc(rhs), 4096) + assert ln is not None and rn is not None and ln == rn, label + print(f'PASS {label}: {len(ln)}-bit common normal form', flush=True) + +def z(q): + return rf'(\u \r. r {q})' + +def h(q, c): + return rf'(\b. b {z(q)} {c})' + +def r(q, c): + return rf'(\s. s {h(q,c)} (s s s))' + +check('R(q,c) Z(t) = t t', + rf'\q \c \t. {r("q","c")} {z("t")}', + r'\q \c \t. t t') +check('H(q,c) R(q,c) = q q c', + rf'\q \c. {h("q","c")} {r("q","c")}', + r'\q \c. q q c') +check('zero stream s(sH) = q', + rf'\q \c \tail. (\s. s (s {h("q","c")})) (\f. f (\a \b. a) tail)', + r'\q \c \tail. q') +check('H_i H_j = c_j q_i c_i', + rf'\qi \ci \qj \cj. {h("qi","ci")} {h("qj","cj")}', + r'\qi \ci \qj \cj. cj qi ci') + +# The full cross-reader expression has an unsolvable payload R_j R_j R_j. +# A four-argument observer discards it and checks both retained arguments. +cj = r'(\q \c \u \v. marker q c)' +check('cross-reader four-argument observer', + rf'\qi \ci \qj \marker. {r("qi","ci")} {r("qj",cj)}', + r'\qi \ci \qj \marker. marker qi ci') + +interpreter = b.compile_lam((REPO / 'data/self-interpreter/machines/int165.lam').read_text()) +detector = b.compile_lam(r'\a \b \c \d \e. e') +next_builder = b.compile_lam(r'''\intL \cont \bit1. + intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args)))))''') +next_term = app(next_builder, interpreter, detector) +quoted_id = b.bitlist('0010', ('V', 0)) +diagonal_probe = ('L', app(b.shift(next_term, 1), b.shift(next_term, 1), quoted_id)) +ordinary_probe = ('L', app(b.shift(interpreter, 1), b.shift(detector, 1), quoted_id)) +diagonal_nf = b.normalize(b.enc(diagonal_probe), 16384) +ordinary_nf = b.normalize(b.enc(ordinary_probe), 16384) +assert diagonal_nf == '0010' +assert ordinary_nf == '0000000010' +print(f'PASS NEXT diagonal separation: q q -> {diagonal_nf}; E C -> {ordinary_nf}', flush=True) + +omega = db.parse(r'(\1 1) (\1 1)') +tail_selector = b.compile_lam(r'\v \r. r') + +def counts(t): + if t[0] == 'V': + return (0, 0, t[1]) + if t[0] == 'L': + l, a, x = counts(t[1]) + return l+1, a, x + left, right = counts(t[1]), counts(t[2]) + return left[0]+right[0], left[1]+right[1]+1, left[2]+right[2] + +def diagonals(t, stack=()): + if t[0] == 'V': + return [] + if t[0] == 'L': + return diagonals(t[1], stack + ('lambda',)) + found = [stack] if t[1] == t[2] else [] + return found + diagonals(t[1], stack+('function',)) + diagonals(t[2], stack+('argument',)) + +for name in ['root_next', 'reader_knot']: + e = b.compile_lam((HERE / (name + '.lam')).read_text()) + suffix_probe = ('L', app(b.shift(e, 1), b.shift(tail_selector, 1), + b.bitlist(b.enc(omega), ('V', 0)))) + suffix = b.normalize(b.enc(suffix_probe), 16384) + assert suffix == '0010' + print(f'PASS {name}: divergent-program suffix -> tail; (L,A,X)={counts(e)}', flush=True) + if name == 'reader_knot': + ds = diagonals(e) + assert len(ds) == 1 + print(f'PASS reader_knot: one syntactic equal-child application, at {ds[0]}', flush=True) diff --git a/data/self-interpreter/reasoning_165/knot/one_binder_carrier.lam b/data/self-interpreter/reasoning_165/knot/one_binder_carrier.lam new file mode 100644 index 00000000..d1e5eb79 --- /dev/null +++ b/data/self-interpreter/reasoning_165/knot/one_binder_carrier.lam @@ -0,0 +1,11 @@ +-- Targeted attempted shrink of reader_knot: use T_x = \r. r x instead of Z_x. +-- Its mixed-reader behavior is not the Z identity; tested only on I first. +(\w. + w (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (w x))) +(\x. x (\u. u) x (\r. r x)) diff --git a/data/self-interpreter/reasoning_165/knot/reader_knot.blc b/data/self-interpreter/reasoning_165/knot/reader_knot.blc new file mode 100644 index 00000000..b2b6b876 --- /dev/null +++ b/data/self-interpreter/reasoning_165/knot/reader_knot.blc @@ -0,0 +1 @@ +010001100001000001000001011000010110000001101111101111001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001110100001010110001010000001101110 diff --git a/data/self-interpreter/reasoning_165/knot/reader_knot.lam b/data/self-interpreter/reasoning_165/knot/reader_knot.lam new file mode 100644 index 00000000..44a76dc7 --- /dev/null +++ b/data/self-interpreter/reasoning_165/knot/reader_knot.lam @@ -0,0 +1,12 @@ +-- Reader-mediated fixed point. No syntactic self-application outside list list. +-- W x = x I x (\unused r. r x). +-- For G = \x. B (W x), the reader identity yields W G -> G G -> B (W G). +(\w. + w (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (w x))) +(\x. x (\u. u) x (\unused \r. r x)) diff --git a/data/self-interpreter/reasoning_165/knot/root_next.blc b/data/self-interpreter/reasoning_165/knot/root_next.blc new file mode 100644 index 00000000..966fedc7 --- /dev/null +++ b/data/self-interpreter/reasoning_165/knot/root_next.blc @@ -0,0 +1 @@ +0100000001011000000110111110110010001101000010000000001011111000010111110011100000011110000001011101110011011110011111100001111000010111101001110101100000010110000101100000010110011111110111111011111011100101101010 diff --git a/data/self-interpreter/reasoning_165/knot/root_next.lam b/data/self-interpreter/reasoning_165/knot/root_next.lam new file mode 100644 index 00000000..d4a28f7f --- /dev/null +++ b/data/self-interpreter/reasoning_165/knot/root_next.lam @@ -0,0 +1,12 @@ +-- Continuation-last NEXT; the root consumes its known leading zero directly. +-- The shared reader inside NEXT uses the whole-stream skip. +(\q. \cont \list. list (\unused \r. r q) cont) +((\x. x x) + (\x. + (\parse. \bit \list \cont. + parse (\exp. bit + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (parse (\exp2. cont (\args. exp args (exp2 args))))) list) + (\cont \list. + list (\bit. bit (\unused \r. r (x x) cont) cont) + (list list list)))) diff --git a/data/self-interpreter/reasoning_165/nextfuse/REPORT.md b/data/self-interpreter/reasoning_165/nextfuse/REPORT.md new file mode 100644 index 00000000..0c7eb59a --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/REPORT.md @@ -0,0 +1,265 @@ +# Next/bit1 fusion: result + +No sub-165 interpreter found. The useful results are two information-loss +obstructions for whole classes of proposed first-parse fusions, a strictness +obstruction, and a correct second hoist which saves one bit within a larger +189-bit construction. None is an unconditional size lower bound. + +All files written by this investigation are in this directory. No searches +were run. Computation comprised four designed candidates, finite identity +checks, and targeted fuel retries on five probes, with at most two threads. All source +sizes are unoptimized BLC sizes. `investigate.py` uses the repository parser +directly and calls `battery.check(..., threads=2)`. + +## Every constructed complete interpreter + +| File | Bits | L,A,X | Standard battery | Idea | +|---|---:|---|---|---| +| `tag_after_parse.lam` | 189 | 20,27,39 | `ok=667 skip=1 fail=0` | Keep the redundant second-tag stream as an extra argument after the first parse; re-read the tag on return. | +| `tag_after_parse_hoisted.lam` | 188 | 19,28,36 | `ok=667 skip=1 fail=0` | Let the known first-tag K discard bit1, hoisting the complete first-parse partial application outside the ignored-bit binder. | +| `tag_after_parse_handler.lam` | 199 | 20,27,49 | `ok=667 skip=1 fail=0` | Re-read bit1 through a Scott handler instead of projecting it with literal K. | +| `independent_projections.lam` | 220 | 25,32,40 | `ok=662 skip=1 fail=5`; all five are fuel caps | Retain the actual tag and independently compute the first parsed value and its remainder. | + +Exact standard-battery lines, with the common directory omitted: + +```text +189 bits ok=667 skip=1 fail=0 tag_after_parse.lam +188 bits ok=667 skip=1 fail=0 tag_after_parse_hoisted.lam +199 bits ok=667 skip=1 fail=0 tag_after_parse_handler.lam +220 bits ok=662 skip=1 fail=5 independent_projections.lam +``` + +The last candidate's five capped probes were retried individually. Four pass +at 2^24 beta fuel; the fifth passes at 2^28. Thus all 667 terminating probes +were verified for it, but it does **not** pass the standard 2^20-fuel battery. +The last retry took 0.53 seconds. Details are in `results.json`, +`projection_retries.json`, and `projection_final_retry.json`. + +All four also return the rigid tail exactly on both Omega and lambda-Omega +with the tail-projecting continuation, at the ordinary 2^20 fuel cap +(`non_strict.json`). These are additional finite checks, not a substitute for +the structural correctness arguments below. No new Lean proof was written. + +## Notation + +`K = lambda a b. a` is bit 0; `F = lambda a b. b` is bit 1. +`cons b t = lambda h. h b t`. Write `w:R` for a finite bit string w followed +by tail R. P is the current parser with its open-term protocol, not an +arbitrary program satisfying only the closed root contract. + +Write + +```text +A(f) = lambda e a. f (lambda x y. x a (y e)) +L(f,g) = lambda e. f e (g e) +B_C(f) = P (lambda g. C L(f,g)). +``` + +If `t = ++ u`, the parser supplies a closure f and residual u to its +continuation. This is a head-reduction fact and does not require M to have a +normal form. The desired second-tag action on `q = cons b t` is therefore + +```text +b (C A(f)) B_C(f) u. +``` + +## Exact identities and the successful, oversized hoist + +For `q = cons b t`, direct beta reduction gives + +```text +q K = b; q F = t; q P = P b t. +``` + +After the first parse, `q P = b f u`: it gives f for ABS and u for APP. +The missing field is a real information loss, not simply an inconvenient +argument order; the next sections give collisions. + +The current reader also has an exact Boolean law not needed by its usual +stream contract. Let + +```text +H_C = lambda b0. b0 (lambda unused r. r NEXT_C) C. +``` + +Then + +```text +P C K = H_C; P C F = F. +``` + +Proof: unfold the parser once. Its reader is `s H_C (s s s)`. K selects +H_C, and F selects `F F F`, which reduces to F. Consequently +`P C K K = lambda unused r. r NEXT_C`, and `P C K F = C`. +`check_identities.py` verifies the reader equations with the recursive parser +left rigid, avoiding an attempt to normalize its infinite unfolding. + +For a lossless deferred-tag protocol, define + +```text +D_C = lambda f u q. (q K) (C A(f)) B_C(f) u +T_C = P D_C. +``` + +The zero arm can use + +```text +q (K T_C) q + -> T_C t q + ->* D_C f u q + ->* b (C A(f)) B_C(f) u. +``` + +The extra copy q is now useful: it survives after the first parse, and D_C +uses it to restore bit1. In the 189-bit version, `K T_C` is written +`lambda unused. P D_C` and named `next`; the zero arm is `lambda r. r next`. +In the 188-bit version, `P D_C` is named `parse`, and the zero arm is +`lambda r. r (bit0 parse)`. The first tag is K in this branch, so it supplies +the discard without a dummy binder in the hoisted definition. + +This is a genuine second hoist, but it improves 189 to 188, not 165 to 164. +Its exact cost change is Delta(L,A,X)=(-1,+1,-3), or -2+4-3=-1 bit. +The needed tag replay, extra return arguments, and deeper captures overwhelm +the saving. The 199-bit variant replaces `q K A B` with +`q (lambda b unused. b A B)`; their equality on Scott streams is immediate, +but the latter deepens the captures of A and B. + +All three preserve the original semantic clauses by structural induction on +the parsed source. The induction first parses the proper first subterm, +then the reductions displayed above recover precisely ABS or APP; the +variable clause is unchanged. In particular, their argument does not assume +normalization of the parsed value. + +For the 220-bit candidate, `source=q F`, `f=P K source`, and +`u=P F source`; `q K` chooses the same two actions. The same structural +induction proves its clauses. Its two projections repeat parsing, which +explains the much worse fuel behavior. + +## Obstruction 1: the parse projection plus the diagonal cannot retain an index + +There is no uniform replacement for NEXT which uses its original q only +through `q P`, `q q`, and `q K`, while retaining the current closure and +continuation protocol. This excludes any postprocessor of those three +results, of any size. It also excludes keeping `q q q` in place of or in +addition to `q q`. + +Proof. Fix a right-operand stream R, and take + +```text +q_n = cons F (1^n 0 : R), n >= 1. +``` + +This is an APP second-tag stream whose first operand is variable n. The +variable parsing law and the ordinary unary diagonal give + +```text +q_n P = P F (1^n 0:R) = R +q_n q_n = K R +q_n K = F +q_n q_n q_n = R. +``` + +Every exposed result is independent of n. Choose `R = 10:N`, so the right +operand is variable 1, and compare n=1 and n=2 under two common enclosing +lambdas. The complete source programs are + +```text +lambda a b. b b +lambda a b. a b. +``` + +Their required returned values have distinct beta normal forms. The incoming +continuation, P, and all three proposed observations of q are the same in +the two cases. Congruence of beta equality therefore makes any uniform +postprocessor's outputs equal, a contradiction. This witness works with a +rigid, otherwise arbitrary N; no divergent suffix is needed. + +The equations were checked for n=1,2,5 with a rigid R (`identities.json`). +The proof itself is the unary-variable law for arbitrary n and the two +closed separating programs. + +## Obstruction 2: retaining the raw source tail with q P still loses the mode + +There is also no uniform replacement using q only through `q P` and `q F`, +under the same current protocol. Even retaining the complete source after +bit1 does not make its parse projection a substitute for remembering bit1. + +Proof. Choose a concrete periodic stream + +```text +D = lambda x. cons F (cons K (x x)) +R = D D, +``` + +so `R -> 10:R` in one beta step. Consider + +```text +q0 = cons K (110:R) -- ABS, body variable 2 +q1 = cons F (11010:R) -- APP, variable 2 applied to variable 1. +``` + +The variable parsing law gives, even before imposing periodicity, + +```text +q0 P = 10:R = q1 P. +``` + +Their raw source projections are `q0 F = 110:R` and `q1 F = 11010:R`. +These are beta equal because R unfolds once to `10:R`. Thus the two retained +fields coincide up to beta equality. Under two common enclosing lambdas, +however, the source programs are + +```text +M0 = lambda x y z. y +M1 = lambda x y. x y. +``` + +With the same value-projecting final continuation K, the required results +are `lambda env. M0` and `lambda env. M1`, which have distinct beta normal +forms. The two outer ABS continuations are identical. Any fixed decoder of +the equal fields must give equal outputs, a contradiction. + +Using this R is legitimate even when the contract is first stated with a +rigid tail N: an equation with free N remains true after substituting any +lambda term for N. Choosing final continuation K discards the infinite +suffix before normalizing the required outputs. + +`check_identities.py` checks both finite projection equations, the exact +one-step unfolding of R, and both complete source programs with this explicit +periodic suffix. Both full probes terminate with the expected, distinct +values. No claim about infinite normal forms or observational approximation +is used. + +## Obstruction 3: making the raw stream the first-parse continuation is strict + +Another direct attempt is to use q itself as the first parse's continuation, +letting its own Scott application receive f and u. Its exact effect is + +```text +P q t ->* q f u -> f b t u, q = cons b t. +``` + +If the first source subterm is the closed program Omega, its parsed value is +beta equal to `lambda env. Omega`. Thus the displayed result is head +divergent. Appending any finite argument spine cannot repair that divergence. +For the ABS source `lambda x. Omega`, the ordinary tail-projecting contract +must nevertheless return its rigid suffix N. Therefore a fusion which puts +`P q t` at the output head and tries to repair it only by applying more +arguments cannot be correct. A scheme that encloses this result in a thunk, +discards it, or retains q for a separate parse is outside this exclusion. + +## Where a smaller interpreter could still hide + +The duplicated q really can be used, as the 189/188 constructions demonstrate. +But consuming it as a diagonal erases the first operand's unary index, and +consuming it only as a parse projection plus raw source can erase the mode. +Using it as a raw continuation forces semantic evaluation too early. + +A successful fusion in this lens must retain a tag-sensitive, index-sensitive +use of q through the first parse while keeping that parse non-strict. It must +do so more cheaply than the explicit return arguments and tag replay above. +An off-diagonal use of the original stream coupled to a changed continuation +representation remains open. These arguments do not show such a construction +exists, and do not exclude a different reader or an interpreter outside the +current open-term protocol. I found no concrete sub-165 construction to +pursue or claim. diff --git a/data/self-interpreter/reasoning_165/nextfuse/SUMMARY.md b/data/self-interpreter/reasoning_165/nextfuse/SUMMARY.md new file mode 100644 index 00000000..15ea73da --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/SUMMARY.md @@ -0,0 +1,76 @@ +( •̀ᴗ•́ ) **No sub-165 found.** The useful results are three precise obstructions and a correct second hoist that improves a new construction from 189 to 188 bits. + +Full proofs, sources, wires, and verification records are in [REPORT.md](REPORT.md). Repository unchanged; no enumeration; at most two threads. + +Every complete construction built: + +| File | Bits | Battery | Idea | +|---|---:|---|---| +| `tag_after_parse.lam` | 189 | `ok=667 skip=1 fail=0` | Carry the redundant second-tag stream through the first parse; recover bit1 afterward. | +| `tag_after_parse_hoisted.lam` | 188 | `ok=667 skip=1 fail=0` | Use bit0’s known `K` to discard bit1, hoisting the first-parse partial application. | +| `tag_after_parse_handler.lam` | 199 | `ok=667 skip=1 fail=0` | Recover bit1 with a Scott handler instead of a literal `K` projection. | +| `independent_projections.lam` | 220 | `ok=662 skip=1 fail=5` | Preserve the tag and separately parse the value and remainder. | + +The 220’s five failures were fuel caps: four pass individually at `2^24` β fuel, the fifth at `2^28`. It therefore verifies all 667 terminating cases with increased fuel, but **does not pass the standard battery budget**. All four also return the rigid suffix exactly for both Ω and λΩ with a tail-projecting continuation. + +The strongest findings concern `q = cons bit1 t`, with `P` retaining the current open-term parser protocol. + +**1. `q P`, `q q`, and the tag together cannot replace q.** + +Take `q_n = cons F (1^n 0:R)`, the APP tag followed by variable n. Then + +```text +q_n P = R +q_n q_n = K R +q_n K = F +``` + +Every retained field loses n. Set `R = 10:N` and surround the operation with two lambdas. For n=1 and n=2 the required programs are respectively + +```text +λa b. b b +λa b. a b +``` + +Their returned values have distinct β-normal forms. Any uniform postprocessor receiving the identical fields must return β-equal results—a contradiction. This excludes arbitrary-sized postprocessors of these fields, including retaining `q q q`. + +**2. Even `q P` together with the complete raw tail `q F` can lose bit1.** + +Let `R = D D`, where `D = λx. cons F (cons K (x x))`; thus `R → 10:R`. Set + +```text +q0 = cons K (110:R) +q1 = cons F (11010:R). +``` + +Both have `q P = 10:R`. Their raw tails, `110:R` and `11010:R`, are β-equal by one unfolding of R. Yet under two identical enclosing lambdas, these represent + +```text +λx y z. y +λx y. x y. +``` + +A value-projecting final continuation produces distinct normal forms. Hence no uniform decoder of those two fields can implement both operations. The periodic suffix is legitimate: a contract equation with rigid free N remains valid under substitution for N. Both complete witness programs were checked with this explicit suffix. + +**3. Using q itself as the first-parse continuation introduces forbidden strictness.** + +The Scott application gives + +```text +P q t →* q f u → f bit1 t u. +``` + +For first subterm Ω, `f =β λenv.Ω`, so this is head divergent. Appending arguments cannot repair it, whereas parsing λΩ with the tail-projecting continuation must return its suffix. This excludes repairs that leave `P q t` at the output head. + +The successful oversized hoist uses the redundant q losslessly. Define a return handler `D_C` that receives `f, u, q`, projects `q K`, and performs the original ABS/APP dispatch. With `T_C = P D_C`: + +```text +q (K T_C) q → T_C t q →* D_C f u q. +``` + +The first tag supplies that `K` through `bit0 parse`. This saves exactly one bit: `Δ(L,A,X)=(-1,+1,-3)`. The remaining replay and argument plumbing costs too much. + +Another exact identity derived and checked is `P C K = H_C`, `P C F = F`, where `H_C` is the current first-bit handler; unfolding the reader proves both directly. + +These are interface-scoped paper proofs with explicit reduction checks, not Lean proofs or a global size bound. A smaller fusion must preserve a tag-sensitive and index-sensitive use of the original q through a non-strict first parse, more cheaply than explicit tag replay. An off-diagonal stream use coupled to a changed continuation representation remains open; I have no concrete sub-165 candidate. + diff --git a/data/self-interpreter/reasoning_165/nextfuse/check_identities.py b/data/self-interpreter/reasoning_165/nextfuse/check_identities.py new file mode 100644 index 00000000..355ba71d --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/check_identities.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python3 +"""Finitely many derived identities and separating witnesses; no search.""" +from pathlib import Path +import json +import sys +import time +from concurrent.futures import ThreadPoolExecutor + +from investigate import HERE, ROOT, parse +import battery +import lc + + +def app(f, a): + return ('A', f, a) + + +def lam(t): + return ('L', t) + + +K = battery.TRUE +F = battery.FALSE +E = parse((ROOT / 'data/self-interpreter/machines/int165.lam').read_text()) +R = ('V', 0) + + +def normalize(term): + result = battery.normalize(battery.enc(term), 1 << 20) + assert result is not None + return result + + +def check(label, a, b): + na, nb = normalize(a), normalize(b) + assert na == nb, label + print(f'PASS {label}', flush=True) + return dict(label=label, normal_form=na) + + +def cons(b, t): + return lc.pair(b, t) + + +def main(): + rows = [] + # q_n is the second-tag stream for APP(var n, right operand). + # The arbitrary R here includes the right operand and the final tail. + for n in [1, 2, 5]: + q = cons(F, battery.bitlist('1' * n + '0', R)) + rows.append(check(f'q_{n} P = R', lam(app(q, E)), lam(R))) + rows.append(check(f'q_{n} q_{n} = K R', lam(app(q, q)), lam(app(K, R)))) + rows.append(check(f'q_{n} K = F', lam(app(q, K)), lam(F))) + + # Finite symbolic equations used by the periodic-tail collision. + q0 = cons(K, battery.bitlist('110', R)) + q1 = cons(F, battery.bitlist('11010', R)) + suffix = battery.bitlist('10', R) + rows.append(check('q0 P = 10:R', lam(app(q0, E)), lam(suffix))) + rows.append(check('q1 P = 10:R', lam(app(q1, E)), lam(suffix))) + rows.append(check('q0 F = 110:R', lam(app(q0, F)), lam(battery.bitlist('110', R)))) + rows.append(check('q1 F = 11010:R', lam(app(q1, F)), lam(battery.bitlist('11010', R)))) + + # An explicit R = D D with R -> cons F (cons K R). + delta = parse(r'\x. \f. f (\a \b. b) (\g. g (\a \b. a) (x x))') + periodic = app(delta, delta) + assert lc.beta(delta, delta) == battery.bitlist('10', periodic) + print('PASS exact one-step fixed-point unfolding R -> 10:R', flush=True) + + # The enclosing two ABS continuations are the same. The full closed + # programs must nevertheless return distinct values. Project the value + # so their common infinite tail disappears before normalization. + m0 = parse(r'\x \y \z. y') + m1 = parse(r'\x \y. x y') + nfs = [] + for label, term in [('M0', m0), ('M1', m1)]: + got = app(app(E, K), battery.bitlist(battery.enc(term), periodic)) + want = lam(battery.shift(term, 1)) + rows.append(check(f'{label} with periodic suffix returns its correct value', got, want)) + nfs.append(normalize(want)) + assert nfs[0] != nfs[1] + print('PASS M0 and M1 required values have distinct beta normal forms', flush=True) + + # Bare Boolean behavior, with the recursive parser left rigid. This + # checks the reader identity without normalizing an infinite knot. + body = r'''\p \c. + (\next. \s. s (\b. b (\u \r. r next) c) (s s s)) + (\b. p (\f. b (c (\e \a. f (\x \y. x a (y e)))) + (p (\g. c (\e. f e (g e))))))''' + p = parse(body) + # Inside the abstract p,c binders, expose the source body then apply K/F. + reader = p[1][1] + for label, selector, want in [ + ('reader F = F', F, F), + ('reader K = first-bit handler', K, + parse(r'''\p \c. \b. b + (\u \r. r (\d. p (\f. d + (c (\e \a. f (\x \y. x a (y e)))) + (p (\g. c (\e. f e (g e))))))) c''')[1][1]), + ]: + rows.append(check(label, lam(lam(app(reader, selector))), lam(lam(want)))) + + (HERE / 'identities.json').write_text(json.dumps(rows, indent=2) + '\n') + + # Only the five resource-capped projections probes are retried. + prior = json.loads((HERE / 'results.json').read_text())[-1] + from investigate import PROJECT + candidate = parse(PROJECT) + original = battery.normalize + battery.normalize = lambda bits, beta: original(bits, (1 << 24) if beta == (1 << 20) else beta) + def retry(item): + bits, old = item + program, end = lc.decode(bits) + assert end == len(bits) + start = time.monotonic() + verdict = battery._probe(candidate, program, False) + result = dict(program=bits, old=old, verdict=verdict, + beta_budget=1 << 24, seconds=time.monotonic() - start) + print('RETRY', json.dumps(result), flush=True) + return result + with ThreadPoolExecutor(2) as pool: + retries = list(pool.map(retry, prior['failures'])) + (HERE / 'projection_retries.json').write_text(json.dumps(retries, indent=2) + '\n') + + +if __name__ == '__main__': + main() diff --git a/data/self-interpreter/reasoning_165/nextfuse/identities.json b/data/self-interpreter/reasoning_165/nextfuse/identities.json new file mode 100644 index 00000000..0a87278e --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/identities.json @@ -0,0 +1,70 @@ +[ + { + "label": "q_1 P = R", + "normal_form": "0010" + }, + { + "label": "q_1 q_1 = K R", + "normal_form": "0000110" + }, + { + "label": "q_1 K = F", + "normal_form": "00000010" + }, + { + "label": "q_2 P = R", + "normal_form": "0010" + }, + { + "label": "q_2 q_2 = K R", + "normal_form": "0000110" + }, + { + "label": "q_2 K = F", + "normal_form": "00000010" + }, + { + "label": "q_5 P = R", + "normal_form": "0010" + }, + { + "label": "q_5 q_5 = K R", + "normal_form": "0000110" + }, + { + "label": "q_5 K = F", + "normal_form": "00000010" + }, + { + "label": "q0 P = 10:R", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "q1 P = 10:R", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "q0 F = 110:R", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "q1 F = 11010:R", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "M0 with periodic suffix returns its correct value", + "normal_form": "00000000110" + }, + { + "label": "M1 with periodic suffix returns its correct value", + "normal_form": "0000000111010" + }, + { + "label": "reader F = F", + "normal_form": "0000000010" + }, + { + "label": "reader K = first-bit handler", + "normal_form": "0000000101100000011000011111110000101110011111110000001111000000101110111001101111001111111100001111111100001011110100111010110" + } +] diff --git a/data/self-interpreter/reasoning_165/nextfuse/independent_projections.blc b/data/self-interpreter/reasoning_165/nextfuse/independent_projections.blc new file mode 100644 index 00000000..9daf36f6 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/independent_projections.blc @@ -0,0 +1 @@ +0100011010000100000100000101100001011000111101111001011010100001000100010101011110000011001111100000011110000001011101110011011110011111100001111110000101111010011101001011111100000101100101111100000110100110000010011010 diff --git a/data/self-interpreter/reasoning_165/nextfuse/independent_projections.lam b/data/self-interpreter/reasoning_165/nextfuse/independent_projections.lam new file mode 100644 index 00000000..54dda3a9 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/independent_projections.lam @@ -0,0 +1,8 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused. next) cont) (list list list)) + (\tagtail. + (\source. + (\exp. tagtail (\a \b. a) (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args)))) (intL (\a \b. b) source)) + (intL (\a \b. a) source)) + (tagtail (\a \b. b)))) (x x)) diff --git a/data/self-interpreter/reasoning_165/nextfuse/investigate.py b/data/self-interpreter/reasoning_165/nextfuse/investigate.py new file mode 100644 index 00000000..2ffca7c8 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/investigate.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +"""A few derived second-tag handoffs; no enumeration or optimization.""" +from pathlib import Path +import json +import os +import sys +import time + +HERE = Path(__file__).resolve().parent +ROOT = Path('/Users/a9lim/Work/blam') +sys.path[:0] = [str(ROOT / 'tools/self-interpreter'), str(ROOT / 'tools')] +os.environ['RAYON_NUM_THREADS'] = '2' +os.environ['TMPDIR'] = str(HERE) +import battery +import blcc + + +def parse(src): + p = blcc.P(blcc.strip_comments(src)) + ast = blcc.p_lc(p) + p.ws() + assert p.i == len(p.t) + return blcc.to_db(ast) + + +def knot(body): + return rf'(\x. x x) (\x. (\intL. {body}) (x x))' + + +ABS = r'(cont (\args \arg. exp (\zx \zy. zx arg (zy args))))' +APP = r'(intL (\exp2. cont (\args. exp args (exp2 args))))' +K = r'(\a \b. a)' +F = r'(\a \b. b)' + +# One zero-arm binder leaves its second copy of q after the first parse. +# next ignores b1; D receives f, residual, q and re-reads b1 as q K. +AFTER = knot(rf'''\cont. + (\next. \list. + list (\bit0. bit0 (\r. r next) cont) (list list list)) + (\unused. intL (\exp \rest \tagtail. + tagtail {K} {ABS} {APP} rest))''') + +# Since bit0 is K in the zero arm, it can discard b1 for us. This floats +# the complete first-parse partial application outside that dummy binder. +HOIST = knot(rf'''\cont. + (\parse. \list. + list (\bit0. bit0 (\r. r (bit0 parse)) cont) (list list list)) + (intL (\exp \rest \tagtail. + tagtail {K} {ABS} {APP} rest))''') + +# Same new protocol, but eliminate the second tag's source field with a +# handler rather than a literal K projection; the lexical-depth cost matters. +HANDLER = knot(rf'''\cont. + (\next. \list. + list (\bit0. bit0 (\r. r next) cont) (list list list)) + (\unused. intL (\exp \rest \tagtail. + tagtail (\bit1 \source. bit1 {ABS} {APP}) rest))''') + +# Retain the actual tag explicitly and derive the two first-parse fields +# separately. This is a lossless realization of the q P / projection idea. +PROJECT = knot(rf'''\cont. + (\next. \list. + list (\bit0. bit0 (\unused. next) cont) (list list list)) + (\tagtail. + (\source. + (\exp. tagtail {K} {ABS} {APP} (intL {F} source)) + (intL {K} source)) + (tagtail {F}))''') + +CANDIDATES = [ + ('tag_after_parse', AFTER, 'Carry the redundant second-tag stream through the first parse and re-read its tag afterward.'), + ('tag_after_parse_hoisted', HOIST, 'Use the known first-tag K to hoist the first-parse partial application out of the ignored-bit binder.'), + ('tag_after_parse_handler', HANDLER, 'Replay the second tag with a Scott handler instead of the literal K projection.'), + ('independent_projections', PROJECT, 'Preserve the second tag and reconstruct value and remainder with separate first-parse projections.'), +] + + +def counts(t): + if t[0] == 'V': + return (0, 0, t[1]) + if t[0] == 'L': + l, a, x = counts(t[1]) + return l + 1, a, x + a, b = counts(t[1]), counts(t[2]) + return a[0] + b[0], a[1] + b[1] + 1, a[2] + b[2] + + +def main(): + rows = [] + for name, source, idea in CANDIDATES: + path = HERE / (name + '.lam') + path.write_text(source + '\n') + term = parse(source) + bits = battery.enc(term) + (HERE / (name + '.blc')).write_text(bits + '\n') + started = time.monotonic() + ok, skip, bad = battery.check(term, threads=2) + elapsed = time.monotonic() - started + line = f'{len(bits):5d} bits ok={ok} skip={skip} fail={len(bad)} {path}' + print(line, flush=True) + print(f' L,A,X={counts(term)} seconds={elapsed:.3f}; {idea}', flush=True) + for failure in bad[:5]: + print(' ', *failure, flush=True) + rows.append(dict(name=name, bits=len(bits), counts=counts(term), ok=ok, + skip=skip, failures=bad, seconds=elapsed, idea=idea, + line=line)) + (HERE / 'results.json').write_text(json.dumps(rows, indent=2) + '\n') + + +if __name__ == '__main__': + main() diff --git a/data/self-interpreter/reasoning_165/nextfuse/non_strict.json b/data/self-interpreter/reasoning_165/nextfuse/non_strict.json new file mode 100644 index 00000000..3adbadf9 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/non_strict.json @@ -0,0 +1,42 @@ +[ + { + "candidate": "tag_after_parse", + "program": "Omega", + "result": "tail returned exactly" + }, + { + "candidate": "tag_after_parse", + "program": "lambda_Omega", + "result": "tail returned exactly" + }, + { + "candidate": "tag_after_parse_hoisted", + "program": "Omega", + "result": "tail returned exactly" + }, + { + "candidate": "tag_after_parse_hoisted", + "program": "lambda_Omega", + "result": "tail returned exactly" + }, + { + "candidate": "tag_after_parse_handler", + "program": "Omega", + "result": "tail returned exactly" + }, + { + "candidate": "tag_after_parse_handler", + "program": "lambda_Omega", + "result": "tail returned exactly" + }, + { + "candidate": "independent_projections", + "program": "Omega", + "result": "tail returned exactly" + }, + { + "candidate": "independent_projections", + "program": "lambda_Omega", + "result": "tail returned exactly" + } +] diff --git a/data/self-interpreter/reasoning_165/nextfuse/projection_final_retry.json b/data/self-interpreter/reasoning_165/nextfuse/projection_final_retry.json new file mode 100644 index 00000000..58ade5e3 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/projection_final_retry.json @@ -0,0 +1,7 @@ +{ + "program": "010000011100111010000001110011100111010", + "old": "fuel", + "verdict": "ok", + "beta_budget": 268435456, + "seconds": 0.5297309579909779 +} diff --git a/data/self-interpreter/reasoning_165/nextfuse/projection_retries.json b/data/self-interpreter/reasoning_165/nextfuse/projection_retries.json new file mode 100644 index 00000000..632c7df6 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/projection_retries.json @@ -0,0 +1,37 @@ +[ + { + "program": "00000000000101010110110111011110111110", + "old": "fuel", + "verdict": "ok", + "beta_budget": 16777216, + "seconds": 0.018356333021074533 + }, + { + "program": "00000000000101010111111011110111011010", + "old": "fuel", + "verdict": "ok", + "beta_budget": 16777216, + "seconds": 0.019270666991360486 + }, + { + "program": "00010000000101111010011101010", + "old": "fuel", + "verdict": "ok", + "beta_budget": 16777216, + "seconds": 0.013300666003488004 + }, + { + "program": "010000011100111010000001110011100111010", + "old": "fuel", + "verdict": "fuel", + "beta_budget": 16777216, + "seconds": 0.09745783399557695 + }, + { + "program": "0001011000000000000011111100000011101110", + "old": "fuel", + "verdict": "ok", + "beta_budget": 16777216, + "seconds": 0.07567270798608661 + } +] diff --git a/data/self-interpreter/reasoning_165/nextfuse/results.json b/data/self-interpreter/reasoning_165/nextfuse/results.json new file mode 100644 index 00000000..f3dbc3f1 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/results.json @@ -0,0 +1,83 @@ +[ + { + "name": "tag_after_parse", + "bits": 189, + "counts": [ + 20, + 27, + 39 + ], + "ok": 667, + "skip": 1, + "failures": [], + "seconds": 2.391082375019323, + "idea": "Carry the redundant second-tag stream through the first parse and re-read its tag afterward.", + "line": " 189 bits ok=667 skip=1 fail=0 nextfuse/tag_after_parse.lam" + }, + { + "name": "tag_after_parse_hoisted", + "bits": 188, + "counts": [ + 19, + 28, + 36 + ], + "ok": 667, + "skip": 1, + "failures": [], + "seconds": 2.411460333969444, + "idea": "Use the known first-tag K to hoist the first-parse partial application out of the ignored-bit binder.", + "line": " 188 bits ok=667 skip=1 fail=0 nextfuse/tag_after_parse_hoisted.lam" + }, + { + "name": "tag_after_parse_handler", + "bits": 199, + "counts": [ + 20, + 27, + 49 + ], + "ok": 667, + "skip": 1, + "failures": [], + "seconds": 2.454805333050899, + "idea": "Replay the second tag with a Scott handler instead of the literal K projection.", + "line": " 199 bits ok=667 skip=1 fail=0 nextfuse/tag_after_parse_handler.lam" + }, + { + "name": "independent_projections", + "bits": 220, + "counts": [ + 25, + 32, + 40 + ], + "ok": 662, + "skip": 1, + "failures": [ + [ + "00000000000101010110110111011110111110", + "fuel" + ], + [ + "00000000000101010111111011110111011010", + "fuel" + ], + [ + "00010000000101111010011101010", + "fuel" + ], + [ + "010000011100111010000001110011100111010", + "fuel" + ], + [ + "0001011000000000000011111100000011101110", + "fuel" + ] + ], + "seconds": 2.479693917033728, + "idea": "Preserve the second tag and reconstruct value and remainder with separate first-parse projections.", + "line": " 220 bits ok=662 skip=1 fail=5 nextfuse/independent_projections.lam" + } +] diff --git a/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse.blc b/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse.blc new file mode 100644 index 00000000..232ef903 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100001101111011110010110101000011110000000010101011000001100111111000000111111000000101110111001101111001111111000011111110000101111110100111010110011010 diff --git a/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse.lam b/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse.lam new file mode 100644 index 00000000..8cacba71 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse.lam @@ -0,0 +1,5 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\r. r next) cont) (list list list)) + (\unused. intL (\exp \rest \tagtail. + tagtail (\a \b. a) (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args)))) rest))) (x x)) diff --git a/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_handler.blc b/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_handler.blc new file mode 100644 index 00000000..e9ff3a43 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_handler.blc @@ -0,0 +1 @@ +0100011010000100000100000101100001011000011011110111100101101010000111100000000101100000010111001111111100000011111111000000101110111001101111001111111110000111111111000010111111110100111010110011010 diff --git a/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_handler.lam b/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_handler.lam new file mode 100644 index 00000000..521f9737 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_handler.lam @@ -0,0 +1,5 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\r. r next) cont) (list list list)) + (\unused. intL (\exp \rest \tagtail. + tagtail (\bit1 \source. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args))))) rest))) (x x)) diff --git a/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_hoisted.blc b/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_hoisted.blc new file mode 100644 index 00000000..26a289b8 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_hoisted.blc @@ -0,0 +1 @@ +01000110100001000001000001011000010110000110011101111011110010110101001110000000010101011000001100111110000001111110000001011101110011011110011111100001111110000101111110100111010110011010 diff --git a/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_hoisted.lam b/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_hoisted.lam new file mode 100644 index 00000000..7e6534b8 --- /dev/null +++ b/data/self-interpreter/reasoning_165/nextfuse/tag_after_parse_hoisted.lam @@ -0,0 +1,5 @@ +(\x. x x) (\x. (\intL. \cont. + (\parse. \list. + list (\bit0. bit0 (\r. r (bit0 parse)) cont) (list list list)) + (intL (\exp \rest \tagtail. + tagtail (\a \b. a) (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args)))) rest))) (x x)) diff --git a/data/self-interpreter/reasoning_165/protocol/REPORT.txt b/data/self-interpreter/reasoning_165/protocol/REPORT.txt new file mode 100644 index 00000000..be790944 --- /dev/null +++ b/data/self-interpreter/reasoning_165/protocol/REPORT.txt @@ -0,0 +1,162 @@ +PROTOCOL CO-DESIGN RESULT + +No sub-165 interpreter found. No enumeration was performed. Two complete +hand-derived interpreters were constructed and tested, with two battery +workers. The repository was not modified. The 165 record was read first; +the constructions below repair the recorded failing r intL idea rather than +propose that known failure as a candidate. Their purpose is to determine +whether the reader's duplicated second-bit stream can supply useful work. + +COMPLETE CONSTRUCTIONS + +225 bits ok=667 skip=1 fail=0 reparse_selected.lam +234 bits ok=667 skip=1 fail=0 reparse_shared.lam + +Unoptimized source and exact wire encodings are saved as matching .lam/.blc +files. The counts (L,A,X) are (21,32,53) and (22,33,56), respectively. These +give 225 and 234 using 2L+4A+2+X. Battery times were 2.314 s and 2.366 s. +Each also passes four tail-extraction probes on Omega, lambda.Omega, +Omega I, and I Omega: E (lambda v r.r) (quote(M) ++ n) normalizes to n. +These probes cover a demand boundary omitted by the normal-form battery; +they are not a substitute for a proof on all divergent programs. + +The 225 uses the zero arm (lambda r.r next), deliberately retaining the +extra application that makes the recorded 162-bit near-miss fail. For a +constructor, the reader now calls next b t r, where r = cons b t is the +duplicated stream beginning with the second tag bit. Thus r P = P b t. +This yields the first parsed value in ABS, and its remainder in APP. +A complementary parse obtains the missing component. The 234 computes +the complementary component once with P (b F K) t and binds it as other; +the extra selector, let, and binder depths make this nine bits larger. + +These are not proposed improvements. Relative to 165, the 225 has four +more lambdas, seven more applications, and 24 more index-excess bits: +8 + 28 + 24 = 60. The experiment identifies a correct use of the extra +reader argument, but obtaining its missing information is too expensive +in these constructions. No minimality of these repairs is claimed. + +EXACT IDENTITIES AND CORRECTNESS PROOF + +Notation: K = lambda x y.x (bit 0); F = lambda x y.y (bit 1); +delta(s) = s s s; cell(a,e) = lambda x y.x a (y e). +Write A(f) = lambda e a.f(cell(a,e)), B(f,g) = lambda e.f e (g e). +P is a parser with the usual value/remainder interface, including on open +syntax. Its recursive syntactic value V(M,R) is: + + V(var n,R) = the stream 1^(n-1)0 ++ R; + V(lambda M,R) = A(V(M,R)); + V(M N,R) = B(V(M,quote(N)++R), V(N,R)). + +The standard property is P k (quote(M)++R) =beta k V(M,R) R. + +1. Selected parsing from the duplicated stream. + +For r = cons b (quote(M)++R), set f=V(M,R). Then + + r P =beta P b (quote(M)++R) =beta b f R. + +Consequently r P =beta f when b=K and =beta R when b=F. +The complementary call P (b F K) (quote(M)++R) is R in the +first case and f in the second. Proof: expand the Scott cons, use the +parser law, and reduce K/F. This identity does not evaluate f. + +2. The 225's constructor law. + +The outer reader is s (lambda b0.b0 (lambda r.r next) c) delta(s). +For first bit 0, s=cons K r and delta(s)=r, so this reduces to +r next r = next b t r. Its next body is exactly + + b [c (A(r P)) (P F t)] + [P (lambda g.c (B(P K t,g))) (r P)]. + +When b=K and t=quote(M)++R, identity 1 makes this c (A(f)) R. +When b=F and t=quote(M)++quote(N)++R, identity 1 supplies the second +operand's input stream, P K t supplies f, and the second parse produces +c (B(f,g)) R. The variable case is unchanged: first bit F selects c, +and the Scott stream supplies the unary value and delta(s)=R. + +This is an induction on source syntax. Every recursive parse used by a +constructor parses a proper subterm; duplicating a parse does not change +that induction measure. It proves precisely the standard P k law above, +with the same V as the 165. Therefore the existing environment-denotation +argument yields the exact closed-program contract, divergent syntax +included. This is a paper proof, not a new Lean formalization. + +For the 234, name other = P (b F K) t. Its two branches are +c (A(r P)) other and P (lambda g.c (B(other,g))) (r P). +Identity 1 gives the same induction immediately. + +INTERFACE IMPOSSIBILITY RESULTS + +3. Selecting just one parse component cannot be repaired downstream +without retaining input-dependent information about the discarded one. + +Assume a fixed postprocessor receives b and x=P b (quote(M)++R), +along with c and P, but has no other dependence on the input stream. +For ABS, choose the closed body I and two distinct rigid final tails. +x=P K (quote(I)++R)=beta K I is independent of R, but the required +outputs c (A(K I)) R have different rigid tails. Church-Rosser rules out +a common result. For APP, use first operands I and K, the same second +operand I, and the same final tail. Both selected inputs equal +quote(I)++R, but the required results contain I versus K I, distinct +beta-normal forms. Thus no such postprocessor exists at any size. + +This proves an obstruction for the already-recorded r P failure. It does +not prohibit retaining r (as the two constructions do), retaining the +first value, or changing the value/remainder protocol. + +4. Supplying the skipped original stream as well still loses variable +indices in APP. This also holds for every positive iterate of skip. + +Assume the ordinary open-term parser law. Let the first APP operand be +var n, let R be the second-operand stream, and let + + t_n = 1^n 0 ++ R, r_n = 1^(n+1) 0 ++ R. + +The available selected result is P F t_n =beta R. Also +delta(r_n)=beta R by the unary skip law, so for every j>=1, +delta^j(r_n)=beta delta^(j-1)(R). All these fields are independent of n. +Hence a postprocessor whose only stream-dependent inputs are the +selected result and any collection of these positive skipped residuals +cannot recover which first variable was parsed. + +This is a contradiction within the closed-program contract, not merely +an open-term disagreement: place the APP under two lambdas and let its +second operand be var 1. The two closed programs are + + lambda a b.b b and lambda a b.a b. + +At the APP boundary their fixed preceding context is identical and all +the proposed fields coincide, but their required values have different +beta-normal forms. Their BLC normal forms are 0000011010 and +00000111010. targeted_checks.json records a normalizer check that both +the selected fields and delta(r_n) coincide for n=1,2; the general proof +is the unary reduction above. The result applies only to the stated +interface. A different VAR return, an unskipped pointer, or an extra +index-bearing field escapes it. + +READ OF THE REMAINING OPPORTUNITY + +The extra zero-branch argument can carry useful syntax/control state; +it is not intrinsically disposable. But using its native r P projection +splits the exact pair the constructor needs. Combining that projection +with one or more skipped pointers does not restore the missing value +when APP's first operand is a variable. Reparsing restores it, at the +measured cost above. + +A smaller design along this route would have to preserve the raw unary +suffix or another index-bearing value while using the stream's own +application to supply the continuation arguments. Merely moving skip +later or taking more skipped residuals cannot do that in this interface. +I do not have a lower-cost carrier satisfying those requirements, nor a +lower bound ruling one out. This leaves the sub-165 problem open. + +REPRODUCTION + +python3 -B check.py + +The script uses the existing repository normalizer and battery, forces +two battery workers, redirects temporary compilation files into this +directory, and suppresses bytecode writes. battery.json records the +original measured runs; targeted_checks.json records the additional +divergence and collision probes. diff --git a/data/self-interpreter/reasoning_165/protocol/SUMMARY.md b/data/self-interpreter/reasoning_165/protocol/SUMMARY.md new file mode 100644 index 00000000..f34a73ce --- /dev/null +++ b/data/self-interpreter/reasoning_165/protocol/SUMMARY.md @@ -0,0 +1,28 @@ +(•̀_•́) **No sub-165 interpreter found.** Two complete repairs pass; the useful result is an obstruction to combining a selected parse result with skipped residuals. + +- [reparse_selected.lam](reparse_selected.lam): `225 bits ok=667 skip=1 fail=0`. Uses the duplicated zero-branch stream as `r intL`, then reparses to recover the discarded component. +- [reparse_shared.lam](reparse_shared.lam): `234 bits ok=667 skip=1 fail=0`. Shares the complementary parse through a let; its selector and binder costs add nine bits. + +Both also pass suffix extraction on `Ω`, `λ.Ω`, `Ω I`, and `I Ω`. Batteries used two workers and took approximately 2.3 seconds each. No enumeration or repository changes. + +The exact identities and obstructions are: + +1. **The duplicate stream supplies a selected parse component.** Write `K` for bit zero, `F` for bit one, and assume the ordinary parser law `P k (⌜M⌝++R) =β k v R`. For `r = cons b (⌜M⌝++R)`, + ``` + r P =β P b (⌜M⌝++R) =β b v R. + ``` + Thus `r P` supplies the value in ABS and the remainder in APP. The complementary call `P (b F K) (⌜M⌝++R)` supplies the other component. Expanding Scott cons and reducing the selectors proves both identities. These identities give structural-induction correctness proofs for the two constructions, including divergent syntax; those proofs are on paper, not Lean. + +2. **The selected component alone cannot support a downstream repair.** In ABS, choose closed body `I` and two different rigid tails: the selected value is identical, but the required outputs have different tails. In APP, choose first operands `I` and `K`, followed by the same second operand `I`: the selected remainder is identical, but the required values normalize to `I` and `K I`. A fixed postprocessor without additional input-dependent information cannot distinguish either pair. + +3. **Adding skipped residuals still loses variable indices in APP.** Let `δ(s)=s s s`, retain the ordinary open-term parser interface, and set + ``` + tₙ = 1ⁿ0 ++ R + rₙ = 1ⁿ⁺¹0 ++ R. + ``` + Then `P F tₙ =β R` and `δ(rₙ)=β R`. Every positive iterate of `δ` is likewise independent of `n`. Consequently, the selected result plus any collection of these skipped residuals cannot recover the first operand’s index. The closed witnesses are `λa b.b b` and `λa b.a b`: identical preceding context and proposed fields, distinct required β-normal forms. + +The last obstruction is interface-specific. Changing VAR’s return or retaining an unskipped pointer escapes it. My read is that this route needs an inexpensive carrier preserving the raw unary suffix while the stream supplies continuation arguments. Reparsing works, but these measured repairs are far too large; no lower bound excludes a better carrier. + +[Full report, proofs, accounting, and reproduction instructions](REPORT.txt). + diff --git a/data/self-interpreter/reasoning_165/protocol/battery.json b/data/self-interpreter/reasoning_165/protocol/battery.json new file mode 100644 index 00000000..14c93819 --- /dev/null +++ b/data/self-interpreter/reasoning_165/protocol/battery.json @@ -0,0 +1,22 @@ +[ + { + "name": "reparse_selected", + "bits": 225, + "ok": 667, + "skip": 1, + "fail": 0, + "failures": [], + "seconds": 2.3138279580161907, + "line": " 225 bits ok=667 skip=1 fail=0 reparse_selected.lam" + }, + { + "name": "reparse_shared", + "bits": 234, + "ok": 667, + "skip": 1, + "fail": 0, + "failures": [], + "seconds": 2.3664639170165174, + "line": " 234 bits ok=667 skip=1 fail=0 reparse_shared.lam" + } +] diff --git a/data/self-interpreter/reasoning_165/protocol/check.py b/data/self-interpreter/reasoning_165/protocol/check.py new file mode 100644 index 00000000..e867d94f --- /dev/null +++ b/data/self-interpreter/reasoning_165/protocol/check.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +"""Recheck the two hand-derived interpreters with at most two workers.""" +import os +from pathlib import Path +import sys +import tempfile + +sys.dont_write_bytecode = True +os.environ["RAYON_NUM_THREADS"] = "2" +OUT = Path(__file__).resolve().parent +ROOT = Path("/Users/a9lim/Work/blam") +tempfile.tempdir = str(OUT) +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +from battery import FALSE, bitlist, check, compile_lam, enc, normalize, shift + +V = lambda i: ("V", i) +L = lambda t: ("L", t) +A = lambda f, a: ("A", f, a) + +for name, size in (("reparse_selected", 225), ("reparse_shared", 234)): + path = OUT / (name + ".lam") + term = compile_lam(path.read_text()) + assert len(enc(term)) == size + assert enc(term) == path.with_suffix(".blc").read_text().strip() + ok, skipped, failures = check(term, threads=2) + print(f"{size:5d} bits ok={ok} skip={skipped} fail={len(failures)} {path.name}", flush=True) + assert (ok, skipped, failures) == (667, 1, []) + for source in ( + r"(\x.x x) (\x.x x)", + r"\z.(\x.x x) (\x.x x)", + r"((\x.x x) (\x.x x)) (\x.x)", + r"(\x.x) ((\x.x x) (\x.x x))", + ): + program = compile_lam(source) + probe = L(A(A(shift(term, 1), FALSE), bitlist(enc(program), V(0)))) + assert normalize(enc(probe), 1 << 16) == "0010" + print(" divergent suffix probes: 4/4", flush=True) + +term = compile_lam((OUT / "reparse_selected.lam").read_text()) +rest = bitlist("10", V(0)) +expected = normalize(enc(L(rest)), 1 << 16) +for index in (1, 2): + code = "1" * index + "0" + stream = bitlist(code + "10", V(0)) + after_tag = bitlist("1" + code + "10", V(0)) + selected = L(A(A(shift(term, 1), FALSE), stream)) + skipped = L(A(A(after_tag, after_tag), after_tag)) + assert normalize(enc(selected), 1 << 16) == expected + assert normalize(enc(skipped), 1 << 16) == expected +print(" APP var-1/var-2 selected-result and skip collision: verified", flush=True) diff --git a/data/self-interpreter/reasoning_165/protocol/reparse_selected.blc b/data/self-interpreter/reasoning_165/protocol/reparse_selected.blc new file mode 100644 index 00000000..be522a13 --- /dev/null +++ b/data/self-interpreter/reasoning_165/protocol/reparse_selected.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100001101111011110010110101000000001011110010111110000001011110111111100000010111011100110111100101111110000010110010111111000011111100001010101111111100000110111101001110100110111110011010 diff --git a/data/self-interpreter/reasoning_165/protocol/reparse_selected.lam b/data/self-interpreter/reasoning_165/protocol/reparse_selected.lam new file mode 100644 index 00000000..2285866f --- /dev/null +++ b/data/self-interpreter/reasoning_165/protocol/reparse_selected.lam @@ -0,0 +1,7 @@ +(\x.x x) (\x.(\intL.\cont. + (\next.\list.list (\bit0.bit0 (\r.r next) cont) (list list list)) + (\bit1\tail\orig.bit1 + (cont (\args\arg.(orig intL) (\zx\zy.zx arg (zy args))) + (intL (\u\v.v) tail)) + (intL (\exp2.cont (\args.(intL (\u\v.u) tail) args (exp2 args))) + (orig intL)))) (x x)) diff --git a/data/self-interpreter/reasoning_165/protocol/reparse_shared.blc b/data/self-interpreter/reasoning_165/protocol/reparse_shared.blc new file mode 100644 index 00000000..ed2d90fa --- /dev/null +++ b/data/self-interpreter/reasoning_165/protocol/reparse_shared.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100001101111011110010110101000000001000101111100101111110000001011111011111111000000101110111001101111010010111111100001111111000010111101001110100111011111100101111110010111100000100000110110011010 diff --git a/data/self-interpreter/reasoning_165/protocol/reparse_shared.lam b/data/self-interpreter/reasoning_165/protocol/reparse_shared.lam new file mode 100644 index 00000000..a2e490c6 --- /dev/null +++ b/data/self-interpreter/reasoning_165/protocol/reparse_shared.lam @@ -0,0 +1,7 @@ +(\x.x x) (\x.(\intL.\cont. + (\next.\list.list (\bit0.bit0 (\r.r next) cont) (list list list)) + (\bit1\tail\orig. + (\other.bit1 + (cont (\args\arg.(orig intL) (\zx\zy.zx arg (zy args))) other) + (intL (\exp2.cont (\args.other args (exp2 args))) (orig intL))) + (intL (bit1 (\u\v.v) (\u\v.u)) tail))) (x x)) diff --git a/data/self-interpreter/reasoning_165/protocol/targeted_checks.json b/data/self-interpreter/reasoning_165/protocol/targeted_checks.json new file mode 100644 index 00000000..a9ff937d --- /dev/null +++ b/data/self-interpreter/reasoning_165/protocol/targeted_checks.json @@ -0,0 +1,70 @@ +[ + { + "candidate": "reparse_selected", + "test": "omega", + "suffix_nf": "0010" + }, + { + "candidate": "reparse_selected", + "test": "abs_omega", + "suffix_nf": "0010" + }, + { + "candidate": "reparse_selected", + "test": "omega_i", + "suffix_nf": "0010" + }, + { + "candidate": "reparse_selected", + "test": "i_omega", + "suffix_nf": "0010" + }, + { + "candidate": "reparse_shared", + "test": "omega", + "suffix_nf": "0010" + }, + { + "candidate": "reparse_shared", + "test": "abs_omega", + "suffix_nf": "0010" + }, + { + "candidate": "reparse_shared", + "test": "omega_i", + "suffix_nf": "0010" + }, + { + "candidate": "reparse_shared", + "test": "i_omega", + "suffix_nf": "0010" + }, + { + "variable": 1, + "test": "selected", + "nf": "00000101100000100001011000001101110" + }, + { + "variable": 1, + "test": "skipped", + "nf": "00000101100000100001011000001101110" + }, + { + "variable": 2, + "test": "selected", + "nf": "00000101100000100001011000001101110" + }, + { + "variable": 2, + "test": "skipped", + "nf": "00000101100000100001011000001101110" + }, + { + "target_source": "\\a\\b.b b", + "nf": "0000011010" + }, + { + "target_source": "\\a\\b.a b", + "nf": "00000111010" + } +] diff --git a/data/self-interpreter/reasoning_165/reader/RESULTS.txt b/data/self-interpreter/reasoning_165/reader/RESULTS.txt new file mode 100644 index 00000000..e47afd7f --- /dev/null +++ b/data/self-interpreter/reasoning_165/reader/RESULTS.txt @@ -0,0 +1,182 @@ +READER-SHAPE CONSULT: NO SUB-165 RESULT + +Scope and evidence +------------------ +Read the current interpreter.md and STATUS.md before designing candidates. +No repository files changed. No enumeration, no new agents, no external +consults. check.py uses the existing unoptimized compiler and battery with +threads=2; its temporary files stay in this directory. Two complete terms +were written, both reported below. All identities and exclusions below have +hand proofs; the small rigid probes are supplementary checks, not proofs. + +Notation: K = lambda x y.x (bit 0), F = lambda x y.y (bit 1), +cons b r = lambda f.f b r, D = lambda x.x x. Juxtaposition associates left. +P denotes the current next callback; C and N are rigid. A parametric reader +must send 0:b:t to P b t and 1^n:0:N to C (1^(n-1):0:N) N. + +COMPLETE CANDIDATES +------------------- +1. spine3_bare.lam, 158 bits. + + Reader: lambda s. s (lambda b. b b C) (s s s) P + + Idea: use bit 0 itself as the zero branch, and place next on the outer + application spine. This removes the original two-lambda zero arm. + + 158 bits ok=0 skip=1 fail=667 spine3_bare.lam + + All listed failures were fuel outcomes. They are independently refuted, + not unresolved: the zero cases work, but the variable case returns + C r N P, with a third argument at the rigid continuation head. On the + closed identity program I, the complete term reduces to + + C (lambda z.I) N J + + for a residual next callback J. Its three-argument rigid C head cannot + become the required two-argument C head by beta conversion. + +2. spine3_repaired.lam, 178 bits. + + Reader: lambda s. s + (lambda b. b b (lambda v r unused. C v r)) (s s s) P + + Idea: same three-argument spine, with the extra-argument erasure moved + into the variable arm. + + 178 bits ok=667 skip=1 fail=0 spine3_repaired.lam + + Let Cbar = lambda v r unused.C v r. For s=cons K r, s s s -> r, + and K K Cbar -> K, so the reader reduces to K r r P -> r P. + For s=1^n:0:N, s s s -> N, and F F Cbar -> Cbar, so it reduces to + Cbar r N P -> C r N. These are the same recursive reader equations as + the 165, with the entire NEXT region unchanged. Thus the usual structural + parser proof transfers, including source terms without normal forms; + this transfer was reasoned by hand, not checked in Lean. + + The explicit variable adapter costs 25 bits at its capture frame, versus + the bare C's 5: 158 + 20 = 178. This is a measured repair cost, not a lower + bound on all possible repairs. + +Both readers were additionally tested with rigid P,C,N on zero prefixes 00 +and 01 and variables 1^n0 for n=1,2,3,9,31. The 158 passed only the zero +cases. The 178 passed all seven. The full battery skipped its usual one +non-normalizing expected result. + +EXACT IDENTITIES +---------------- +1. The stream diagonal exposes a useful conditional predecessor: + + (cons b r) D -> b b r + (cons K r) D -> K + (cons F r) D -> r. + + Proof: (cons b r) D -> D b r -> b b r. K K r -> K, whereas + F F r -> r. No assumption on r is needed. + +2. A conditional suffix thunk, and its force: + + D (s D) = (s D) (s D) + -> K K if s begins with 0, + -> K N if s = 1^n 0 ++ N, n >= 1. + + Hence, for every dummy X, + + D (s D) X -> K on a zero tag, + D (s D) X -> N on a variable. + + Proof: in the zero case identity 1 gives s D -> K. In the variable + case it gives s D -> r = 1^(n-1)0 ++ N. For any unary prefix u=1^k0++N, + u u -> K N: at k=0, (cons K N)(cons K N) -> K N; at k+1 the two + leading F operations reduce to the corresponding tail self-application. + Thus r r -> K N. Applying either K thunk to X proves the last display. + + The equivalent triple (s D)(s D)(s D) is K on zero and N on variables. + Inlining D, the more compact D (s D) s costs 26 bits in the reader body, + versus 10 for s s s. This is not a saving as a standalone skip. It might + be useful only if D is shared with the knot or its conditional predecessor + role replaces other work. No such saving was obtained in this pass. + + Rigid Rust normalization checked identity 1 for both bits and the suffix + identities at n=1,2,3,9,31, plus the zero case. Every check passed. + +ALL-SIZE EXCLUSIONS FOR EXPLICITLY LIMITED READER FAMILIES +-------------------------------------------------------- +1. No abstraction-free application body over s,P,C is a parametric reader. + + This covers every application tree, every number of stream copies and + arbitrary repetitions of P or C, not just a fixed spine. The reader may + have its outer lambda s; the exclusion is that its body contains only + application and the three parameters, with no further abstractions. + + Proof: specialize the input to variable 1. Put + + R = cons K N, S = cons F R, T = lambda u.N = K N. + + Every expression made by application from S,P,C normalizes. All the + substituted lambda terms are affine, so a beta contraction strictly + decreases size. Induction on the application expression proves that its + normal form is either S, T, or q A1 ... Ak for q in {P,C,N}. + The only nontrivial cases when applying such normal forms are + + S S -> T; S T -> N R; + S (q A1 ... Ak) -> q A1 ... Ak F R; + T X -> N. + + A rigid-headed left operand merely appends the right operand. In + particular, no expression's normal form is R. + + Simultaneously, whenever the normal form is C-headed and has arguments, + its first argument is not R. If it already had an argument, induction + preserves it. If application supplies the first argument, that argument + is either the normal form of a smaller expression (never R), or F in + the S(q ...) case. F is not R. But the required variable result is + C R N, whose first argument IS R. Uniqueness of normal forms contradicts + correctness. + + Scope: P is opaque/rigid here. This does not exclude exploiting the + concrete nontrivial implementation of next as an extra computational + primitive. Nor does it exclude a beta-compressed body containing lambdas. + +2. Starting the reader's head spine with s s is impossible. + + For a variable stream, s s -> K N. Therefore + (s s) A1 ... Ak has a lambda head if k=0, reduces to N if k=1, and + has rigid head N with k-1 arguments if k>=2. None has head C. This holds + irrespective of what the Ai contain or whether they normalize. A + skip-first reader cannot resume dispatch by only appending arguments to + that raw self-application. + +3. Retaining a bare-C variable branch forces exactly the existing arity. + + Consider any reader of shape + + lambda s. s (lambda b. b Z C) A1 ... Ak. + + On s=cons F r it reduces to C r A1 ... Ak. The required result has + exactly two arguments at rigid C. Therefore k=1, and the sole A1 must + be beta-equal to N on variable streams. No change to Z repairs k=0 or + k>=2. The 158-bit candidate is precisely a k=2 violation. + + This is not an exclusion of arbitrary three-argument readers: the + passing 178 explicitly changes the variable arm and escapes the premise. + +ASSESSMENT +---------- +No improvement on 165. The promising-looking way to delete the zero arm's +discard and place next on a longer spine only moves the discard into the +variable branch, where the explicit repair is substantially dearer. + +A genuinely different small parametric reader must contain local +abstractions and cannot use raw s s as its final head path. If it retains +the current bare C arm, adding or removing outer arguments cannot help. +The remaining live places are a different handler that uses its branch +arguments jointly, a small beta-compressed construction whose exposed +spine is larger, or treating concrete next / the knot as computational +resources. The D identity supplies a specific conditional-predecessor +operation for that last possibility; it is not evidence of a smaller +complete interpreter. No unconditional bound at 165 was proved. + +Reproduce all candidates and probes: + PYTHONDONTWRITEBYTECODE=1 RAYON_NUM_THREADS=2 python3 check.py +Identity checks only: + PYTHONDONTWRITEBYTECODE=1 RAYON_NUM_THREADS=2 python3 check.py --identities-only diff --git a/data/self-interpreter/reasoning_165/reader/SUMMARY.md b/data/self-interpreter/reasoning_165/reader/SUMMARY.md new file mode 100644 index 00000000..6901f8e5 --- /dev/null +++ b/data/self-interpreter/reasoning_165/reader/SUMMARY.md @@ -0,0 +1,57 @@ +( •̀ᴗ•́ ) No sub-165 result. Two complete candidates were built; one passes at 178 bits. Full proofs, sources, and reproduction commands are in [RESULTS.txt](RESULTS.txt). + +| Candidate | Battery | Idea | +|---|---|---| +| [spine3_bare.lam](spine3_bare.lam), **158 bits** | `ok=0 skip=1 fail=667` | Replace the zero arm by its bit, moving `next` onto a third outer argument. | +| [spine3_repaired.lam](spine3_repaired.lam), **178 bits** | `ok=667 skip=1 fail=0` | Move the extra-argument discard into the variable continuation. | + +Write `P = next`, `K = bit 0`, `F = bit 1`. The 158’s reader is + +```text +λs. s (λb. b b C) (s s s) P +``` + +On a zero tag, `K K C → K`, so it correctly returns `r P`. On a variable, `F F C → C`, so it returns **`C r N P`**. This is independently refuted despite the battery’s fuel outcomes: on the closed identity program the complete interpreter reaches `C (λz.I) N J`, with three arguments at rigid `C`, which cannot become the required two. + +The 178 replaces `C` in that reader by `λv r unused. C v r`. Both branches then have exactly the 165’s reader equations. Consequently its correctness proof transfers by structural parsing induction, including divergent source programs. That transfer is a hand proof; no new Lean verification was performed. + +A useful exact identity emerged. Let `D = λx.x x`. Then + +```text +(cons b r) D → D b r → b b r +(cons K r) D → K +(cons F r) D → r +``` + +Thus the stream supplies a **conditional predecessor**: `K` on zero, its immediate tail on one. Moreover, + +```text +D (s D) X → K when s begins with 0 +D (s D) X → N when s = 1^n 0 ++ N, n ≥ 1 +``` + +for arbitrary `X`. Proof: the zero case becomes `K K X → K`. In the variable case `s D → r`, and unary-tail induction gives `r r → K N`, hence `r r X → N`. All targeted rigid probes passed. Unfortunately, `D (s D) s` costs 26 bits with `D` inlined, versus 10 for the existing skip. Sharing `D` with the knot or replacing additional work would be necessary. + +Three limited-family exclusions were proved: + +1. **No abstraction-free application body over `s,P,C` is a parametric reader, at any size.** Specialize to variable 1: let `R = cons K N`, `S = cons F R`, and `T = K N`. Every application expression over `S,P,C` normalizes to either `S`, `T`, or a rigid-headed term with head in `{P,C,N}`. The induction uses + ```text + S S → T + S T → N R + S (q A⃗) → q A⃗ F R + T X → N + ``` + No such expression normalizes to `R`. Furthermore, a `C`-headed result cannot have first argument `R`: its first argument either comes from a smaller expression, whose normal form is never `R`, or is the supplied `F`. Therefore it cannot equal `C R N`. This treats `P` as opaque; exploiting concrete NEXT remains outside the exclusion. + +2. **A head spine starting with `s s` cannot work.** On variables, `s s → K N`. With no further argument it is a constant function; with one it becomes `N`; with more it remains `N`-headed. Arbitrary appended arguments cannot restore a `C` head. + +3. **Keeping the bare-`C` branch forces the existing outer arity.** Any reader + ```text + λs. s (λb. b Z C) A1 … Ak + ``` + returns `C r A1 … Ak` on variables. Rigid continuation arity forces **`k = 1`**. Changing the zero arm cannot repair a longer spine; the 178 escapes only by changing the variable arm. + +My read: merely relocating the dropped copy does not pay. The remaining plausible routes involve a handler using its arguments jointly, a compressed construction whose exposed spine is larger, or concrete NEXT/knot behavior. The diagonal identity gives a specific operation to investigate there, but no evidence yet of a smaller complete interpreter. + +Only targeted probes and two batteries with two workers were run. Repository files remain unchanged. + diff --git a/data/self-interpreter/reasoning_165/reader/check.py b/data/self-interpreter/reasoning_165/reader/check.py new file mode 100644 index 00000000..94b0bdab --- /dev/null +++ b/data/self-interpreter/reasoning_165/reader/check.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python3 +"""Only hand-derived candidates and small rigid reader probes; two workers.""" +import os +import sys +from pathlib import Path + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = Path('/Users/a9lim/Work/blam') +os.environ['TMPDIR'] = str(HERE) +os.environ['RAYON_NUM_THREADS'] = '2' +import tempfile +tempfile.tempdir = str(HERE) +sys.path.insert(0, str(ROOT / 'tools/self-interpreter')) +from battery import check, compile_lam, enc, bitlist, normalize, shift, TRUE, FALSE + +ABS = r'(cont (\args \arg. exp (\zx \zy. zx arg (zy args))))' +APP = r'(intL (\exp2. cont (\args. exp args (exp2 args))))' +NEXT = rf'(\bit1. intL (\exp. bit1 {ABS} {APP}))' + +def machine(reader): + return rf'''(\x. x x) (\x. (\intL. \cont. + (\next. {reader}) {NEXT}) (x x))''' + +# The extra final next fixes ZERO after replacing its arm by bit0 itself. +# With the bare continuation, it also escapes into the variable result. +READERS = { + 'spine3_bare': r'''\list. list (\bit0. bit0 bit0 cont) + (list list list) next''', + 'spine3_repaired': r'''\list. list + (\bit0. bit0 bit0 (\value \rest \unused. cont value rest)) + (list list list) next''', +} + +def A(f, *args): + for a in args: + f = ('A', f, a) + return f + +def Ls(n, body): + for _ in range(n): + body = ('L', body) + return body + +V = lambda i: ('V', i) + +def rigid_reader(reader): + E = compile_lam(r'\next \cont. ' + reader) + outcomes = [] + for word in ['00', '01'] + ['1' * i + '0' for i in [1, 2, 3, 9, 31]]: + s = bitlist(word, V(0)) + got = Ls(3, A(shift(E, 3), V(2), V(1), s)) + if word[0] == '0': + want = Ls(3, A(V(2), TRUE if word[1] == '0' else FALSE, V(0))) + else: + want = Ls(3, A(V(1), bitlist(word[1:], V(0)), V(0))) + g, w = normalize(enc(got), 100000), normalize(enc(want), 100000) + outcomes.append((word, g == w)) + return outcomes + +def identities(): + # For s = cons b r and D = lambda x. x x: s D -> b b r. + D = compile_lam(r'\x. x x') + checks = [] + for b, expected in [(TRUE, TRUE), (FALSE, V(0))]: + s = ('L', A(V(0), shift(b, 1), V(1))) + got = ('L', A(s, D)) + want = ('L', expected) + checks.append(('stream_diagonal_' + ('K' if b == TRUE else 'F'), + normalize(enc(got), 10000) == normalize(enc(want), 10000))) + # For unary s = 1^n 0 ++ N, n>=1, (s D)^3 -> N. + for n in [1, 2, 3, 9, 31]: + s = bitlist('1' * n + '0', V(0)) + u = A(s, D) + got = ('L', A(u, u, u)) + checks.append((f'diagonal_skip_{n}', normalize(enc(got), 100000) == '0010')) + # D (s D) arbitrary = K for 0:r, and N for 1^n 0:N. + for word in ['0'] + ['1' * i + '0' for i in [1, 2, 3, 9, 31]]: + s = bitlist(word, V(1)) + got = Ls(2, A(D, A(s, D), V(0))) + want = Ls(2, TRUE if word == '0' else V(1)) + checks.append((f'conditional_skip_{len(word)-1}', + normalize(enc(got), 100000) == normalize(enc(want), 100000))) + print('identity probes:', checks) + assert all(v for _, v in checks) + +if __name__ == '__main__': + identities() + if '--identities-only' in sys.argv: + raise SystemExit(0) + for name, reader in READERS.items(): + path = HERE / (name + '.lam') + path.write_text(machine(reader) + '\n') + E = compile_lam(path.read_text()) + print(name, 'rigid reader probes:', rigid_reader(reader), flush=True) + ok, skip, bad = check(E, threads=2) + print(f'{len(enc(E)):5d} bits ok={ok} skip={skip} fail={len(bad)} {path}', flush=True) + if bad: + print('first failures:', bad[:5], flush=True) diff --git a/data/self-interpreter/reasoning_165/reader/spine3_bare.lam b/data/self-interpreter/reasoning_165/reader/spine3_bare.lam new file mode 100644 index 00000000..bd77d8e0 --- /dev/null +++ b/data/self-interpreter/reasoning_165/reader/spine3_bare.lam @@ -0,0 +1,3 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. list (\bit0. bit0 bit0 cont) + (list list list) next) (\bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_165/reader/spine3_repaired.lam b/data/self-interpreter/reasoning_165/reader/spine3_repaired.lam new file mode 100644 index 00000000..53c56cff --- /dev/null +++ b/data/self-interpreter/reasoning_165/reader/spine3_repaired.lam @@ -0,0 +1,4 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. list + (\bit0. bit0 bit0 (\value \rest \unused. cont value rest)) + (list list list) next) (\bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_165/universal/REPORT.md b/data/self-interpreter/reasoning_165/universal/REPORT.md new file mode 100644 index 00000000..0ddde799 --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/REPORT.md @@ -0,0 +1,98 @@ +# Universal-boundary result + +No sub-175 non-strict machine, sub-187 strict machine, or sub-165 self-interpreter found. The concrete result is a 186-bit **non-strict** universal machine that survives all six existing strictness probes but is refuted by a 19-bit open program. There is an exact, size-independent obstruction for the entire environment family that produced it. + +All artifacts are in this directory. Repository files were read only. Every battery used `battery.check(..., threads=2)` and unoptimized compilation. Each full battery took approximately 2.5 seconds. There were no enumeration runs. + +## Complete constructions + +Let P be the 165 with its skip changed from `list list list` to `list list next`; P has 166 bits. K and F denote the BLC zero and one booleans, respectively. + +| File | Bits | Exact battery line | Idea | +|---|---:|---|---| +| `int166_skip_next.lam` | 166 | `166 bits ok=667 skip=1 fail=0 int166_skip_next.lam` | Change an erased skip argument to `next`, preserving all genuine-stream parsing while changing boolean-input behavior. | +| `uni186_skip_next_Kparser.lam` | 186 | `186 bits ok=667 skip=1 fail=0 uni186_skip_next_Kparser.lam` | `(\p. p (\v. v (\b. p))) P`, using K P as the base environment. | +| `uni188_skip_next_parser_parser.lam` | 188 | `188 bits ok=667 skip=1 fail=0 uni188_skip_next_parser_parser.lam` | `(\p. p (\v. v (p p))) P`, using P P as the base environment. | + +Each source has a matching exact `.blc` file. `candidates.log` and `identities.log` contain the observations. Both universal machines are non-strict: on `(free_1 K) F` terminated by F, the 186 returns a finite Scott stream and the 188 returns I. All six existing nil-terminated strictness probes were CAPPED at 2^16 beta for both machines; those caps are not divergence proofs. + +The 185-bit K-parser environment with the unmodified reader is already in the record after translating its 168-based size down by three. The new construction is the coordinated one-bit skip change, which changes all six strictness-filter outcomes. It is not offered as a new successful strict wiring. + +## Correctness of the modified interpreter and both universal machines + +The record proves the identity `s s = K rest`, where rest follows the first zero of a genuine finite bit prefix. Consequently **every** third argument T gives `s s T ->* rest`; T need not terminate. For completeness: + +- If `s = cons K r`, then `s s ->* K r`. +- If `s = cons F r`, then `s s ->* r r`. + +Induction over the leading ones reaches the first case. Replacing the third occurrence of `list` by `next` therefore leaves every parser transition on genuine encoded terms unchanged. Each recursive subterm also has a first zero before the arbitrary tail. The 165's structural parser proof consequently applies unchanged except for this skip reduction. This is a mathematical reduction argument, not a new Lean verification. + +For closed M, P consequently returns `lambda env. M` and the exact tail N, including when M diverges. For any base environment A, + +`P (lambda v. v A) (code(M) ++ N) ->* (lambda env. M) A N -> M N`. + +Take A = K P or A = P P for the two complete machines. This proof does not rely on the finite battery or on M having a normal form. + +## Exact off-protocol identities + +Write a parser reader in the form + +`P_Q c s = s H_c Q(c,s)`, with `H_c = lambda b. b Z_c c`. + +Z and Q may contain the recursive parser, continuation, stream, and other captured terms. The following identity is independent of them: + +`P_Q c K F -> K H_c Q F -> H_c F -> F Z_c c -> c`. + +Thus **P_Q c K F =beta c** for this entire reader family. + +For the skip family `Q(c,s) = s s T`, there is also + +`P_T c F -> F H_c (F F T) -> T[c,s:=F]`. + +In particular: + +- original skip T = s: `P_s c F =beta F`; +- T = next: `P_next c F =beta next_c`; +- T = c: `P_c c F =beta c`; +- T = recursive parser: `P_p c F =beta p`. + +`check_identities.py` verified all eight displayed specializations (the four F-input laws and four K/F laws) by exact beta normal forms with the recursive parser p and continuation c rigid. Substitution stability makes the identities valid when those rigid terms are replaced by the actual recursive parser and continuation. + +## A strictness obstruction at every size + +Consider **any** parser in the reader family above, preserving the ordinary variable and APP representation, with universal boundary + +`U_Q = P_Q (lambda v. v (K P_Q))`. + +Use the open program `M = (free_1 K) F` with arbitrary suffix N. Set + +`R = code(K) ++ code(F) ++ N`, and `r = cons K R`. + +The variable leaf returns exactly r. The two following closed arguments denote K and F, so the parsed closure is beta-equivalent to + +`lambda e. (r e) K F`. + +The universal boundary therefore reduces as follows: + +`U_Q (code(M) ++ N)` +`=beta r (K P_Q) K F N` +`->* P_Q R K F N` +`->* R N`. + +The last step is the preceding K/F identity. Taking N = F makes R F the finite Scott suffix after R's first bit. It has a normal form. A free index was evaluated and applied twice, so this refutes strictness in the required operational sense, not just syntactic rejection of open inputs. + +The exact code of M is `0101100000110000010` (19 bits). The 186's computed normal form has 183 bits and is saved in `strictness_witness.nf.blc`. The entire identity was also checked with N rigid, not merely with N = F. + +This obstruction holds for every Q and every term size within the stated reader and environment family. Changing only the third skip argument cannot repair the K-parser environment. It is not a lower bound for arbitrary machines. + +A second exact obstruction is useful for the original 165. Since `P_s c F = F`, no partially applied parser `P_s a` can be a strict base environment: on open variable 2, with `r = cons F (cons K N)`, + +`r (P_s a) N ->* P_s a F (cons K N) N ->* F (cons K N) N -> N`. + +This holds for every a, even a dependent on the parsed value, because a is erased. It excludes that entire original-reader environment family, not only the six tested examples. + +## Remaining prospects + +The new one-bit change demonstrates that off-protocol behavior can move substantially while the complete parser contract remains fixed. This is a real degree of freedom for universal wirings, but the six existing strict probes can be fooled cheaply. The 19-bit witness above should accompany any candidate using parser-derived environments. + +For a strict improvement along this route, a new design must avoid exposing the parser through K P, or change the handler/read structure enough to break `P c K F = c`. A different skip alone cannot do it. For the non-strict target, these constructions offer no saving: changing an environment that closed values erase cannot by itself remove the output decoder's cost. A coordinated value/control representation or reader/knot fusion remains the live boundary. No global optimality claim follows from this work. diff --git a/data/self-interpreter/reasoning_165/universal/SUMMARY.md b/data/self-interpreter/reasoning_165/universal/SUMMARY.md new file mode 100644 index 00000000..3ff1f13d --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/SUMMARY.md @@ -0,0 +1,67 @@ +(._.) **No sub-175 non-strict machine, sub-187 strict machine, or sub-165 interpreter found.** I constructed a 186-bit universal machine that survives all six strictness probes but is **provably non-strict**, and derived an obstruction covering its entire environment family. + +All artifacts are in the assigned directory; full derivations and reproduction scripts are in [REPORT.md](REPORT.md). + +Let `P` be the 165 with `list list list` replaced by `list list next`. + +| Complete construction | Bits | Battery result | Idea | +|---|---:|---|---| +| `int166_skip_next.lam` | 166 | `ok=667 skip=1 fail=0` | Change the erased skip argument to alter behavior on non-stream inputs. | +| `uni186_skip_next_Kparser.lam` | 186 | `ok=667 skip=1 fail=0` | `(\p. p (\v. v (\b. p))) P`, base environment `K P`. | +| `uni188_skip_next_parser_parser.lam` | 188 | `ok=667 skip=1 fail=0` | `(\p. p (\v. v (p p))) P`, base environment `P P`. | + +Each has a matching `.blc`. Compilation was unoptimized; batteries used two threads and took approximately 2.5 seconds each. No enumeration runs. + +The correctness argument extends beyond the battery. The recorded identity `s s =β K rest` implies `s s T =β rest` for **any** third argument, including divergent `T`. Thus the modified parser has the same genuine-stream transitions. For closed `M`, either universal boundary reduces to + +```text +P (λv. v A) (⌜M⌝ ++ N) →* (λenv. M) A N → M N. +``` + +This includes divergent `M`; it is a reduction proof, not a new Lean verification. + +The useful exact identities concern non-stream inputs. Write the reader as + +```text +P_Q c s = s H_c Q(c,s) +H_c = λb. b Z_c c. +``` + +Then, independently of `Q` and `Z`, + +```text +P_Q c K F → H_c F → c. +``` + +For skips `Q = s s T`, additionally `P_T c F → T[s := F]`. Consequently the original parser gives `P c F = F`, while the modified parser gives `P c F = next_c`. These identities were also checked by exact normalization with the recursive parser and continuation rigid. + +**The strictness obstruction:** every boundary `P_Q (λv. v (K P_Q))` with the ordinary variable and APP representations fails on + +```text +M = (free₁ K) F +⌜M⌝ = 0101100000110000010. +``` + +Put `R = ⌜K⌝ ++ ⌜F⌝ ++ N`. The variable’s returned selector is `r = cons K R`, so + +```text +U_Q (⌜M⌝ ++ N) + =β r (K P_Q) K F N + →* P_Q R K F N + →* R N. +``` + +With `N = F`, this is a finite Scott stream. This refutes strictness **at every size in this family**, regardless of the skip expression. The identity was computationally verified with both rigid `N` and concrete `F`. + +Both new universal machines were capped on all six existing strictness probes at `2¹⁶` β. Nevertheless, this witness makes the 186 halt with a 183-bit normal form and the 188 halt with `I`. + +A second family exclusion follows for the original 165: base environment `P a` cannot be strict for any `a`. Open variable 2 evaluates to + +```text +(cons F (cons K N)) (P a) N + →* P a F (cons K N) N + →* N. +``` + +My read: off-protocol behavior is a real degree of freedom, but modifying the skip alone cannot rescue the `K parser` environment. A strict improvement here must break the exposed identity `P c K F = c` or use a different environment construction. For the non-strict target, I found no saving; coordinated value/control changes or reader/knot fusion remain necessary avenues, without any global optimality claim. + diff --git a/data/self-interpreter/reasoning_165/universal/candidates.log b/data/self-interpreter/reasoning_165/universal/candidates.log new file mode 100644 index 00000000..d2a3defe --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/candidates.log @@ -0,0 +1,16 @@ +186 bits ok=667 skip=1 fail=0 uni186_skip_next_Kparser.lam seconds=2.46 + strict-filter code=10 nf=CAPPED + strict-filter code=110 nf=CAPPED + strict-filter code=00110 nf=CAPPED + strict-filter code=011010 nf=CAPPED + strict-filter code=01101010 nf=CAPPED + strict-filter code=000011110 nf=CAPPED + strict-filter code=0101100000110000010 nf=000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000010 +188 bits ok=667 skip=1 fail=0 uni188_skip_next_parser_parser.lam seconds=2.55 + strict-filter code=10 nf=CAPPED + strict-filter code=110 nf=CAPPED + strict-filter code=00110 nf=CAPPED + strict-filter code=011010 nf=CAPPED + strict-filter code=01101010 nf=CAPPED + strict-filter code=000011110 nf=CAPPED + strict-filter code=0101100000110000010 nf=0010 diff --git a/data/self-interpreter/reasoning_165/universal/check_candidates.py b/data/self-interpreter/reasoning_165/universal/check_candidates.py new file mode 100644 index 00000000..864834dd --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/check_candidates.py @@ -0,0 +1,24 @@ +from pathlib import Path +import os +import sys +import time +HERE = Path(__file__).resolve().parent +sys.path.insert(0, '/Users/a9lim/Work/blam/tools/self-interpreter') +from battery import compile_lam, enc, check, bitlist, normalize, FALSE +from merges import INT165 + +sources = { + 'uni186_skip_next_Kparser': r'(\e.e (\v.v (\b.e))) (' + INT165.replace('(list list list)', '(list list next)') + ')', + 'uni188_skip_next_parser_parser': r'(\e.e (\v.v (e e))) (' + INT165.replace('(list list list)', '(list list next)') + ')', +} +for name, src in sources.items(): + (HERE / (name + '.lam')).write_text(src + '\n') + E = compile_lam(src) + (HERE / (name + '.blc')).write_text(enc(E) + '\n') + t0 = time.monotonic() + ok, skip, bad = check(E, uni=True, max_bits=18, threads=2) + print(f'{len(enc(E))} bits ok={ok} skip={skip} fail={len(bad)} {name}.lam seconds={time.monotonic()-t0:.2f}', flush=True) + for p, v in bad[:5]: print(' ', p, v, flush=True) + for code in ['10','110','00110','011010','01101010','000011110', '0101100000110000010']: + got = normalize(enc(('A', E, bitlist(code,FALSE))), 1 << 16) + print(f' strict-filter code={code} nf={got if got is not None else "CAPPED"}', flush=True) diff --git a/data/self-interpreter/reasoning_165/universal/check_identities.py b/data/self-interpreter/reasoning_165/universal/check_identities.py new file mode 100644 index 00000000..9fb656e4 --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/check_identities.py @@ -0,0 +1,50 @@ +from pathlib import Path +import sys +HERE = Path(__file__).resolve().parent +sys.path.insert(0, '/Users/a9lim/Work/blam/tools/self-interpreter') +from battery import compile_lam, enc, check, bitlist, normalize, FALSE, TRUE +from merges import INT165, body165, READER165, ABS, APP + +K = r'(\x\y.x)' +F = r'(\x\y.y)' +NEXT = rf'(\bit1.intL (\exp.bit1 {ABS} {APP}))' +for dummy, want in [('list', F), ('next', NEXT), ('cont','cont'), ('intL','intL')]: + body = body165(READER165).replace('(list list list)', f'(list list {dummy})') + def normalized(src): + return normalize(enc(compile_lam(src)), 4096) + got = normalized(rf'\intL\cont. ({body}) cont {F}') + expected = normalized(rf'\intL\cont. {want}') + assert got is not None and got == expected + print(f'B_{dummy} p c F = {dummy if dummy != "list" else "F"}: exact beta normal forms agree',flush=True) + got = normalized(rf'\intL\cont. ({body}) cont {K} {F}') + expected = normalized(r'\intL\cont.cont') + assert got is not None and got == expected + print(f'B_{dummy} p c K F = c: exact beta normal forms agree', flush=True) + +src = INT165.replace('(list list list)', '(list list next)') +(HERE/'int166_skip_next.lam').write_text(src+'\n') +P = compile_lam(src) +(HERE/'int166_skip_next.blc').write_text(enc(P)+'\n') +ok,skip,bad = check(P,uni=False,max_bits=18,threads=2) +print(f'{len(enc(P))} bits ok={ok} skip={skip} fail={len(bad)} int166_skip_next.lam',flush=True) + +# M = (free_1 K) F; R is exactly the suffix after that variable's 10 code. +M = ('A', ('A', ('V',0),TRUE),FALSE) +Rbits = enc(TRUE)+enc(FALSE) +print('strictness witness M code='+enc(M),flush=True) +U = compile_lam((HERE/'uni186_skip_next_Kparser.lam').read_text()) +got = normalize(enc(('A',U,bitlist(enc(M),FALSE))), 1<<16) +expected = normalize(enc(('A',bitlist(Rbits,FALSE),FALSE)),1<<16) +assert got is not None and got == expected +print(f'U_186 (code(M) ++ F) = (code(K) ++ code(F) ++ F) F: exact beta normal forms agree; normal-form size={len(got)}',flush=True) +(HERE/'strictness_witness.nf.blc').write_text(got+'\n') + +# The same derivation holds with a rigid suffix, which proves failure is +# not merely a nil-specific coincidence. +from battery import shift +from_lhs = ('L',('A',shift(U,1),bitlist(enc(M),('V',0)))) +from_rhs = ('L',('A',bitlist(Rbits,('V',0)),('V',0))) +lhs = normalize(enc(from_lhs),1<<16) +rhs = normalize(enc(from_rhs),1<<16) +assert lhs is not None and lhs == rhs +print('strictness witness identity also verified with arbitrary rigid N',flush=True) diff --git a/data/self-interpreter/reasoning_165/universal/identities.log b/data/self-interpreter/reasoning_165/universal/identities.log new file mode 100644 index 00000000..7dfa4722 --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/identities.log @@ -0,0 +1,12 @@ +B_list p c F = F: exact beta normal forms agree +B_list p c K F = c: exact beta normal forms agree +B_next p c F = next: exact beta normal forms agree +B_next p c K F = c: exact beta normal forms agree +B_cont p c F = cont: exact beta normal forms agree +B_cont p c K F = c: exact beta normal forms agree +B_intL p c F = intL: exact beta normal forms agree +B_intL p c K F = c: exact beta normal forms agree +166 bits ok=667 skip=1 fail=0 int166_skip_next.lam +strictness witness M code=0101100000110000010 +U_186 (code(M) ++ F) = (code(K) ++ code(F) ++ F) F: exact beta normal forms agree; normal-form size=183 +strictness witness identity also verified with arbitrary rigid N diff --git a/data/self-interpreter/reasoning_165/universal/int166_skip_next.blc b/data/self-interpreter/reasoning_165/universal/int166_skip_next.blc new file mode 100644 index 00000000..215ee83d --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/int166_skip_next.blc @@ -0,0 +1 @@ +0100011010000100000100000101100001011000000110111110111100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_165/universal/int166_skip_next.lam b/data/self-interpreter/reasoning_165/universal/int166_skip_next.lam new file mode 100644 index 00000000..60777d8d --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/int166_skip_next.lam @@ -0,0 +1,3 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list next)) + (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_165/universal/strictness_witness.nf.blc b/data/self-interpreter/reasoning_165/universal/strictness_witness.nf.blc new file mode 100644 index 00000000..63f67461 --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/strictness_witness.nf.blc @@ -0,0 +1 @@ +000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000010 diff --git a/data/self-interpreter/reasoning_165/universal/uni186_skip_next_Kparser.blc b/data/self-interpreter/reasoning_165/universal/uni186_skip_next_Kparser.blc new file mode 100644 index 00000000..011946e7 --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/uni186_skip_next_Kparser.blc @@ -0,0 +1 @@ +010001100001100011100100011010000100000100000101100001011000000110111110111100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_165/universal/uni186_skip_next_Kparser.lam b/data/self-interpreter/reasoning_165/universal/uni186_skip_next_Kparser.lam new file mode 100644 index 00000000..d0e49549 --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/uni186_skip_next_Kparser.lam @@ -0,0 +1,3 @@ +(\e.e (\v.v (\b.e))) ((\x. x x) (\x. (\intL. \cont. + (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list next)) + (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x))) diff --git a/data/self-interpreter/reasoning_165/universal/uni188_skip_next_parser_parser.blc b/data/self-interpreter/reasoning_165/universal/uni188_skip_next_parser_parser.blc new file mode 100644 index 00000000..af1bf9d1 --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/uni188_skip_next_parser_parser.blc @@ -0,0 +1 @@ +01000110000110011101100100011010000100000100000101100001011000000110111110111100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_165/universal/uni188_skip_next_parser_parser.lam b/data/self-interpreter/reasoning_165/universal/uni188_skip_next_parser_parser.lam new file mode 100644 index 00000000..f0620a25 --- /dev/null +++ b/data/self-interpreter/reasoning_165/universal/uni188_skip_next_parser_parser.lam @@ -0,0 +1,3 @@ +(\e.e (\v.v (e e))) ((\x. x x) (\x. (\intL. \cont. + (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list next)) + (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x))) diff --git a/data/self-interpreter/reasoning_165/values/REPORT.txt b/data/self-interpreter/reasoning_165/values/REPORT.txt new file mode 100644 index 00000000..5622b1c3 --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/REPORT.txt @@ -0,0 +1,218 @@ +RESULT: no sub-165 interpreter found. + +All artifacts are in this directory. No repository files were modified. +No enumeration or hole search was run. The two batteries used exactly two +workers, a frozen copy of blam, and unoptimized compilation. Their measured +wall times were 2.787 s and 2.474 s. Small symbolic identity checks used both +the Python beta normalizer and Rust KN; proofs below distinguish these checks +from the all-input arguments. There is no new Lean proof. + +COMPLETE INTERPRETERS BUILT + +193 bits ok=667 skip=1 fail=0 abs_driver.lam + Share the abstraction constructor between ABS and the recursion driver. + This is beta-convertible to the 165; the sharing costs 28 bits overall. + +203 bits ok=667 skip=1 fail=0 tagged_optional.lam + Package an optional second parse as a solvable Scott option. Its value + builder can then dispense with the original tag bit. This validates a + precise escape from the mode-free-builder obstruction, at excessive cost. + +Each .lam has a matching .blc and .battery.txt. Both also pass the divergent +Omega suffix probe E (lambda value rest. rest) ( ++ N) = N with rigid +N. identities.txt records all checks; check.py and identities.py reproduce +them. The 203 is a packing variant of the already-recorded optional-parse +family, not evidence that the known bare optional-parser route was missed. + +NOTATION + +K = lambda x y. x, F = lambda x y. y, I = lambda x. x. +cell(a,e) = lambda b r. b a (r e). +X_1^R = cons K R; X_(n+1)^R = cons F (X_n^R). +Thus X_n^R is precisely the current raw value for variable n. + +1. AN ALL-SIZE OBSTRUCTION TO THE CELL/APP ALIAS + +For every environment term e, n >= 1 and suffix R: + + e (K I) X_n^R =beta e F X_n^R =beta X_(n+1)^R e. + +The first equality is K I =beta F. The second is the definition of cons. +Consequently the proposed lift + + lift_alias f g = lambda e. e f g + +satisfies the exact identity + + lift_alias (K I) X_n^R =beta X_(n+1)^R. + +The final equality is beta equality, not an eta assumption: X_(n+1)^R is +literally lambda h. h F X_n^R, so expanding it establishes the equality. + +If the recursive parser has the public raw-value ABI, its closed I result +must be K I =beta F, for every suffix. Therefore this lift compiles I (var n) +as var (n+1). In particular the two closed source terms + + lambda a b. I b + lambda a b. a + +receive beta-equal body values and therefore beta-equal outputs through any +common ABS constructor of the current interface. Their required outputs are +C (lambda z a b. b) N and C (lambda z a b. a) N, distinct beta normal forms. +Church-Rosser gives a contradiction. + +This removes the size cap on repairing that particular APP alias by changing +only the environment cell. It assumes bare-variable values, canonical closed +values, and the current ABS interface. A new internal parser ABI or a public +decoder can escape those assumptions; it is not an unrestricted lower bound. +The core identity was also checked with rigid e and R by Python and Rust. + +2. THE MODE-FREE BUILDER OBSTRUCTION DOES NOT DEPEND ON MARKER K + +Suppose W must satisfy, for some arbitrary ABS marker q0, + + W f q0 e =beta lambda a. f (cell(a,e)) + W f g e =beta f e (g e) for all raw parsed values g. + +Take f0 = K (K I), the raw closure of lambda x. I, and g = K Omega, the raw +closure of the closed divergent program Omega. Set e = I. The APP equation +requires + + W f0 (K Omega) I =beta I. + +K Omega has no head normal form: its initial lambda does not make it +solvable. By the standard genericity lemma, since the displayed context has +normal form I, replacing that entire unsolvable argument by any q gives the +same normal form I. In particular W f0 q0 I =beta I. But the ABS equation +requires + + W f0 q0 I =beta lambda a. K I = K (K I), + +a different normal form. This contradicts Church-Rosser. The marker can even +depend on f/e: instantiate it after choosing f0 and I. Changing K to I, +another normal marker, or another unsolvable marker does not help. Nor does +merely eta-expanding the divergent raw closure. + +This is a handwritten proof using the standard genericity lemma already +used in the repository record. It is not newly kernel checked. + +The exact escape is to make the discriminated object solvable independently +of its value. Define + + None = K + Some(g) = lambda none some. some g + W f q e = q (lambda a. f (cell(a,e))) + (lambda g. f e (g e)). + +Then W f None e and W f (Some(g)) e have the desired ABS/APP reductions. +Some(K Omega) has head normal form lambda none some. some (K Omega), so the +genericity argument cannot replace it by an arbitrary marker. It does not +have a full normal form; head solvability is the relevant distinction. + +The 203 implements precisely this escape. For b = K its optional parser +lambda k. k b returns None without consuming the stream. For b = F it invokes +the ordinary parser and returns Some(g). The outer value continuation is +lambda q. cont (lambda e. W exp q e). Substituting either tag reduces NEXT +to the original ABS or APP continuation with the same remaining stream. +Both equalities were verified with rigid p, cont and operand parameters in +Python/Rust. Together with the unchanged reader, the usual structural parser +induction proves the contract, including divergent source terms: the parser +never needs to normalize a constructed operand value. + +3. A SUFFIX-INDEPENDENT BOOLEAN / SCOTT-BIT-CELL DISCRIMINATOR + + T = lambda t. t K K K I + +satisfies + + T K =beta K + T F =beta K + T (cons b r) =beta F for b in {K,F}, arbitrary r. + +Proof: the first two applications reduce to K K I = K. For a cell: + + cons b r K K K I + -> K b r K K I + -> b K K I + -> K I + -> F. + +No reduction in r is used. Python/Rust checks include rigid tails and Omega +tails for both bit choices. This is a genuine type separation available on +the promised input domains; it is not a discriminator for arbitrary parsed +closures, which can be unsolvable or equal F. + +bit_or_cell.lam is 37 bits. Sharing K explicitly gives 36 bits: + + (lambda k t. t k k k I) K + +in bit_or_cell_shared.lam. These are helper terms, not self-interpreters. + +A small conditional lower bound explains the cost. In the unshared template +lambda t. t K A B C with closed A,B,C and these exact K/F outputs, the K input +forces B =beta K. The one-cell input headed by F forces B C =beta F, hence +C =beta I. The other equations require A I =beta F and A K I =beta K. Neither +closed term below 7 bits (I or F) meets them, so |A| >= 7; also |B| >= 7 and +|C| >= 4. Including the first K and syntax gives at least 37 bits, achieved +by A=B=K,C=I. The 36-bit shared form deliberately leaves that template. This +is not a lower bound for arbitrary classifiers or for an interpreter reader. + +4. ABS CONSTRUCTOR AS A RECURSION DRIVER + +Let + + A f e a = f (cell(a,e)) + delta = lambda h. h h + B c p = the 165 reader/NEXT body with cont=c, intL=p, + and its ABS value written A exp + H = A (lambda env. env B delta) + E = delta H. + +Then the following is an exact finite beta reduction: + + E c = H H c + -> (lambda env. env B delta) (cell(c,H)) + -> cell(c,H) B delta + -> B c (delta H) + = B c E. + +The check counted seven head beta contractions with B rigid and found the +expected AST exactly. This makes the environment cell supply both the public +continuation and the recursive parser. The same A is used by genuine ABS +nodes, so the helper is shared rather than copied into the driver. + +There is also a direct proof transferring the 165's full contract. Removing +the outer A let from abs_driver.lam leaves delta H. Expanding the finite +generator H and expanding the 165's finite knot generator give identical +beta normal forms. Both Python and Rust checked that equality; the common +bits are in common_generator_nf.blc. By congruence, the two entire closed +interpreters are beta-convertible. This construction adds no new semantics +and is too large at 193 bits. + +WHERE A SUB-165 COULD STILL HIDE + +The cheap APP alias has an all-size collision, not merely a small-cell +failure. A marker substitution cannot rescue a tagless ABS/APP builder. These +two observations make the current raw-value interface an especially narrow +place to seek another local saving. + +A genuinely different internal representation can evade both arguments. +It must retain a visible control head even when its semantic payload is +Omega, or alter which object the operation discriminates. A surrounding +Scott continuation/option has that property. If the same E is recursively +called with its public interface, however, every closed subprogram still +returns K M; an internally tagged representation needs a distinct entry or +a control carrier that the public continuation never receives as its value. + +The concrete remaining prospect is to obtain that carrier from applications +already present in the reader or recursion driver, so packing/decoding is +not paid separately. The boolean/cell identity is a possible ingredient if +its K arguments are already supplied by control flow. Its standalone cost +is far larger than the four-bit APP-lift saving. The 203 shows that allocating +the carrier explicitly does not pay, and the 193 shows that explicitly +sharing the current ABS constructor with the knot does not pay either. + +I have no sub-165 candidate, no unconditional interpreter lower bound, and +no justified new local enumeration to recommend. The surviving direction +is a control/value fusion that supplies a solvable carrier implicitly; +this remains a hypothesis, not a construction. diff --git a/data/self-interpreter/reasoning_165/values/SUMMARY.md b/data/self-interpreter/reasoning_165/values/SUMMARY.md new file mode 100644 index 00000000..821a3996 --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/SUMMARY.md @@ -0,0 +1,104 @@ +(•̀ᴗ•́) **No sub-165 interpreter found.** Full constructions, proofs, and reproduction scripts are in [REPORT.txt](REPORT.txt). + +| Complete interpreter | Exact battery line | Idea | +|---|---|---| +| [abs_driver.lam](abs_driver.lam) | `193 bits ok=667 skip=1 fail=0` | Share the ABS constructor with the recursion driver. | +| [tagged_optional.lam](tagged_optional.lam) | `203 bits ok=667 skip=1 fail=0` | Give the optional second value a solvable Scott wrapper. | + +Both also return the rigid suffix when discarding the interpreted Ω value. Batteries used two workers and took 2.8 and 2.5 seconds. No enumeration or repository modifications. + +**The cell/APP alias has an all-size obstruction.** Write \(K=\lambda xy.x\), \(F=\lambda xy.y\), \(I=\lambda x.x\), and let the current raw variable values be +\[ +X_1^R=\operatorname{cons}K R,\qquad +X_{n+1}^R=\operatorname{cons}F(X_n^R). +\] +For every environment \(e\), +\[ +e(KI)X_n^R =_\beta eF X_n^R =_\beta X_{n+1}^R e. +\] +Consequently the cheap lift +\[ +L(f,g)=\lambda e.e f g +\] +satisfies \(L(KI,X_n^R)=_\beta X_{n+1}^R\). This is β equality: expand the Scott cell; no η assumption is needed. + +Thus it compiles `I (var n)` as `var (n+1)`. In particular, `λa b. I b` and `λa b. a` acquire equal body values and equal outputs through the same ABS constructor, although their required normal forms differ. Church–Rosser gives a contradiction. + +**No cell of any size repairs this alias while preserving bare variable values, canonical closed values, and the current ABS interface.** The symbolic identity was checked with rigid environment and suffix in Python and Rust. A different internal value interface can escape this theorem. + +**Changing the mode-free builder’s marker cannot help.** Suppose, for any chosen marker \(q_0\), +\[ +W f q_0 e =_\beta \lambda a.f(\operatorname{cell}(a,e)),\qquad +W f g e =_\beta f e(g e) +\] +for all raw parsed values \(g\). + +Choose \(f_0=K(KI)\), \(g=K\Omega\), and \(e=I\). APP requires +\[ +W f_0(K\Omega)I =_\beta I. +\] +Since \(K\Omega\) is unsolvable, genericity implies that replacing this entire argument by **any** \(q_0\) preserves normal form \(I\). ABS instead requires \(K(KI)\), a different normal form. Contradiction. + +This extends the recorded argument from marker \(K\) to every marker, including one chosen as a function of \(f,e\). Merely adding leading lambdas to the divergent payload does not escape it. This is a handwritten proof using the standard genericity lemma, without a new Lean check. + +The precise escape is: +\[ +\mathrm{None}=K,\qquad +\mathrm{Some}(g)=\lambda n\,s.s g, +\] +\[ +W f q e = +q\;(\lambda a.f(\operatorname{cell}(a,e))) + \;(\lambda g.f e(g e)). +\] +Both desired equations now follow by β reduction. Crucially, `Some(K Ω)` has a head normal form. + +The 203-bit construction realizes this escape. Its ABS and APP NEXT branches reduce to the original continuations for the respective actual tag bits; these identities were checked with rigid parameters. The unchanged reader and structural parser induction establish correctness even for divergent source terms. Its cost makes this packing repair uncompetitive. + +**A suffix-independent discriminator exists:** +\[ +T=\lambda t.t K K K I. +\] +It satisfies +\[ +TK=_\beta K,\quad TF=_\beta K,\quad +T(\operatorname{cons}b r)=_\beta F +\quad(b\in\{K,F\}). +\] +For the last equation, +\[ +\operatorname{cons}b r\,K K K I +\to K b r K K I +\to b K K I +\to K I +\to F. +\] +The suffix is never evaluated. Python/Rust checks include rigid and divergent suffixes. + +This costs **37 bits**, or **36** with explicit sharing: +```text +(\k \t. t k k k (\x.x)) (\x \y.x) +``` +It distinguishes booleans from Scott **bit** cells, not arbitrary parsed closures. + +There is a small conditional lower bound: in the unshared template `λt.t K A B C` with closed fillers and these exact outputs, the equations force \(B=_\beta K\), \(C=_\beta I\), \(AI=_\beta F\), and \(AKI=_\beta K\). Neither closed term below seven bits, \(I\) or \(F\), works for \(A\). Therefore the template needs at least 37 bits. Sharing leaves that template; this is no general discriminator lower bound. + +**The ABS-driver construction is exactly β-equivalent to the 165.** Define +\[ +A f e a=f(\operatorname{cell}(a,e)),\quad +\delta=\lambda h.hh,\quad +H=A(\lambda e.e B\delta),\quad E=\delta H, +\] +where \(B\,c\,p\) is the parser body using continuation \(c\), parser \(p\), and `A exp` for ABS. Then +\[ +E c +\to (\lambda e.e B\delta)(\operatorname{cell}(c,H)) +\to B c(\delta H) +=B cE. +\] +The environment cell supplies both continuation and recursion. The exact unfolding took seven head β steps in the symbolic check. + +More strongly, after removing the helper let, its finite knot generator and the actual checked-in 165’s generator have identical β-normal forms in both Python and Rust. Congruence transfers the 165’s full contract. The explicit sharing nevertheless adds 28 bits. + +My remaining hypothesis is **a solvable control carrier supplied implicitly by the reader or recursion**, retaining a visible head even when its value is Ω. A distinct internal interface could evade both impossibility arguments. Explicit packing costs too much, and the discriminator is too expensive as a separate helper; some existing Scott applications would need to supply that work. I have no concrete sub-165 realization or justified new local enumeration to recommend. + diff --git a/data/self-interpreter/reasoning_165/values/abs_driver.battery.txt b/data/self-interpreter/reasoning_165/values/abs_driver.battery.txt new file mode 100644 index 00000000..0d0869e2 --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/abs_driver.battery.txt @@ -0,0 +1,2 @@ +193 bits ok=667 skip=1 fail=0 abs_driver.lam +[] diff --git a/data/self-interpreter/reasoning_165/values/abs_driver.blc b/data/self-interpreter/reasoning_165/values/abs_driver.blc new file mode 100644 index 00000000..63ad47d2 --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/abs_driver.blc @@ -0,0 +1 @@ +0100010001101001100001011000000100000101100001011000000110111110111110010110101000011100001011100111110011111110100111100001111110000101111010011101000011010000000011110000001011101110011011110 diff --git a/data/self-interpreter/reasoning_165/values/abs_driver.lam b/data/self-interpreter/reasoning_165/values/abs_driver.lam new file mode 100644 index 00000000..7353c51c --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/abs_driver.lam @@ -0,0 +1,12 @@ +(\abs. + (\h. h h) + (abs (\env. env + (\cont \intL. + (\next \list. + list (\bit0. bit0 (\unused \r. r next) cont) + (list list list)) + (\bit1. intL (\exp. bit1 + (cont (abs exp)) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (\h. h h)))) + (\body \env \arg. body (\b \r. b arg (r env))) diff --git a/data/self-interpreter/reasoning_165/values/bit_or_cell.blc b/data/self-interpreter/reasoning_165/values/bit_or_cell.blc new file mode 100644 index 00000000..3ea84bfb --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/bit_or_cell.blc @@ -0,0 +1 @@ +0001010101100000110000011000001100010 diff --git a/data/self-interpreter/reasoning_165/values/bit_or_cell.lam b/data/self-interpreter/reasoning_165/values/bit_or_cell.lam new file mode 100644 index 00000000..8f072842 --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/bit_or_cell.lam @@ -0,0 +1 @@ +(\t. t (\x \y. x) (\x \y. x) (\x \y. x) (\x. x)) diff --git a/data/self-interpreter/reasoning_165/values/bit_or_cell_shared.blc b/data/self-interpreter/reasoning_165/values/bit_or_cell_shared.blc new file mode 100644 index 00000000..f6adf08e --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/bit_or_cell_shared.blc @@ -0,0 +1 @@ +010000010101011011011011000100000110 diff --git a/data/self-interpreter/reasoning_165/values/bit_or_cell_shared.lam b/data/self-interpreter/reasoning_165/values/bit_or_cell_shared.lam new file mode 100644 index 00000000..6682b1a1 --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/bit_or_cell_shared.lam @@ -0,0 +1 @@ +(\k \t. t k k k (\x. x)) (\x \y. x) diff --git a/data/self-interpreter/reasoning_165/values/check.py b/data/self-interpreter/reasoning_165/values/check.py new file mode 100644 index 00000000..87c07fd6 --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/check.py @@ -0,0 +1,31 @@ +import os +from pathlib import Path +import shutil +import sys +import time + +HERE = Path(__file__).resolve().parent +ROOT = Path('/Users/a9lim/Work/blam') +os.environ['TMPDIR'] = str(HERE) +os.environ['RAYON_NUM_THREADS'] = '2' +sys.path.insert(0, str(ROOT / 'tools/self-interpreter')) +import battery + +binary = HERE / 'blam-frozen' +if not binary.exists(): + shutil.copy2(ROOT / 'target/release/blam', binary) +battery.BLAM = str(binary) + +for name in sys.argv[1:]: + path = HERE / name + term = battery.compile_lam(path.read_text()) + bits = battery.enc(term) + path.with_suffix('.blc').write_text(bits + '\n') + start = time.monotonic() + ok, skip, bad = battery.check(term, threads=2) + line = f'{len(bits)} bits ok={ok} skip={skip} fail={len(bad)} {path.name}' + print(line, flush=True) + print(f'elapsed={time.monotonic()-start:.3f}s', flush=True) + for b, verdict in bad[:5]: + print(b, verdict, flush=True) + path.with_suffix('.battery.txt').write_text(line + '\n' + repr(bad) + '\n') diff --git a/data/self-interpreter/reasoning_165/values/common_generator_nf.blc b/data/self-interpreter/reasoning_165/values/common_generator_nf.blc new file mode 100644 index 00000000..3ae230a7 --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/common_generator_nf.blc @@ -0,0 +1 @@ +000000010110000101100000011000010111111110111111100001011100111111110000001111000000101110111001101111001011111111101111111100001111111110000101111010011101011100101101010 diff --git a/data/self-interpreter/reasoning_165/values/identities.py b/data/self-interpreter/reasoning_165/values/identities.py new file mode 100644 index 00000000..0a0f3054 --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/identities.py @@ -0,0 +1,131 @@ +import os +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent +ROOT = Path('/Users/a9lim/Work/blam') +os.environ['TMPDIR'] = str(HERE) +os.environ['RAYON_NUM_THREADS'] = '2' +sys.path.insert(0, str(ROOT / 'tools/self-interpreter')) +import battery +import lc +battery.BLAM = str(HERE / 'blam-frozen') + +K = r'(\x \y. x)' +F = r'(\x \y. y)' +I = r'(\x. x)' +OMEGA = r'((\x. x x) (\x. x x))' +D = rf'(\t. t {K} {K} {K} {I})' + +def pair(b, r): + return rf'(\h. h {b} {r})' + +cases = [ + ('classify K', f'{D} {K}', K), + ('classify F', f'{D} {F}', K), + ('classify 0-cell, rigid tail', rf'\r. {D} {pair(K,"r")}', rf'\r. {F}'), + ('classify 1-cell, rigid tail', rf'\r. {D} {pair(F,"r")}', rf'\r. {F}'), + ('classify 0-cell, divergent tail', f'{D} {pair(K,OMEGA)}', F), + ('classify 1-cell, divergent tail', f'{D} {pair(F,OMEGA)}', F), + ('APP alias = unary successor', rf'\e \r. e ({K} {I}) {pair(K,"r")}', + rf'\e \r. {pair(F,pair(K,"r"))} e'), +] + +cell = r'(\b \r. b a (r e))' +av = rf'(\a. f {cell})' +bv = r'(\g. f e (g e))' +cases += [ + ('tagged W none', rf'\f \e. {K} {av} {bv}', rf'\f \e. {av}'), + ('tagged W some', rf'\f \g \e. (\none \some. some g) {av} {bv}', + r'\f \g \e. f e (g e)'), +] + +next_tagged = r'''(\b. p (\f. + (b (\k. k b) (\k. p (\g. k (\none \some. some g)))) + (\q. c (\e. q + (\a. f (\u \v. u a (v e))) + (\g. f e (g e))))))''' +cases += [ + ('tagged NEXT, ABS bit', rf'\p \c. {next_tagged} {K}', + r'\p \c. p (\f. c (\e \a. f (\u \v. u a (v e))))'), + ('tagged NEXT, APP bit', rf'\p \c. {next_tagged} {F}', + r'\p \c. p (\f. p (\g. c (\e. f e (g e))))'), +] + +lines = [] +for name, lhs, rhs in cases: + a = battery.compile_lam(lhs) + b = battery.compile_lam(rhs) + py_a = lc.nf(a, [10000]) + py_b = lc.nf(b, [10000]) + rust_a = battery.normalize(battery.enc(a), 10000) + rust_b = battery.normalize(battery.enc(b), 10000) + assert py_a == py_b, name + assert rust_a == rust_b == battery.enc(py_a), name + lines.append(f'PASS Python/Rust: {name}') + +# Check the ABS-assisted knot by head reduction only. Normalizing the +# recursive argument under rigid B would ask for an infinite normal form. +A = r'(\body \env \arg. body (\b \r. b arg (r env)))' +delta = r'(\h. h h)' +h = rf'({A} (\env. env B {delta}))' +e = rf'({delta} {h})' +unfold = battery.compile_lam(rf'\B \c. {e} c')[1][1] +want = battery.compile_lam(rf'\B \c. B c {e}')[1][1] + +def head(term): + stack = [] + count = 0 + while True: + if term[0] == 'A': + stack.append(term[2]) + term = term[1] + elif term[0] == 'L' and stack: + term = lc.beta(term, stack.pop()) + count += 1 + assert count < 100 + else: + break + while stack: + term = ('A', term, stack.pop()) + return term, count + +got, steps = head(unfold) +assert got == want +lines.append(f'PASS exact AST, {steps} head beta steps: E c -> B c E') + +# The 193-bit candidate is actually beta-convertible to the 165. Remove +# its outer helper let, then compare the two finite knot generators. +source193 = battery.compile_lam((HERE / 'abs_driver.lam').read_text()) +source165 = battery.compile_lam((ROOT / 'data/self-interpreter/machines/int165.lam').read_text()) +unlet193 = lc.beta(source193[1], source193[2]) +assert unlet193[0] == source165[0] == 'A' +assert unlet193[1] == source165[1] +nf193 = lc.nf(unlet193[2], [10000]) +nf165 = lc.nf(source165[2], [10000]) +assert nf193 == nf165 +assert battery.normalize(battery.enc(unlet193[2]), 10000) == battery.enc(nf165) +assert battery.normalize(battery.enc(source165[2]), 10000) == battery.enc(nf165) +(HERE / 'common_generator_nf.blc').write_text(battery.enc(nf165) + '\n') +lines.append('PASS Python/Rust: 193 and 165 knot generators have identical beta normal forms') +term = battery.compile_lam(D) +lines.append(f'Boolean/Scott-cell classifier: {len(battery.enc(term))} bits unoptimized') +(HERE / 'bit_or_cell.lam').write_text(D + '\n') +(HERE / 'bit_or_cell.blc').write_text(battery.enc(term) + '\n') +shared_D = rf'(\k \t. t k k k {I}) {K}' +shared_term = battery.compile_lam(shared_D) +assert lc.nf(shared_term, [1000]) == term +lines.append(f'Shared-K classifier: {len(battery.enc(shared_term))} bits unoptimized') +(HERE / 'bit_or_cell_shared.lam').write_text(shared_D + '\n') +(HERE / 'bit_or_cell_shared.blc').write_text(battery.enc(shared_term) + '\n') + +omega = battery.compile_lam(OMEGA) +for name in ['abs_driver', 'tagged_optional']: + program = battery.compile_lam((HERE / f'{name}.lam').read_text()) + probe = ('L', ('A', ('A', battery.shift(program, 1), battery.FALSE), + battery.bitlist(battery.enc(omega), ('V', 0)))) + got = battery.normalize(battery.enc(probe), 100000) + assert got == battery.enc(battery.compile_lam(I)), name + lines.append(f'PASS Rust: {name} discards divergent value and returns rigid suffix') +(HERE / 'identities.txt').write_text('\n'.join(lines) + '\n') +print('\n'.join(lines)) diff --git a/data/self-interpreter/reasoning_165/values/identities.txt b/data/self-interpreter/reasoning_165/values/identities.txt new file mode 100644 index 00000000..92ac696e --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/identities.txt @@ -0,0 +1,17 @@ +PASS Python/Rust: classify K +PASS Python/Rust: classify F +PASS Python/Rust: classify 0-cell, rigid tail +PASS Python/Rust: classify 1-cell, rigid tail +PASS Python/Rust: classify 0-cell, divergent tail +PASS Python/Rust: classify 1-cell, divergent tail +PASS Python/Rust: APP alias = unary successor +PASS Python/Rust: tagged W none +PASS Python/Rust: tagged W some +PASS Python/Rust: tagged NEXT, ABS bit +PASS Python/Rust: tagged NEXT, APP bit +PASS exact AST, 7 head beta steps: E c -> B c E +PASS Python/Rust: 193 and 165 knot generators have identical beta normal forms +Boolean/Scott-cell classifier: 37 bits unoptimized +Shared-K classifier: 36 bits unoptimized +PASS Rust: abs_driver discards divergent value and returns rigid suffix +PASS Rust: tagged_optional discards divergent value and returns rigid suffix diff --git a/data/self-interpreter/reasoning_165/values/tagged_optional.battery.txt b/data/self-interpreter/reasoning_165/values/tagged_optional.battery.txt new file mode 100644 index 00000000..46df4c40 --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/tagged_optional.battery.txt @@ -0,0 +1,2 @@ +203 bits ok=667 skip=1 fail=0 tagged_optional.lam +[] diff --git a/data/self-interpreter/reasoning_165/values/tagged_optional.blc b/data/self-interpreter/reasoning_165/values/tagged_optional.blc new file mode 100644 index 00000000..f87fae03 --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/tagged_optional.blc @@ -0,0 +1 @@ +01000110100001000001000001011000010110000001101111101111001011010100001111000010101110000110111000011111100001110000001101110000111110000101110000111110000001011101110011011110000101111101100110110011010 diff --git a/data/self-interpreter/reasoning_165/values/tagged_optional.lam b/data/self-interpreter/reasoning_165/values/tagged_optional.lam new file mode 100644 index 00000000..aa5bbeea --- /dev/null +++ b/data/self-interpreter/reasoning_165/values/tagged_optional.lam @@ -0,0 +1,12 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) + (list list list)) + (\bit1. intL (\exp. + (bit1 + (\k. k bit1) + (\k. intL (\exp2. k (\none \some. some exp2)))) + (\option. cont (\args. option + (\arg. exp (\zx \zy. zx arg (zy args))) + (\exp2. exp args (exp2 args))))))) + (x x)) diff --git a/docs/STATUS.md b/docs/STATUS.md index 5124cdde..c6ef5105 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -159,7 +159,12 @@ with all features (three opt-in tests ignored) and 328 with default features. every interpreter has head normal form `λc s. c A B` or `λc s. s A⃗` and a duplicated binder, and a β-normal correct interpreter exists, so no knot is forced; a proof at 165 bits needs a decomposition theorem that does not yet - exist. + exist. Within the 165's own reader shape (`s H S`, handler `λb r⃗. b A B`) + Codex proved the 165 minimal, with the zero arm ≥ 14 and the APP lift ≥ 19 + bits, and excluded reader/handler knot trees and the cell/APP alias at every + size (§5, handwritten proofs with checks in + `data/self-interpreter/reasoning_165/`); its seventeen correct + constructions measure 166 to 234, and a 158 and a 167 fail (`merges.py`). - **The universal machine** (`classical/self-interpreter/universal.md`): Tromp's wirings around the 165's body give 175 (non-strict) and 187 (strict), against 178 and 190 around the 168's. Wirings around the new body @@ -169,8 +174,11 @@ with all features (three opt-in tests ignored) and 328 with default features. 2,375,084 capped contexts. Joint U-specific searches around the old body screened 2,207,444,203 assignments below 178 with no survivor and 1,462,818 caps (`data/self-interpreter/universal.json`). The partially applied parser - is no longer a universal continuation with the 165's reader. Unsearched: the - strict contexts of 39..43 bits around either body. + is no longer a universal continuation with the 165's reader. The strict + filter has seven probes: Codex's `1 K F` shows that 186- and 188-bit + machines around the 165 passing the first six are not strict, and excludes + parser-applying base environments at every size. Unsearched: the strict + contexts of 39..43 bits around either body. ### AIT golf @@ -242,8 +250,9 @@ GHC 9.10.3; `uni.rs` with rustc), all three harnesses in 11 minutes: and build prefix-tree conditional predictions under `m` and `S`. Infinite streams belong to the separate monotone-machine `ref/AIT` lane. 9. **The self-interpreter below 165** (`classical/self-interpreter/interpreter.md` - §7): readers not of the `list H S` shape, knots entangled with the reader, - and the capped fills of the reader searches. Look for another shared + §7): readers outside the shape bounded in §5, the reader's own diagonal + `R Z →* next next` as the knot's generator, and the capped fills of the + reader searches. Look for another shared computation of the kind the reader is, by reasoning first; an unconditional lower bound needs a decomposition theorem. Upstreaming the 165, 175 and 187 to tromp/AIT is a9's call (`contrib/PR_KIT.md`). diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index d73e410c..ba5ded7f 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -118,6 +118,19 @@ Dropping it through `bit0`, which is `K` in that arm, costs one bit more `C`, and re-dispatching it through `H` runs into the uniform-handler impossibility of §5. +**Identities of the reader** (Codex). Write `R = \s. s H (s s s)` for the +reader with `next` and `cont` fixed, `H = \b. b Z cont` and `Z = \u r. r next`. +Off genuine streams the reader still computes: `R K = H`, `R F = F`, +`R I = \r. r next`, and `R (K a) = a (a (K a))`, so a constant stream is a +return instruction, `R (K (K X)) = X`. It also diagonalizes its own zero arm: +`R Z →* next next`, and in general `R Z_t →* t t` for `Z_t = \u r. r t` +whatever `next` and `cont` are, while `H R →* next next cont`. On streams, +`s (\x. x x)` is a conditional predecessor (`K` after a 0, the tail after a +1), two cells cross-apply as `cons b r (cons d t) = b d t r`, and unary codes +`U_k(N) = 1^k 0 ++ N` satisfy `U_{i+1}(N) U_{j+1}(M) = U_j(M) U_i(N)`. Proofs +and rigid-variable checks are in `data/self-interpreter/reasoning_165/` +(`fresh/`, `knot/`, `algebra/`, `reader/`). + ### The NEXT region From `next` inward the 165 is the 168, at the same binder stack @@ -317,6 +330,34 @@ semantic slots. A proof at this size therefore needs a decomposition theorem — a way to localize the interpreter's roles in separately priced subterms — and the 165 shows that the natural decomposition is false. +### Bounds within the 165's reader shape + +These are Codex's handwritten proofs, with targeted reduction checks in +`data/self-interpreter/reasoning_165/bounds/` (`proof_check.py`); none is in +Lean. + +- **The reader.** In the frame `[s, next, cont, intL, x]`, take readers + `s H S` where `S` satisfies the stop-at-first-zero law and + `H = λb r1 … rm. b A B` with arbitrary `A`, `B` (redexes and further uses + of `b` allowed) and no common arguments after `b A B`, satisfying + `H K R R = R next` and `H F R T = cont R T` for rigid neighbours. The + cheapest handler costs 27, 33 or 40 bits with 0, 1 or 2 tails bound before + the dispatch; three or more leave an outer λ. The skip costs at least 10 and + the two applications with `s` 6, so the reader costs at least 43, and with + the other 122 bits unchanged the minimum is the 165. The class does not + cover other reader heads, arguments shared across the dispatch, or use of + the correlation between a variable's selector and its suffix. +- **The zero arm costs at least 14 bits**, even with `bit0 := K` and the whole + zero cell available to borrow. With `R` absent and the neighbours rigid, + `Z R R = R next` forces the normal form `λu v. u next` (15) or + `λu v. v next` (14), and every term below 14 that uses the known tag or cell + fails. So reusing the duplicated zero cell cannot buy the missing bit while + `next` and the recursion stay rigid. +- **The APP lift costs at least 19 bits** under `V E = f E (g E)` with + independent rigid variables, with no syntax restriction: its unique normal + form costs 19, and a non-normal representative needs two λs, three + applications and one index bit for `f`. + ### Exclusions at every size - **One handler for both tag bits is impossible.** Using `H c` for the first @@ -333,25 +374,57 @@ the 165 shows that the natural decomposition is false. `b`, take `R = ⌜I⌝ ++ N` and `S = ⌜I⌝ ++ R`: the ABS program `λx.I` with tail `R` and the APP program `I I` with tail `N` reach the same payload `H0`, ABS forces `H0 = K (K I)`, and APP then returns `I` instead of `C (K I) N`. -- **A mode-free ABS/APP value builder is impossible:** a `W` with - `W f K e = λa. f (cell a e)` and `W f g e = f e (g e)` for every value `g` - meets `f = K (K I)`, `g = K Ω`: APP requires `I`, ABS `K (K I)`, and the - genericity lemma forbids telling the unsolvable `K Ω` apart from `K`. +- **A mode-free ABS/APP value builder is impossible, whatever its marker:** a + `W` with `W f q0 e = λa. f (cell a e)` and `W f g e = f e (g e)` for every + value `g` meets `f = K (K I)`, `g = K Ω`, `e = I`: APP requires `I`, ABS + `K (K I)`, and by the genericity lemma the unsolvable `K Ω` can be replaced + by any `q0`, even one chosen from `f` and `e` (Codex). Giving the optional + value a solvable wrapper, `None = K` and `Some g = λn s. s g`, escapes it, at + 203 bits (§6). +- **The cell/APP alias fails with every cell.** With raw variable values + `X1 = cons K R`, `X(n+1) = cons F Xn`, every environment satisfies + `e (K I) Xn = Xn+1 e`, so the lift `λe. e f g` compiles `I (var n)` as + `var (n+1)`, and `λa b. I b` and `λa b. a` collide. No cell of any size + repairs this while bare variable values, canonical closed values and the ABS + interface stay as they are (Codex). - **A destructured rest cannot reach the root:** a protocol whose continuations receive the rest as `k v b r` needs an adapter at the root, because the contract's final rest is the rigid `N`, which no term destructures; without one it fails every program. -- **Handler-only knots stay `C`-headed:** `H H → C next C`, and every - application tree of two or more copies of the 165's handler reduces to a - `C`-headed term, so replicating the handler alone cannot make an internal - parser while `C` is public and rigid. +- **Reader and handler knots stay `C`-headed:** `H H → C next C`, and every + application tree with at least two leaves drawn from the 165's handlers and + readers `H_Ci`, `R_Ci` (rigid continuations `Ci`) head-reduces to some `Ci` + with at least two arguments; trees of readers alone get at least four + (`R R →* C n C (C n C H) (R R R)`). So no such tree is a parser while the + continuation is public and rigid (Codex). Bare `next`, new λs and + transformed streams are outside this. +- **A full parser cannot be the zero arm's carrier:** for any + `P = λc s. s H_c (s s s)`, `P P P` reproduces itself at the head with more + arguments and has no head normal form, and `R_i P` reduces to it. The + current `next` diagonal cannot replace `E C` either: `next next` on quoted + `I` leaves five arguments at the rigid `C`. (Codex.) +- **Readers of the bare-`cont` shape have outer arity one:** any + `λs. s (λb. b Z C) A1 … Ak` returns `C r A1 … Ak` on a variable, so `k = 1` + whatever the zero arm; and no application-only body over `s`, `next`, `C` + (no λ, `next` opaque) is a reader at any size. (Codex.) +- **No continuation adapter makes the 165 accept a thunked stream:** + `R_C (K a) = a (a (K a))` whatever `C` is, so `E (A C) (K s)` never mentions + `C`. The input path itself has to change. (Codex.) +- **The fields NEXT can recompute from `q = cons bit1 rest` lose + information.** `q P`, `q q` and `q K` drop the variable index `n` of the + next operand (`λa b. b b` and `λa b. a b` meet the same fields); `q P` + together with the raw tail `q F` can still lose the tag (with the periodic + suffix `R → 10:R`, `λx y z. y` and `λx y. x y` agree on both); and using `q` + as the first parse's continuation makes `P q t` head-divergent on Ω, which + the contract forbids. Likewise a selected parse result `r P = bit value rest` + plus any iterate of the skip loses the first operand's index. (Codex.) ## 6. Protocol changes A protocol change alters what an operation passes or expects, so it leaves the βη class and every search of §4. Over a hundred have been built and measured against the 168; none goes below it, and those confined to NEXT keep their -size change on the 165 (§2). +size change on the 165 (§2). Nineteen more, built on the 165, close the section. ### Operation merges @@ -387,7 +460,7 @@ Unless marked, each passes the battery and is larger than the 168. | Indices parsed into Scott selectors by `intL` | 222 | zero/successor parsing and accessors | | Absolute de Bruijn levels | 449 | depth state and runtime append | | Values that also return their code suffix | 273 | cell 24 → 36, APP value 19 → 52 | -| Cell/APP alias: APP's value `\args. args exp exp2`, since `cell a e (K M) (K P) = M P` | 164, *fails* | fails 577 programs: at the root the environment is the contract's arbitrary `z`, and inside an environment `λz.I` equals the input bit `1`; no cell up to 27 bits repairs it | +| Cell/APP alias: APP's value `\args. args exp exp2`, since `cell a e (K M) (K P) = M P` | 164, *fails* | fails 577 programs: at the root the environment is the contract's arbitrary `z`, and inside an environment `λz.I` equals the input bit `1`; no cell of any size repairs it (§5) | | **Control and calling convention** | | | | `next` inside `\list` | 170 | +2 of depth | | Parser takes the stream first | 201–208 | recursive calls lose η over the stream | @@ -404,6 +477,30 @@ Unless marked, each passes the battery and is larger than the 168. | A cell holding F performs the knot: `cell(a,e) cell(a,e) = λk. a a (k e e)` | 199 | the continuation receives two extra arguments | | Both recursive call heads replaced, with the knot removed | — | 221,930,567 pairs (34 free bits): no survivor | +### Variants of the 165 + +Codex's constructions, each written from a derivation rather than found by +search; sources and proofs are in `data/self-interpreter/reasoning_165/`, and +`merges.py` re-measures every one. Each passes the battery unless marked. + +| idea | bits | note | +|---|---:|---| +| Skip `list list next` | 166 | the erased argument changes only off-stream behaviour | +| Arity switch `s (s K)` dispatching constructor against variable | 167, *fails* | the variable arm returns `λc. I` on `I` | +| Balanced skip `(s s) (s s)` | 169 | `s s = K N`, so both forms reduce to `N` | +| `Δ = λx. x x` shared between the knot and `s s` | 176 | the let costs 11 | +| Zero arm replaced by its bit, `next` as a third outer argument | 158, *fails* | variables return `C r N next`, three arguments at `C` | +| The same, with the variable arm discarding the extra argument | 178 | the 165's reader equations in both arms | +| Duplicate tail discarded after the second cell elimination | 181 | | +| Tag replayed after the first parse, `bit0`'s `K` discarding `bit1` | 188 / 189 / 199 | the redundant tag costs more than the hoist saves | +| Constant stream as ABS's return instruction, `R (K (K X)) = X` | 191 / 207 | capturing the real remainder | +| Reader-carried knot `W = λx. x I x Z_x`: the only self-application is the skip's | 192 | +27 for the carrier; `R Z_t → t t` drives it | +| ABS constructor shared with the recursion driver | 193 | β-equivalent to the 165; the sharing costs 28 | +| Reader diagonal `Q g g (λu r. r g)` as the outer knot | 199 | reconstructs `G G`; the helper costs 34 | +| Optional second value in a solvable wrapper | 203 | the escape from the mode-free builder exclusion | +| Root shortcut with continuation-last NEXT | 214 | every closed program starts with 0 | +| Reparse the component that `r intL` discards | 225 / 234 | the selected-component obstruction (§5) forces a second parse | + ## 7. Boundaries The 165 is pinned locally from every direction searched: its let structure, βη @@ -416,11 +513,16 @@ argument. Open: -- readers under the current `next` protocol that are not of the `list H S` - shape, and readers with a different `next` protocol beyond the handful - priced in §3; -- knots entangled with the 165's reader (the stream's own `list list list`, the - handler diagonal `H H → C next C`); +- readers outside the shape bounded in §5: other reader heads, arguments + shared across the dispatch, the correlation between a variable's selector + and its suffix, and readers with a different `next` protocol beyond those + priced in §3 and §6; +- the reader's diagonal `R Z →* next next` (§2): the 165 already contains the + self-application a knot needs, and a sub-165 along this line would have + `next`'s zero arm serve as the knot's generator. Built with a separate + carrier it works at 192 and 199 bits; making `next` do both while keeping + its Boolean cases is unsolved, and the exclusions of §5 rule out the + current `next` and parser doing it unchanged; - the capped fills of §3 (4,052,176 in the joint reader search, 7,790 in the handler, 218 in whole APP) and of §4; - an unconditional lower bound beyond small sizes: §5 states the structure @@ -431,8 +533,9 @@ Open: | instrument | what it runs | |---|---| -| `tools/self-interpreter/battery.py` | the exact contract on 668 programs (`--max-bits`, `--uni`) | -| `tools/self-interpreter/merges.py` | the 165, its nearest variants, and the 168's protocol variants | +| `tools/self-interpreter/battery.py` | the exact contract on 668 programs (`--max-bits`, `--uni`, `--strict`) | +| `tools/self-interpreter/merges.py` | the 165, its nearest variants, the 168's protocol variants, and the variants of §6 | +| `data/self-interpreter/reasoning_165/` | the proofs and checks behind §2's identities, §5's shape bounds and exclusions, and §6's variants | | `blam golf letopt`, `blam golf component` (lab) | let structure and βη component (`--contextual`) | | `blam selfint hole` (lab), `tools/self-interpreter/sketches.py` | one- and two-hole searches, including the 165's reader slots | | `blam selfint ctx` (lab) | contextual slot searches in the 168 | diff --git a/docs/classical/self-interpreter/universal.md b/docs/classical/self-interpreter/universal.md index b3fa2b48..b1eb0460 100644 --- a/docs/classical/self-interpreter/universal.md +++ b/docs/classical/self-interpreter/universal.md @@ -72,8 +72,11 @@ They are why "no machine of this shape below 178" is conditional on these 3,961 diverging. **Strict.** `--strict` adds Tromp's convention: no normal form within 2¹⁶ β -on six open programs that use their free variable (`1`, `2`, `\2`, `1 1`, -`1 1` followed by the data bits `10`, and `\\4`), each terminated by `nil`. +on seven open programs that use their free variable (`1`, `2`, `\2`, `1 1`, +`1 1` followed by the data bits `10`, `\\4`, and `1 (\\2) (\\1)`), each +terminated by `nil`. The seventh is Codex's (below); the searches of this +section ran with the first six, and a further probe only removes survivors, so +their exclusions stand. `battery.py --uni --strict` runs the same seven. The tail must be concrete. With a symbolic tail, `intL (intL intL)` at 182 bits passes: its base environment is the parser's own dispatch handler, so a free variable re-parses the leftover input, and @@ -93,18 +96,31 @@ cheap alternatives (`dbl`, `F`, the parser's own handler) all return values or re-read input; Ω via a shared `dbl` (`\b. b (a a)`, 12 bits over the 178) is the cheapest found. An environment with no normal form can still fail strictness after object-level application: free indices alone diverge, but -`1 1` normalizes. Head divergence avoids that trap, and the 190 passes all six +`1 1` normalizes. Head divergence avoids that trap, and the 190 passes all seven nil-terminated probes. Logs: `wiring_uni.log`, `wiring_uni_strict.log`. -The six probes are a filter, not a proof of strictness: a machine whose base +The probes are a filter, not a proof of strictness: a machine whose base environment has no normal form can still return garbage on an open program whose nil tail discharges the apparent recursion. The 187 and the 190 owe their strictness to their base environment Ω, supplied by the top continuation `λv. v Ω`: a free index looks itself up in Ω and diverges at the head. The probes only corroborate it. +The seventh probe exists because the first six were not enough. Codex built +two machines around the 165 with the skip `list list next`: +`(\e. e (\v. v (\b. e))) P` at 186 bits (base environment `K P`) and +`(\e. e (\v. v (e e))) P` at 188 (base environment `P P`). Both meet the +contract and are capped on all six probes, but on `M = 1 K F` the variable +returns the selector `cons K R` with `R = ⌜K⌝ ++ ⌜F⌝ ++ N`, so +`U (⌜M⌝ ++ N) →* P R K F N →* R N`, a finite stream when `N` is nil. The 186 +halts with a 183-bit normal form, the 188 with `I`. The argument uses only the +ordinary variable and APP values, so no skip expression makes a base +environment `K P_Q` strict, and for the 165's own parser no base environment +`P a` is strict either (open `2` reduces to `N`). Proofs and checks are in +`data/self-interpreter/reasoning_165/universal/`. + ## 2. βη and let structure `letopt` detects knots anywhere and lets identical subterms, knot heads @@ -261,7 +277,8 @@ Open: - the 282 capped fills in the arbitrary-context-around-`G` family, and the capped assignments of §4; - the 51,873 unexcluded caps among the wirings around the 165's body, and the - strict wirings around it beyond Tromp's; + strict wirings around it beyond Tromp's and the parser-applying base + environments excluded in §1; - a coordinated representation that exploits reachable relationships between control and values. The experiments above narrow several specific implementations of that idea; they do not prove 175 minimal. diff --git a/src/cli/selfint/wiring.rs b/src/cli/selfint/wiring.rs index 8565f34e..a166df1a 100644 --- a/src/cli/selfint/wiring.rs +++ b/src/cli/selfint/wiring.rs @@ -388,19 +388,29 @@ fn setup(n_programs: usize, strict: bool) -> Setup { // Open programs whose free variable is applied or returned, terminated // by nil (Tromp's KS convention): a strict machine has no normal form on // them. A symbolic tail is not enough: a machine that re-parses leftover - // input on a free variable gets stuck on it and only looks strict. + // input on a free variable gets stuck on it and only looks strict. The + // last, `1 (\\2) (\\1)`, is Codex's witness against base environments + // that apply the parser; battery.py --strict runs the same seven. let open_probes: Vec = if strict { - ["10", "110", "00110", "011010", "01101010", "000011110"] - .iter() - .map(|m| { - let mut p = Probe::new_uni(m); - p.head = vec![false, true]; // U S, no outer binder - let n = p.tail.len(); - p.tail.truncate(n - (2 + m.len())); // drop the rigid tail variable - super::ctx::push_bits(&mut p.tail, "000010"); // nil - p - }) - .collect() + [ + "10", + "110", + "00110", + "011010", + "01101010", + "000011110", + "0101100000110000010", + ] + .iter() + .map(|m| { + let mut p = Probe::new_uni(m); + p.head = vec![false, true]; // U S, no outer binder + let n = p.tail.len(); + p.tail.truncate(n - (2 + m.len())); // drop the rigid tail variable + super::ctx::push_bits(&mut p.tail, "000010"); // nil + p + }) + .collect() } else { Vec::new() }; diff --git a/tools/self-interpreter/battery.py b/tools/self-interpreter/battery.py index 6af330cd..72790a76 100644 --- a/tools/self-interpreter/battery.py +++ b/tools/self-interpreter/battery.py @@ -12,8 +12,13 @@ agreement on a marker. Programs: every closed term of 4..MAXBITS bits plus a few deep-index extras. - battery.py FILE.lam... [--uni] [--int4] [--max-bits N] - battery.py --bits BITS [--uni] [--int4] [--max-bits N] + battery.py FILE.lam... [--uni [--strict]] [--int4] [--max-bits N] + battery.py --bits BITS [--uni [--strict]] [--int4] [--max-bits N] + +--strict (universal machines) also runs Tromp's strict filter: U applied to +each open program in STRICT, terminated by nil, must have no normal form +within 2^16 beta. Like `blam selfint wiring --strict`, it is a filter, not a +proof of strictness. --int4 encodes the programs in int4.lam's four-primitive code (00 lambda, 01 application, 10 variable zero, 11 successor) instead of BLC. @@ -47,6 +52,13 @@ "\\1 (\\\\\\\\\\\\6) (\\\\2 3)", ] +# Open programs whose free variable is used: `1`, `2`, `\2`, `1 1`, `1 1` +# followed by the data bits 10, `\\4`, and `1 (\\2) (\\1)`. The last is +# Codex's witness against machines whose base environment applies the parser: +# they pass the other six and still halt on it. +STRICT = ["10", "110", "00110", "011010", "01101010", "000011110", + "0101100000110000010"] + def enc(t): return blcc.encode(t) @@ -140,6 +152,14 @@ def check(E, uni=False, max_bits=18, threads=10, code=enc): return sum(r == "ok" for r in res), sum(r == "skip" for r in res), bad +def strict_halts(E, threads=7): + """The STRICT programs on which universal machine E halts within 2^16 beta.""" + def halts(c): + return normalize(enc(("A", E, bitlist(c, FALSE))), 1 << 16) is not None + with ThreadPoolExecutor(threads) as ex: + return [c for c, h in zip(STRICT, ex.map(halts, STRICT)) if h] + + def main(): args = sys.argv[1:] uni = "--uni" in args @@ -149,7 +169,8 @@ def main(): i = args.index("--max-bits") max_bits = int(args[i + 1]) del args[i:i + 2] - targets = [a for a in args if a not in ("--uni", "--int4")] + strict = "--strict" in args + targets = [a for a in args if a not in ("--uni", "--int4", "--strict")] if targets and targets[0] == "--bits": from lc import decode targets = [("bits", decode(b, 0)[0]) for b in targets[1:]] @@ -160,6 +181,10 @@ def main(): print(f"{len(enc(E)):5d} bits ok={ok} skip={skip} fail={len(bad)} {path}") for b in bad[:5]: print(" ", *b) + if strict: + halts = strict_halts(E) + print(" strict filter:", + "halts on " + " ".join(halts) if halts else "no normal form on all") if __name__ == "__main__": diff --git a/tools/self-interpreter/merges.py b/tools/self-interpreter/merges.py index 142a2500..1a049452 100644 --- a/tools/self-interpreter/merges.py +++ b/tools/self-interpreter/merges.py @@ -14,6 +14,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parent)) from battery import check, compile_lam, enc +FLEET = Path(__file__).resolve().parents[2] / "data/self-interpreter/reasoning_165" ABS = r"(cont (\args\arg.exp (\zx\zy. zx arg (zy args))))" APP = r"(intL (\exp2.cont (\args.exp args (exp2 args))))" VAR = r"(cont list1 (list1 list1 list1))" @@ -139,6 +140,35 @@ def int165(reader): False, 177, True), ] +# interpreter.md §6 and universal.md §3: complete constructions from Codex's +# reasoning consults on the 165 (data/self-interpreter/reasoning_165/). +# (file, universal-machine contract?, expected bits, should pass) +FLEET_VARIANTS = [ + ("universal/int166_skip_next.lam", False, 166, True), + ("algebra/balanced_skip.lam", False, 169, True), + ("algebra/shared_delta.lam", False, 176, True), + ("algebra/arity_switch_failed.lam", False, 167, False), + ("reader/spine3_bare.lam", False, 158, False), + ("reader/spine3_repaired.lam", False, 178, True), + ("fresh/late_zero_discard.lam", False, 181, True), + ("fresh/return_stream.lam", False, 191, True), + ("fresh/return_stream_shared_cont.lam", False, 207, True), + ("fresh/reader_diagonal_knot.lam", False, 199, True), + ("knot/reader_knot.lam", False, 192, True), + ("knot/root_next.lam", False, 214, True), + ("nextfuse/tag_after_parse_hoisted.lam", False, 188, True), + ("nextfuse/tag_after_parse.lam", False, 189, True), + ("nextfuse/tag_after_parse_handler.lam", False, 199, True), + ("values/abs_driver.lam", False, 193, True), + ("values/tagged_optional.lam", False, 203, True), + ("protocol/reparse_selected.lam", False, 225, True), + ("protocol/reparse_shared.lam", False, 234, True), + ("universal/uni186_skip_next_Kparser.lam", True, 186, True), + ("universal/uni188_skip_next_parser_parser.lam", True, 188, True), +] +VARIANTS += [(f"fleet: {f}", (FLEET / f).read_text(), uni, want, ok) + for f, uni, want, ok in FLEET_VARIANTS] + def main(): max_bits = int(sys.argv[sys.argv.index("--max-bits") + 1]) \ From 056ad0e2f0d90f71c7f4701983847d687c4d6386 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 12:01:50 -0400 Subject: [PATCH 07/41] Drop the CLAUDE.md shim: Claude Code reads AGENTS.md directly --- CLAUDE.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 43c994c2..00000000 --- a/CLAUDE.md +++ /dev/null @@ -1 +0,0 @@ -@AGENTS.md From 6e820291fce614235c01fe25eb68ef69166691fa Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 13:32:33 -0400 Subject: [PATCH 08/41] Prove self-interpreter structure and add checked normal witnesses Kernel-check the sharp two-nonlinear-binder bound, live-capture necessity, and quotation-origin invariants. Add a 204-bit normal interpreter and exact sharpness constructions; extend the parametric handler and protocol arguments while keeping unrestricted 165-bit optimality open. --- .../machines/int204_normal.blc | 1 + .../machines/int204_normal.lam | 1 + .../machines/int584_two_nonlinear.blc | 1 + .../machines/int584_two_nonlinear.lam | 2 + .../machines/int672_typed_normal.blc | 1 + .../machines/int672_typed_normal.lam | 1 + .../machines/int742_two_nonlinear_normal.blc | 1 + .../machines/int742_two_nonlinear_normal.lam | 2 + .../machines/int_skip_continuation.blc | 1 + .../machines/int_skip_continuation.lam | 13 + .../machines/int_skip_generator.blc | 1 + .../machines/int_skip_generator.lam | 13 + .../machines/int_skip_next.blc | 1 + .../machines/int_skip_next.lam | 13 + .../machines/int_skip_parser.blc | 1 + .../machines/int_skip_parser.lam | 13 + data/self-interpreter/theory/erased_skip.json | 70 ++ data/self-interpreter/theory/normal204.json | 19 + .../theory/two_nonlinear.json | 27 + .../theory/two_nonlinear_normal.json | 43 + .../self-interpreter/theory/typed_normal.json | 15 + docs/STATUS.md | 80 +- .../self-interpreter/handler-bound.md | 205 +++++ .../classical/self-interpreter/interpreter.md | 100 ++- docs/classical/self-interpreter/normal.md | 124 +++ .../self-interpreter/protocol-obstructions.md | 361 ++++++++ .../self-interpreter/structural-bounds.md | 162 ++++ .../self-interpreter/two-nonlinear.md | 101 +++ .../self-interpreter/typed-normal.md | 106 +++ lean/Blc.lean | 5 + lean/Blc/SelfintCapture.lean | 265 ++++++ lean/Blc/SelfintLowerBound.lean | 402 +++++++++ lean/Blc/SelfintNormal.lean | 285 +++++++ lean/Blc/SelfintOrigins.lean | 786 ++++++++++++++++++ lean/Blc/SelfintSharp.lean | 210 +++++ tools/self-interpreter/theory/affine_basis.py | 307 +++++++ tools/self-interpreter/theory/erased_skip.py | 122 +++ .../self-interpreter/theory/handler_bound.py | 70 ++ tools/self-interpreter/theory/normal204.py | 65 ++ tools/self-interpreter/theory/typed_normal.py | 182 ++++ 40 files changed, 4123 insertions(+), 55 deletions(-) create mode 100644 data/self-interpreter/machines/int204_normal.blc create mode 100644 data/self-interpreter/machines/int204_normal.lam create mode 100644 data/self-interpreter/machines/int584_two_nonlinear.blc create mode 100644 data/self-interpreter/machines/int584_two_nonlinear.lam create mode 100644 data/self-interpreter/machines/int672_typed_normal.blc create mode 100644 data/self-interpreter/machines/int672_typed_normal.lam create mode 100644 data/self-interpreter/machines/int742_two_nonlinear_normal.blc create mode 100644 data/self-interpreter/machines/int742_two_nonlinear_normal.lam create mode 100644 data/self-interpreter/machines/int_skip_continuation.blc create mode 100644 data/self-interpreter/machines/int_skip_continuation.lam create mode 100644 data/self-interpreter/machines/int_skip_generator.blc create mode 100644 data/self-interpreter/machines/int_skip_generator.lam create mode 100644 data/self-interpreter/machines/int_skip_next.blc create mode 100644 data/self-interpreter/machines/int_skip_next.lam create mode 100644 data/self-interpreter/machines/int_skip_parser.blc create mode 100644 data/self-interpreter/machines/int_skip_parser.lam create mode 100644 data/self-interpreter/theory/erased_skip.json create mode 100644 data/self-interpreter/theory/normal204.json create mode 100644 data/self-interpreter/theory/two_nonlinear.json create mode 100644 data/self-interpreter/theory/two_nonlinear_normal.json create mode 100644 data/self-interpreter/theory/typed_normal.json create mode 100644 docs/classical/self-interpreter/handler-bound.md create mode 100644 docs/classical/self-interpreter/normal.md create mode 100644 docs/classical/self-interpreter/protocol-obstructions.md create mode 100644 docs/classical/self-interpreter/structural-bounds.md create mode 100644 docs/classical/self-interpreter/two-nonlinear.md create mode 100644 docs/classical/self-interpreter/typed-normal.md create mode 100644 lean/Blc/SelfintCapture.lean create mode 100644 lean/Blc/SelfintLowerBound.lean create mode 100644 lean/Blc/SelfintNormal.lean create mode 100644 lean/Blc/SelfintOrigins.lean create mode 100644 lean/Blc/SelfintSharp.lean create mode 100644 tools/self-interpreter/theory/affine_basis.py create mode 100644 tools/self-interpreter/theory/erased_skip.py create mode 100644 tools/self-interpreter/theory/handler_bound.py create mode 100644 tools/self-interpreter/theory/normal204.py create mode 100644 tools/self-interpreter/theory/typed_normal.py diff --git a/data/self-interpreter/machines/int204_normal.blc b/data/self-interpreter/machines/int204_normal.blc new file mode 100644 index 00000000..11186522 --- /dev/null +++ b/data/self-interpreter/machines/int204_normal.blc @@ -0,0 +1 @@ +000001010101100001011000000110101000000001011000010101100000000110000111110000101110011111111100000011110000001011101110011011110011111100001111111111000010111101001110100011110011111011110010110101011010 diff --git a/data/self-interpreter/machines/int204_normal.lam b/data/self-interpreter/machines/int204_normal.lam new file mode 100644 index 00000000..4048846d --- /dev/null +++ b/data/self-interpreter/machines/int204_normal.lam @@ -0,0 +1 @@ +\a\b.b (\c.c (\d\e.e e) c) (\d\e\f.f (\g.g (\h\i\j.j (\k.h (\l.k (e (\m\n.l (\o\p.o n (p m)))) (h (\m.e (\n.l n (m n))))))) (\h.e) (d d)) (f f f)) a b diff --git a/data/self-interpreter/machines/int584_two_nonlinear.blc b/data/self-interpreter/machines/int584_two_nonlinear.blc new file mode 100644 index 00000000..bae3b4fe --- /dev/null +++ b/data/self-interpreter/machines/int584_two_nonlinear.blc @@ -0,0 +1 @@ +01000101000001111000010110001111011000000111010010000011110000101100011110110000001010000011111100001011000111101100000010000011111111000010110001111011000010000011111111100001011000111101100000010001000001111111111110000101100011110110000100000111111111111100001011000111101100001000001111111111111100001011000111101100000010111110000101100000011011111111011111111100101111011010000111111100100000111111111111000010110001111011000000101111001111110000001111100000010111011100110111100111111110000111111001000001111111111111110000101100011110110000001011111011001111010011101000011010 diff --git a/data/self-interpreter/machines/int584_two_nonlinear.lam b/data/self-interpreter/machines/int584_two_nonlinear.lam new file mode 100644 index 00000000..51a7129d --- /dev/null +++ b/data/self-interpreter/machines/int584_two_nonlinear.lam @@ -0,0 +1,2 @@ +-- A direct affine translation of int165 with exactly two nonlinear binders. +((\v1. (((\v22. (\v3. (v1 (\v23. ((v23 (\v24. v22)) v3))))) (\v20. (\v21. (v20 v21)))) ((\v67. (\v4. (v1 (\v68. ((v68 (\v69. v67)) v4))))) (\v65. (\v66. (((\v62. (\v5. (v1 (\v63. ((v63 (\v64. v62)) v5))))) (\v60. (\v61. ((\v52. (\v6. (v1 (\v53. ((v53 (\v54. v52)) v6))))) (\v50. ((\v57. (\v51. (v1 (\v58. ((v58 (\v59. v57)) v51))))) (\v55. (\v56. ((\v7. ((\v27. (\v8. (v1 (\v28. ((v28 (\v29. v27)) v8))))) (\v25. ((\v32. (\v26. (v1 (\v33. ((v33 (\v34. v32)) v26))))) (\v30. ((\v37. (\v31. (v1 (\v38. ((v38 (\v39. v37)) v31))))) (\v35. (\v36. ((v25 (\v9. ((v9 (\v10. (\v11. (v11 v7)))) v50))) ((v30 v35) v36)))))))))) (\v12. (v60 ((\v47. (\v13. (v1 (\v48. ((v48 (\v49. v47)) v13))))) (\v45. (\v46. ((v12 (v55 (\v14. (\v15. (v45 (\v16. (\v17. ((v16 v15) (v17 v14))))))))) (v61 (\v18. (v56 ((\v42. (\v19. (v1 (\v43. ((v43 (\v44. v42)) v19))))) (\v40. (\v41. ((v46 v40) (v18 v41))))))))))))))))))))))) (v65 v66))))))) (\v2. (v2 v2))) diff --git a/data/self-interpreter/machines/int672_typed_normal.blc b/data/self-interpreter/machines/int672_typed_normal.blc new file mode 100644 index 00000000..a8b427cd --- /dev/null +++ b/data/self-interpreter/machines/int672_typed_normal.blc @@ -0,0 +1 @@ +000001100000010101110000101100010001010000001011100101110010111001100001011110101001100001011110011100001111000010111111001111100001111110000101111111100101111111101001111111000010111111111001011111111101001111111100001111111110000101111111111101011111011110010111111110010111111110101010011111000010111111101110011111100001011111111001011111111011001011111111011100111111100001111111100001011111111110111001111111110000111111111100001011111111111100101111111111110110111001011111111111101011110010111111110111100111111100001011111111101111001111111100001011111111110010111111111101110100101111111111011010010111101010111111001100001011110010111101001110000111100011011110 diff --git a/data/self-interpreter/machines/int672_typed_normal.lam b/data/self-interpreter/machines/int672_typed_normal.lam new file mode 100644 index 00000000..8701b72e --- /dev/null +++ b/data/self-interpreter/machines/int672_typed_normal.lam @@ -0,0 +1 @@ +(\x0. (\x1. (x1 (\x2. (\x3. (((x2 (\x4. ((x4 (\x5. x5)) (\x6. x6)))) x3) (\x7. (\x8. ((x7 ((x7 ((x7 (x8 (\x9. ((x7 x9) x9)))) (x8 (\x10. ((x7 (x8 (\x11. (x8 (\x12. ((x7 (x8 (\x13. (x8 (\x14. ((x7 ((x7 x14) (x8 (\x15. ((x7 ((x7 x15) (x8 (\x16. (x8 (\x17. ((x7 x17) x13))))))) x12))))) ((x7 ((x7 x14) x14)) x14))))))) (x8 (\x18. ((x7 x11) (x8 (\x19. ((x7 ((x7 x18) ((x7 x12) (x8 (\x20. (x8 (\x21. ((x7 x19) (x8 (\x22. (x8 (\x23. ((x7 ((x7 x22) x21)) ((x7 x23) x20)))))))))))))) ((x7 x11) (x8 (\x24. ((x7 x12) (x8 (\x25. ((x7 ((x7 x19) x25)) ((x7 x24) x25)))))))))))))))))))) ((x7 x10) x10)))))) x0)) (x8 (\x26. ((x7 ((x7 x26) (x8 (\x27. (x8 (\x28. x27)))))) x3)))))))))))) diff --git a/data/self-interpreter/machines/int742_two_nonlinear_normal.blc b/data/self-interpreter/machines/int742_two_nonlinear_normal.blc new file mode 100644 index 00000000..403af38d --- /dev/null +++ b/data/self-interpreter/machines/int742_two_nonlinear_normal.blc @@ -0,0 +1 @@ +0000011000000101010101110000110000101100000000111010000111100001011000000001111111100001011000000000011111111111110000101100000000111111111111111110000101100000000001111111111111111111111000010110000000011111111111111111111111111000010110000000011111111111111111111111111111100001011000000001011111111111000010110000001100001111111111111111111111111111100001111111111111111111111111111111111111110000101100000000101111111001111111111111111111111111000000111110000001011101110011011110011111111111111111111111111111111100001111111111111111111111111000011111111111111111111111111111111111111111111100001011000000001011111111011001111111010110110111111111111111111110010111111101101011011011011011001111011011000100001101011110000101100000110110 diff --git a/data/self-interpreter/machines/int742_two_nonlinear_normal.lam b/data/self-interpreter/machines/int742_two_nonlinear_normal.lam new file mode 100644 index 00000000..7825e64f --- /dev/null +++ b/data/self-interpreter/machines/int742_two_nonlinear_normal.lam @@ -0,0 +1,2 @@ +-- A beta-normal self-interpreter with exactly two closed nonlinear lambda subterms. +(\v71. (\v72. (v72 (\v73. (\v74. (((((v73 (\v70. (v70 (\v78. ((v78 (\v79. (\v80. (\v81. (v80 v81))))) (\v82. (v70 (\v83. ((v83 (\v84. (\v85. (\v86. (v70 (\v87. ((v87 (\v88. (\v89. (\v90. (\v91. (v70 (\v92. ((v92 (\v93. (\v94. (\v95. (v70 (\v96. ((v96 (\v97. (\v98. (\v99. (\v100. (v70 (\v101. ((v101 (\v102. (\v103. (\v104. (v70 (\v105. ((v105 (\v106. (\v107. (\v108. (v70 (\v109. ((v109 (\v110. (\v111. (\v112. ((v103 (\v113. ((v113 (\v114. (\v115. (v115 (\v116. (v89 (\v117. (v70 (\v118. ((v118 (\v119. (\v120. (\v121. ((v116 (v98 (\v122. (\v123. (v120 (\v124. (\v125. ((v124 v123) (v125 v122))))))))) (v90 (\v126. (v99 (\v127. (v70 (\v128. ((v128 (\v129. (\v130. (\v131. ((v121 v130) (v126 v131)))))) v127)))))))))))) v117)))))))))) v94))) ((v107 v111) v112)))))) v108))))))) v104))))))) v100)))))))) v95))))))) v91)))))))) (v85 v86)))))))) v82))))))))) (\v76. v76)) (\v76. (v76 v76))) v71) (\v75. ((v75 (\v76. (\v77. v76))) v74)))))))) diff --git a/data/self-interpreter/machines/int_skip_continuation.blc b/data/self-interpreter/machines/int_skip_continuation.blc new file mode 100644 index 00000000..288af519 --- /dev/null +++ b/data/self-interpreter/machines/int_skip_continuation.blc @@ -0,0 +1 @@ +01000110100001000001000001011000010110000001101111101111001011010111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/machines/int_skip_continuation.lam b/data/self-interpreter/machines/int_skip_continuation.lam new file mode 100644 index 00000000..732cfb4b --- /dev/null +++ b/data/self-interpreter/machines/int_skip_continuation.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list cont)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/machines/int_skip_generator.blc b/data/self-interpreter/machines/int_skip_generator.blc new file mode 100644 index 00000000..4c413772 --- /dev/null +++ b/data/self-interpreter/machines/int_skip_generator.blc @@ -0,0 +1 @@ +0100011010000100000100000101100001011000000110111110111100101101011111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/machines/int_skip_generator.lam b/data/self-interpreter/machines/int_skip_generator.lam new file mode 100644 index 00000000..53a027a3 --- /dev/null +++ b/data/self-interpreter/machines/int_skip_generator.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list x)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/machines/int_skip_next.blc b/data/self-interpreter/machines/int_skip_next.blc new file mode 100644 index 00000000..215ee83d --- /dev/null +++ b/data/self-interpreter/machines/int_skip_next.blc @@ -0,0 +1 @@ +0100011010000100000100000101100001011000000110111110111100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/machines/int_skip_next.lam b/data/self-interpreter/machines/int_skip_next.lam new file mode 100644 index 00000000..675a9c69 --- /dev/null +++ b/data/self-interpreter/machines/int_skip_next.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list next)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/machines/int_skip_parser.blc b/data/self-interpreter/machines/int_skip_parser.blc new file mode 100644 index 00000000..790afac0 --- /dev/null +++ b/data/self-interpreter/machines/int_skip_parser.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100000011011111011110010110101111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/machines/int_skip_parser.lam b/data/self-interpreter/machines/int_skip_parser.lam new file mode 100644 index 00000000..89bd94e6 --- /dev/null +++ b/data/self-interpreter/machines/int_skip_parser.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list intL)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/theory/erased_skip.json b/data/self-interpreter/theory/erased_skip.json new file mode 100644 index 00000000..e17f2177 --- /dev/null +++ b/data/self-interpreter/theory/erased_skip.json @@ -0,0 +1,70 @@ +{ + "equations": [ + { + "name": "R_a F = a", + "equal_normal_form_bits": 8 + }, + { + "name": "R_a Z_t = a t t", + "equal_normal_form_bits": 19 + }, + { + "name": "R_a K = H", + "equal_normal_form_bits": 33 + }, + { + "name": "R_a I = a Z_q c", + "equal_normal_form_bits": 29 + }, + { + "name": "skip-erasure on a leading zero", + "equal_normal_form_bits": 7 + }, + { + "name": "skip-erasure through two leading ones", + "equal_normal_form_bits": 7 + } + ], + "variants": [ + { + "variant": "next", + "bits": 166, + "battery": { + "ok": 667, + "skipped": 1, + "failures": [] + } + }, + { + "variant": "continuation", + "bits": 167, + "off_domain": "E C F -> C", + "battery": { + "ok": 667, + "skipped": 1, + "failures": [] + } + }, + { + "variant": "parser", + "bits": 168, + "off_domain": "E C F -> E (paper); checked on I", + "battery": { + "ok": 667, + "skipped": 1, + "failures": [] + } + }, + { + "variant": "generator", + "bits": 169, + "battery": { + "ok": 667, + "skipped": 1, + "failures": [] + } + } + ], + "elapsed_seconds": 7.039, + "search_performed": false +} diff --git a/data/self-interpreter/theory/normal204.json b/data/self-interpreter/theory/normal204.json new file mode 100644 index 00000000..75299460 --- /dev/null +++ b/data/self-interpreter/theory/normal204.json @@ -0,0 +1,19 @@ +{ + "bits": 204, + "L_A_X": [ + 21, + 29, + 44 + ], + "beta_normal": true, + "battery": { + "ok": 667, + "skipped": 1, + "failures": 0 + }, + "suffix_probes": { + "omega": "exact rigid tail", + "lambda_omega": "exact rigid tail" + }, + "seconds": 1.9093 +} diff --git a/data/self-interpreter/theory/two_nonlinear.json b/data/self-interpreter/theory/two_nonlinear.json new file mode 100644 index 00000000..00d7da24 --- /dev/null +++ b/data/self-interpreter/theory/two_nonlinear.json @@ -0,0 +1,27 @@ +{ + "bits": 584, + "nonlinear": [ + { + "path": [ + 1 + ], + "uses": 10, + "captures": [] + }, + { + "path": [ + 2 + ], + "uses": 2, + "captures": [] + } + ], + "administrative_beta_steps": 71, + "reduces_to": "literal int165", + "battery": { + "ok": 667, + "skipped": 1, + "failures": 0 + }, + "seconds": 1.7848 +} diff --git a/data/self-interpreter/theory/two_nonlinear_normal.json b/data/self-interpreter/theory/two_nonlinear_normal.json new file mode 100644 index 00000000..7c342b19 --- /dev/null +++ b/data/self-interpreter/theory/two_nonlinear_normal.json @@ -0,0 +1,43 @@ +{ + "bits": 742, + "beta_normal": true, + "nonlinear": [ + { + "path": [ + 0, + 0, + 2, + 0, + 0, + 1, + 1, + 1, + 1, + 2 + ], + "uses": 10, + "captures": [] + }, + { + "path": [ + 0, + 0, + 2, + 0, + 0, + 1, + 1, + 2 + ], + "uses": 2, + "captures": [] + } + ], + "affine_normalization_steps": 13, + "battery": { + "ok": 667, + "skipped": 1, + "failures": 0 + }, + "seconds": 1.8064 +} diff --git a/data/self-interpreter/theory/typed_normal.json b/data/self-interpreter/theory/typed_normal.json new file mode 100644 index 00000000..d6ca8cbb --- /dev/null +++ b/data/self-interpreter/theory/typed_normal.json @@ -0,0 +1,15 @@ +{ + "bits": 672, + "beta_normal": true, + "simply_typable": true, + "principal_type": "(a0 -> (((((((a1 -> a1) -> ((a2 -> a2) -> a3)) -> a3) -> (a0 -> (((a0 -> (a0 -> a0)) -> (((a0 -> a0) -> a0) -> a0)) -> a4))) -> (a0 -> a4)) -> a5) -> a5))", + "two_cast_witness_type": "((a0 -> (a0 -> a1)) -> (((a0 -> a1) -> a0) -> a1))", + "search_performed": false, + "battery": { + "ok": 667, + "skipped": 1, + "failures": [] + }, + "divergent_source_suffix": true, + "elapsed_seconds": 1.761 +} diff --git a/docs/STATUS.md b/docs/STATUS.md index c6ef5105..e814f925 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -5,7 +5,7 @@ boundaries, and ordered next work. `README.md` is the public map, the domain documents under `docs/` state durable contracts and research records, and canonical outputs live in `data/`. Superseded state lives in Git history. -Last updated: 2026-10-17. +Last updated: 2026-10-20. ## Classical @@ -132,7 +132,7 @@ two seeds. `lake build Certs BusyBeaver` checks all 415 exclusions, the eight halting certificates, and their wire identities; `lake build` also checks the -self-interpreter proofs (`Blc/Selfint165.lean`, `Blc/SelfintProof.lean`). The +self-interpreter proofs and structural theorems (`Blc/Selfint*.lean`). The Lean development has no sorries or mathlib, and its axioms are `propext` and `Quot.sound`. `scripts/bb-regen.sh` audits the BB registry's axioms, refreshes the @@ -148,23 +148,62 @@ with all features (three opt-in tests ignored) and 328 with default features. stream, where it is right for both dispatch arms, and lets the Scott list hand `list1` to the variable arm, which becomes `cont` itself (L 17, A 25, X 29). Lean proves it, and the 168, correct for every closed program as a - β-reduction (`selfint_contract165`, `selfint_contract`). Nothing below 165 - in its neighbourhood: let structure to three cuts (unique minimum), βη - component to +20 (2,183,051 terms) and contextual to +16, every reader slot + β-reduction (`selfint_contract165`, `selfint_contract`). No verified + sub-165 has been found in the tested neighbourhoods: let structure to + three cuts (unique minimum), βη component to +20 (2,183,051 terms) and + contextual to +16, every reader slot singly and handler × skip jointly through 164-bit interpreters (32,366,372 pairs, no survivor, 4,052,176 capped), whole APP ≤ 34 bits, and the 168's near misses rebuilt on it (≥ 166; `merges.py`). The 168's module bound (minima summing to 168) is conditional on opaque modules, the clause the 165 - breaks; it still bounds the NEXT region the two share. Unconditionally, - every interpreter has head normal form `λc s. c A B` or `λc s. s A⃗` and a - duplicated binder, and a β-normal correct interpreter exists, so no knot is - forced; a proof at 165 bits needs a decomposition theorem that does not yet - exist. Within the 165's own reader shape (`s H S`, handler `λb r⃗. b A B`) - Codex proved the 165 minimal, with the zero arm ≥ 14 and the APP lift ≥ 19 - bits, and excluded reader/handler knot trees and the cell/APP alias at every - size (§5, handwritten proofs with checks in - `data/self-interpreter/reasoning_165/`); its seventeen correct - constructions measure 166 to 234, and a 158 and a 167 fail (`merges.py`). + breaks; it still bounds the NEXT region the two share. The handwritten + reader bound now permits arbitrary handlers: independent rigid laws force + `|H| ≥ 27`, so `s H S` still costs at least 43 and the unchanged surrounding + interpreter at least 165 (`classical/self-interpreter/handler-bound.md`). + Actual stream/selector/suffix correlations remain outside that theorem. + The zero arm ≥ 14, APP lift ≥ 19, reader/handler knot-tree and cell/APP + exclusions remain as specified in §5. +- **Unconditional structure** (`classical/self-interpreter/structural-bounds.md`): + Lean proves that every interpreter has at least two syntactically + nonlinear binders, and that an explicit `λc s.B` needs two inside `B`. + The normalization argument gives the small numerical floor 18, not a + 165-bit bound. A 584-bit witness has exactly two nonlinear binders, both + closed in isolation; a kernel-replayed 71-step reduction reaches the + literal 165. A 742-bit β-normal witness also has exactly two closed + nonlinear binders, with its contract kernel-checked as β-joinability. + Thus the minimum count two is attained even among β-normal interpreters. + Every interpreter must also contain a live abstraction capturing an + enclosing local variable. + A colored reduction theorem proves that quotation-origin binders remain + affine, retain one of three protected head shapes, and cannot acquire a + live capture; live quotation bodies stay normal and contain only + quotation-origin abstractions. These results do not yet give an additive + size decomposition. +- **Normal and typed witnesses** (`classical/self-interpreter/normal.md`, + `typed-normal.md`): the β-normal interpreter is 204 bits + (`int204_normal`, L 21, A 29, X 44). Lean proves its exact wire, + normality, and directed contract for every closed source and arbitrary + continuation and suffix. A separate 672-bit construction is both + β-normal and simply typable, with a general handwritten reduction proof; + application to its quotation need not be simply typable. The 204, 584, + 672, 742, and four erased-skip variants each pass the existing bounded + battery (667 pass, one divergent expected result skipped, zero failures). + Targeted divergent-source suffix checks also pass. Sources are in + `data/self-interpreter/machines/`, reports in + `data/self-interpreter/theory/`, and reproducible checks in + `tools/self-interpreter/theory/`. No candidate enumeration is part of + these checks. The integrated Lean build passes, with the main theorem + axioms limited to `propext` and `Quot.sound`; the five focused Python + checks took 14.4 seconds together. +- **Protocol constraints** (`classical/self-interpreter/protocol-obstructions.md`): + the erased skip operand can return the continuation, parser, or generator + off the input domain, producing correct 167-, 168-, and 169-bit variants. + The unchanged NEXT diagonal fails for every skip function under its + handler protocol. Root transparency and context independence already + force canonical closed internal values, sharpening the cell/APP collision. + A representation that erases β distinctions cannot have an exact decoder + using only that representation; closed two-sided β-inverse coercions are + necessarily identities. These are protocol-specific handwritten proofs. - **The universal machine** (`classical/self-interpreter/universal.md`): Tromp's wirings around the 165's body give 175 (non-strict) and 187 (strict), against 178 and 190 around the 168's. Wirings around the new body @@ -250,11 +289,12 @@ GHC 9.10.3; `uni.rs` with rustc), all three harnesses in 11 minutes: and build prefix-tree conditional predictions under `m` and `S`. Infinite streams belong to the separate monotone-machine `ref/AIT` lane. 9. **The self-interpreter below 165** (`classical/self-interpreter/interpreter.md` - §7): readers outside the shape bounded in §5, the reader's own diagonal - `R Z →* next next` as the knot's generator, and the capped fills of the - reader searches. Look for another shared - computation of the kind the reader is, by reasoning first; an unconditional - lower bound needs a decomposition theorem. Upstreaming the 165, 175 and 187 + §7): correlated readers outside the independent rigid laws, a changed + NEXT protocol that can use the reader's diagonal, and the capped fills of + the reader searches. Look for another shared computation of the kind the + reader is, by reasoning first. The two-nonlinear count is sharp even + though the current witness is large; a stronger lower bound must price + connections, captures, and protected quotation origins. Upstreaming the 165, 175 and 187 to tromp/AIT is a9's call (`contrib/PR_KIT.md`). 10. **`blam uni` throughput:** within 4× of `uni.c` on byte streams. The next lever is allocation: a slab with index-based reference counts (or the diff --git a/docs/classical/self-interpreter/handler-bound.md b/docs/classical/self-interpreter/handler-bound.md new file mode 100644 index 00000000..b38ee5c7 --- /dev/null +++ b/docs/classical/self-interpreter/handler-bound.md @@ -0,0 +1,205 @@ +# An unrestricted parametric handler bound + +This is Codex's handwritten proof, independently reviewed by two subagents. +It is not a global 165-bit optimality theorem. It removes the syntactic restriction on the +handler in the existing reader bound while retaining the independent, +rigid-neighbour laws. In particular it does not identify a variable selector +with the stream that contains its remainder. + +## Statement + +The ambient de Bruijn frame, innermost first, is `[s,j,c,p,x]`. Let `H` +be any lambda term in that frame. Put `K = λa b.a`, `F = λa b.b`. +For fresh independent rigid variables `R,T`, suppose + +``` +H K R R =β R j, +H F R T =β c R T. +``` + +Then `|H| ≥ 27`. The term + +``` +λb. b (λu v. v j) c +``` + +attains 27. No head shape, normality, restriction on repeated tests, or +absence of common post-dispatch arguments is assumed. + +Consequently a reader `s H S` with these handler laws and an independent +stop-at-first-zero skip law still costs at least `6 + 27 + 10 = 43` +bits. Keeping the other 122 bits of the 165 unchanged gives a 165-bit +minimum for this larger, still parametric reader class. + +## Elementary constraints + +Write `L,A,X` for abstraction count, application count, and sum of zero-based +indices, so `|H| = 2L + 4A + 2 + X`. A binary application/unary abstraction +tree has `A+1` variable leaves. Both `j` and `c` must occur freely in `H`, +since reduction cannot create a missing rigid variable. Hence `X ≥ 1+2=3`. + +The first argument must matter: the two displayed laws have different rigid +heads after the same second and third arguments are supplied. In particular +some surviving abstraction must bind the first argument non-vacuously. + +The head normal form of `H` must be + +``` +λb r1 ... rm. b A1 ... Ak, 0 ≤ m ≤ 2, k ≥ 2. +``` + +Indeed a fixed ambient rigid head cannot change between the laws; a tail +binder would give head `R` or `T` on the `F` branch, rather than `c`. +More than three leading lambdas leave a lambda in the result. With fewer +than two internal arguments to `b`, `F` selects one of the externally +supplied rigid tails, never the required `c`-headed expression. + +The use of head normal forms here is semantic, not a size assumption. +The argument below treats compression by beta redexes separately. + +### A single explicit abstraction cannot suffice + +If a term with at most one explicit abstraction has a leading lambda in +head normal form, that lambda was never consumed: there is no second +abstraction for a head reduction to expose or duplicate. Thus the term +already has the shape `λb.B`, with `B` application-only. + +Substituting `K` for `b` leaves an application tree over `K` and rigid +ambient variables. The only reductions are `K U V → U`. They preserve +left-to-right order of all surviving rigid leaves. In + +``` +B[b:=K] R R +``` + +every occurrence of `j` precedes the fresh `R` occurrences, whereas the +required normal form `R j` has an `R` before `j`. This is impossible. +The same argument permits additional vacuous lambdas: their contractions +only erase leaves, and unused lambdas left at the head also fail the law. + +Therefore every handler has `L ≥ 2`. + +## Excluding at most three applications + +First, a handler with at most two applications is impossible. Its at most +three leaves are already needed for `j`, `c`, and an occurrence of the +first-argument binder. There is no non-vacuous tail binder and no repeated +binder. All internal beta contractions are affine and decrease application +count. In normal form the forced two-argument Boolean dispatch spends both +available applications. The `F` branch can be `c` with its two external +arguments, but its `K` branch is a leaf, with only vacuous lambdas around it; +it cannot send `j` to the fresh `R`. + +Now let `A=3`, so there are four leaves. If an internal beta reduction +duplicates its argument, its binder uses at least two leaves. Together +with `j,c`, this consumes all four: every other abstraction is vacuous. +Once that duplicating binder is contracted, no non-vacuous abstraction +remains to receive the future first argument. The handler laws therefore +exclude such a head reduction. An affine internal head reduction leaves +at most two applications, already excluded. The same applies to a redex +in a branch: an affine contraction leaves at most two applications; a +nonlinear one has used up every non-vacuous binder occurrence. Thus a +successful four-leaf handler is beta-normal. + +Classify its forced head form. A Boolean head with three internal +arguments spends all three applications, so each of its arguments is a +chain of lambdas ending in one variable. Such a chain only selects or +discards supplied arguments; it cannot construct an application. +In the `K` branch the selected first chain receives the common third +chain, followed by `2-m` external copies of `R`. To yield `R j`, `j` +must be the common argument left after a previously bound `R` becomes +head. No external `R` may follow that `j`, so this forces `m=2`. +(For `m=0`, every `j` precedes the fresh `R` leaves and selection cannot +reverse them. For `m=1`, a bound `R` can precede `j`, but then the final +external `R` remains; selecting or discarding that final argument also +consumes or discards the earlier `j`.) +When `m=2`, however, the `F` branch is only its selected second chain +applied to the common third chain. It has at most two rigid variable +leaves; substitution of affine `F` and reduction of these chains cannot +produce the three independent rigid leaves `c,R,T`. This case fails. + +With exactly two internal Boolean arguments, only one application +remains: + +* With no tail bound, the zero branch needs the remaining application + to connect its fresh head `R` to `j`. The `F` branch therefore has + no applications, and its law forces it to be `c`, without vacuous + wrappers. The zero branch must have normal form `λu v.u j` or + `λu v.v j`. +* With one tail bound, the one remaining application is needed for `c r`; + the zero branch is only a leaf, up to vacuous lambdas, and fails. +* With two tails bound, `c r t` already requires two further applications. + +The first case alone succeeds. Its smaller variant has three lambdas, +three applications, and `X=7`, hence 27 bits. The other costs 28. + +## Excluding four applications below 27 bits + +Suppose `A=4` and `|H|≤26`. Since `L≥2` and `X≥3`, + +``` +2L+X ≤ 8, +``` + +so `L=2`, `X≤4`. If `H` begins syntactically with a lambda, the required +`j,c` occurrences alone contribute at least `(1+1)+(2+1)=5` to `X`. +Thus `H` is not syntactically a lambda, and its head reduction must consume +an abstraction before exposing a lambda. + +If that contraction is affine, the reduct has at most one explicit +abstraction and fails the preceding lemma. The only remaining possibility +is that the head redex duplicates an argument containing the other +abstraction. + +There are five leaves. Two belong to the duplicated binder `x`, and two +are the required `j,c`. For an eventual input-dependent lambda the fifth +must belong to the other binder `b`, exactly once. Therefore the +duplicated argument has a single affine abstraction and otherwise only +application nodes and the rigid leaves `j,c`. + +Such an argument can expose a lambda only if it begins with `λb`. +(Consuming its only abstraction leaves an application-only rigid term.) +Write it `D=λb.V`, where `b` occurs once. If the head of `V` is rigid, +applying `D` immediately yields that rigid head. Otherwise + +``` +D = λb. b W1 ... Wq, +``` + +where every `Wi` is application-only over rigid leaves. For `q>0`, every +application tree of copies of `D` and rigid leaves with at least two +leaves is rigid-headed after reduction: `D U` pushes its fixed nonempty +rigid spine onto `U`, and a second `D` consumes its first rigid argument. +For `q=0`, `D=I`; applications of identities preserve every rigid leaf, +so a tree containing either required rigid variable cannot yield a +lambda. These cases exhaust the duplicated argument. + +The surrounding body contains both occurrences of `x`; hence after +substitution it is such a nontrivial application tree. It cannot expose +the input-dependent lambda required by the handler laws. This excludes +the last below-27 case with four applications. + +## Five or more applications + +For `A≥5`, the elementary bounds `L≥1`, `X≥3` already give + +``` +|H| ≥ 2 + 20 + 2 + 3 = 27. +``` + +Together the cases prove the claim. + +## What this does not prove + +The stream `s` is still an independent rigid ambient variable in the two +handler laws. The selector `R` and suffix `T` are independently varied. +A real unary selector contains its suffix, and a real stream contains its +tag and tail. A handler exploiting those correlations is outside the +theorem. The reader itself is still `s H S`, and the rest of the +interpreter is fixed. No conclusion about arbitrary sub-165 programs +follows without further decomposition or a different global invariant. + +The four explicit witnesses and the arithmetic are checked by +`tools/self-interpreter/theory/handler_bound.py`. That script does not +enumerate terms or prove the quantified lower bound; the proof is the case +analysis above. diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index ba5ded7f..d5988bf8 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -303,19 +303,35 @@ Both shapes occur: the 165 and 168 are `s`-headed; parsing twice, `λc s. c (E (λv r. v) s) (E (λv r. r) s)`, is a correct `c`-headed interpreter. -**Duplication.** Some binder of `E` occurs at least twice. *Proof:* the stream -cells and both booleans are affine, and β preserves affineness, so an affine -`E` would make `E C ⌜λx. x x⌝N` affine, while its required β-normal form -`C (λz. λx. x x) N` is not. - -**No knot is forced.** A correct interpreter can be β-normal. Mark every -application of a correct `E0` with a fresh `b`, `(U V)ᵇ = b Uᵇ b Vᵇ`, so `E0ᵇ` -is normal and `E0ᵇ[b := K] →* E0`; then `λc s. s (λb r. b E0ᵇ b c s)` is -β-normal and correct, because every closed program's first bit is 0 (`K`). -Built on the 165 it is 712 bits (on the 168, 753), and both pass the battery. So any argument that a -small interpreter must contain a fixed-point combinator, a syntactic `x x`, or -an infinite Böhm tree needs a quantitative step; correctness alone does not -supply one. +**Duplication.** At least two syntactic binders of `E` occur at least twice. +Lean proves that every term with at most one such binder weakly normalizes; +the interpreter contract on Ω contradicts that conclusion. If `E = λc s.B`, +at least two are inside `B`: the public interface binders cannot supply +them. The count is sharp: a correct 584-bit interpreter uses exactly two, +both closed in isolation, by sharing one `λx.x x` across an affine +translation of the 165. Its reduction to the literal 165 is kernel-checked. +The minimum count two is attained even by a β-normal 742-bit witness, +whose contract is kernel-checked as β-joinability. +See `structural-bounds.md`, `Blc/SelfintLowerBound.lean`, and +`Blc/SelfintSharp.lean`. + +**Capture and provenance.** Some live abstraction of `E` captures an +enclosing local variable. Lean proves that absence of this property is +preserved by β-reduction and holds for the quotation, while the normal +output for `λa b.a b` violates it. A separate colored reduction theorem +tracks quotation-origin binders through unrestricted interpreter +reductions: they remain affine with a protected head occurrence. +These are global constraints, not separately additive module costs +(`structural-bounds.md`, `Blc/SelfintCapture.lean`, +`Blc/SelfintOrigins.lean`). + +**No syntactic knot or untypability is forced.** A correct interpreter can +be β-normal; `normal.md` gives a compact construction with a kernel-checked +contract. It can even be both β-normal and simply typable: +`typed-normal.md` gives an explicit 672-bit construction and a general +syntactic correctness proof. The actual application to the quotation need +not share that simple typing. Thus neither a β redex nor untypability of +`E` follows from correctness alone. **Search cost.** There are about `1.02 × 10^44` closed terms of 167 bits. The property "is a self-interpreter" is Π⁰₂-complete in general, so no total @@ -333,20 +349,21 @@ the 165 shows that the natural decomposition is false. ### Bounds within the 165's reader shape These are Codex's handwritten proofs, with targeted reduction checks in -`data/self-interpreter/reasoning_165/bounds/` (`proof_check.py`); none is in -Lean. +`data/self-interpreter/reasoning_165/bounds/` (`proof_check.py`) and +`tools/self-interpreter/theory/handler_bound.py`; none is in Lean. - **The reader.** In the frame `[s, next, cont, intL, x]`, take readers - `s H S` where `S` satisfies the stop-at-first-zero law and - `H = λb r1 … rm. b A B` with arbitrary `A`, `B` (redexes and further uses - of `b` allowed) and no common arguments after `b A B`, satisfying - `H K R R = R next` and `H F R T = cont R T` for rigid neighbours. The - cheapest handler costs 27, 33 or 40 bits with 0, 1 or 2 tails bound before - the dispatch; three or more leave an outer λ. The skip costs at least 10 and - the two applications with `s` 6, so the reader costs at least 43, and with - the other 122 bits unchanged the minimum is the 165. The class does not - cover other reader heads, arguments shared across the dispatch, or use of - the correlation between a variable's selector and its suffix. + `s H S` where `S` satisfies the stop-at-first-zero law and arbitrary `H` + satisfies `H K R R = R next` and `H F R T = cont R T` for independent + rigid neighbours. The handler costs at least 27, without assuming its + syntax, normality, dispatch shape, or absence of common arguments. + `handler-bound.md` gives the complete small-budget case proof. The skip + costs at least 10 and the two applications with `s` 6, so the reader costs + at least 43; with the other 122 bits unchanged the minimum is 165. + This does not cover other reader heads or handlers exploiting actual + stream/selector/suffix correlations. `normal.md` gives an explicit + correlated handler satisfying the actual-stream laws but not these + independent rigid laws. - **The zero arm costs at least 14 bits**, even with `bit0 := K` and the whole zero cell available to borrow. With `R` absent and the neighbours rigid, `Z R R = R next` forces the normal form `λu v. u next` (15) or @@ -402,7 +419,9 @@ Lean. `P = λc s. s H_c (s s s)`, `P P P` reproduces itself at the head with more arguments and has no head normal form, and `R_i P` reduces to it. The current `next` diagonal cannot replace `E C` either: `next next` on quoted - `I` leaves five arguments at the rigid `C`. (Codex.) + `I` leaves five arguments at the rigid `C`. This latter obstruction holds + for every choice of skip function with the same handler and NEXT protocol, + not only `s s s` (`protocol-obstructions.md`). (Codex.) - **Readers of the bare-`cont` shape have outer arity one:** any `λs. s (λb. b Z C) A1 … Ak` returns `C r A1 … Ak` on a variable, so `k = 1` whatever the zero arm; and no application-only body over `s`, `next`, `C` @@ -418,6 +437,12 @@ Lean. as the first parse's continuation makes `P q t` head-divergent on Ω, which the contract forbids. Likewise a selected parse result `r P = bit value rest` plus any iterate of the skip loses the first operand's index. (Codex.) +- **A uniform decoder cannot repair an η-collapsed representation.** If + two source programs have β-equal internal representations but distinct + required β-normal outputs, every decoder depending only on that + representation produces β-equal results for both. In particular, erasing + the difference between `I` and `λf x.f x` cannot be repaired at the public + boundary without additional information (`protocol-obstructions.md`). ## 6. Protocol changes @@ -486,6 +511,7 @@ search; sources and proofs are in `data/self-interpreter/reasoning_165/`, and | idea | bits | note | |---|---:|---| | Skip `list list next` | 166 | the erased argument changes only off-stream behaviour | +| Skip `list list cont`, `list list intL`, or `list list x` | 167 / 168 / 169 | on the off-domain input F, returns the continuation, parser, or generator; `protocol-obstructions.md` | | Arity switch `s (s K)` dispatching constructor against variable | 167, *fails* | the variable arm returns `λc. I` on `I` | | Balanced skip `(s s) (s s)` | 169 | `s s = K N`, so both forms reduce to `N` | | `Δ = λx. x x` shared between the knot and `s s` | 176 | the let costs 11 | @@ -503,18 +529,19 @@ search; sources and proofs are in `data/self-interpreter/reasoning_165/`, and ## 7. Boundaries -The 165 is pinned locally from every direction searched: its let structure, βη -and contextual components, every slot of its reader singly and the handler and -skip jointly through interpreters of 164 bits, and the NEXT region it shares -with the 168. A sub-165 would need another fusion of the kind the reader is: +No verified sub-165 has been found in the tested neighbourhoods: its let +structure, βη and contextual components, every slot of its reader singly and +the handler and skip jointly through interpreters of 164 bits, and the NEXT +region it shares with the 168. Capped candidates remain unresolved. Another +fusion of the kind the reader uses is a promising constructive route: work that two parts of the interpreter need, computed once where its value is right for both, or a Scott structure whose own application supplies an argument. Open: -- readers outside the shape bounded in §5: other reader heads, arguments - shared across the dispatch, the correlation between a variable's selector +- readers outside the parametric class bounded in §5: other reader heads, + the correlation between a variable's selector and its suffix, and readers with a different `next` protocol beyond those priced in §3 and §6; - the reader's diagonal `R Z →* next next` (§2): the 165 already contains the @@ -526,8 +553,10 @@ Open: - the capped fills of §3 (4,052,176 in the joint reader search, 7,790 in the handler, 218 in whole APP) and of §4; - an unconditional lower bound beyond small sizes: §5 states the structure - every interpreter has, and why a proof at this size needs a decomposition - theorem that does not yet exist. + every interpreter has. The minimum nonlinear-binder count two is attained, + so counting more such binders cannot close the gap. A quantitative theorem + must account for their connections, live captures, and quotation-origin + restrictions without incorrectly adding costs of computations that share. ## 8. Reproduce @@ -543,5 +572,6 @@ Open: | `tools/self-interpreter/module_bound.py` | the 168's module grammar (`assemble`, `audit`) | | `tools/self-interpreter/search_fix.py` | the knot search | | `tools/self-interpreter/beta_search.py` | the Python βη component reference | -| `lake build` in `lean/` | `Blc/Selfint165.lean`, `Blc/SelfintProof.lean` | +| `tools/self-interpreter/theory/` | bounded checks for explicit structural witnesses and protocol equations; no candidate search | +| `lake build` in `lean/` | the 165/168, normal and two-nonlinear witnesses; unconditional normalization, capture and origin theorems | | `data/self-interpreter/searches_165.json` | commands and totals of the joint searches of §3 | diff --git a/docs/classical/self-interpreter/normal.md b/docs/classical/self-interpreter/normal.md new file mode 100644 index 00000000..7d4572d9 --- /dev/null +++ b/docs/classical/self-interpreter/normal.md @@ -0,0 +1,124 @@ +# A kernel-checked 204-bit beta-normal interpreter + +The complete beta-normal interpreter is **204 bits**. Its source and wire +encoding are `data/self-interpreter/machines/int204_normal.{lam,blc}`. +It quantifies the limitation of arguments claiming that correctness forces +an interpreter to contain a beta redex or a literal fixed-point application. +It does not improve the minimum unrestricted interpreter size. + +The full directed-reduction contract, exact size, and normality are proved +in `lean/Blc/SelfintNormal.lean`: + +- `selfint_contract204`: for every closed source `M` and arbitrary `C,N`, + `intL204 C (code(M) ++ N)` beta-reduces to `C (lambda z.M) N`; +- `isSelfInterpreter_intL204`; +- `wire_intL204` and `intL204_size`; +- `intL204_nft` and `intL204_normal`. + +The contract uses only `propext` and `Quot.sound`; normality uses `propext`. +The proof imports the existing 165 theorem's machinery, replays the changed +control reductions with `decide`, and carries over its structural parsing +induction. It does not assume source normalization or use `sorry`. + +## Construction + +Let `K = lambda a b.a` encode bit zero, and let `Q(p,c)` be the existing +NEXT operation: + +```text +Q(p,c) = lambda t. p (lambda f. t + (c (lambda e a. f (lambda z y. z a (y e)))) + (p (lambda g. c (lambda e. f e (g e))))) +``` + +The new, beta-normal generator is + +```text +G = lambda x c s. + s (lambda b. + b (lambda p u r. r Q(p,c)) + (lambda p.c) + (x x)) + (s s s). +``` + +It costs 165 bits. The tag gates the binding of `p = x x`; it saves a copy +of `x x` without introducing a syntactic beta redex. For a zero cell +`s = cons K R`, its self-skip is `R`, and + +```text +G x c s ->* R Q(x x,c). +``` + +For a variable stream `s = 1^n 0 ++ N`, with immediate tail `R`, + +```text +G x c s ->* c R N. +``` + +These are exactly the 165's two parsing equations, with recursive parser +`x x`. Therefore `G G` has the full open-term parser contract. The new +handler is not globally beta-equivalent to the old handler on arbitrary +non-Boolean arguments; the proof uses the actual K/F control laws. + +To make the complete public interpreter beta-normal, use the fact that +every closed source starts with zero: + +```text +D = lambda u x. x x +E = lambda c s. s (lambda b. b D b) G c s. +``` + +Here `D` and `G` are written inline, with no lets. If `s = cons K R`, + +```text +E c s ->* K D K R G c s + ->* D R G c s + ->* G G c s. +``` + +The finite source contains no beta redex: the outer heads are `s`, `b`, +and variables bound inside `D` and `G`. All applications that activate the +interpreter arise after substituting the actual input's K. The public +root is required to work on closed sources, exactly as in the target +contract; the internal parser `G G` also handles open sources. + +The syntactic counts are `L=21`, `A=29`, `X=44`, giving +`2L + 4A + 2 + X = 204`. + +## Verification + +```text +(cd lean && lake env lean Blc/SelfintNormal.lean) +python tools/self-interpreter/theory/normal204.py +``` + +The second command verifies that the named source, BLC bits, and Lean wire +literal agree; checks syntactic beta-normality; runs the existing bounded +battery with two workers; and verifies rigid suffix extraction for Omega +and lambda-Omega. Current verification results are recorded in +`docs/STATUS.md`. The check is limited to this explicit construction; it +performs no candidate search. + +## Correlated-reader boundary + +The actual variable selector has the shape `R = 1^k 0 ++ N`. Consequently +it is a Scott cell, and `lambda h.R h` beta-reduces to `R`. This shows why +a proof under independent rigid `R,N` does not transfer to the actual +stream law by logical implication alone. For example, + +```text +H = lambda b r. b (lambda t.t j) (c (lambda h.r h)) +``` + +has the correct actual-stream zero and variable laws but fails the rigid +variable law: it returns `c (lambda h.R h) N` instead of `c R N`. +Its exact cost in `[s,j,c,p,x]` is 40 bits, well above 27. This is a scope +counterexample, not a promising small construction. + +The original bare-C selector shape cannot exploit this correlation: the +existing strengthened 14-bit zero-arm theorem already permits using the +whole zero cell, and C is already the cheapest possible variable arm. +A useful smaller correlated reader would therefore have to change the +handler's head/argument sharing or use concrete NEXT behavior. No such +sub-27 handler was found by the reasoning here. diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md new file mode 100644 index 00000000..445af20c --- /dev/null +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -0,0 +1,361 @@ +# Interpreter protocol constraints + +These are exact symbolic arguments and explicit constructions by Codex. They +apply to the stated protocols, not to arbitrary interpreters. The targeted +checks perform no candidate enumeration. + +## A free semantic parameter in the skip + + +Write + +```text +K = λu v.u F = λu v.v +Z_t = λu r.r t +H(q,c) = λb.b Z_q c +R_a(q,c) = λs.s H(q,c) (s s a). +``` + +For every unary prefix `1^n 0 ++ N`, including `n=0`, + +```text +s s ->* K N +s s a ->* N. +``` + +The second equation holds for arbitrary `a`, including divergent terms. The +proof is the same structural induction as the existing skip law, followed by +one erased application. Consequently the last skip operand can be any +in-scope term without changing the parser's behavior on source encodings. +The structural parser proof therefore transfers, including divergent source +programs; finite batteries are supplementary evidence. + +Off the stream domain, the choice matters: + +```text +R_a F ->* a +R_a K ->* H(q,c) +R_a I ->* a Z_q c +R_a Z_t ->* a t t. +``` + +For the last identity, + +```text +Z_t H(q,c) (Z_t Z_t a) + -> (λr.r t) (a t) + -> a t t. +``` + +These equations were checked with all parameters bound rigidly. They expose +an off-domain control channel that the `s s s` reader does not have. + +Four complete variants replace only the final `list` in the 165's skip: + +| Erased operand | Bits | Off-domain operation | +|---|---:|---| +| `next` | 166 | `E C F -> Q_C` | +| `cont` | 167 | `E C F -> C` | +| `intL` | 168 | `E C F -> E` | +| `x` | 169 | `E C F -> G`, the ordinary knot generator | + +These are complete interpreter constructions, all larger than 165. The reset identity in the +168-bit variant follows by finitely unfolding its existing knot once; +the script additionally checks the reset followed by parsing `I`. + +## The raw NEXT diagonal still fails for every skip function + +The existing five-argument obstruction is stronger than its original +`s s s` presentation suggests. Allow completely arbitrary skip terms, +including ones depending on the stream: + +```text +R_i = λs.s H_i S_i(s) +H_i = λb.b (λu r.r q_i) c_i. +``` + +Then, without inspecting either skip term, + +```text +H_i H_j ->* c_j q_i c_i +R_i R_j ->* c_j q_i c_i S_j(H_i) S_i(R_j). +``` + +The second equation is just + +```text +R_i R_j + -> R_j H_i S_i(R_j) + -> H_i H_j S_j(H_i) S_i(R_j). +``` + +Retain the current NEXT interface, + +```text +A(f) = λe a.f (cell a e) +V(f,g) = λe.f e (g e) +a_f = λg.C V(f,g) +q = λb.P (λf.b (C A(f)) (P a_f)). +``` + +As in the existing derivation, put + +```text +k(f) = q (C A(f)) (P a_f) +d_f = λg.C A(f) (C A(g)) (P a_g). +``` + +Then + +```text +q q = P k +k(f) = P d_f (P a_f) = R_(d_f) R_(a_f) + ->* C V(f,q_(d_f)) d_f + S_(a_f)(H_(d_f)) S_(d_f)(R_(a_f)). +``` + +On quoted `I` with rigid tail `N`, `P k` supplies its parsed value `f` +followed by `N`. The result has **five arguments at rigid head `C`**, +whereas the contract requires exactly two. No reduction inside those +arguments can remove the three extra arguments at the rigid head. + +Thus replacing the skip by *any* extensionally correct alternative cannot +turn the unchanged NEXT diagonal into the required parser. This includes all +four erased-operand variants and more general stream-dependent skip +computations. It does not exclude a different NEXT protocol or a different +handler shape. + +The old `P P P` head-loop proof specifically uses `s s s`; it should not be +silently transferred to the erased-operand family. The argument above is the +valid stronger obstruction for the raw NEXT-diagonal proposal. + +## Constructive routes considered + +An internal reset `E C F = E` or generator extraction `E C F = G` does not +by itself create a cheaper fixed point: using it to recover the recursive +parser requires that parser to be available already. Likewise, +`E C F = C` gives a continuation-return instruction, but its arity differs +from the no-input parser `λk.k k`; appending the missing fake value also +appends it on the real second-parse branch unless another mode adapter is +introduced. + +Self-application of a Scott pair also has a concrete payload-duplication +cost. For `D = λh.h g r`, + +```text +D D ->* g g r r. +``` + +It can perform the generator diagonal while supplying a field, but supplies +that field twice. A complete construction must discard or use the duplicate +before reaching the rigid public continuation. Simply calling it a +“pair-carried knot” does not eliminate that obligation. + +These observations leave the productive target precise: a revised control +protocol in which an erased skip operand carries a *solvable* recursion or +return instruction, and that instruction performs an already-required +semantic operation. An explicit adapter that merely recovers the current +parser repays the hoped-for saving. A smaller protocol of this kind remains open. + + +## Closed-source correctness already forces closed internal values + +Consider a context-independent compositional parser with a transparent root +callback: + +```text +P C (code(M) ++ N) ->* C V(M,N) N, +``` + +where `V` is independent of `C` and of the syntactic context containing `M`. +If `P` itself satisfies the required closed-source contract, then for every +closed `M`, + +```text +V(M,N) =_beta λz.M. +``` + +The argument uses the contract with rigid `C,N` and Church-Rosser: a common +reduct of the two rigid-`C` applications must have common reducts in their +corresponding argument positions. This does not require correctness of +intermediate closures on arbitrary open terms or arbitrary environments. + +Consequently the existing cell/APP alias obstruction remains even if one +relaxes open-parser correctness as far as possible. Let + +```text +X1^N = cons K N +X(n+1)^N = cons F Xn^N +APP(f,g) = λe.e f g. +``` + +The closed term `I` necessarily compiles to `K I =_beta F`, including when +its suffix contains the next operand. Therefore + +```text +APP(V(I,...), Xn^N) + =_beta λe.e F Xn^N + =_alpha X(n+1)^N. +``` + +The bodies `I b` and `a` in the contexts `λa b.[...]` thus acquire identical +values with the same suffix. If ABS depends only on the child value and +suffix, the complete closed sources + +```text +λa b.I b λa b.a +``` + +also acquire identical values, although their required beta-normal forms +differ. No choice of environment cell repairs this collision. + +Thus the assumption of canonical closed internal values in the previous +alias theorem is derivable from root transparency and context independence; +it is not an extra consequence of an overly strong open-term interface. +A successful alternative must change at least one of raw variable values, +root transparency, context independence, or the information carried through +ABS. + +The direct common-combinator idea does not yet supply that escape. Both the +cell and APP use the skeleton + +```text +D a e f g = f a (g e). +``` + +But cell construction partially applies `D` to its first two fields, whereas +APP must feed the *same whole environment* into both fields. Making the cell +itself act as APP requires overloading its behavior on parsed values versus +the Boolean selectors. The canonical closed value of `I` is exactly `F`, +so these are not disjoint domains. A value wrapper or context distinction +must preserve additional information before such overloading is meaningful. + +## Eta-optimized combinator values cannot have a uniform beta repair + +Ordinary SK bracket abstraction can preserve beta equality if it retains +lambda structure instead of applying eta optimization. The tempting cheaper +route is to erase eta expansions during compilation and repair the public +result with a fixed decoder. That route has an information-loss obstruction. + +Let `R` be any representation and `D` a decoder using only that +representation. If + +```text +R(I) =_beta R(λf x.f x), +``` + +then beta congruence forces + +```text +D(R(I)) =_beta D(R(λf x.f x)). +``` + +The two required results are distinct beta-normal forms. Hence no such `D` +can satisfy the exact interpreter contract on both programs. This applies +to any representation that collapses eta equivalence, irrespective of the +decoder's size or computation time. + +Retaining the original code, an eta-shape annotation, or another context +parameter avoids the hypothesis. A decoder supplied only an eta-collapsed +value cannot restore the missing syntactic distinction. This explains why +an eta-only internal protocol cannot be made beta-exact merely by adding a +uniform boundary coercion. + + +## Two-sided beta inverses are trivial + + +**Theorem.** Let `F` and `G` be closed untyped lambda terms, and let `z` be a +fresh variable. If + +``` +F (G z) =beta z +G (F z) =beta z, +``` + +then `F =beta I` and `G =beta I`. + +**Proof.** Since `z` is beta-normal, Church–Rosser gives reductions +`F (G z) ->* z` and `G (F z) ->* z`. A head-normalizing application has a +head-normalizing operator, so both `F` and `G` have head normal forms. +Closed head normal forms have the shape + +``` +lambda a1 ... an. ai U1 ... Uk +``` + +with `n >= 1` and `1 <= i <= n`. + +The first reduction forces `F` to have exactly one leading abstraction: +if its head normal form had `n >= 2`, applying one argument would leave an +outer abstraction. Beta reduction preserves an existing outer abstraction, +so this reduct could not have the common reduct `z`. The second reduction, +separately, forces `G` to have exactly one leading abstraction. Thus their +head normal forms are + +``` +F ->* lambda a. a U1 ... Uk +G ->* lambda b. b V1 ... Vl. +``` + +Apply the first form to `G z`, then reduce the head occurrence of `G`. +The result has the form + +``` +z V1[z/b] ... Vl[z/b] U1[G z/a] ... Uk[G z/a]. +``` + +Its rigid head is `z`; reducing inside an argument cannot remove a head +argument. Therefore its number of head arguments, `l + k`, must be zero. +Both head normal forms are `lambda a. a`, as required. ∎ + +This proof uses head normalization and Church–Rosser as standard lambda +calculus facts; it is a handwritten argument, not a Lean theorem in this +repository. + +The claim is about two-sided inverses on arbitrary terms. It permits +nontrivial retractions, such as + +``` +J x = lambda k. k x +D v = v I, +``` + +for which `D (J x) ->* x` but `J (D z)` does not reduce to `z`. It also +permits inverses restricted to a chosen representation domain. + +## Swapping a closure's two arguments is not an exact involution + +A tempting wrapper swaps a closure's environment and source-argument +positions: + +``` +J f = lambda a e. f e a. +``` + +However, + +``` +J (J f) ->* lambda e a. f e a. +``` + +For a rigid variable `f`, the right side is beta-normal and distinct from +`f`. It is an eta-expansion, not a beta inverse. This is also visible on +closed terms: with `Omega = (lambda x. x x) (lambda x. x x)` and +`f = lambda e. Omega`, the two expressions reduce respectively to +`lambda e a. Omega a` and `lambda e. Omega`. Their only remaining redex is +the self-loop in `Omega`, so they have no common reduct. + +Restricting the input to closures that always already expose two leading +abstractions would make the swap an involution on that domain. Raw variable +closures do not satisfy this restriction: evaluation can return an arbitrary +runtime argument. Enforcing such a domain therefore requires a changed +value representation and a beta-exact root decoder. + +## Reproduction + +`python tools/self-interpreter/theory/erased_skip.py --battery` checks the +symbolic identities and the four complete variants. Their source and wire +encodings are `data/self-interpreter/machines/int_skip_*.{lam,blc}`; the +results are `data/self-interpreter/theory/erased_skip.json`. Current measured +verification is in `docs/STATUS.md`. diff --git a/docs/classical/self-interpreter/structural-bounds.md b/docs/classical/self-interpreter/structural-bounds.md new file mode 100644 index 00000000..cd42c5c0 --- /dev/null +++ b/docs/classical/self-interpreter/structural-bounds.md @@ -0,0 +1,162 @@ +# Unconditional structural constraints on self-interpreters + +These results concern the repository's actual closed-source, beta-exact +contract. They do not assume a parser architecture, an environment +representation, or correctness on open source programs. They do not prove +165-bit optimality. The constructions in `normal.md` and `typed-normal.md` +also show why several plausible qualitative restrictions are false. + +## At least two nonlinear binders + +Let `nonlinear(t)` count syntactic abstractions whose own bound variable +occurs at least twice, including occurrences beneath nested abstractions. +This counts syntax, not graph nodes or redexes. + +`Blc.SelfintLowerBound.selfInterpreter_two_nonlinear` proves + +```text +IsSelfInterpreter E -> 2 <= nonlinear(E). +``` + +The stronger interface statement +`selfInterpreter_two_inside_interface` proves that when `E = λc s.B`, +the body `B` itself contains at least two nonlinear binders. Duplication of +the public continuation or stream cannot supply them: those two interface +binders disappear when their affine arguments are substituted. + +The engine of the proof is `one_nonlinear_normalizes`: every term with at +most one nonlinear binder has a beta-normal form. This is a weak +normalization theorem; strong normalization is not claimed. + +Capture-avoiding substitution obeys the exact identity + +```text +nonlinear(B[x := A]) = + nonlinear(B) + occurrences(x,B) nonlinear(A). +``` + +For a weak-head reduction, which crosses no enclosing abstraction: + +- An affine contraction strictly decreases syntax-node count and does not + increase the nonlinear count. +- If the contracted binder is the unique nonlinear binder, its body, + argument, and other spine arguments are affine. The entire reduct is + therefore affine and normalizes. + +An induction on node count follows weak-head reduction and then descends +under a leading lambda or into the arguments of a rigid head. Separating +these phases matters: reducing under an enclosing binder can make that +binder nonlinear, as in `λy z.(λx.x x)(y z)`. The proof never asserts that +the nonlinear count decreases under arbitrary contextual reduction. + +For the interpreter theorem, instantiate the contract at the closed +divergent source Ω. Quotation cells and K/F bits are affine, so + +```text +nonlinear(E C (quote(Ω) ++ N)) = nonlinear(E) +``` + +for rigid `C,N`. With at most one nonlinear binder the left side would +normalize. Confluence transfers existence of a normal form across the +contract's beta join to `C (λz.Ω) N`, contradicting non-normalization of Ω. +No finite test battery enters this argument. + +The kernel also proves the syntax inequality + +```text +10 nonlinear(t) + 4 freeLeaves(0,t) <= |t|_BLC + 2, +``` + +giving `selfintSizeBound_eighteen : SelfintSizeBound 18`. This is a small +numeric consequence, not a useful approximation to a 165-bit bound. + +The nonlinear count is sharp, even among beta-normal interpreters. +`Blc.SelfintSharp` gives a 584-bit interpreter reducing to the literal 165 +and a 742-bit beta-normal interpreter satisfying `IsSelfInterpreter`; +each has exactly two nonlinear binders, both closed in isolation. +`two-nonlinear.md` describes the affine translation and first-bit gate. +Thus a live capturing binder need not itself be nonlinear, and neither +normality nor the absence of a nonlinear capture raises this count. + +## A live abstraction must capture an enclosing variable + +Call an abstraction *live* when its own bound variable occurs in its body. +`Separated d t` allows arbitrary global free variables, but requires each +live abstraction in `t` to mention none of its enclosing local binders. +Vacuous abstractions may capture freely. + +`Blc.SelfintCapture` proves that separation is preserved by shifting, +substitution, and every beta reduction, including reduction under lambdas. +The substitution argument is direct: a live inner binder cannot contain +the substituted enclosing local variable, so substitution cannot connect +that inner binder to another local binder. Reduction cannot introduce a +previously absent variable. + +K, F, and every Scott quotation with rigid suffix are separated. But the +required normal output for the closed source + +```text +λa b.a b +``` + +is not: its inner live binder captures `a`. Hence every self-interpreter +already contains such a dependency. + +The formal conclusions are: + +- `selfinterpreter_not_separated`; +- `selfinterpreter_has_live_capture`, an explicit existential witness; +- `selfinterpreter_indexSum_pos`, excluding terms whose every de Bruijn + index is zero. + +These are source-syntax constraints. They do not say that the captured +binder must itself be nonlinear. + +## Quotation-origin binders cannot provide arbitrary binding structure + +`Blc.SelfintOrigins` colors abstractions by origin: interpreter syntax is +red, and the input quotation's K/F/Scott abstractions are blue. Substitution +copies these colors. Erasing colors gives the ordinary lambda term. + +A live blue binder's sole bound occurrence stays at the rigid head beneath +leading lambdas. Its pair of counts `(leading lambdas, head arguments)` is +one of `(1,0)`, `(0,0)`, or `(0,2)`, inherited from K's outer binder, F's +inner binder, or a Scott cell. Capture-avoiding substitution cannot capture +a blue bound variable, and reduction below that binder cannot move or +duplicate its protected head occurrence. + +The module lifts every ordinary beta-reduction path from + +```text +E C (stream(bits,N)) +``` + +to a colored path and proves preservation of the blue invariant. +`quotation_origins_frozen` supplies one residual coloring with all of the +following properties: + +- Every blue binder is affine; a live one retains one of the three head + shapes. +- A live blue binder captures no enclosing local variable. +- Its body remains beta-normal and contains only blue abstractions. + Vacuous blue wrappers may contain arbitrary red payloads. + +`selfInterpreter_normal_frozen` transfers these properties to the exact +output for every closed normal source program. Consequently a nonlinear +output binder, or a live output binder capturing an enclosing variable, +must descend from the interpreter's syntax, possibly through duplication. + +This provenance statement is stronger than saying the initial quotation +is affine. Affineness alone does not identify the origin of a binder +after unrestricted interpreter reductions. + +## Exact evidence boundary + +The three structural modules are kernel-checked, use no `sorry` or +candidate enumeration, and depend only on `propext` and `Quot.sound`. +`lake build` includes them. + +None of the results prices parsing, exact remainder recovery, or arbitrary +closure construction as independent modules. Those operations can share +syntax and computation. Adding their familiar implementation costs would +require a decomposition theorem that has not been established. diff --git a/docs/classical/self-interpreter/two-nonlinear.md b/docs/classical/self-interpreter/two-nonlinear.md new file mode 100644 index 00000000..6d4e610b --- /dev/null +++ b/docs/classical/self-interpreter/two-nonlinear.md @@ -0,0 +1,101 @@ +# The two nonlinear binders are sufficient + +`lean/Blc/SelfintSharp.lean` proves a closed self-interpreter with exactly two +syntactically nonlinear binders. Both nonlinear lambda subterms are closed in +isolation. The 584-bit witness therefore has no binder that is simultaneously +nonlinear and captures an enclosing variable. + +This makes the unrestricted two-binder lower bound in +`Blc/SelfintLowerBound.lean` sharp. It also rules out strengthening the +live-capture theorem by demanding that its capturing binder be nonlinear. +It does not improve the 165-bit interpreter, and it gives no numerical +optimality result for 165. + +## Direct construction + +Let `Δ = λa.a a`, and use one free variable `d` for every occurrence of it. +The affine duplicator is + +```text +W_d = λf x. d (λb. b (λk.f) x). +``` + +Every binder of `W_d` is affine. On substituting `Δ` for `d`, its behavior is +`W_Δ f x →* f x x`. Writing `A = λb.b (λk.f) x`, the essential reductions are + +```text +Δ A → A A → A (λk.f) x → (λk.f) (λk.f) x x → f x x. +``` + +The compiler recursively translates a term. It retains an abstraction +`λx.B` when `x` occurs at most once. Otherwise it gives the first occurrence +a fresh name `u`, the remaining occurrences a fresh name `v`, and replaces +the abstraction with `W_d (λu. T(λv.B[u,v]))`. Repeating this operation +reduces the multiplicity of each binder until every binder is affine. + +For a closed source `E`, close the resulting code as +`(λd.T(E)) Δ`. The only possible nonlinear binders are the shared `d` +and the argument of `Δ`; both corresponding lambda subterms are closed. +Substitution of `Δ`, followed by the displayed reductions and structural +induction, gives a finite directed beta reduction to `E`. + +For the literal 165-bit interpreter this deterministic construction gives +584 bits, ten uses of the shared `d`, and 71 administrative beta steps back +to the literal source. No candidate enumeration or search occurs. + +The source and wire encoding are +`data/self-interpreter/machines/int584_two_nonlinear.{lam,blc}`. + +## Sharpness among normal interpreters + +The same two-binder minimum is attained by a beta-normal interpreter. First +normalize the affine body `T(E)` while its free `d` stays rigid, obtaining +`B(d)`. Affine reduction terminates and leaves its own binders affine. +Both `λd.B(d)` and `Δ` are normal and closed. The public root is + +```text +E_normal = λc s. s (λb r. b (λd.B(d)) I Δ c (λk.k K r)). +``` + +For a closed source the first bit is `K`, so `s = λk.k K r`. The root uses +that bit to select `λd.B(d)`, discards `I`, and supplies `Δ`. Its last +argument rebuilds the consumed first cell: + +```text +E_normal c (λk.k K r) →* ((λd.B(d)) Δ) c (λk.k K r). +``` + +No application in the source has a lambda as its function. The root binders +`c`, `s`, `b`, `r`, and `k` are all affine. The two nonlinear lambda subterms +remain the closed `λd.B(d)` and `Δ`. + +For the 165-derived code this produces the 742-bit canonical witness +`data/self-interpreter/machines/int742_two_nonlinear_normal.{lam,blc}`. +Lean checks a 13-step reduction of the 584 to the normalized core, a +seven-step root reduction, normality, and the exact nonlinear count. +Confluence with the 584's directed contract proves the 742's contract as +**beta joinability**, for every closed source and arbitrary continuation +and suffix. The theorem does not claim a directed reduction to the literal +target `C (λz.M) N` when that target is itself reducible. + +## Evidence + +`tools/self-interpreter/theory/affine_basis.py` constructs both witnesses, +checks their exact source and traces against the Lean literals, counts the +nonlinear binders, and runs the standard interpreter battery with two +workers. The checked reports are +`data/self-interpreter/theory/two_nonlinear.json` and +`data/self-interpreter/theory/two_nonlinear_normal.json`. + +The Lean theorem `reduces584` replays all 71 beta steps through a proved +path-selected reduction checker. `selfint_contract584` then inherits the +directed contract for every closed source term, including diverging terms, +and arbitrary continuation and suffix. `two_nonlinear_sharp` packages +correctness, exact nonlinear count two, and `NonlinearClosed`. Its only +axioms are `propext` and `Quot.sound`. + +`two_nonlinear_normal_sharp` additionally requires beta-normality, using +`selfint_join742` for correctness. It has the same axiom inventory. These +two sharpness theorems establish that a stronger interpreter size bound +needs more than a larger count of nonlinear binders, including within the +normal fragment. diff --git a/docs/classical/self-interpreter/typed-normal.md b/docs/classical/self-interpreter/typed-normal.md new file mode 100644 index 00000000..c5370e08 --- /dev/null +++ b/docs/classical/self-interpreter/typed-normal.md @@ -0,0 +1,106 @@ +# A simply typed beta-normal self-interpreter + + +The complete construction is `data/self-interpreter/machines/int672_typed_normal.lam`, **672 bits**. It is +syntactically beta-normal and passes ordinary simple-type inference with an +occurs check. Current finite verification results are in `docs/STATUS.md` and +`data/self-interpreter/theory/typed_normal.json`. The general contract is +the syntactic reduction argument below, rather than a finite observation. + +The important result is the construction, rather than its size. In +particular, **simple typability of the interpreter alone cannot be an +unconditional exclusion**. Actual applications to quotations need not admit +the interpreter's inferred type. + +Let `E0` be any closed correct interpreter, `I = λx.x`, and + +```text +B = λk.k I I. +``` + +For source variables all assigned one base type `o`, define the translation +with two free cast parameters: + +```text +u : o -> o -> o +d : (o -> o) -> o + +x* = x +(M N)* = u M* N* +(λx.M)* = d (λx.M*). +``` + +Induction on syntax proves: + +1. Every `M*` has simple type `o`, given its source variables type `o`. +2. `M*` is beta-normal, regardless of redexes in `M`: every translated + application is headed by `u`, and every translated abstraction is guarded + by `d`. +3. Substituting `u := I` and `d := I` gives a finite beta reduction to `M`. + This reduction can be performed by removing only the added cast redexes; + it does not require normalizing any original redex of `M`. + +For variables `C,R`, put + +```text +T(C,R) = λu d.(E0 C (cons K R))*. + +E_typed = λC S.S (λbit R.bit B R T(C,R)). +``` + +Here `C,R` are source variables in the translation, both assigned type `o`. +The first bit of every closed source is `K`, so + +```text +E_typed C (cons K R) + ->* K B R T(C,R) + ->* B T(C,R) + ->* T(C,R) I I + ->* E0 C (cons K R). +``` + +This is a finite beta-reduction for every remainder and continuation, +including divergent ones. It transfers the exact beta contract; no eta law +is used. + +To see the simple typing of the complete interpreter explicitly, write + +```text +U = (o -> o -> o) -> ((o -> o) -> o) -> o +``` + +for the type of `T`. Choose any simple type `Q` of the closed affine packet +`B`, and give + +```text +bit : Q -> o -> (U -> o). +``` + +Then `λbit R.bit B R T(C,R)` has type + +```text +(Q -> o -> (U -> o)) -> o -> o, +``` + +and `S` is assigned the corresponding consumer type. This establishes a +simple type for `E_typed`. The actual bit `K` does not fit this assigned type; +that is precisely where the evaluated application leaves the simply typed +fragment. All subterms of `E_typed` remain beta-normal. + +`tools/self-interpreter/theory/typed_normal.py` constructs the AST directly, round-trips its named source, +checks syntactic normality, infers a simple type, and optionally runs the +bounded battery: + +```text +python tools/self-interpreter/theory/typed_normal.py --battery +``` + +As a smaller illustration of the same typing issue, + +```text +T_omega = λu d.u (d (λx.u x x)) (d (λx.u x x)) +``` + +is simply typable, while `T_omega I I ->* Omega`. Packaging the two identities +in the closed affine `B` yields two individually simply typed closed terms +whose application diverges. diff --git a/lean/Blc.lean b/lean/Blc.lean index c9f7e712..be4b5b3b 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -16,3 +16,8 @@ import Blc.Wire import Blc.Selfint import Blc.SelfintProof import Blc.Selfint165 +import Blc.SelfintLowerBound +import Blc.SelfintNormal +import Blc.SelfintCapture +import Blc.SelfintOrigins +import Blc.SelfintSharp diff --git a/lean/Blc/SelfintCapture.lean b/lean/Blc/SelfintCapture.lean new file mode 100644 index 00000000..4735d56b --- /dev/null +++ b/lean/Blc/SelfintCapture.lean @@ -0,0 +1,265 @@ +/- +No live abstraction may capture an enclosing local binder. Global free +variables are explicitly outside the forbidden range. The property is +preserved by full beta reduction, including reduction under lambdas. +Consequently every classical BLC self-interpreter contains a live lambda +that captures an enclosing local variable. The Scott quotation cannot +supply that dependency. This is an unconditional structural necessity, +not an unrestricted 165-bit size bound. +-/ +import Blc.SelfintProof +import Blc.Confluence +import Blc.Par + +namespace Blc +namespace SelfintCapture +open Term + +/-- `Separated d t` regards free indices below d as enclosing local +binders; indices at or above d are unrestricted global rigid variables. -/ +def Separated : Nat → Term → Prop + | _, .var _ => True + | d, .app f a => Separated d f ∧ Separated d a + | d, .lam b => Separated (d + 1) b ∧ + (0 < occ 0 b → ∀ i, i < d → occ (i + 1) b = 0) + +def decSeparated : (d : Nat) → (t : Term) → Decidable (Separated d t) + | _, .var _ => .isTrue trivial + | d, .app f a => + have _ := decSeparated d f + have _ := decSeparated d a + inferInstanceAs (Decidable (_ ∧ _)) + | d, .lam b => + have _ := decSeparated (d + 1) b + inferInstanceAs (Decidable (_ ∧ _)) + +instance (d : Nat) (t : Term) : Decidable (Separated d t) := decSeparated d t + +/-- Inserting an unused local slot preserves separation. -/ +theorem separated_shift (t : Term) (d c : Nat) (hc : c ≤ d) + (ht : Separated d t) : Separated (d + 1) (shift 1 c t) := by + induction t generalizing d c with + | var n => simp only [shift]; split <;> trivial + | app f a ihf iha => + exact ⟨ihf d c hc ht.1, iha d c hc ht.2⟩ + | lam b ih => + refine ⟨ih (d + 1) (c + 1) (by omega) ht.1, ?_⟩ + intro live i hi + rw [occ_shift_lt b 0 (c + 1) (by omega)] at live + by_cases hlt : i + 1 < c + 1 + · rw [occ_shift_lt b (i + 1) (c + 1) hlt] + exact ht.2 live i (by omega) + · by_cases heq : i + 1 = c + 1 + · rw [heq, occ_shift_eq] + · have hgt : c + 1 ≤ i := by omega + have hip : 0 < i := by omega + have he : i + 1 = (i - 1) + 1 + 1 := by omega + rw [he, occ_shift_ge b ((i - 1) + 1) (c + 1) (by omega)] + exact ht.2 live (i - 1) (by omega) + +/-- Deleting a local slot by capture-avoiding substitution preserves +separation. A live inner binder cannot contain the substituted local, +so no inserted argument can newly connect two live nested binders. -/ +theorem separated_subst (t a : Term) (d j : Nat) (hj : j ≤ d) + (ht : Separated (d + 1) t) (ha : Separated d a) : + Separated d (substDec j a t) := by + induction t generalizing a d j with + | var n => + simp only [substDec] + split + · exact ha + · split <;> trivial + | app f x ihf ihx => + exact ⟨ihf a d j hj ht.1 ha, ihx a d j hj ht.2 ha⟩ + | lam b ih => + refine ⟨ih (shift 1 0 a) (d + 1) (j + 1) (by omega) ht.1 + (separated_shift a d 0 (by omega) ha), ?_⟩ + intro live i hi + rw [occ_substDec_lt b (shift 1 0 a) 0 (j + 1) (by omega), + occ_shift_eq, Nat.mul_zero, Nat.add_zero] at live + have hcut : occ (j + 1) b = 0 := ht.2 live j (by omega) + by_cases hlt : i + 1 < j + 1 + · rw [occ_substDec_lt b (shift 1 0 a) (i + 1) (j + 1) hlt, + hcut, Nat.zero_mul, Nat.add_zero] + exact ht.2 live i (by omega) + · rw [occ_substDec_ge b (shift 1 0 a) (i + 1) (j + 1) (by omega), + hcut, Nat.zero_mul, Nat.add_zero] + exact ht.2 live (i + 1) (by omega) + +/-- Reduction cannot introduce an absent free variable. -/ +theorem occ_beta_zero {t u : Term} (h : Beta t u) (j : Nat) + (ht : occ j t = 0) : occ j u = 0 := by + induction h generalizing j with + | beta b a => + simp only [occ, Nat.add_eq_zero_iff] at ht + rw [contract, occ_substDec_ge b a j 0 (by omega), ht.1, ht.2] + simp + | appL a h ih => + simp only [occ, Nat.add_eq_zero_iff] at ht ⊢ + exact ⟨ih j ht.1, ht.2⟩ + | appR f h ih => + simp only [occ, Nat.add_eq_zero_iff] at ht ⊢ + exact ⟨ht.1, ih j ht.2⟩ + | lam h ih => exact ih (j + 1) ht + +theorem separated_beta {t u : Term} (h : Beta t u) (d : Nat) + (ht : Separated d t) : Separated d u := by + induction h generalizing d with + | beta b a => exact separated_subst b a d 0 (by omega) ht.1.1 ht.2 + | appL a h ih => exact ⟨ih d ht.1, ht.2⟩ + | appR f h ih => exact ⟨ht.1, ih d ht.2⟩ + | @lam b b' h ih => + refine ⟨ih (d + 1) ht.1, ?_⟩ + intro live i hi + have oldlive : 0 < occ 0 b := by + by_cases hz : occ 0 b = 0 + · have := occ_beta_zero h 0 hz + omega + · omega + exact occ_beta_zero h (i + 1) (ht.2 oldlive i hi) + +theorem separated_betas {t u : Term} (h : Betas t u) (d : Nat) + (ht : Separated d t) : Separated d u := by + induction h with + | refl => exact ht + | head hb _ ih => exact ih (separated_beta hb d ht) + +/-- Scott quotation contributes no live capture among its own binders. -/ +theorem separated_pair (a r : Term) (ha : Separated 0 a) (hr : Separated 0 r) : + Separated 0 (pairT a r) := by + refine ⟨⟨⟨trivial, separated_shift a 0 0 (by omega) ha⟩, + separated_shift r 0 0 (by omega) hr⟩, ?_⟩ + intro _ i hi + omega + +theorem separated_bit (b : Bool) : Separated 0 (churchBit b) := by + cases b <;> decide + +theorem separated_stream (bs : List Bool) (r : Term) (hr : Separated 0 r) : + Separated 0 (streamOf bs r) := by + induction bs with + | nil => exact hr + | cons b bs ih => exact separated_pair _ _ (separated_bit b) ih + +/-- The source lambda a b.a b uses both a local binder and a capture. -/ +def mixed : Term := .lam (.lam (.app (.var 1) (.var 0))) + +def target : Term := .app (.app (.var 0) (.lam mixed)) (.var 1) + +theorem target_normal : NormalForm target := + fun _ hb => nft_no_beta (by decide : NFt target) hb + +theorem target_not_separated : ¬ Separated 0 target := by decide + +/-- Unconditional structural necessity: some live abstraction of every +self-interpreter captures an enclosing local variable. Input K/F/cells +cannot supply this mixed dependency from nothing. -/ +theorem selfinterpreter_not_separated (E : Term) (hE : IsSelfInterpreter E) : + ¬ Separated 0 E := by + intro hsep + obtain ⟨u, hsource, htarget⟩ := hE.2 mixed (by decide) + have heq : u = target := normalForm_betas_eq target_normal htarget + subst u + have hs : Separated 0 (.app (.app E (.var 0)) + (streamOf (blcCode mixed) (.var 1))) := + ⟨⟨hsep, trivial⟩, separated_stream _ _ trivial⟩ + exact target_not_separated (separated_betas hsource 0 hs) + + +/-- A concrete live-capture witness, found at some abstraction subterm. -/ +def HasLiveCapture : Nat → Term → Prop + | _, .var _ => False + | d, .app f a => HasLiveCapture d f ∨ HasLiveCapture d a + | d, .lam b => HasLiveCapture (d + 1) b ∨ + (0 < occ 0 b ∧ ∃ i, i < d ∧ 0 < occ (i + 1) b) + +theorem local_capture_of_not_all_zero (d : Nat) (b : Term) + (h : ¬ ∀ i, i < d → occ (i + 1) b = 0) : + ∃ i, i < d ∧ 0 < occ (i + 1) b := by + induction d with + | zero => exact (h (fun i hi => (Nat.not_lt_zero i hi).elim)).elim + | succ d ih => + by_cases hz : occ (d + 1) b = 0 + · by_cases hall : ∀ i, i < d → occ (i + 1) b = 0 + · apply False.elim + apply h + intro i hi + by_cases hlt : i < d + · exact hall i hlt + · have heq : i = d := by omega + simpa [heq] using hz + · obtain ⟨i, hi, hc⟩ := ih hall + exact ⟨i, by omega, hc⟩ + · exact ⟨d, by omega, by omega⟩ + +theorem hasLiveCapture_of_not_separated (t : Term) (d : Nat) + (h : ¬ Separated d t) : HasLiveCapture d t := by + induction t generalizing d with + | var n => exact (h trivial).elim + | app f a ihf iha => + by_cases hf : Separated d f + · exact Or.inr (iha d (fun ha => h ⟨hf, ha⟩)) + · exact Or.inl (ihf d hf) + | lam b ih => + by_cases hb : Separated (d + 1) b + · by_cases hlive : 0 < occ 0 b + · right + exact ⟨hlive, local_capture_of_not_all_zero d b + (fun hzero => h ⟨hb, fun _ => hzero⟩)⟩ + · exact (h ⟨hb, fun live => (hlive live).elim⟩).elim + · exact Or.inl (ih (d + 1) hb) + +theorem selfinterpreter_has_live_capture (E : Term) (hE : IsSelfInterpreter E) : + HasLiveCapture 0 E := + hasLiveCapture_of_not_separated E 0 (selfinterpreter_not_separated E hE) + +/-- All variable leaves use de Bruijn index zero. -/ +def ZeroIndices : Term → Prop + | .var n => n = 0 + | .lam b => ZeroIndices b + | .app f a => ZeroIndices f ∧ ZeroIndices a + +theorem zeroIndices_occ (t : Term) (h : ZeroIndices t) (j : Nat) (hj : 0 < j) : + occ j t = 0 := by + induction t generalizing j with + | var n => + simp only [ZeroIndices] at h + subst n + simp [occ, Nat.ne_of_lt hj] + | lam b ih => exact ih h (j + 1) (by omega) + | app f a ihf iha => simp only [occ, ihf h.1 j hj, iha h.2 j hj, Nat.add_zero] + +theorem zeroIndices_separated (t : Term) (h : ZeroIndices t) (d : Nat) : + Separated d t := by + induction t generalizing d with + | var n => trivial + | app f a ihf iha => exact ⟨ihf h.1 d, iha h.2 d⟩ + | lam b ih => + exact ⟨ih h (d + 1), fun _ i _ => zeroIndices_occ b h (i + 1) (by omega)⟩ + +theorem selfinterpreter_not_zeroIndices (E : Term) (hE : IsSelfInterpreter E) : + ¬ ZeroIndices E := + fun h => selfinterpreter_not_separated E hE (zeroIndices_separated E h 0) + +/-- The X term in the BLC size identity. -/ +def indexSum : Term → Nat + | .var n => n + | .lam b => indexSum b + | .app f a => indexSum f + indexSum a + +theorem zeroIndices_of_indexSum_zero (t : Term) (h : indexSum t = 0) : ZeroIndices t := by + induction t with + | var n => exact h + | lam b ih => exact ih h + | app f a ihf iha => + simp only [indexSum, Nat.add_eq_zero_iff] at h + exact ⟨ihf h.1, iha h.2⟩ + +theorem selfinterpreter_indexSum_pos (E : Term) (hE : IsSelfInterpreter E) : + 0 < indexSum E := by + by_cases hz : indexSum E = 0 + · exact (selfinterpreter_not_zeroIndices E hE (zeroIndices_of_indexSum_zero E hz)).elim + · omega + +end SelfintCapture +end Blc diff --git a/lean/Blc/SelfintLowerBound.lean b/lean/Blc/SelfintLowerBound.lean new file mode 100644 index 00000000..cd2ee268 --- /dev/null +++ b/lean/Blc/SelfintLowerBound.lean @@ -0,0 +1,402 @@ +/- +Structural lower bounds for the rigid-tail self-interpreter contract. +A nonlinear binder is a lambda whose own variable occurs at least twice. +The normalization argument counts nonlinear binders, not redexes or a +particular interpreter decomposition. +-/ +import Blc.SelfintProof +import Blc.Confluence +import Blc.Rigid + +namespace Blc +open Term +namespace SelfintLowerBound + +/-- Number of syntactically nonlinear binders. Free variables are unrestricted. -/ +def nonlinear : Term → Nat + | .var _ => 0 + | .lam b => nonlinear b + if 1 < occ 0 b then 1 else 0 + | .app f a => nonlinear f + nonlinear a + +/-- Ordinary tree nodes, independently of de Bruijn wire lengths. -/ +def nodes : Term → Nat + | .var _ => 1 + | .lam b => nodes b + 1 + | .app f a => nodes f + nodes a + 1 + +theorem nodes_pos (t : Term) : 0 < nodes t := by + cases t <;> simp [nodes] <;> omega + +theorem nodes_shift (t : Term) (c : Nat) : nodes (shift 1 c t) = nodes t := by + induction t generalizing c with + | var n => simp only [shift]; split <;> rfl + | lam b ih => simp [shift, nodes, ih] + | app f a ihf iha => simp [shift, nodes, ihf, iha] + +theorem nonlinear_shift (t : Term) (c : Nat) : + nonlinear (shift 1 c t) = nonlinear t := by + induction t generalizing c with + | var n => simp only [shift]; split <;> rfl + | lam b ih => + simp only [shift, nonlinear, ih] + rw [occ_shift_lt b 0 (c + 1) (by omega)] + | app f a ihf iha => simp [shift, nonlinear, ihf, iha] + +/-- Capture-avoiding substitution does not change any binder already in the +body; it inserts one copy of the argument's binders at each substituted leaf. -/ +theorem nonlinear_subst (t s : Term) (j : Nat) : + nonlinear (substDec j s t) = nonlinear t + occ j t * nonlinear s := by + induction t generalizing s j with + | var n => + simp only [substDec, occ, nonlinear] + split <;> simp_all + split <;> simp [nonlinear] + | lam b ih => + simp only [substDec, nonlinear, occ] + rw [occ_substDec_lt b (shift 1 0 s) 0 (j + 1) (by omega), occ_shift_eq s 0] + simp only [Nat.mul_zero, Nat.add_zero] + rw [ih, nonlinear_shift] + omega + | app f a ihf iha => + simp only [substDec, nonlinear, occ, ihf, iha, Nat.add_mul] + omega + +/-- Exact ordinary-node substitution accounting, written without subtraction. -/ +theorem nodes_subst (t s : Term) (j : Nat) : + nodes (substDec j s t) + occ j t = nodes t + occ j t * nodes s := by + induction t generalizing s j with + | var n => + simp only [substDec, occ, nodes] + split + · simp_all [Nat.add_comm] + · split <;> simp_all [nodes] + | lam b ih => + simp only [substDec, nodes, occ] + have h := ih (shift 1 0 s) (j + 1) + rw [nodes_shift] at h + omega + | app f a ihf iha => + simp only [substDec, nodes, occ, Nat.add_mul] + have hf := ihf s j + have ha := iha s j + omega + +/-- Weak-head step: never reduces underneath a lambda. -/ +def weakStep : Term → Option Term + | .var _ => none + | .lam _ => none + | .app (.lam b) a => some (contract b a) + | .app f a => (weakStep f).map (Term.app · a) + +theorem weakStep_beta {t u : Term} (h : weakStep t = some u) : Beta t u := by + induction t generalizing u with + | var n => simp [weakStep] at h + | lam b ih => simp [weakStep] at h + | app f a ihf iha => + cases f with + | lam b => simp [weakStep] at h; subst u; exact .beta _ _ + | var n => simp [weakStep] at h + | app g b => + simp only [weakStep, Option.map_eq_some_iff] at h + obtain ⟨v, hv, rfl⟩ := h + exact .appL a (ihf hv) + +/-- With at most one nonlinear binder, a weak-head step either shrinks the +ordinary syntax while preserving the bound, or consumes its only nonlinear +binder and leaves an affine term. There are no enclosing lambdas on this path. -/ +theorem weakStep_progress {t u : Term} (ht : nonlinear t ≤ 1) + (h : weakStep t = some u) : + (nodes u < nodes t ∧ nonlinear u ≤ nonlinear t) ∨ + (nonlinear t = 1 ∧ nonlinear u = 0) := by + induction t generalizing u with + | var n => simp [weakStep] at h + | lam b ih => simp [weakStep] at h + | app f a ihf iha => + cases f with + | var n => simp [weakStep] at h + | lam b => + simp only [weakStep, Option.some.injEq] at h + subst u + have hn := nodes_subst b a 0 + have hp := nodes_pos a + by_cases hb : occ 0 b ≤ 1 + · left + have hno : ¬ 1 < occ 0 b := by omega + simp only [contract, nonlinear_subst, nonlinear, if_neg hno, Nat.add_zero, nodes] + rcases Nat.le_one_iff_eq_zero_or_eq_one.mp hb with hz | ho + · simp only [hz, Nat.zero_mul, Nat.add_zero] at hn ⊢ + constructor <;> omega + · simp only [ho, Nat.one_mul] at hn ⊢ + constructor <;> omega + · right + have hyes : 1 < occ 0 b := by omega + simp only [nonlinear, if_pos hyes] at ht ⊢ + have hnb : nonlinear b = 0 := by omega + have hna : nonlinear a = 0 := by omega + simp [contract, nonlinear_subst, hnb, hna] + | app g b => + simp only [weakStep, Option.map_eq_some_iff] at h + obtain ⟨v, hv, rfl⟩ := h + have hsmall : nonlinear (.app g b) ≤ 1 := by + simp only [nonlinear] at ht ⊢; omega + rcases ihf hsmall hv with ⟨hn, hc⟩ | ⟨hc, hz⟩ + · left; simp only [nodes, nonlinear] at hn hc ⊢; constructor <;> omega + · right; simp only [nonlinear] at ht hc ⊢; constructor <;> omega + +theorem weakStep_none_rigid {t : Term} (h : weakStep t = none) + (hl : ¬ IsLam t) : Rigid t := by + induction t with + | var n => exact .var n + | lam b ih => exact (hl trivial).elim + | app f a ihf iha => + apply Rigid.app a + cases f with + | var n => exact .var n + | lam b => simp [weakStep] at h + | app g b => + apply ihf + · simpa only [weakStep, Option.map_eq_none_iff] using h + · exact fun h => h + +theorem rigid_betas {t u : Term} (hr : Rigid t) (h : Betas t u) : Rigid u := by + induction h with + | refl => exact hr + | head hb _ ih => exact ih (rigid_beta hr hb) + +/-- Binder-affine terms normalize. Free-variable multiplicity is immaterial. -/ +theorem affine_normalizes (t : Term) (ht : nonlinear t = 0) : + ∃ n, Betas t n ∧ NFt n := by + generalize hm : nodes t = m + induction m using Nat.strongRecOn generalizing t with + | ind m ih => + cases hs : weakStep t with + | some u => + have hp := weakStep_progress (by omega : nonlinear t ≤ 1) hs + rcases hp with ⟨hn, hc⟩ | ⟨hc, _⟩ + · obtain ⟨n, hr, hnf⟩ := ih (nodes u) (by omega) u (by omega) rfl + exact ⟨n, Betas.head (weakStep_beta hs) hr, hnf⟩ + · exfalso; omega + | none => + cases t with + | var v => exact ⟨.var v, .refl _, trivial⟩ + | lam b => + have hb : nonlinear b = 0 := by simp only [nonlinear] at ht; omega + obtain ⟨n, hr, hnf⟩ := ih (nodes b) (by simp [nodes] at hm; omega) b hb rfl + exact ⟨.lam n, betas_lam hr, hnf⟩ + | app f a => + have hf : nonlinear f = 0 := by simp only [nonlinear] at ht; omega + have ha : nonlinear a = 0 := by simp only [nonlinear] at ht; omega + have hr : Rigid (.app f a) := weakStep_none_rigid hs (fun h => h) + have hrf : Rigid f := by cases hr; assumption + obtain ⟨nf, hf', hnff⟩ := ih (nodes f) (by simp [nodes] at hm; omega) f hf rfl + obtain ⟨na, ha', hnfa⟩ := ih (nodes a) (by simp [nodes] at hm; omega) a ha rfl + refine ⟨.app nf na, betas_app hf' ha', ?_, hnff, hnfa⟩ + intro hnl + cases nf with + | var => exact hnl + | app => exact hnl + | lam b => exact rigid_not_lam (rigid_betas hrf hf') b rfl + +/-- Every term with at most one nonlinear binder has a beta-normal form. +This is weak normalization; no claim of strong normalization is needed. -/ +theorem one_nonlinear_normalizes (t : Term) (ht : nonlinear t ≤ 1) : + ∃ n, Betas t n ∧ NFt n := by + generalize hm : nodes t = m + induction m using Nat.strongRecOn generalizing t with + | ind m ih => + cases hs : weakStep t with + | some u => + rcases weakStep_progress ht hs with ⟨hn, hc⟩ | ⟨_, hz⟩ + · obtain ⟨n, hr, hnf⟩ := ih (nodes u) (by omega) u (by omega) rfl + exact ⟨n, Betas.head (weakStep_beta hs) hr, hnf⟩ + · obtain ⟨n, hr, hnf⟩ := affine_normalizes u hz + exact ⟨n, Betas.head (weakStep_beta hs) hr, hnf⟩ + | none => + cases t with + | var v => exact ⟨.var v, .refl _, trivial⟩ + | lam b => + have hb : nonlinear b ≤ 1 := by simp only [nonlinear] at ht; omega + obtain ⟨n, hr, hnf⟩ := ih (nodes b) (by simp [nodes] at hm; omega) b hb rfl + exact ⟨.lam n, betas_lam hr, hnf⟩ + | app f a => + have hf : nonlinear f ≤ 1 := by simp only [nonlinear] at ht; omega + have ha : nonlinear a ≤ 1 := by simp only [nonlinear] at ht; omega + have hr : Rigid (.app f a) := weakStep_none_rigid hs (fun h => h) + have hrf : Rigid f := by cases hr; assumption + obtain ⟨nf, hf', hnff⟩ := ih (nodes f) (by simp [nodes] at hm; omega) f hf rfl + obtain ⟨na, ha', hnfa⟩ := ih (nodes a) (by simp [nodes] at hm; omega) a ha rfl + refine ⟨.app nf na, betas_app hf' ha', ?_, hnff, hnfa⟩ + intro hnl + cases nf with + | var => exact hnl + | app => exact hnl + | lam b => exact rigid_not_lam (rigid_betas hrf hf') b rfl + + +/-- Quotation contributes no nonlinear binder, irrespective of its data bits. -/ +theorem nonlinear_pair (a r : Term) : + nonlinear (pairT a r) = nonlinear a + nonlinear r := by + simp only [pairT, nonlinear, occ, occ_shift_eq, Nat.add_zero] + rw [nonlinear_shift, nonlinear_shift] + simp + +theorem nonlinear_bit (b : Bool) : nonlinear (churchBit b) = 0 := by + cases b <;> decide + +theorem nonlinear_stream (bs : List Bool) (r : Term) : + nonlinear (streamOf bs r) = nonlinear r := by + induction bs with + | nil => rfl + | cons b bs ih => + change nonlinear (pairT (churchBit b) (streamOf bs r)) = nonlinear r + rw [nonlinear_pair, nonlinear_bit, ih, Nat.zero_add] + +private def delta : Term := .lam (.app (.var 0) (.var 0)) +private def omegaTerm : Term := .app delta delta +private theorem omega_spine : Spine omegaTerm := Spine.redex (by decide) (by decide) +private theorem omega_step : Beta omegaTerm omegaTerm := by + exact Beta.beta (.app (.var 0) (.var 0)) delta +private theorem omega_beta_eq {u : Term} (h : Beta omegaTerm u) : u = omegaTerm := by + have hs := headStep_complete (spine_beta_head omega_spine h) + exact Option.some.inj hs.symm +private theorem omega_betas_eq {u : Term} (h : Betas omegaTerm u) : u = omegaTerm := by + have aux : ∀ t v, Betas t v → t = omegaTerm → v = omegaTerm := by + intro t v hs + induction hs with + | refl => exact id + | head hb _ ih => + intro ht + apply ih + subst ht + exact omega_beta_eq hb + exact aux _ _ h rfl +private theorem omega_no_nf : ¬ HasNormalForm omegaTerm := by + rintro ⟨n, hr, hnf⟩ + have he := omega_betas_eq hr + subst n + exact hnf _ omega_step + +private theorem omega_output_no_nf : + ¬ HasNormalForm (.app (.app (.var 0) (.lam omegaTerm)) (.var 1)) := by + rintro ⟨n, hr, hnf⟩ + obtain ⟨⟨m, hm, hnfm⟩, _⟩ := rigid_app_betas_nf hr hnf rfl (.app _ (.var 0)) + obtain ⟨_, ⟨v, hv, hnfv⟩⟩ := rigid_app_betas_nf hm hnfm rfl (.var 0) + exact omega_no_nf (lam_betas_nf hv hnfv rfl) + +/-- Every self-interpreter has at least two syntactically nonlinear binders. +One closed program (Omega) witnesses the obstruction; no bounded census or +candidate enumeration enters the proof. -/ +theorem selfInterpreter_two_nonlinear {E : Term} (hE : IsSelfInterpreter E) : + 2 ≤ nonlinear E := by + apply Nat.le_of_not_lt + intro hn + have hsmall : nonlinear E ≤ 1 := by omega + let source : Term := .app (.app E (.var 0)) (streamOf (blcCode omegaTerm) (.var 1)) + have hsource : nonlinear source ≤ 1 := by + simp only [source, nonlinear, nonlinear_stream, Nat.add_zero] + exact hsmall + obtain ⟨nf, hr, hnft⟩ := one_nonlinear_normalizes source hsource + have hnf : NormalForm nf := fun _ h => nft_no_beta hnft h + obtain ⟨w, hw1, hw2⟩ := hE.2 omegaTerm (by decide) + obtain ⟨v, hv, hnfv⟩ := betas_preserve_hasNormalForm hw1 ⟨nf, hr, hnf⟩ + exact omega_output_no_nf ⟨v, betas_trans hw2 hv, hnfv⟩ + + +/-- Free variable leaves above a de Bruijn cutoff, counting multiplicity. -/ +def freeLeaves (c : Nat) : Term → Nat + | .var n => if c ≤ n then 1 else 0 + | .lam b => freeLeaves (c + 1) b + | .app f a => freeLeaves c f + freeLeaves c a + +theorem freeLeaves_split (t : Term) (c : Nat) : + freeLeaves c t = occ c t + freeLeaves (c + 1) t := by + induction t generalizing c with + | var n => + simp only [freeLeaves, occ] + repeat' first | split | omega + | lam b ih => exact ih (c + 1) + | app f a ihf iha => + simp only [freeLeaves, occ] + rw [ihf c, iha c] + omega + +/-- Each nonlinear binder costs at least ten bits in aggregate, with a +two-bit endpoint correction. The free-leaf term makes the induction valid +for open subterms and accounts for every bound occurrence exactly once. -/ +theorem nonlinear_wire_bound (t : Term) : + 10 * nonlinear t + 4 * freeLeaves 0 t ≤ (blcCode t).length + 2 := by + induction t with + | var n => simp [nonlinear, freeLeaves, blcCode] + | lam b ih => + have hs := freeLeaves_split b 0 + simp only [nonlinear, freeLeaves, blcCode, List.length_cons] + split <;> omega + | app f a ihf iha => + simp only [nonlinear, freeLeaves, blcCode, List.length_cons, List.length_append] + omega + +/-- A small unconditional numeric consequence. This is not a 165-bit +optimality result: the substantive new invariant is the two-binder theorem. -/ +theorem selfintSizeBound_eighteen : SelfintSizeBound 18 := by + intro E hE + have hn := selfInterpreter_two_nonlinear hE + have hs := nonlinear_wire_bound E + omega + + +/-- Arbitrary lifting preserves nonlinear-binder count. -/ +theorem nonlinear_shift_any (t : Term) (d c : Nat) : + nonlinear (shift d c t) = nonlinear t := by + induction d with + | zero => rw [shift_zero] + | succ d ih => + have hs := shift_shift_add t 1 d c c (by omega) (by omega) + have he : 1 + d = d + 1 := by omega + rw [he] at hs + rw [← hs, nonlinear_shift, ih] + +/-- Any finite simultaneous instantiation by affine arguments preserves +exactly the body's nonlinear count, whatever the variables' multiplicities. -/ +theorem nonlinear_instN (as : List Term) (j : Nat) (t : Term) + (ha : ∀ a ∈ as, nonlinear a = 0) : + nonlinear (instN as j t) = nonlinear t := by + induction as generalizing j t with + | nil => rfl + | cons a as ih => + have hna : nonlinear a = 0 := ha a (by simp) + have hrest : ∀ u ∈ as, nonlinear u = 0 := by + intro u hu; exact ha u (by simp [hu]) + simp only [instN, nonlinear_subst, nonlinear_shift_any, hna, Nat.mul_zero, + Nat.add_zero] + exact ih (j + 1) t hrest + +private theorem selfInterpreter_omega_input_no_nf {E : Term} + (hE : IsSelfInterpreter E) : + ¬ HasNormalForm (.app (.app E (.var 0)) (streamOf (blcCode omegaTerm) (.var 1))) := by + intro hsource + obtain ⟨w, hw1, hw2⟩ := hE.2 omegaTerm (by decide) + obtain ⟨v, hv, hnfv⟩ := betas_preserve_hasNormalForm hw1 hsource + exact omega_output_no_nf ⟨v, betas_trans hw2 hv, hnfv⟩ + +/-- Duplicating the public continuation or stream cannot supply the two +nonlinear binders required by computation: those interface binders disappear +when their affine arguments are supplied. This applies to every body shape. -/ +theorem selfInterpreter_two_inside_interface {B : Term} + (hE : IsSelfInterpreter (.lam (.lam B))) : 2 ≤ nonlinear B := by + apply Nat.le_of_not_lt + intro hn + let S := streamOf (blcCode omegaTerm) (.var 1) + let inner := substDec 1 (shift 1 0 (.var 0)) B + let result := contract inner S + have hc : nonlinear result = nonlinear B := by + simp only [result, inner, contract, nonlinear_subst, S, nonlinear_stream, + nonlinear_shift, nonlinear, Nat.mul_zero, Nat.add_zero] + obtain ⟨nf, hr, hnf⟩ := one_nonlinear_normalizes result (by omega) + have hs : Betas (.app (.app (.lam (.lam B)) (.var 0)) S) result := + Betas.head (Beta.appL S (Beta.beta (.lam B) (.var 0))) + (Betas.head (Beta.beta inner S) (Betas.refl _)) + exact selfInterpreter_omega_input_no_nf hE + ⟨nf, betas_trans hs hr, fun _ h => nft_no_beta hnf h⟩ + +end SelfintLowerBound +end Blc diff --git a/lean/Blc/SelfintNormal.lean b/lean/Blc/SelfintNormal.lean new file mode 100644 index 00000000..49b91e9b --- /dev/null +++ b/lean/Blc/SelfintNormal.lean @@ -0,0 +1,285 @@ +/- +A beta-normal classical BLC self-interpreter of 204 bits. +Adapted from Blc.Selfint165's parser proof; source-derived generator and +root gate are new. This improves the old 712-bit normal-form witness, +not the unrestricted 165-bit interpreter bound. + +The generator uses the actual first tag to activate a shared recursive +parser binding. The public root uses the first zero of every closed code +to activate its fixed point. Neither source contains a beta redex. + +The literal wire pins the unoptimized source in +`data/self-interpreter/machines/int204_normal.lam`. +-/ +import Blc.Selfint165 +namespace Blc +open Term +set_option maxRecDepth 100000 +set_option maxHeartbeats 4000000 +def generator204 : Term := (.lam (.lam (.lam (.app (.app (.var 0) (.lam (.app (.app (.app (.var 0) (.lam (.lam (.lam (.app (.var 0) (.lam (.app (.var 3) (.lam (.app (.app (.var 1) (.app (.var 7) (.lam (.lam (.app (.var 2) (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 3)))))))))) (.app (.var 4) (.lam (.app (.var 8) (.lam (.app (.app (.var 2) (.var 0)) (.app (.var 1) (.var 0)))))))))))))))) (.lam (.var 3))) (.app (.var 3) (.var 3))))) (.app (.app (.var 0) (.var 0)) (.var 0)))))) +def parser204 : Term := .app generator204 generator204 +def intL204 : Term := (.lam (.lam (.app (.app (.app (.app (.var 0) (.lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (.var 0))))) (.var 0)))) generator204) (.var 1)) (.var 0)))) + +theorem parser204_closed : Closed parser204 := by decide +theorem intL204_closed : Closed intL204 := by decide +theorem shift_parser204 (d c : Nat) : shift d c parser204 = parser204 := + shift_closed d c parser204_closed +theorem substDec_parser204 (j : Nat) (s : Term) : substDec j s parser204 = parser204 := + substDec_closed j s parser204_closed + +/-- The zero branch's `next`, with `cont` free at index `c` and `intL` +resolved to the parser. -/ +def next204 (c : Nat) : Term := + .lam (.app parser204 (.lam (.app (.app (.var 1) (.app (.var (c + 2)) absVt)) + (.app parser204 (.lam (.app (.var (c + 3)) appVt)))))) + +def hndc204 : Term := (.lam (.app (.app (.app (.var 0) (.lam (.lam (.lam (.app (.var 0) (.lam (.app (.var 3) (.lam (.app (.app (.var 1) (.app (.var 6) (.lam (.lam (.app (.var 2) (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 3)))))))))) (.app (.var 4) (.lam (.app (.var 7) (.lam (.app (.app (.var 2) (.var 0)) (.app (.var 1) (.var 0)))))))))))))))) (.lam (.var 2))) parser204)) + +/-- The first parse's continuation, with `cont` free at index 0 and the +second tag bit `b` substituted (the 168's `kont`, calling this parser). -/ +def kont204 (b : Term) : Term := + .lam (.app (.app b (.app (.var 1) absVt)) (.app parser204 (.lam (.app (.var 2) appVt)))) + +theorem substDec_hndc204 (j : Nat) (s : Term) (h : 1 ≤ j) : substDec j s hndc204 = hndc204 := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +theorem substDec_next204 (j : Nat) (s : Term) (h : 1 ≤ j) : + substDec j s (next204 0) = next204 0 := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +theorem substDec_kont204T (j : Nat) (s : Term) (h : 1 ≤ j) : + substDec j s (kont204 churchTrue) = kont204 churchTrue := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +theorem substDec_kont204F (j : Nat) (s : Term) (h : 1 ≤ j) : + substDec j s (kont204 churchFalse) = kont204 churchFalse := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +/-- The reader, closed over `cont = K`. -/ +def hnd204 (K : Term) : Term := substDec 0 K hndc204 + +/-- The zero branch's `next`, closed over `cont = K`. -/ +def nxt204 (K : Term) : Term := substDec 0 K (next204 0) + +/-- ABS's continuation, closed over `cont = K`. -/ +def kA204 (K : Term) : Term := substDec 0 K (kont204 churchTrue) + +/-- APP's first continuation, closed over `cont = K`. -/ +def kB204 (K : Term) : Term := substDec 0 K (kont204 churchFalse) + +-- --------------------------------------------------------------------------- +-- §2. The machine runs, replayed by the kernel on placeholder terms. + +/-- The parser unfolds and runs the stream on the reader and `s s s`. -/ +theorem run_unfold204 : + spineSteps 3 (.app (.app parser204 (.var 0)) (.var 1)) + = some (.app (.app (.var 1) hndc204) (.app (.app (.var 1) (.var 1)) (.var 1))) := by + decide + +/-- Tag `1`: VAR returns `cont list S`. -/ +theorem run_var204 : + spineSteps 5 (.app (.app (pairT churchFalse (.var 1)) hndc204) (.var 2)) + = some (.app (.app (.var 0) (.var 1)) (.var 2)) := by + decide + +/-- Tag `0`: the reader hands `next` to `S`. -/ +theorem run_zero204 : + spineSteps 7 (.app (.app (pairT churchTrue (.var 1)) hndc204) (.var 2)) + = some (.app (.var 2) (next204 0)) := by + decide + +/-- Tags `00`: ABS parses its body under the ABS continuation. -/ +theorem run_lam204 : + spineSteps 2 (.app (pairT churchTrue (.var 1)) (next204 0)) + = some (.app (.app parser204 (kont204 churchTrue)) (.var 1)) := by + decide + +/-- Tags `01`: APP parses its function under the APP continuation. -/ +theorem run_app204 : + spineSteps 2 (.app (pairT churchFalse (.var 1)) (next204 0)) + = some (.app (.app parser204 (kont204 churchFalse)) (.var 1)) := by + decide + +/-- ABS returns its value. -/ +theorem run_retLam204 : + spineSteps 3 (.app (.app (kont204 churchTrue) (.var 1)) (.var 2)) + = some (.app (.app (.var 0) absVc) (.var 2)) := by + decide + +/-- APP's first parse continues into the second. -/ +theorem run_retApp1_204 : + spineSteps 3 (.app (.app (kont204 churchFalse) (.var 1)) (.var 2)) + = some (.app (.app parser204 kont2) (.var 2)) := by + decide + +-- --------------------------------------------------------------------------- +-- §3. The runs, lifted to arbitrary continuations, tails and closures. + +theorem spine_unfold204 (K s : Term) : + SpineReds (.app (.app parser204 K) s) (.app (.app s (hnd204 K)) (.app (.app s s) s)) := by + have h := spineReds_instN [K, s] 0 (spineReds_of_spineSteps _ run_unfold204) + simpa [instN, hnd204, substDec, shift, substDec_parser204, substDec_hndc204, substDec_shift0, + shift_zero] using h + +/-- Tag `1`: `(1:r) (hnd K) S → K r S`. -/ +theorem spine_var204 (K r S : Term) : + SpineReds (.app (.app (pairT churchFalse r) (hnd204 K)) S) (.app (.app K r) S) := by + have h := spineReds_instN [K, r, S] 0 (spineReds_of_spineSteps _ run_var204) + simpa [instN, hnd204, pairT, substDec, shift, shift_churchFalse, substDec_churchFalse, + substDec_hndc204, shift_shift0, substDec_shift0, shift_zero] using h + +/-- Tag `0`: `(0:r) (hnd K) S → S (next K)`. -/ +theorem spine_zero204 (K r S : Term) : + SpineReds (.app (.app (pairT churchTrue r) (hnd204 K)) S) (.app S (nxt204 K)) := by + have h := spineReds_instN [K, r, S] 0 (spineReds_of_spineSteps _ run_zero204) + simpa [instN, hnd204, nxt204, pairT, substDec, shift, shift_churchTrue, substDec_churchTrue, + substDec_hndc204, substDec_next204, shift_shift0, substDec_shift0, shift_zero] using h + +/-- Tags `00`: `(0:r) (next K) → P (kA K) r`. -/ +theorem spine_lam204 (K r : Term) : + SpineReds (.app (pairT churchTrue r) (nxt204 K)) (.app (.app parser204 (kA204 K)) r) := by + have h := spineReds_instN [K, r] 0 (spineReds_of_spineSteps _ run_lam204) + simpa [instN, nxt204, kA204, pairT, substDec, shift, shift_parser204, substDec_parser204, + shift_churchTrue, substDec_churchTrue, substDec_next204, substDec_kont204T, shift_shift0, + substDec_shift0, shift_zero] using h + +/-- Tags `01`: `(1:r) (next K) → P (kB K) r`. -/ +theorem spine_app204 (K r : Term) : + SpineReds (.app (pairT churchFalse r) (nxt204 K)) (.app (.app parser204 (kB204 K)) r) := by + have h := spineReds_instN [K, r] 0 (spineReds_of_spineSteps _ run_app204) + simpa [instN, nxt204, kB204, pairT, substDec, shift, shift_parser204, substDec_parser204, + shift_churchFalse, substDec_churchFalse, substDec_next204, substDec_kont204F, shift_shift0, + substDec_shift0, shift_zero] using h + +theorem ret_lam204 (K e u : Term) : + SpineReds (.app (.app (kA204 K) e) u) (.app (.app K (absV e)) u) := by + have h := spineReds_instN [K, e, u] 0 (spineReds_of_spineSteps _ run_retLam204) + simpa [instN, kA204, absV, absVc, consP, substDec, shift, substDec_kont204T, + shift_shift0, substDec_shift0, shift_zero] using h + +theorem ret_app1_204 (K e u : Term) : + SpineReds (.app (.app (kB204 K) e) u) (.app (.app parser204 (kC K e)) u) := by + have h := spineReds_instN [K, e, u] 0 (spineReds_of_spineSteps _ run_retApp1_204) + simpa [instN, kB204, kC, substDec, shift, substDec_parser204, substDec_kont204F, substDec_kont2, + shift_shift0, substDec_shift0, shift_zero] using h + + +/-- The open parser theorem for the 204: for every term `M` and tail +`R`, one closure `λ.B` denoting and implementing `M`, and for every +third argument `S` that reaches the stream past the first `0`, one +residual `U` spine-reducing to `R` such that, for EVERY continuation +`K`, the stream run on the reader and `S` spine-reduces to `K (λ.B) U`. -/ +theorem parse204 : ∀ (M R : Term), ∃ B, Den M B ∧ Implements (.lam B) M ∧ + ∀ S, SpineReds S (pastZero M R) → ∃ U, SpineReds U R ∧ + ∀ K, SpineReds (.app (.app (streamOf (blcCode M) R) (hnd204 K)) S) + (.app (.app K (.lam B)) U) := by + intro M + induction M with + | var i => + intro R + rw [code_var, streamOf_cons] + have himpl : Implements (streamOf (vbits i) R) (.var i) := by + intro env R' h + exact headReduces_of_spineReds (engine i env R' R _ (List.getElem?_eq_getElem h)) + cases i with + | zero => + exact ⟨_, den_var0 R, himpl, fun S hS => + ⟨S, hS, fun K => spine_var204 K (streamOf (vbits 0) R) S⟩⟩ + | succ j => + rw [stream_vbits_succ] at himpl ⊢ + exact ⟨_, den_varS j R, himpl, fun S hS => + ⟨S, hS, fun K => spine_var204 K _ S⟩⟩ + | lam M ih => + intro R + obtain ⟨B, hD, hI, hP⟩ := ih R + refine ⟨_, den_lam hD, ⟨.lam B, hI, fun ρ a => + headReduces_of_spineReds (spine_absImpl (.lam B) ρ a)⟩, fun S hS => ?_⟩ + obtain ⟨U, hU, hK⟩ := hP _ (pastZero_self M R _ (SpineReds.refl _)) + refine ⟨U, hU, fun K => ?_⟩ + have hS' : SpineReds S (pairT churchTrue (streamOf (blcCode M) R)) := hS + show SpineReds (.app (.app (pairT churchTrue (pairT churchTrue (streamOf (blcCode M) R))) + (hnd204 K)) S) _ + refine spineReds_trans (spine_zero204 K _ S) ?_ + refine spineReds_trans (spineReds_appL _ hS') ?_ + refine spineReds_trans (spine_lam204 K _) ?_ + refine spineReds_trans (spine_unfold204 (kA204 K) _) ?_ + exact spineReds_trans (hK (kA204 K)) (ret_lam204 K (.lam B) U) + | app M N ihM ihN => + intro R + obtain ⟨B₁, hD₁, hI₁, hP₁⟩ := ihM (streamOf (blcCode N) R) + obtain ⟨B₂, hD₂, hI₂, hP₂⟩ := ihN R + refine ⟨_, den_app hD₁ hD₂, ⟨.lam B₁, .lam B₂, hI₁, hI₂, fun ρ => + headReduces_of_spineReds (spine_appImpl (.lam B₁) (.lam B₂) ρ)⟩, fun S hS => ?_⟩ + obtain ⟨U₁, hU₁, hK₁⟩ := hP₁ _ (pastZero_self M _ _ (SpineReds.refl _)) + obtain ⟨U₂, hU₂, hK₂⟩ := hP₂ _ (pastZero_self N R U₁ hU₁) + refine ⟨U₂, hU₂, fun K => ?_⟩ + have hS' : SpineReds S + (pairT churchFalse (streamOf (blcCode M) (streamOf (blcCode N) R))) := by + have e : pastZero (.app M N) R + = pairT churchFalse (streamOf (blcCode M) (streamOf (blcCode N) R)) := by + simp only [pastZero, streamOf_cons, streamOf_append]; rfl + rw [← e]; exact hS + show SpineReds (.app (.app + (pairT churchTrue (pairT churchFalse (streamOf (blcCode M ++ blcCode N) R))) + (hnd204 K)) S) _ + rw [streamOf_append] + refine spineReds_trans (spine_zero204 K _ S) ?_ + refine spineReds_trans (spineReds_appL _ hS') ?_ + refine spineReds_trans (spine_app204 K _) ?_ + refine spineReds_trans (spine_unfold204 (kB204 K) _) ?_ + refine spineReds_trans (hK₁ (kB204 K)) ?_ + refine spineReds_trans (ret_app1_204 K (.lam B₁) U₁) ?_ + refine spineReds_trans (spine_unfold204 (kC K (.lam B₁)) U₁) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ hU₁)) ?_ + exact spineReds_trans (hK₂ (kC K (.lam B₁))) (ret_app2 K (.lam B₁) (.lam B₂) U₂) + +theorem parser204_parse : Parses parser204 := by + intro M R + obtain ⟨B, hD, hI, hP⟩ := parse204 M R + obtain ⟨U, hU, hK⟩ := hP _ (pastZero_self M R _ (SpineReds.refl _)) + exact ⟨B, U, hD, hI, hU, fun C => spineReds_trans (spine_unfold204 C _) (hK C)⟩ + + +/-- The public root uses the first K of every closed source to trigger recursion. -/ +theorem run_root204 : + spineSteps 8 (.app (.app intL204 (.var 0)) (pairT churchTrue (.var 1))) + = some (.app (.app parser204 (.var 0)) (pairT churchTrue (.var 1))) := by decide + +theorem substDec_intL204 (j : Nat) (s : Term) : substDec j s intL204 = intL204 := + substDec_closed j s intL204_closed + +theorem spine_root204 (C R : Term) : + SpineReds (.app (.app intL204 C) (pairT churchTrue R)) + (.app (.app parser204 C) (pairT churchTrue R)) := by + have h := spineReds_instN [C, R] 0 (spineReds_of_spineSteps _ run_root204) + simpa [instN, pairT, substDec, shift, substDec_intL204, substDec_parser204, + shift_churchTrue, substDec_churchTrue, shift_shift0, substDec_shift0, shift_zero] using h + +theorem selfint_contract204 (M : Term) (hM : Closed M) (C N : Term) : + Betas (.app (.app intL204 C) (streamOf (blcCode M) N)) (.app (.app C (.lam M)) N) := by + have hzero : ∃ R, streamOf (blcCode M) N = pairT churchTrue R := by + cases M with + | var i => simp [Closed, FreeUnder] at hM + | lam M => exact ⟨_, rfl⟩ + | app M P => exact ⟨_, rfl⟩ + obtain ⟨R, hR⟩ := hzero + have hr : SpineReds (.app (.app intL204 C) (streamOf (blcCode M) N)) + (.app (.app parser204 C) (streamOf (blcCode M) N)) := by + rw [hR] + exact spine_root204 C R + exact betas_trans (betas_of_spineReds hr) (contract_of_parses parser204_parse M hM C N) + +theorem isSelfInterpreter_intL204 : IsSelfInterpreter intL204 := + ⟨intL204_closed, fun M hM => ⟨_, selfint_contract204 M hM (.var 0) (.var 1), Betas.refl _⟩⟩ + +def intL204Wire : List Bool := [false, false, false, false, false, true, false, true, false, true, false, true, true, false, false, false, false, true, false, true, true, false, false, false, false, false, false, true, true, false, true, false, true, false, false, false, false, false, false, false, false, true, false, true, true, false, false, false, false, true, false, true, false, true, true, false, false, false, false, false, false, false, false, true, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, false, true, true, true, false, false, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, false, true, false, true, true, true, false, true, true, true, false, false, true, true, false, true, true, true, true, false, false, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, true, true, true, true, true, false, false, false, false, true, false, true, true, true, true, false, true, false, false, true, true, true, false, true, false, false, false, true, true, true, true, false, false, true, true, true, true, true, false, true, true, true, true, false, false, true, false, true, true, false, true, false, true, false, true, true, false, true, false] + +theorem wire_intL204 : blcCode intL204 = intL204Wire := by decide + +theorem intL204_size : (blcCode intL204).length = 204 := by decide + +theorem intL204_nft : NFt intL204 := by decide + +theorem intL204_normal : NormalForm intL204 := fun _ h => nft_no_beta intL204_nft h + +end Blc diff --git a/lean/Blc/SelfintOrigins.lean b/lean/Blc/SelfintOrigins.lean new file mode 100644 index 00000000..7355a83e --- /dev/null +++ b/lean/Blc/SelfintOrigins.lean @@ -0,0 +1,786 @@ +/- +Quotation-origin binders retain their guarded shape under arbitrary beta +reduction. Live quotation binders remain affine, capture no enclosing local +variables, and retain normal bodies containing only quotation-origin syntax. +Red interpreter lambdas are unrestricted. This is a provenance theorem, +not a global 165-bit size bound. +-/ +import Blc.SelfintProof +import Blc.Par +import Blc.Confluence + +namespace Blc.QuoteOrigins +open Blc Term + +/-- A rigid head at one specified free index. -/ +inductive RigidAt (j : Nat) : Term → Prop where + | var : RigidAt j (.var j) + | app {f : Term} (a : Term) : RigidAt j f → RigidAt j (.app f a) + +/-- That same free head below zero or more leading lambdas. -/ +inductive HeadAt : Nat → Term → Prop where + | rigid {j : Nat} {t : Term} : RigidAt j t → HeadAt j t + | lam {j : Nat} {b : Term} : HeadAt (j + 1) b → HeadAt j (.lam b) + +theorem rigidAt_occ {j : Nat} {t : Term} (h : RigidAt j t) : 1 ≤ occ j t := by + induction h with + | var => simp [occ] + | app a h ih => simp only [occ]; omega + +theorem rigidAt_shift {k : Nat} {t : Term} (h : RigidAt k t) + (c : Nat) (hc : k < c) : RigidAt k (shift 1 c t) := by + induction h with + | var => simpa [shift, show ¬ k ≥ c from by omega] using (RigidAt.var (j := k)) + | app a h ih => exact RigidAt.app _ ih + +theorem headAt_shift {k : Nat} {t : Term} (h : HeadAt k t) + (c : Nat) (hc : k < c) : HeadAt k (shift 1 c t) := by + induction h generalizing c with + | rigid h => exact .rigid (rigidAt_shift h c hc) + | lam h ih => exact .lam (ih (c + 1) (by omega)) + +theorem rigidAt_subst {k : Nat} {t : Term} (h : RigidAt k t) + (j : Nat) (s : Term) (hj : k < j) : RigidAt k (substDec j s t) := by + induction h with + | var => simpa [substDec, show k ≠ j from by omega, show ¬ k > j from by omega] + using (RigidAt.var (j := k)) + | app a h ih => exact RigidAt.app _ ih + +theorem headAt_subst {k : Nat} {t : Term} (h : HeadAt k t) + (j : Nat) (s : Term) (hj : k < j) : HeadAt k (substDec j s t) := by + induction h generalizing j s with + | rigid h => exact .rigid (rigidAt_subst h j s hj) + | lam h ih => exact .lam (ih (j + 1) (shift 1 0 s) (by omega)) + +/-- Beta reduction cannot create a previously absent free variable. -/ +theorem occ_zero_beta {t u : Term} (h : Beta t u) (j : Nat) + (hz : occ j t = 0) : occ j u = 0 := by + induction h generalizing j with + | beta b a => + simp only [occ] at hz + simp only [contract, occ_substDec_ge b a j 0 (by omega)] + have hb : occ (j + 1) b = 0 := by omega + have ha : occ j a = 0 := by omega + simp [hb, ha] + | appL a h ih => + rename_i f f' + simp only [occ] at hz ⊢ + have hf : occ j f = 0 := by omega + rw [ih j hf] + omega + | appR f h ih => + rename_i a a' + simp only [occ] at hz ⊢ + have ha : occ j a = 0 := by omega + rw [ih j ha] + omega + | lam h ih => exact ih (j + 1) hz + +/-- A unique rigid-head occurrence cannot be copied by reductions below it. -/ +theorem rigidAt_one_beta {k : Nat} {t u : Term} (h : RigidAt k t) + (ho : occ k t = 1) (hb : Beta t u) : RigidAt k u ∧ occ k u = 1 := by + induction h generalizing u with + | var => cases hb + | app a hf ih => + rename_i f + have hfo : occ k f = 1 := by + have hpos := rigidAt_occ hf + simp only [occ] at ho + omega + have hao : occ k a = 0 := by + have hpos := rigidAt_occ hf + simp only [occ] at ho + omega + cases hb with + | beta b a => cases hf + | appL a hb => + obtain ⟨hf', ho'⟩ := ih hfo hb + exact ⟨.app a hf', by simp [occ, ho', hao]⟩ + | appR f hb => + have ha' := occ_zero_beta hb k hao + exact ⟨.app _ hf, by simp [occ, hfo, ha']⟩ + +theorem headAt_one_beta {k : Nat} {t u : Term} (h : HeadAt k t) + (ho : occ k t = 1) (hb : Beta t u) : HeadAt k u ∧ occ k u = 1 := by + induction h generalizing u with + | rigid h => + obtain ⟨hr, ho'⟩ := rigidAt_one_beta h ho hb + exact ⟨.rigid hr, ho'⟩ + | lam h ih => + cases hb with + | lam hb => + obtain ⟨hh, ho'⟩ := ih ho hb + exact ⟨.lam hh, ho'⟩ + +/-- Exact argument count on a specified free-variable head. -/ +inductive SpineAt (j : Nat) : Nat → Term → Prop where + | var : SpineAt j 0 (.var j) + | app {n : Nat} {f : Term} (a : Term) : + SpineAt j n f → SpineAt j (n + 1) (.app f a) + +/-- Exact leading-lambda and head-argument counts. -/ +inductive ShapeAt : Nat → Nat → Nat → Term → Prop where + | spine {j n : Nat} {t : Term} : SpineAt j n t → ShapeAt j 0 n t + | lam {j l n : Nat} {b : Term} : + ShapeAt (j + 1) l n b → ShapeAt j (l + 1) n (.lam b) + +theorem spineAt_rigid {j n : Nat} {t : Term} (h : SpineAt j n t) : + RigidAt j t := by + induction h with + | var => exact .var + | app a h ih => exact .app a ih + +theorem spineAt_shift {k n : Nat} {t : Term} (h : SpineAt k n t) + (c : Nat) (hc : k < c) : SpineAt k n (shift 1 c t) := by + induction h with + | var => simpa [shift, show ¬ k ≥ c from by omega] using (SpineAt.var (j := k)) + | app a h ih => exact .app _ ih + +theorem shapeAt_shift {k l n : Nat} {t : Term} (h : ShapeAt k l n t) + (c : Nat) (hc : k < c) : ShapeAt k l n (shift 1 c t) := by + induction h generalizing c with + | spine h => exact .spine (spineAt_shift h c hc) + | lam h ih => exact .lam (ih (c + 1) (by omega)) + +theorem spineAt_subst {k n : Nat} {t : Term} (h : SpineAt k n t) + (j : Nat) (s : Term) (hj : k < j) : SpineAt k n (substDec j s t) := by + induction h with + | var => simpa [substDec, show k ≠ j from by omega, show ¬ k > j from by omega] + using (SpineAt.var (j := k)) + | app a h ih => exact .app _ ih + +theorem shapeAt_subst {k l n : Nat} {t : Term} (h : ShapeAt k l n t) + (j : Nat) (s : Term) (hj : k < j) : ShapeAt k l n (substDec j s t) := by + induction h generalizing j s with + | spine h => exact .spine (spineAt_subst h j s hj) + | lam h ih => exact .lam (ih (j + 1) (shift 1 0 s) (by omega)) + +theorem spineAt_one_beta {k n : Nat} {t u : Term} (h : SpineAt k n t) + (ho : occ k t = 1) (hb : Beta t u) : SpineAt k n u ∧ occ k u = 1 := by + induction h generalizing u with + | var => cases hb + | app a hf ih => + rename_i f + have hfo : occ k f = 1 := by + have hpos := rigidAt_occ (spineAt_rigid hf) + simp only [occ] at ho + omega + have hao : occ k a = 0 := by + have hpos := rigidAt_occ (spineAt_rigid hf) + simp only [occ] at ho + omega + cases hb with + | beta b a => cases hf + | appL a hb => + obtain ⟨hf', ho'⟩ := ih hfo hb + exact ⟨.app a hf', by simp [occ, ho', hao]⟩ + | appR f hb => + have ha' := occ_zero_beta hb k hao + exact ⟨.app _ hf, by simp [occ, hfo, ha']⟩ + +theorem shapeAt_one_beta {k l n : Nat} {t u : Term} (h : ShapeAt k l n t) + (ho : occ k t = 1) (hb : Beta t u) : ShapeAt k l n u ∧ occ k u = 1 := by + induction h generalizing u with + | spine h => + obtain ⟨hr, ho'⟩ := spineAt_one_beta h ho hb + exact ⟨.spine hr, ho'⟩ + | lam h ih => + cases hb with + | lam hb => + obtain ⟨hh, ho'⟩ := ih ho hb + exact ⟨.lam hh, ho'⟩ + +/-- The only live head skeletons supplied by a quotation: the outer K +binder, the inner F binder, or a Scott cell binder. -/ +def QuoteShape (l n : Nat) : Prop := + (l = 1 ∧ n = 0) ∨ (l = 0 ∧ n = 0) ∨ (l = 0 ∧ n = 2) + +/-- A protected binder is vacuous, or has its only use at the rigid head +of one of the three exact skeletons supplied by quotation. -/ +def Protected (b : Term) : Prop := + occ 0 b = 0 ∨ ∃ l n, QuoteShape l n ∧ ShapeAt 0 l n b ∧ occ 0 b = 1 + +theorem protected_shift {b : Term} (h : Protected b) (c : Nat) : + Protected (shift 1 (c + 1) b) := by + rcases h with hz | ⟨l, n, hq, hh, ho⟩ + · left; rw [occ_shift_lt b 0 (c + 1) (by omega)]; exact hz + · exact Or.inr ⟨l, n, hq, shapeAt_shift hh (c + 1) (by omega), by + rw [occ_shift_lt b 0 (c + 1) (by omega)]; exact ho⟩ + +theorem protected_subst {b : Term} (h : Protected b) (j : Nat) (s : Term) : + Protected (substDec (j + 1) (shift 1 0 s) b) := by + have he : occ 0 (substDec (j + 1) (shift 1 0 s) b) = occ 0 b := by + rw [occ_substDec_lt b (shift 1 0 s) 0 (j + 1) (by omega), occ_shift_eq s 0] + simp + rcases h with hz | ⟨l, n, hq, hh, ho⟩ + · exact Or.inl (he.trans hz) + · exact Or.inr ⟨l, n, hq, shapeAt_subst hh (j + 1) _ (by omega), he.trans ho⟩ + +theorem protected_beta {b b' : Term} (h : Protected b) (hb : Beta b b') : + Protected b' := by + rcases h with hz | ⟨l, n, hq, hh, ho⟩ + · exact Or.inl (occ_zero_beta hb 0 hz) + · exact Or.inr ⟨l, n, hq, shapeAt_one_beta hh ho hb⟩ + +/-- A color is a residual-origin annotation. Beta contraction copies colors +with syntax and deletes the color of the lambda it consumes. -/ +inductive Marked where + | var (n : Nat) + | lam (blue : Bool) (b : Marked) + | app (f a : Marked) +deriving DecidableEq +namespace Marked + +def erase : Marked → Term + | .var n => .var n + | .lam _ b => .lam (erase b) + | .app f a => .app (erase f) (erase a) + +def shift (c : Nat) : Marked → Marked + | .var n => if c ≤ n then .var (n + 1) else .var n + | .lam q b => .lam q (shift (c + 1) b) + | .app f a => .app (shift c f) (shift c a) + +def subst (j : Nat) (s : Marked) : Marked → Marked + | .var n => if n = j then s else if j < n then .var (n - 1) else .var n + | .lam q b => .lam q (subst (j + 1) (shift 0 s) b) + | .app f a => .app (subst j s f) (subst j s a) + +def Good : Marked → Prop + | .var _ => True + | .lam q b => Good b ∧ (q = true → Protected (erase b)) + | .app f a => Good f ∧ Good a + +def BlueAffine : Marked → Prop + | .var _ => True + | .lam q b => BlueAffine b ∧ (q = true → occ 0 (erase b) ≤ 1) + | .app f a => BlueAffine f ∧ BlueAffine a + +theorem erase_shift (t : Marked) (c : Nat) : + erase (shift c t) = Term.shift 1 c (erase t) := by + induction t generalizing c with + | var n => simp [shift, erase, Term.shift]; split <;> rfl + | lam q b ih => simp [shift, erase, Term.shift, ih] + | app f a ihf iha => simp [shift, erase, Term.shift, ihf, iha] + +theorem erase_subst (t s : Marked) (j : Nat) : + erase (subst j s t) = substDec j (erase s) (erase t) := by + induction t generalizing s j with + | var n => simp only [subst, erase, substDec]; split <;> simp; split <;> rfl + | lam q b ih => simp [subst, erase, substDec, ih, erase_shift] + | app f a ihf iha => simp [subst, erase, substDec, ihf, iha] + +theorem good_shift {t : Marked} (h : Good t) (c : Nat) : Good (shift c t) := by + induction t generalizing c with + | var n => simp only [shift]; split <;> trivial + | lam q b ih => + refine ⟨ih h.1 (c + 1), ?_⟩ + intro hq + rw [erase_shift] + exact protected_shift (h.2 hq) c + | app f a ihf iha => exact ⟨ihf h.1 c, iha h.2 c⟩ + +theorem good_subst {t s : Marked} (ht : Good t) (hs : Good s) (j : Nat) : + Good (subst j s t) := by + induction t generalizing s j with + | var n => simp only [subst]; split; exact hs; split <;> trivial + | lam q b ih => + refine ⟨ih ht.1 (good_shift hs 0) (j + 1), ?_⟩ + intro hq + rw [erase_subst, erase_shift] + exact protected_subst (ht.2 hq) j (erase s) + | app f a ihf iha => exact ⟨ihf ht.1 hs j, iha ht.2 hs j⟩ + +inductive Step : Marked → Marked → Prop where + | beta (q : Bool) (b a : Marked) : Step (.app (.lam q b) a) (subst 0 a b) + | appL {f f' : Marked} (a : Marked) : Step f f' → Step (.app f a) (.app f' a) + | appR (f : Marked) {a a' : Marked} : Step a a' → Step (.app f a) (.app f a') + | lam (q : Bool) {b b' : Marked} : Step b b' → Step (.lam q b) (.lam q b') + +inductive Steps : Marked → Marked → Prop where + | refl (t : Marked) : Steps t t + | step {t u v : Marked} : Step t u → Steps u v → Steps t v + +theorem step_erase {t u : Marked} (h : Step t u) : Beta (erase t) (erase u) := by + induction h with + | beta q b a => simpa only [erase, erase_subst, contract] using (Beta.beta (erase b) (erase a)) + | appL a h ih => exact .appL _ ih + | appR f h ih => exact .appR _ ih + | lam q h ih => exact .lam ih + +theorem good_step {t u : Marked} (h : Step t u) (ht : Good t) : Good u := by + induction h with + | beta q b a => exact good_subst ht.1.1 ht.2 0 + | appL a h ih => exact ⟨ih ht.1, ht.2⟩ + | appR f h ih => exact ⟨ht.1, ih ht.2⟩ + | lam q h ih => exact ⟨ih ht.1, fun hq => protected_beta (ht.2 hq) (step_erase h)⟩ + +theorem good_steps {t u : Marked} (h : Steps t u) (ht : Good t) : Good u := by + induction h with + | refl => exact ht + | step h _ ih => exact ih (good_step h ht) + +theorem good_blueAffine {t : Marked} (h : Good t) : BlueAffine t := by + induction t with + | var => trivial + | lam q b ih => + refine ⟨ih h.1, ?_⟩ + intro hq + rcases h.2 hq with hz | ⟨_, _, _, _, ho⟩ <;> omega + | app f a ihf iha => exact ⟨ihf h.1, iha h.2⟩ + +/-- An ordinary beta step has a color-preserving residual step above it. -/ +theorem lift_beta {t : Marked} {u : Term} (h : Beta (erase t) u) : + ∃ v, Step t v ∧ erase v = u := by + generalize he : erase t = z at h + induction h generalizing t with + | beta b a => + cases t with + | var n => cases he + | lam q b => cases he + | app f a => + cases f with + | var n => cases he + | app f x => cases he + | lam q b => + cases he + exact ⟨subst 0 a b, .beta q b a, erase_subst b a 0⟩ + | appL a h ih => + cases t with + | var n => cases he + | lam q b => cases he + | app f x => + cases he + obtain ⟨v, hv, heq⟩ := ih rfl + exact ⟨.app v x, .appL x hv, congrArg (Term.app · (erase x)) heq⟩ + | appR f h ih => + cases t with + | var n => cases he + | lam q b => cases he + | app f x => + cases he + obtain ⟨v, hv, heq⟩ := ih rfl + exact ⟨.app f v, .appR f hv, congrArg (Term.app (erase f)) heq⟩ + | lam h ih => + cases t with + | var n => cases he + | app f a => cases he + | lam q b => + cases he + obtain ⟨v, hv, heq⟩ := ih rfl + exact ⟨.lam q v, .lam q hv, congrArg Term.lam heq⟩ + +theorem lift_betas {t : Marked} {u : Term} (h : Betas (erase t) u) : + ∃ v, Steps t v ∧ erase v = u := by + generalize he : erase t = z at h + induction h generalizing t with + | refl z => exact ⟨t, .refl t, he⟩ + | head h _ ih => + rw [← he] at h + obtain ⟨v, hv, heq⟩ := lift_beta h + obtain ⟨w, hw, heq'⟩ := ih heq + exact ⟨w, .step hv hw, heq'⟩ + +/-- Red marking of arbitrary interpreter syntax. -/ +def red : Term → Marked + | .var n => .var n + | .lam b => .lam false (red b) + | .app f a => .app (red f) (red a) + +theorem red_good (t : Term) : Good (red t) := by + induction t with + | var => trivial + | lam b ih => exact ⟨ih, by simp⟩ + | app f a ihf iha => exact ⟨ihf, iha⟩ + +theorem erase_red (t : Term) : erase (red t) = t := by + induction t with + | var => rfl + | lam b ih => exact congrArg Term.lam ih + | app f a ihf iha => simp [red, erase, ihf, iha] + +def bit (b : Bool) : Marked := + .lam true (.lam true (.var (if b then 0 else 1))) + +def pair (a r : Marked) : Marked := + .lam true (.app (.app (.var 0) (shift 0 a)) (shift 0 r)) + +def stream (bs : List Bool) (r : Marked) : Marked := + bs.foldr (fun b t => pair (bit b) t) r + +theorem bit_good (b : Bool) : Good (bit b) := by + cases b + · refine ⟨⟨trivial, fun _ => Or.inl (by decide)⟩, ?_⟩ + intro _ + exact Or.inr ⟨1, 0, Or.inl ⟨rfl, rfl⟩, .lam (.spine .var), by decide⟩ + · refine ⟨⟨trivial, ?_⟩, fun _ => Or.inl (by decide)⟩ + intro _ + exact Or.inr ⟨0, 0, Or.inr (Or.inl ⟨rfl, rfl⟩), .spine .var, by decide⟩ + +theorem pair_good {a r : Marked} (ha : Good a) (hr : Good r) : Good (pair a r) := by + refine ⟨⟨⟨trivial, good_shift ha 0⟩, good_shift hr 0⟩, ?_⟩ + intro _ + refine Or.inr ⟨0, 2, Or.inr (Or.inr ⟨rfl, rfl⟩), + .spine (.app _ (.app _ .var)), ?_⟩ + simp [erase, erase_shift, occ, occ_shift_eq] + +theorem stream_good (bs : List Bool) {r : Marked} (hr : Good r) : Good (stream bs r) := by + induction bs with + | nil => exact hr + | cons b bs ih => exact pair_good (bit_good b) ih + +theorem erase_bit (b : Bool) : erase (bit b) = churchBit b := by cases b <;> rfl + +theorem erase_pair (a r : Marked) : erase (pair a r) = pairT (erase a) (erase r) := by + simp [pair, erase, pairT, erase_shift] + +theorem erase_stream (bs : List Bool) (r : Marked) : + erase (stream bs r) = streamOf bs (erase r) := by + induction bs with + | nil => rfl + | cons b bs ih => + change erase (pair (bit b) (stream bs r)) = pairT (churchBit b) (streamOf bs (erase r)) + rw [erase_pair, erase_bit, ih] + +def source (E : Term) (bs : List Bool) : Marked := + .app (.app (red E) (.var 0)) (stream bs (.var 1)) + +theorem source_good (E : Term) (bs : List Bool) : Good (source E bs) := + ⟨⟨red_good E, trivial⟩, stream_good bs trivial⟩ + +theorem erase_source (E : Term) (bs : List Bool) : + erase (source E bs) = .app (.app E (.var 0)) (streamOf bs (.var 1)) := by + simp [source, erase, erase_red, erase_stream] + +/-- Every beta reduct has a residual coloring in which all quotation-origin +binders remain vacuous or retain one of the three exact guarded head shapes. +The marked path preserves origin tags; this is not a recoloring of its end. -/ +theorem quotation_origins_stay_protected (E : Term) (bs : List Bool) {u : Term} + (h : Betas (.app (.app E (.var 0)) (streamOf bs (.var 1))) u) : + ∃ v, Steps (source E bs) v ∧ erase v = u ∧ Good v := by + rw [← erase_source] at h + obtain ⟨v, hv, heq⟩ := lift_betas h + exact ⟨v, hv, heq, good_steps hv (source_good E bs)⟩ + +/-- In particular every quotation-origin binder remains affine. -/ +theorem quotation_origins_stay_affine (E : Term) (bs : List Bool) {u : Term} + (h : Betas (.app (.app E (.var 0)) (streamOf bs (.var 1))) u) : + ∃ v, Steps (source E bs) v ∧ erase v = u ∧ BlueAffine v := by + obtain ⟨v, hv, heq, hg⟩ := quotation_origins_stay_protected E bs h + exact ⟨v, hv, heq, good_blueAffine hg⟩ + +/-- For normal input programs the actual self-interpreter contract reaches +the exact output, so its binders inherit the protected provenance invariant. -/ +theorem selfInterpreter_normal_origins {E M : Term} (hE : IsSelfInterpreter E) + (hM : Closed M) (hN : NFt M) : + ∃ v, Steps (source E (blcCode M)) v ∧ + erase v = .app (.app (.var 0) (.lam M)) (.var 1) ∧ Good v := by + obtain ⟨u, hu, hm⟩ := hE.2 M hM + have htarget : NormalForm (.app (.app (.var 0) (.lam M)) (.var 1)) := by + have hnft : NFt (.app (.app (.var 0) (.lam M)) (.var 1)) := + ⟨(fun h => h), ⟨(fun h => h), trivial, hN⟩, trivial⟩ + exact fun _ hb => nft_no_beta hnft hb + have heq := normalForm_betas_eq htarget hm + subst u + exact quotation_origins_stay_protected E (blcCode M) hu + +/-- A live blue lambda has no dependence on an enclosing local binder. +Global rigid variables are outside the forbidden range. Red lambdas may +capture arbitrarily; this predicate constrains quotation origins only. -/ +def Detached : Nat → Marked → Prop + | _, .var _ => True + | d, .app f a => Detached d f ∧ Detached d a + | d, .lam q b => Detached (d + 1) b ∧ + (q = true → 0 < occ 0 (erase b) → + ∀ i, i < d → occ (i + 1) (erase b) = 0) + +theorem detached_shift (t : Marked) (d c : Nat) (hc : c ≤ d) + (ht : Detached d t) : Detached (d + 1) (shift c t) := by + induction t generalizing d c with + | var n => simp only [shift]; split <;> trivial + | app f a ihf iha => exact ⟨ihf d c hc ht.1, iha d c hc ht.2⟩ + | lam q b ih => + refine ⟨ih (d + 1) (c + 1) (by omega) ht.1, ?_⟩ + intro hq live i hi + rw [erase_shift, occ_shift_lt (erase b) 0 (c + 1) (by omega)] at live + rw [erase_shift] + by_cases hlt : i + 1 < c + 1 + · rw [occ_shift_lt (erase b) (i + 1) (c + 1) hlt] + exact ht.2 hq live i (by omega) + · by_cases heq : i + 1 = c + 1 + · rw [heq, occ_shift_eq] + · have he : i + 1 = (i - 1) + 1 + 1 := by omega + rw [he, occ_shift_ge (erase b) ((i - 1) + 1) (c + 1) (by omega)] + exact ht.2 hq live (i - 1) (by omega) + +theorem detached_subst (t a : Marked) (d j : Nat) (hj : j ≤ d) + (ht : Detached (d + 1) t) (ha : Detached d a) : + Detached d (subst j a t) := by + induction t generalizing a d j with + | var n => simp only [subst]; split; exact ha; split <;> trivial + | app f x ihf ihx => exact ⟨ihf a d j hj ht.1 ha, ihx a d j hj ht.2 ha⟩ + | lam q b ih => + refine ⟨ih (shift 0 a) (d + 1) (j + 1) (by omega) ht.1 + (detached_shift a d 0 (by omega) ha), ?_⟩ + intro hq live i hi + rw [erase_subst, erase_shift, + occ_substDec_lt (erase b) (Term.shift 1 0 (erase a)) 0 (j + 1) (by omega), + occ_shift_eq, Nat.mul_zero, Nat.add_zero] at live + have hcut : occ (j + 1) (erase b) = 0 := ht.2 hq live j (by omega) + rw [erase_subst, erase_shift] + by_cases hlt : i + 1 < j + 1 + · rw [occ_substDec_lt (erase b) (Term.shift 1 0 (erase a)) (i + 1) (j + 1) hlt, + hcut, Nat.zero_mul, Nat.add_zero] + exact ht.2 hq live i (by omega) + · rw [occ_substDec_ge (erase b) (Term.shift 1 0 (erase a)) (i + 1) (j + 1) + (by omega), hcut, Nat.zero_mul, Nat.add_zero] + exact ht.2 hq live (i + 1) (by omega) + +theorem detached_step {t u : Marked} (h : Step t u) (d : Nat) + (ht : Detached d t) : Detached d u := by + induction h generalizing d with + | beta q b a => exact detached_subst b a d 0 (by omega) ht.1.1 ht.2 + | appL a h ih => exact ⟨ih d ht.1, ht.2⟩ + | appR f h ih => exact ⟨ht.1, ih d ht.2⟩ + | @lam q b b' h ih => + refine ⟨ih (d + 1) ht.1, ?_⟩ + intro hq live i hi + have oldlive : 0 < occ 0 (erase b) := by + by_cases hz : occ 0 (erase b) = 0 + · have := occ_zero_beta (step_erase h) 0 hz + omega + · omega + exact occ_zero_beta (step_erase h) (i + 1) (ht.2 hq oldlive i hi) + +theorem detached_steps {t u : Marked} (h : Steps t u) (d : Nat) + (ht : Detached d t) : Detached d u := by + induction h with + | refl => exact ht + | step h _ ih => exact ih (detached_step h d ht) + +theorem red_detached (t : Term) (d : Nat) : Detached d (red t) := by + induction t generalizing d with + | var => trivial + | lam b ih => exact ⟨ih (d + 1), by simp⟩ + | app f a ihf iha => exact ⟨ihf d, iha d⟩ + +theorem bit_detached (b : Bool) : Detached 0 (bit b) := by + cases b + · refine ⟨⟨trivial, ?_⟩, ?_⟩ + · intro _ live; simp [erase, occ] at live + · intro _ _ i hi; omega + · refine ⟨⟨trivial, ?_⟩, ?_⟩ + · intro _ _ i hi + have hi0 : i = 0 := by omega + subst i + rfl + · intro _ live; simp [erase, occ] at live + +theorem pair_detached {a r : Marked} (ha : Detached 0 a) (hr : Detached 0 r) : + Detached 0 (pair a r) := by + refine ⟨⟨⟨trivial, detached_shift a 0 0 (by omega) ha⟩, + detached_shift r 0 0 (by omega) hr⟩, ?_⟩ + intro _ _ i hi + omega + +theorem stream_detached (bs : List Bool) {r : Marked} (hr : Detached 0 r) : + Detached 0 (stream bs r) := by + induction bs with + | nil => exact hr + | cons b bs ih => exact pair_detached (bit_detached b) ih + +theorem source_detached (E : Term) (bs : List Bool) : Detached 0 (source E bs) := + ⟨⟨red_detached E 0, trivial⟩, stream_detached bs trivial⟩ + +/-- Every reduct has one origin-preserving coloring satisfying both exact +head-shape protection and absence of local capture by live blue binders. -/ +theorem quotation_origins_guarded (E : Term) (bs : List Bool) {u : Term} + (h : Betas (.app (.app E (.var 0)) (streamOf bs (.var 1))) u) : + ∃ v, Steps (source E bs) v ∧ erase v = u ∧ Good v ∧ Detached 0 v := by + rw [← erase_source] at h + obtain ⟨v, hv, heq⟩ := lift_betas h + exact ⟨v, hv, heq, good_steps hv (source_good E bs), + detached_steps hv 0 (source_detached E bs)⟩ + +/-- All abstractions in this subterm have quotation origin. -/ +def BlueOnly : Marked → Prop + | .var _ => True + | .lam q b => q = true ∧ BlueOnly b + | .app f a => BlueOnly f ∧ BlueOnly a + +theorem blueOnly_shift {t : Marked} (ht : BlueOnly t) (c : Nat) : + BlueOnly (shift c t) := by + induction t generalizing c with + | var n => simp only [shift]; split <;> trivial + | lam q b ih => exact ⟨ht.1, ih ht.2 (c + 1)⟩ + | app f a ihf iha => exact ⟨ihf ht.1 c, iha ht.2 c⟩ + +theorem blueOnly_subst_absent {t : Marked} (ht : BlueOnly t) (j : Nat) (a : Marked) + (hz : occ j (erase t) = 0) : BlueOnly (subst j a t) := by + induction t generalizing j a with + | var n => + have hn : n ≠ j := by intro he; subst n; simp [erase, occ] at hz + simp only [subst, if_neg hn] + split <;> trivial + | lam q b ih => exact ⟨ht.1, ih ht.2 (j + 1) (shift 0 a) hz⟩ + | app f x ihf ihx => + simp only [erase, occ, Nat.add_eq_zero_iff] at hz + exact ⟨ihf ht.1 j a hz.1, ihx ht.2 j a hz.2⟩ + +theorem nft_shift {t : Term} (ht : NFt t) (c : Nat) : NFt (Term.shift 1 c t) := by + induction t generalizing c with + | var n => simp only [Term.shift]; split <;> trivial + | lam b ih => exact ih ht (c + 1) + | app f a ihf iha => + refine ⟨?_, ihf ht.2.1 c, iha ht.2.2 c⟩ + cases f with + | var n => simp only [Term.shift]; split <;> exact fun h => h + | lam b => exact (ht.1 trivial).elim + | app g x => exact fun h => h + +theorem nft_subst_absent {t : Term} (ht : NFt t) (j : Nat) (a : Term) + (hz : occ j t = 0) : NFt (substDec j a t) := by + induction t generalizing j a with + | var n => + have hn : n ≠ j := by intro he; subst n; simp [occ] at hz + simp only [substDec, if_neg hn] + split <;> trivial + | lam b ih => exact ih ht (j + 1) (Term.shift 1 0 a) hz + | app f x ihf ihx => + simp only [occ, Nat.add_eq_zero_iff] at hz + refine ⟨?_, ihf ht.2.1 j a hz.1, ihx ht.2.2 j a hz.2⟩ + cases f with + | var n => + have hn : n ≠ j := by intro he; subst n; simp [occ] at hz + simp only [substDec, if_neg hn] + split <;> exact fun h => h + | lam b => exact (ht.1 trivial).elim + | app g x => exact fun h => h + +/-- A surviving live blue lambda keeps a normal body made entirely from +blue syntax. Vacuous blue wrappers may enclose unrestricted red payloads. -/ +def Frozen : Marked → Prop + | .var _ => True + | .app f a => Frozen f ∧ Frozen a + | .lam q b => Frozen b ∧ + (q = true → 0 < occ 0 (erase b) → NFt (erase b) ∧ BlueOnly b) + +theorem frozen_shift {t : Marked} (ht : Frozen t) (c : Nat) : + Frozen (shift c t) := by + induction t generalizing c with + | var n => simp only [shift]; split <;> trivial + | app f a ihf iha => exact ⟨ihf ht.1 c, iha ht.2 c⟩ + | lam q b ih => + refine ⟨ih ht.1 (c + 1), ?_⟩ + intro hq live + rw [erase_shift, occ_shift_lt (erase b) 0 (c + 1) (by omega)] at live + obtain ⟨hn, hp⟩ := ht.2 hq live + exact ⟨by rw [erase_shift]; exact nft_shift hn (c + 1), + blueOnly_shift hp (c + 1)⟩ + +theorem frozen_subst (t a : Marked) (d j : Nat) (hj : j ≤ d) + (hd : Detached (d + 1) t) (ht : Frozen t) (ha : Frozen a) : + Frozen (subst j a t) := by + induction t generalizing a d j with + | var n => simp only [subst]; split; exact ha; split <;> trivial + | app f x ihf ihx => exact ⟨ihf a d j hj hd.1 ht.1 ha, + ihx a d j hj hd.2 ht.2 ha⟩ + | lam q b ih => + refine ⟨ih (shift 0 a) (d + 1) (j + 1) (by omega) hd.1 ht.1 + (frozen_shift ha 0), ?_⟩ + intro hq live + rw [erase_subst, erase_shift, + occ_substDec_lt (erase b) (Term.shift 1 0 (erase a)) 0 (j + 1) (by omega), + occ_shift_eq, Nat.mul_zero, Nat.add_zero] at live + have hz : occ (j + 1) (erase b) = 0 := hd.2 hq live j (by omega) + obtain ⟨hn, hp⟩ := ht.2 hq live + exact ⟨by rw [erase_subst]; exact nft_subst_absent hn _ _ hz, + blueOnly_subst_absent hp _ _ hz⟩ + +theorem frozen_step {t u : Marked} (h : Step t u) (d : Nat) + (hd : Detached d t) (ht : Frozen t) : Frozen u := by + induction h generalizing d with + | beta q b a => exact frozen_subst b a d 0 (by omega) hd.1.1 ht.1.1 ht.2 + | appL a h ih => exact ⟨ih d hd.1 ht.1, ht.2⟩ + | appR f h ih => exact ⟨ht.1, ih d hd.2 ht.2⟩ + | @lam q b b' h ih => + refine ⟨ih (d + 1) hd.1 ht.1, ?_⟩ + intro hq live + have oldlive : 0 < occ 0 (erase b) := by + by_cases hz : occ 0 (erase b) = 0 + · have := occ_zero_beta (step_erase h) 0 hz + omega + · omega + exact (nft_no_beta (ht.2 hq oldlive).1 (step_erase h)).elim + +theorem frozen_steps {t u : Marked} (h : Steps t u) (d : Nat) + (hd : Detached d t) (ht : Frozen t) : Frozen u := by + induction h with + | refl => exact ht + | step h _ ih => exact ih (detached_step h d hd) (frozen_step h d hd ht) + +theorem red_frozen (t : Term) : Frozen (red t) := by + induction t with + | var => trivial + | lam b ih => exact ⟨ih, by simp⟩ + | app f a ihf iha => exact ⟨ihf, iha⟩ + +theorem bit_ready (b : Bool) : Frozen (bit b) ∧ NFt (erase (bit b)) ∧ + BlueOnly (bit b) := by + cases b <;> + exact ⟨⟨⟨trivial, fun _ _ => ⟨trivial, trivial⟩⟩, + fun _ _ => ⟨trivial, rfl, trivial⟩⟩, trivial, rfl, rfl, trivial⟩ + +theorem pair_ready {a r : Marked} + (ha : Frozen a ∧ NFt (erase a) ∧ BlueOnly a) + (hr : Frozen r ∧ NFt (erase r) ∧ BlueOnly r) : + Frozen (pair a r) ∧ NFt (erase (pair a r)) ∧ BlueOnly (pair a r) := by + have hb : NFt (erase (.app (.app (.var 0) (shift 0 a)) (shift 0 r))) := + ⟨(fun h => h), ⟨(fun h => h), trivial, + by rw [erase_shift]; exact nft_shift ha.2.1 0⟩, + by rw [erase_shift]; exact nft_shift hr.2.1 0⟩ + have hp : BlueOnly (.app (.app (.var 0) (shift 0 a)) (shift 0 r)) := + ⟨⟨trivial, blueOnly_shift ha.2.2 0⟩, blueOnly_shift hr.2.2 0⟩ + exact ⟨⟨⟨⟨trivial, frozen_shift ha.1 0⟩, frozen_shift hr.1 0⟩, + fun _ _ => ⟨hb, hp⟩⟩, hb, rfl, hp⟩ + +theorem stream_ready (bs : List Bool) {r : Marked} + (hr : Frozen r ∧ NFt (erase r) ∧ BlueOnly r) : + Frozen (stream bs r) ∧ NFt (erase (stream bs r)) ∧ BlueOnly (stream bs r) := by + induction bs with + | nil => exact hr + | cons b bs ih => exact pair_ready (bit_ready b) ih + +theorem source_frozen (E : Term) (bs : List Bool) : Frozen (source E bs) := + ⟨⟨red_frozen E, trivial⟩, + (stream_ready bs (r := .var 1) ⟨trivial, trivial, trivial⟩).1⟩ + +/-- Full provenance invariant: blue binders remain guarded and locally +detached, and their live bodies stay normal with no red syntax inside. +The same single residual coloring witnesses all three properties. -/ +theorem quotation_origins_frozen (E : Term) (bs : List Bool) {u : Term} + (h : Betas (.app (.app E (.var 0)) (streamOf bs (.var 1))) u) : + ∃ v, Steps (source E bs) v ∧ erase v = u ∧ + Good v ∧ Detached 0 v ∧ Frozen v := by + rw [← erase_source] at h + obtain ⟨v, hv, heq⟩ := lift_betas h + exact ⟨v, hv, heq, good_steps hv (source_good E bs), + detached_steps hv 0 (source_detached E bs), + frozen_steps hv 0 (source_detached E bs) (source_frozen E bs)⟩ + +/-- The full origin invariant holds at the exact output of every normal +closed program, under the existing beta-join self-interpreter contract. -/ +theorem selfInterpreter_normal_frozen {E M : Term} (hE : IsSelfInterpreter E) + (hM : Closed M) (hN : NFt M) : + ∃ v, Steps (source E (blcCode M)) v ∧ + erase v = .app (.app (.var 0) (.lam M)) (.var 1) ∧ + Good v ∧ Detached 0 v ∧ Frozen v := by + obtain ⟨u, hu, hm⟩ := hE.2 M hM + have hnft : NFt (.app (.app (.var 0) (.lam M)) (.var 1)) := + ⟨(fun h => h), ⟨(fun h => h), trivial, hN⟩, trivial⟩ + have heq := normalForm_betas_eq (fun _ hb => nft_no_beta hnft hb) hm + subst u + exact quotation_origins_frozen E (blcCode M) hu + +end Marked +end Blc.QuoteOrigins diff --git a/lean/Blc/SelfintSharp.lean b/lean/Blc/SelfintSharp.lean new file mode 100644 index 00000000..a9b71bb1 --- /dev/null +++ b/lean/Blc/SelfintSharp.lean @@ -0,0 +1,210 @@ +/- +The two-nonlinear-binder lower bound is sharp. + +A direct affine translation of the 165-bit self-interpreter, using one shared +Delta, has exactly two nonlinear binders. Both nonlinear lambda subterms are +closed, so neither captures an enclosing variable. A kernel-replayed finite +beta trace reduces it to the literal intL165. + +Normalizing the affine code with Delta left neutral and gating it on the +first zero produces a beta-normal 742-bit witness with the same structure. +Its all-source contract is proved as beta joinability by confluence. + +Generated term and trace: tools/self-interpreter/theory/affine_basis.py. +-/ +import Blc.Selfint165 +import Blc.SelfintLowerBound + +namespace Blc.SelfintSharp +open Term +set_option maxRecDepth 100000 +set_option maxHeartbeats 4000000 + +inductive Direction where + | under | left | right + deriving DecidableEq + +/-- Contract the unique redex selected by an explicit syntax path. -/ +def atPath : List Direction → Term → Option Term + | [], .app (.lam b) a => some (contract b a) + | .under :: ps, .lam b => (atPath ps b).map Term.lam + | .left :: ps, .app f a => (atPath ps f).map (fun g => .app g a) + | .right :: ps, .app f a => (atPath ps a).map (fun b => .app f b) + | _, _ => none + +theorem atPath_sound {p : List Direction} {t u : Term} + (h : atPath p t = some u) : Beta t u := by + induction p generalizing t u with + | nil => + cases t with + | var n => simp [atPath] at h + | lam b => simp [atPath] at h + | app f a => + cases f with + | var n => simp [atPath] at h + | app g b => simp [atPath] at h + | lam b => + simp only [atPath, Option.some.injEq] at h + subst u + exact .beta b a + | cons k p ih => + cases k <;> cases t <;> simp only [atPath] at h + all_goals try contradiction + all_goals + obtain ⟨v, hv, rfl⟩ := Option.map_eq_some_iff.mp h + · exact .lam (ih hv) + · exact .appL _ (ih hv) + · exact .appR _ (ih hv) + +def replay : List (List Direction) → Term → Option Term + | [], t => some t + | p :: ps, t => (atPath p t).bind (replay ps) + +theorem replay_sound {ps : List (List Direction)} {t u : Term} + (h : replay ps t = some u) : Betas t u := by + induction ps generalizing t with + | nil => + simp only [replay, Option.some.injEq] at h + subst u + exact .refl _ + | cons p ps ih => + cases he : atPath p t with + | none => simp [replay, he] at h + | some v => + have hr : replay ps v = some u := by simpa [replay, he] using h + exact .head (atPath_sound he) (ih hr) + +/-- Every nonlinear lambda subterm is closed in isolation. -/ +def NonlinearClosed : Term → Prop + | .var _ => True + | .lam b => NonlinearClosed b ∧ + (1 < occ 0 b → Closed (.lam b)) + | .app f a => NonlinearClosed f ∧ NonlinearClosed a + +def decNonlinearClosed : (t : Term) → Decidable (NonlinearClosed t) + | .var _ => isTrue trivial + | .lam b => + let _ := decNonlinearClosed b + inferInstanceAs (Decidable (_ ∧ _)) + | .app f a => + let _ := decNonlinearClosed f + let _ := decNonlinearClosed a + inferInstanceAs (Decidable (_ ∧ _)) + +instance (t : Term) : Decidable (NonlinearClosed t) := decNonlinearClosed t + +def intL584 : Term := (.app (.lam (.app (.app (.lam (.lam (.app (.var 2) (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1)))))) (.lam (.lam (.app (.var 1) (.var 0))))) (.app (.lam (.lam (.app (.var 2) (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1)))))) (.lam (.lam (.app (.app (.lam (.lam (.app (.var 4) (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1)))))) (.lam (.lam (.app (.lam (.lam (.app (.var 6) (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1)))))) (.lam (.app (.lam (.lam (.app (.var 7) (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1)))))) (.lam (.lam (.app (.lam (.app (.lam (.lam (.app (.var 10) (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1)))))) (.lam (.app (.lam (.lam (.app (.var 11) (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1)))))) (.lam (.app (.lam (.lam (.app (.var 12) (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1)))))) (.lam (.lam (.app (.app (.var 3) (.lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (.var 7))))) (.var 8)))) (.app (.app (.var 2) (.var 1)) (.var 0))))))))))) (.lam (.app (.var 5) (.app (.lam (.lam (.app (.var 10) (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1)))))) (.lam (.lam (.app (.app (.var 2) (.app (.var 4) (.lam (.lam (.app (.var 3) (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 3)))))))))) (.app (.var 6) (.lam (.app (.var 4) (.app (.lam (.lam (.app (.var 13) (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1)))))) (.lam (.lam (.app (.app (.var 3) (.var 1)) (.app (.var 2) (.var 0)))))))))))))))))))))))) (.app (.var 1) (.var 0)))))))) (.lam (.app (.var 0) (.var 0)))) + +def trace584 : List (List Direction) := [[], [.left], [.left, .under], [.left, .under], [.left, .under, .left], [.left, .under, .left, .left], [.left, .under, .left], [.left, .under], [.right], [.right, .under], [.right, .under], [.right, .under, .left], [.right, .under, .left, .left], [.right, .under, .left], [.right, .under], [.right, .under, .left], [.right, .under, .left, .under], [.right, .under, .left, .under], [.right, .under, .left, .under, .left], [.right, .under, .left, .under, .left, .left], [.right, .under, .left, .under, .left], [.right, .under, .left, .under], [.right, .under, .left, .under], [.right, .under, .left, .under, .under], [.right, .under, .left, .under, .under], [.right, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under, .left, .left], [.right, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under], [.right, .under, .left, .under, .under], [.right, .under, .left, .under, .under], [.right, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under, .left, .left], [.right, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under], [.right, .under, .left, .under, .under, .left, .under], [.right, .under, .left, .under, .under, .left, .under, .under], [.right, .under, .left, .under, .under, .left, .under, .under], [.right, .under, .left, .under, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under, .left, .under, .under, .left, .left], [.right, .under, .left, .under, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under, .left, .under, .under], [.right, .under, .left, .under, .under, .left, .under, .under], [.right, .under, .left, .under, .under, .left, .under, .under], [.right, .under, .left, .under, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under, .left, .under, .under, .left, .left], [.right, .under, .left, .under, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under, .left, .under, .under], [.right, .under, .left, .under, .under, .left, .under, .under], [.right, .under, .left, .under, .under, .left, .under, .under], [.right, .under, .left, .under, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under, .left, .under, .under, .left, .left], [.right, .under, .left, .under, .under, .left, .under, .under, .left], [.right, .under, .left, .under, .under, .left, .under, .under], [.right, .under, .left, .under, .under, .right, .under, .right], [.right, .under, .left, .under, .under, .right, .under, .right, .under], [.right, .under, .left, .under, .under, .right, .under, .right, .under], [.right, .under, .left, .under, .under, .right, .under, .right, .under, .left], [.right, .under, .left, .under, .under, .right, .under, .right, .under, .left, .left], [.right, .under, .left, .under, .under, .right, .under, .right, .under, .left], [.right, .under, .left, .under, .under, .right, .under, .right, .under], [.right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right, .under, .right], [.right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right, .under, .right, .under], [.right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right, .under, .right, .under], [.right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right, .under, .right, .under, .left], [.right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right, .under, .right, .under, .left, .left], [.right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right, .under, .right, .under, .left], [.right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right, .under, .right, .under]] + +theorem intL584_closed : Closed intL584 := by decide + +theorem intL584_length : (blcCode intL584).length = 584 := by decide + +theorem intL584_two_nonlinear : SelfintLowerBound.nonlinear intL584 = 2 := by decide + +theorem intL584_nonlinear_closed : NonlinearClosed intL584 := by decide + +theorem run584 : replay trace584 intL584 = some intL165 := by decide + +theorem reduces584 : Betas intL584 intL165 := replay_sound run584 + +theorem selfint_contract584 (M : Term) (hM : Closed M) (C N : Term) : + Betas (.app (.app intL584 C) (streamOf (blcCode M) N)) + (.app (.app C (.lam M)) N) := + betas_trans (betas_appL _ (betas_appL _ reduces584)) + (selfint_contract165 M hM C N) + +theorem isSelfInterpreter_intL584 : IsSelfInterpreter intL584 := + ⟨intL584_closed, fun M hM => + ⟨_, selfint_contract584 M hM (.var 0) (.var 1), .refl _⟩⟩ + +/-- Exactly two nonlinear binders suffice, even when both are closed. -/ +theorem two_nonlinear_sharp : ∃ E, IsSelfInterpreter E ∧ + SelfintLowerBound.nonlinear E = 2 ∧ NonlinearClosed E := + ⟨intL584, isSelfInterpreter_intL584, intL584_two_nonlinear, + intL584_nonlinear_closed⟩ + + + + +/-- The affine code normalized with its shared duplicator left neutral. -/ +def code742 : Term := (.lam (.app (.var 0) (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.var 1) (.var 0)))))) (.lam (.app (.var 2) (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.var 6) (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.lam (.app (.var 11) (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.var 15) (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.lam (.app (.var 20) (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.var 24) (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.var 28) (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.app (.var 9) (.lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (.lam (.app (.var 27) (.lam (.app (.var 37) (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.app (.var 5) (.app (.var 23) (.lam (.lam (.app (.var 3) (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 3)))))))))) (.app (.var 31) (.lam (.app (.var 23) (.lam (.app (.var 43) (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.app (.var 6) (.var 1)) (.app (.var 5) (.var 0))))))) (.var 1))))))))))))) (.var 1))))))))))) (.var 19)))) (.app (.app (.var 5) (.var 1)) (.var 0))))))) (.var 1)))))))) (.var 1)))))))) (.var 1))))))))) (.var 1)))))))) (.var 1))))))))) (.app (.var 2) (.var 1))))))))) (.var 1))))))))) + +def delta742 : Term := .lam (.app (.var 0) (.var 0)) + +def core742 : Term := .app code742 delta742 + +/-- The first known zero activates the shared duplicator without a source redex. -/ +def intL742 : Term := (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.app (.app (.app (.app (.var 1) code742) (.lam (.var 0))) (.lam (.app (.var 0) (.var 0)))) (.var 3)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 1))))))))) + +def trace742 : List (List Direction) := [[.left, .under, .left], [.left, .under], [.left, .under, .right, .under, .right], [.left, .under, .right, .under, .right, .under, .right, .under, .left, .right, .under, .under, .under, .left], [.left, .under, .right, .under, .right, .under, .right, .under, .left, .right, .under, .under, .under], [.left, .under, .right, .under, .right, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under], [.left, .under, .right, .under, .right, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .under, .right, .under, .left, .right, .under, .under], [.left, .under, .right, .under, .right, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under], [.left, .under, .right, .under, .right, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under], [.left, .under, .right, .under, .right, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .under, .right, .under, .left, .right, .under, .under], [.left, .under, .right, .under, .right, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under], [.left, .under, .right, .under, .right, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .left, .right, .under, .left, .right, .under, .under, .right, .under, .right], [.left, .under, .right, .under, .right, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .right, .under, .left, .right, .under, .under, .under, .left, .right, .under, .left, .right, .under, .under, .right, .under, .right, .under, .right, .under, .left, .right, .under, .under, .under, .right, .right, .under, .right]] + +theorem code742_closed : Closed code742 := by decide + +theorem core742_closed : Closed core742 := by decide + +theorem intL742_closed : Closed intL742 := by decide + +theorem intL742_length : (blcCode intL742).length = 742 := by decide + +theorem intL742_two_nonlinear : SelfintLowerBound.nonlinear intL742 = 2 := by decide + +theorem intL742_nonlinear_closed : NonlinearClosed intL742 := by decide + +theorem intL742_nft : NFt intL742 := by decide + +theorem intL742_normal : NormalForm intL742 := fun _ h => nft_no_beta intL742_nft h + +theorem run_affine_normal742 : replay trace742 intL584 = some core742 := by decide + +theorem reduces_affine_normal742 : Betas intL584 core742 := + replay_sound run_affine_normal742 + +theorem run_root742 : + spineSteps 7 (.app (.app intL742 (.var 0)) (pairT churchTrue (.var 1))) + = some (.app (.app core742 (.var 0)) (pairT churchTrue (.var 1))) := by decide + +theorem substDec_intL742 (j : Nat) (s : Term) : substDec j s intL742 = intL742 := + substDec_closed j s intL742_closed + +theorem substDec_core742 (j : Nat) (s : Term) : substDec j s core742 = core742 := + substDec_closed j s core742_closed + +theorem spine_root742 (C R : Term) : + SpineReds (.app (.app intL742 C) (pairT churchTrue R)) + (.app (.app core742 C) (pairT churchTrue R)) := by + have h := spineReds_instN [C, R] 0 (spineReds_of_spineSteps _ run_root742) + simpa [instN, pairT, substDec, shift, substDec_intL742, substDec_core742, + shift_churchTrue, substDec_churchTrue, shift_shift0, substDec_shift0, shift_zero] using h + +/-- The beta-normal witness satisfies the contract by beta joinability. -/ +theorem selfint_join742 (M : Term) (hM : Closed M) (C N : Term) : + BetaJoin (.app (.app intL742 C) (streamOf (blcCode M) N)) + (.app (.app C (.lam M)) N) := by + have hzero : ∃ R, streamOf (blcCode M) N = pairT churchTrue R := by + cases M with + | var i => simp [Closed, FreeUnder] at hM + | lam M => exact ⟨_, rfl⟩ + | app M P => exact ⟨_, rfl⟩ + obtain ⟨R, hR⟩ := hzero + have hroot : Betas (.app (.app intL742 C) (streamOf (blcCode M) N)) + (.app (.app core742 C) (streamOf (blcCode M) N)) := by + rw [hR] + exact betas_of_spineReds (spine_root742 C R) + have hcore := betas_appL (streamOf (blcCode M) N) + (betas_appL C reduces_affine_normal742) + obtain ⟨w, hwcore, hwtarget⟩ := betas_confluent hcore (selfint_contract584 M hM C N) + exact ⟨w, betas_trans hroot hwcore, hwtarget⟩ + +theorem isSelfInterpreter_intL742 : IsSelfInterpreter intL742 := + ⟨intL742_closed, fun M hM => selfint_join742 M hM (.var 0) (.var 1)⟩ + +/-- Two nonlinear binders suffice even for a beta-normal self-interpreter, +and both nonlinear lambda subterms can still be closed. -/ +theorem two_nonlinear_normal_sharp : ∃ E, IsSelfInterpreter E ∧ NormalForm E ∧ + SelfintLowerBound.nonlinear E = 2 ∧ NonlinearClosed E := + ⟨intL742, isSelfInterpreter_intL742, intL742_normal, intL742_two_nonlinear, + intL742_nonlinear_closed⟩ + +end Blc.SelfintSharp diff --git a/tools/self-interpreter/theory/affine_basis.py b/tools/self-interpreter/theory/affine_basis.py new file mode 100644 index 00000000..24d717ad --- /dev/null +++ b/tools/self-interpreter/theory/affine_basis.py @@ -0,0 +1,307 @@ +#!/usr/bin/env python3 +"""Structural translation through one shared self-application combinator. + +This is a compiler, not a search. Every lambda except the shared d and the +closed Delta is affine in its own argument. Introduced binders are marked so +the exact administrative beta reduction back to the source can be replayed. +""" +from collections import Counter +import json +from pathlib import Path +import sys +import time + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +MACHINES = ROOT / "data/self-interpreter/machines" +RESULTS = ROOT / "data/self-interpreter/theory" +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery as bt + + +def V(x): + return ("V", x) + + +def A(f, a): + return ("A", f, a) + + +def apps(*terms): + result = terms[0] + for term in terms[1:]: + result = A(result, term) + return result + + +def L(x, b, admin=False): + return ("L", x, b, admin) + + +serial = 0 + + +def fresh(): + global serial + serial += 1 + return f"v{serial}" + + +def named(t, env=()): + if t[0] == "V": + return V(env[t[1]]) + if t[0] == "A": + return A(named(t[1], env), named(t[2], env)) + x = fresh() + return L(x, named(t[1], (x,) + env)) + + +def count(t, x): + if t[0] == "V": + return int(t[1] == x) + if t[0] == "L": + return 0 if t[1] == x else count(t[2], x) + return count(t[1], x) + count(t[2], x) + + +def split(t, x, first, rest): + """Replace the first x by first, and every remaining x by rest.""" + seen = False + + def go(u): + nonlocal seen + if u[0] == "V": + if u[1] != x: + return u + y = rest if seen else first + seen = True + return V(y) + if u[0] == "L": + assert u[1] != x + return L(u[1], go(u[2]), u[3]) + return A(go(u[1]), go(u[2])) + + return go(t) + + +def affine_lambda(x, body, d, admin): + if count(body, x) <= 1: + return L(x, body, admin) + u, v, f, b, k = (fresh() for _ in range(5)) + split_body = split(body, x, u, v) + fn = L(u, affine_lambda(v, split_body, d, True), True) + # W_d = lambda f x. d (lambda b. b (lambda k. f) x). + # After d := Delta, W_d f x -> f x x. + w = L(f, L(x, A(V(d), L(b, A(A(V(b), L(k, V(f), True)), V(x)), True)), + admin), True) + return A(w, fn) + + +def translate(t, d): + if t[0] == "V": + return t + if t[0] == "A": + return A(translate(t[1], d), translate(t[2], d)) + return affine_lambda(t[1], translate(t[2], d), d, t[3]) + + +def debruijn(t, env=()): + if t[0] == "V": + return V(env.index(t[1])) + if t[0] == "A": + return A(debruijn(t[1], env), debruijn(t[2], env)) + return ("L", debruijn(t[2], (t[1],) + env), t[3]) + + +def plain(t): + if t[0] == "V": + return t + if t[0] == "A": + return A(plain(t[1]), plain(t[2])) + return ("L", plain(t[1])) + + +def shift(t, n, c=0): + if t[0] == "V": + return V(t[1] + n) if t[1] >= c else t + if t[0] == "A": + return A(shift(t[1], n, c), shift(t[2], n, c)) + return ("L", shift(t[1], n, c + 1), t[2]) + + +def subst(t, s, j=0): + if t[0] == "V": + if t[1] == j: + return s + return V(t[1] - 1) if t[1] > j else t + if t[0] == "A": + return A(subst(t[1], s, j), subst(t[2], s, j)) + return ("L", subst(t[1], shift(s, 1), j + 1), t[2]) + + +def admin_step(t): + """Find the leftmost introduced redex; original redexes are preserved.""" + if t[0] == "V": + return None + if t[0] == "L": + h = admin_step(t[1]) + return None if h is None else ([0] + h[0], ("L", h[1], t[2])) + if t[1][0] == "L" and t[1][2]: + return ([], subst(t[1][1], t[2])) + h = admin_step(t[1]) + if h is not None: + return ([1] + h[0], A(h[1], t[2])) + h = admin_step(t[2]) + return None if h is None else ([2] + h[0], A(t[1], h[1])) + + +def free_indices(t, depth=0): + if t[0] == "V": + return Counter({t[1] - depth: 1}) if t[1] >= depth else Counter() + if t[0] == "A": + return free_indices(t[1], depth) + free_indices(t[2], depth) + return free_indices(t[1], depth + 1) + + +def nonlinear_binders(t, path=(), depth=0): + if t[0] == "V": + return [] + if t[0] == "A": + return (nonlinear_binders(t[1], path + (1,), depth) + + nonlinear_binders(t[2], path + (2,), depth)) + fv = free_indices(t[1]) + here = [] + if fv[0] > 1: + here = [dict(path=list(path), uses=fv[0], + captures=[i - 1 for i in fv if 0 < i <= depth])] + return here + nonlinear_binders(t[1], path + (0,), depth + 1) + + +def lam_source(t): + if t[0] == "V": + return t[1] + if t[0] == "A": + return f"({lam_source(t[1])} {lam_source(t[2])})" + return f"(\\{t[1]}. {lam_source(t[2])})" + + +def lean_term(t): + if t[0] == "V": + return f"(.var {t[1]})" + if t[0] == "A": + return f"(.app {lean_term(t[1])} {lean_term(t[2])})" + return f"(.lam {lean_term(t[1])})" + + +def lean_trace(trace): + return "[" + ", ".join( + "[" + ", ".join([".under", ".left", ".right"][d] for d in path) + "]" + for path in trace) + "]" + + +def build(): + original = bt.compile_lam((ROOT / "data/self-interpreter/machines/int165.lam").read_text()) + d, a = fresh(), fresh() + named_term = A(L(d, translate(named(original), d), True), + L(a, A(V(a), V(a)), True)) + marked = debruijn(named_term) + result = marked + trace = [] + while (step := admin_step(result)) is not None: + path, result = step + trace.append(path) + assert len(trace) < 10000, "administrative compiler failed to terminate" + assert plain(result) == original + term = plain(marked) + nonlinear = nonlinear_binders(term) + assert len(nonlinear) == 2 + assert all(not b["captures"] for b in nonlinear) + return term, named_term, trace, nonlinear + + +def normal(t): + if t[0] == "V": + return True + if t[0] == "L": + return normal(t[1]) + return t[1][0] != "L" and normal(t[1]) and normal(t[2]) + + +def build_normal(term): + """Normalize only the affine body, keeping its free d rigid.""" + def mark_all(t): + if t[0] == "V": + return t + if t[0] == "A": + return A(mark_all(t[1]), mark_all(t[2])) + return ("L", mark_all(t[1]), True) + + body = mark_all(term[1][1]) + trace = [] + while (step := admin_step(body)) is not None: + path, body = step + trace.append([1, 0] + path) + assert len(trace) < 1000 + body = plain(body) + assert not nonlinear_binders(body) and normal(body) + d, c, s, b, r, k, x, y = (fresh() for _ in range(8)) + code = L(d, named(body, (d,))) + true = L(x, L(y, V(x))) + identity = L(x, V(x)) + delta = L(x, A(V(x), V(x))) + rebuilt = L(k, apps(V(k), true, V(r))) + root = L(c, L(s, A(V(s), + L(b, L(r, apps(V(b), code, identity, delta, V(c), rebuilt)))))) + normal_term = plain(debruijn(root)) + nonlinear = nonlinear_binders(normal_term) + assert normal(normal_term) and len(nonlinear) == 2 + assert all(not binder["captures"] for binder in nonlinear) + return normal_term, root, plain(debruijn(code)), trace, nonlinear + + +def main(): + start = time.monotonic() + term, named_term, trace, nonlinear = build() + bits = bt.enc(term) + proof = (ROOT / "lean/Blc/SelfintSharp.lean").read_text() + assert f"def intL584 : Term := {lean_term(term)}\n" in proof + assert f"def trace584 : List (List Direction) := {lean_trace(trace)}\n" in proof + assert bt.compile_lam(lam_source(named_term)) == term + (MACHINES / "int584_two_nonlinear.lam").write_text( + "-- A direct affine translation of int165 with exactly two nonlinear binders.\n" + + lam_source(named_term) + "\n") + (MACHINES / "int584_two_nonlinear.blc").write_text(bits + "\n") + ok, skipped, bad = bt.check(term, threads=2) + assert (ok, skipped, len(bad)) == (667, 1, 0), bad + report = dict(bits=len(bits), nonlinear=nonlinear, + administrative_beta_steps=len(trace), + reduces_to="literal int165", + battery=dict(ok=ok, skipped=skipped, failures=len(bad)), + seconds=round(time.monotonic() - start, 4)) + (RESULTS / "two_nonlinear.json").write_text(json.dumps(report, indent=2) + "\n") + print(json.dumps(report, indent=2)) + start_normal = time.monotonic() + term742, root742, code742, trace742, nonlinear742 = build_normal(term) + bits742 = bt.enc(term742) + assert len(bits742) == 742 + assert f"def code742 : Term := {lean_term(code742)}\n" in proof + lean742 = lean_term(term742).replace(lean_term(code742), "code742") + assert f"def intL742 : Term := {lean742}\n" in proof + assert f"def trace742 : List (List Direction) := {lean_trace(trace742)}\n" in proof + assert bt.compile_lam(lam_source(root742)) == term742 + (MACHINES / "int742_two_nonlinear_normal.lam").write_text( + "-- A beta-normal self-interpreter with exactly two closed nonlinear lambda subterms.\n" + + lam_source(root742) + "\n") + (MACHINES / "int742_two_nonlinear_normal.blc").write_text(bits742 + "\n") + ok742, skipped742, bad742 = bt.check(term742, threads=2) + assert (ok742, skipped742, len(bad742)) == (667, 1, 0), bad742 + report742 = dict(bits=len(bits742), beta_normal=True, nonlinear=nonlinear742, + affine_normalization_steps=len(trace742), + battery=dict(ok=ok742, skipped=skipped742, failures=len(bad742)), + seconds=round(time.monotonic() - start_normal, 4)) + (RESULTS / "two_nonlinear_normal.json").write_text(json.dumps(report742, indent=2) + "\n") + print(json.dumps(report742, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/tools/self-interpreter/theory/erased_skip.py b/tools/self-interpreter/theory/erased_skip.py new file mode 100644 index 00000000..b14b5bdc --- /dev/null +++ b/tools/self-interpreter/theory/erased_skip.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python3 +"""Targeted erased-skip equations and four hand-derived complete variants. + +No search is performed. The optional finite battery is capped at the existing +18-bit battery and two workers; the algebra checks use rigid lambda binders. +""" +from pathlib import Path +import json +import sys +import time + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +MACHINES = ROOT / "data/self-interpreter/machines" +RESULTS = ROOT / "data/self-interpreter/theory" +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery as b + +K = r"(\u\v.u)" +F = r"(\u\v.v)" +I = r"(\u.u)" + + +def z(t): + return rf"(\u\r.r {t})" + + +def h(q, c): + return rf"(\b.b {z(q)} {c})" + + +def reader(q, c, a): + return rf"(\s.s {h(q, c)} (s s {a}))" + + +def equation(name, lhs, rhs): + left = b.normalize(b.enc(b.compile_lam(lhs)), 4096) + right = b.normalize(b.enc(b.compile_lam(rhs)), 4096) + assert left is not None and right is not None and left == right, name + return {"name": name, "equal_normal_form_bits": len(left)} + + +def app(*terms): + out = terms[0] + for t in terms[1:]: + out = ("A", out, t) + return out + + +def main(): + started = time.monotonic() + eqs = [ + equation("R_a F = a", + rf"\q\c\a.{reader('q', 'c', 'a')} {F}", + r"\q\c\a.a"), + equation("R_a Z_t = a t t", + rf"\q\c\a\t.{reader('q', 'c', 'a')} {z('t')}", + r"\q\c\a\t.a t t"), + equation("R_a K = H", + rf"\q\c\a.{reader('q', 'c', 'a')} {K}", + rf"\q\c\a.{h('q', 'c')}"), + equation("R_a I = a Z_q c", + rf"\q\c\a.{reader('q', 'c', 'a')} {I}", + rf"\q\c\a.a {z('q')} c"), + equation("skip-erasure on a leading zero", + rf"\r\a.(\s.s s a) (\f.f {K} r)", + r"\r\a.r"), + equation("skip-erasure through two leading ones", + rf"\r\a.(\s.s s a) (\f.f {F} (\g.g {F} (\h.h {K} r)))", + r"\r\a.r"), + ] + original = (ROOT / "data/self-interpreter/machines/int165.lam").read_text() + needle = "(list list list)" + assert original.count(needle) == 1 + variants = [] + for label, erased in [ + ("next", "next"), ("continuation", "cont"), + ("parser", "intL"), ("generator", "x"), + ]: + source = original.replace(needle, f"(list list {erased})") + term = b.compile_lam(source) + (MACHINES / f"int_skip_{label}.lam").write_text(source) + (MACHINES / f"int_skip_{label}.blc").write_text(b.enc(term) + "\n") + record = {"variant": label, "bits": len(b.enc(term))} + # On the off-domain input F, the reader exposes the erased operand. + cont = ("V", 0) + off_domain = ("L", app(b.shift(term, 1), cont, b.FALSE)) + if label == "continuation": + assert b.normalize(b.enc(off_domain), 4096) == "0010" + record["off_domain"] = "E C F -> C" + elif label == "parser": + # Applying a rigid observer would require normalizing E itself. + # Compare head reductions through a terminating chosen call. + identity = ("L", ("V", 0)) + lhs = ("L", ("L", app( + b.shift(term, 2), ("V", 1), b.FALSE, ("V", 1), + b.bitlist(b.enc(identity), ("V", 0))))) + rhs = b._probe(term, identity, False) + assert rhs == "ok" + got = b.normalize(b.enc(lhs), 16384) + expected = ("L", ("L", app( + ("V", 1), ("L", b.shift(identity, 3)), ("V", 0)))) + assert got == b.normalize(b.enc(expected), 4096) + record["off_domain"] = "E C F -> E (paper); checked on I" + if "--battery" in sys.argv: + ok, skipped, bad = b.check(term, max_bits=18, threads=2) + record["battery"] = {"ok": ok, "skipped": skipped, "failures": bad} + assert not bad + variants.append(record) + result = { + "equations": eqs, "variants": variants, + "elapsed_seconds": round(time.monotonic() - started, 3), + "search_performed": False, + } + if "--battery" in sys.argv: + (RESULTS / "erased_skip.json").write_text(json.dumps(result, indent=2) + "\n") + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/tools/self-interpreter/theory/handler_bound.py b/tools/self-interpreter/theory/handler_bound.py new file mode 100644 index 00000000..d51ea53c --- /dev/null +++ b/tools/self-interpreter/theory/handler_bound.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 +"""Check the explicit witnesses in docs/classical/self-interpreter/handler-bound.md. + +This is not a term search or a mechanical proof of the universal bound. +The reductions are small open terms with independent rigid neighbours. +""" +from pathlib import Path +import sys + +sys.dont_write_bytecode = True +ROOT = Path(__file__).resolve().parents[3] +sys.path.insert(0, str(ROOT / "tools" / "self-interpreter")) +import battery +import lc + + +def app(f, *args): + for arg in args: + f = ("A", f, arg) + return f + + +def handler(source): + term = battery.compile_lam("\\x.\\p.\\c.\\j.\\s." + source) + for _ in range(5): + assert term[0] == "L" + term = term[1] + return term + + +def normal(term): + return lc.nf(term, [256]) + + +def counts(term): + if term[0] == "V": + return 0, 0, term[1] + if term[0] == "L": + l, a, x = counts(term[1]) + return l + 1, a, x + lf, af, xf = counts(term[1]) + la, aa, xa = counts(term[2]) + return lf + la, af + aa + 1, xf + xa + + +def laws(term): + # Frame [s,j,c,p,x,R,T]. R and T are independent rigid free variables. + r, t = ("V", 5), ("V", 6) + zero = normal(app(term, lc.TRUE, r, r)) == app(r, ("V", 1)) + one = normal(app(term, lc.FALSE, r, t)) == app(("V", 2), r, t) + return zero, one + + +examples = [ + ("minimum", r"\b. b (\u.\v. v j) c", 27, (True, True)), + ("first-copy zero arm", r"\b. b (\u.\v. u j) c", 28, (True, True)), + ("known-K erasure", r"\b. b (b (\v. v j)) c", 28, (True, True)), + # This was an audit counterexample to an intermediate claim, not to + # the theorem: a zero-application F arm need not literally be c. + ("vacuous-chain audit", r"\b. b s (\u. c) j", 25, (False, True)), +] +for name, source, size, wanted in examples: + term = handler(source) + l, a, x = counts(term) + assert lc.size(term) == size == 2 * l + 4 * a + 2 + x + got = laws(term) + assert got == wanted, (name, got, wanted) + print(f"{name}: {size} bits; L={l}, A={a}, X={x}; laws={got}") + +print("PASS: four explicit witnesses; no enumeration") diff --git a/tools/self-interpreter/theory/normal204.py b/tools/self-interpreter/theory/normal204.py new file mode 100644 index 00000000..ac01dfdd --- /dev/null +++ b/tools/self-interpreter/theory/normal204.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +"""Bounded checks for the beta-normal 204. No term or candidate search.""" +from pathlib import Path +import json +import re +import sys +import time + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery as bt +import db + + +def stats(t): + if t[0] == "V": + return 0, 0, t[1] + if t[0] == "L": + l, a, x = stats(t[1]) + return l + 1, a, x + l1, a1, x1 = stats(t[1]) + l2, a2, x2 = stats(t[2]) + return l1 + l2, a1 + a2 + 1, x1 + x2 + + +def normal(t): + if t[0] == "V": + return True + if t[0] == "L": + return normal(t[1]) + return t[1][0] != "L" and normal(t[1]) and normal(t[2]) + + +def main(): + start = time.monotonic() + term = bt.compile_lam((ROOT / "data/self-interpreter/machines/int204_normal.lam").read_text()) + bits = bt.enc(term) + assert bits == (ROOT / "data/self-interpreter/machines/int204_normal.blc").read_text().strip() + assert len(bits) == 204 and normal(term) + proof = (ROOT / "lean/Blc/SelfintNormal.lean").read_text() + literal = re.search(r"def intL204Wire : List Bool := \[([^]]+)\]", proof)[1] + proof_bits = "".join("1" if x.strip() == "true" else "0" for x in literal.split(",")) + assert proof_bits == bits + ok, skipped, bad = bt.check(term, threads=2) + assert (ok, skipped, len(bad)) == (667, 1, 0), bad + suffix = {} + for name, source in [("omega", r"(\1 1) (\1 1)"), ("lambda_omega", r"\(\1 1) (\1 1)")]: + source_term = db.parse(source) + # lambda n. E F ( ++ n), with F projecting the residual. + probe = ("L", ("A", ("A", bt.shift(term, 1), bt.FALSE), + bt.bitlist(bt.enc(source_term), ("V", 0)))) + result = bt.normalize(bt.enc(probe), 1 << 20) + assert result == "0010", (name, result) + suffix[name] = "exact rigid tail" + report = dict(bits=len(bits), L_A_X=stats(term), beta_normal=True, + battery=dict(ok=ok, skipped=skipped, failures=len(bad)), + suffix_probes=suffix, seconds=round(time.monotonic()-start, 4)) + (ROOT / "data/self-interpreter/theory/normal204.json").write_text( + json.dumps(report, indent=2) + "\n") + print(json.dumps(report, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/tools/self-interpreter/theory/typed_normal.py b/tools/self-interpreter/theory/typed_normal.py new file mode 100644 index 00000000..190ab569 --- /dev/null +++ b/tools/self-interpreter/theory/typed_normal.py @@ -0,0 +1,182 @@ +#!/usr/bin/env python3 +"""A simply typed, beta-normal interpreter gated by the first source bit. + +This is one explicit construction, not a search. Two casts uniformly embed +the existing interpreter in a simply typed normal form. The actual source +bit supplies an ill-typed application when evaluation starts. +""" +from pathlib import Path +import json +import sys +import time + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +MACHINES = ROOT / "data/self-interpreter/machines" +RESULTS = ROOT / "data/self-interpreter/theory" +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery as b + + +def app(*ts): + out = ts[0] + for t in ts[1:]: + out = ("A", out, t) + return out + + +def v(n): + return ("V", n) + + +def lam(t): + return ("L", t) + + +I = lam(v(0)) +K = lam(lam(v(1))) +PACKET = lam(app(v(0), I, I)) + + +def cons(bit, rest): + return lam(app(v(0), b.shift(bit, 1), b.shift(rest, 1))) + + +def cast_translation(t, depth=0): + """Translate under two newly inserted binders [down, up]. + + All source variables receive type o. + up:o->o->o; down:(o->o)->o. + """ + if t[0] == "V": + return v(t[1] if t[1] < depth else t[1] + 2) + if t[0] == "A": + return app(v(depth + 1), cast_translation(t[1], depth), + cast_translation(t[2], depth)) + return app(v(depth), lam(cast_translation(t[1], depth + 1))) + + +def is_normal(t): + if t[0] == "V": + return True + if t[0] == "L": + return is_normal(t[1]) + return t[1][0] != "L" and is_normal(t[1]) and is_normal(t[2]) + + +class Types: + """Ordinary first-order simple-type inference, including an occurs check.""" + def __init__(self): + self.next_id = 0 + self.assignments = {} + + def fresh(self): + out = self.next_id + self.next_id += 1 + return out + + def prune(self, t): + if isinstance(t, int) and t in self.assignments: + self.assignments[t] = self.prune(self.assignments[t]) + return self.assignments[t] + return t + + def occurs(self, variable, t): + t = self.prune(t) + return variable == t if isinstance(t, int) else any( + self.occurs(variable, a) for a in t) + + def unify(self, left, right): + left, right = self.prune(left), self.prune(right) + if left == right: + return + if isinstance(left, int): + if self.occurs(left, right): + raise ValueError("simple-type occurs check failed") + self.assignments[left] = right + elif isinstance(right, int): + self.unify(right, left) + else: + self.unify(left[0], right[0]) + self.unify(left[1], right[1]) + + def infer(self, term, context=()): + if term[0] == "V": + return context[term[1]] + if term[0] == "L": + arg = self.fresh() + return (arg, self.infer(term[1], (arg,) + context)) + fn = self.infer(term[1], context) + arg = self.infer(term[2], context) + result = self.fresh() + self.unify(fn, (arg, result)) + return result + + def render(self, t, names=None): + names = {} if names is None else names + t = self.prune(t) + if isinstance(t, int): + if t not in names: + names[t] = f"a{len(names)}" + return names[t] + return f"({self.render(t[0], names)} -> {self.render(t[1], names)})" + + +def named_source(t, context=(), counter=None): + counter = [0] if counter is None else counter + if t[0] == "V": + return context[t[1]] + if t[0] == "L": + name = f"x{counter[0]}" + counter[0] += 1 + return f"(\\{name}. {named_source(t[1], (name,) + context, counter)})" + return f"({named_source(t[1], context, counter)} {named_source(t[2], context, counter)})" + + +def main(): + start = time.monotonic() + e0 = b.compile_lam((ROOT / "data/self-interpreter/machines/int165.lam").read_text()) + # At the T construction site the outer context is [rest, bit, stream, C]. + source_call = app(e0, v(3), cons(K, v(0))) + translated = lam(lam(cast_translation(source_call))) + handler = lam(lam(app(v(1), PACKET, v(0), translated))) + interpreter = lam(lam(app(v(0), handler))) + assert is_normal(interpreter) + types = Types() + principal = types.render(types.infer(interpreter)) + bits = b.enc(interpreter) + (MACHINES / "int672_typed_normal.lam").write_text(named_source(interpreter) + "\n") + (MACHINES / "int672_typed_normal.blc").write_text(bits + "\n") + assert b.compile_lam(named_source(interpreter)) == interpreter + # The typed two-cast expression becomes Omega after two affine I arguments. + two_casts = b.compile_lam( + r"\u\d.u (d (\x.u x x)) (d (\x.u x x))") + witness_types = Types() + witness_type = witness_types.render(witness_types.infer(two_casts)) + result = { + "bits": len(bits), + "beta_normal": True, + "simply_typable": True, + "principal_type": principal, + "two_cast_witness_type": witness_type, + "search_performed": False, + } + if "--battery" in sys.argv: + ok, skipped, bad = b.check(interpreter, max_bits=18, threads=2) + assert not bad + result["battery"] = {"ok": ok, "skipped": skipped, "failures": bad} + omega = b.compile_lam(r"(\x.x x) (\x.x x)") + tail_selector = b.compile_lam(r"\value\rest.rest") + probe = lam(app(b.shift(interpreter, 1), tail_selector, + b.bitlist(b.enc(omega), v(0)))) + assert b.normalize(b.enc(probe), 1 << 16) == "0010" + result["divergent_source_suffix"] = True + result["elapsed_seconds"] = round(time.monotonic() - start, 3) + if "--battery" in sys.argv: + (RESULTS / "typed_normal.json").write_text(json.dumps(result, indent=2) + "\n") + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + main() From c66a3f08515891808601934716fac546a1cd5f3d Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 13:38:36 -0400 Subject: [PATCH 09/41] Record Scott-handler recursion and its adapter cost --- .../machines/int196_stream_handler.blc | 1 + .../machines/int196_stream_handler.lam | 14 +++ .../machines/int204_normal.lam | 16 ++- .../machines/int206_stream_handler.blc | 1 + .../machines/int206_stream_handler.lam | 12 ++ .../theory/stream_handler.json | 26 +++++ docs/STATUS.md | 7 +- .../classical/self-interpreter/interpreter.md | 2 +- .../self-interpreter/protocol-obstructions.md | 106 ++++++++++++++++++ .../self-interpreter/theory/stream_handler.py | 99 ++++++++++++++++ 10 files changed, 281 insertions(+), 3 deletions(-) create mode 100644 data/self-interpreter/machines/int196_stream_handler.blc create mode 100644 data/self-interpreter/machines/int196_stream_handler.lam create mode 100644 data/self-interpreter/machines/int206_stream_handler.blc create mode 100644 data/self-interpreter/machines/int206_stream_handler.lam create mode 100644 data/self-interpreter/theory/stream_handler.json create mode 100644 tools/self-interpreter/theory/stream_handler.py diff --git a/data/self-interpreter/machines/int196_stream_handler.blc b/data/self-interpreter/machines/int196_stream_handler.blc new file mode 100644 index 00000000..f61bcf7e --- /dev/null +++ b/data/self-interpreter/machines/int196_stream_handler.blc @@ -0,0 +1 @@ +0100000001100101111011101100001000000000101110011000000110011111110000101111001111111000000111100000010111011100110111100001100111111111000011111111100001011111010011101001011110100101101010011010 diff --git a/data/self-interpreter/machines/int196_stream_handler.lam b/data/self-interpreter/machines/int196_stream_handler.lam new file mode 100644 index 00000000..0bbb3f9b --- /dev/null +++ b/data/self-interpreter/machines/int196_stream_handler.lam @@ -0,0 +1,14 @@ +-- Scott-handler recursion; generated by stream_handler.py. +-- E C ( ++ N) =beta C (\z.M) N for closed M. +(\h\cont\list.list (h h cont)) +(\h. + (\p\cont\bit0\list1. + bit0 + (list1 + (\bit1\list2.list2 + (p + (\exp.bit1 + (cont (\args\arg.exp (\zx\zy.zx arg (zy args)))) + (\list3.list3 (p (\exp2.cont (\args.exp args (exp2 args))))))))) + (cont list1 (list1 list1 list1))) + (h h)) diff --git a/data/self-interpreter/machines/int204_normal.lam b/data/self-interpreter/machines/int204_normal.lam index 4048846d..a65a15f7 100644 --- a/data/self-interpreter/machines/int204_normal.lam +++ b/data/self-interpreter/machines/int204_normal.lam @@ -1 +1,15 @@ -\a\b.b (\c.c (\d\e.e e) c) (\d\e\f.f (\g.g (\h\i\j.j (\k.h (\l.k (e (\m\n.l (\o\p.o n (p m)))) (h (\m.e (\n.l n (m n))))))) (\h.e) (d d)) (f f f)) a b +-- Beta-normal entry gate; the first K activates the shared parser. +\cont\list. + list (\bit0.bit0 (\unused\x.x x) bit0) + (\x\cont\list. + list + (\bit0.bit0 + (\intL\unused\r.r + (\bit1.intL + (\exp.bit1 + (cont (\args\arg.exp (\zx\zy.zx arg (zy args)))) + (intL (\exp2.cont (\args.exp args (exp2 args))))))) + (\unused.cont) + (x x)) + (list list list)) + cont list diff --git a/data/self-interpreter/machines/int206_stream_handler.blc b/data/self-interpreter/machines/int206_stream_handler.blc new file mode 100644 index 00000000..eea6897c --- /dev/null +++ b/data/self-interpreter/machines/int206_stream_handler.blc @@ -0,0 +1 @@ +01000000011001011110111011000000000010111001100000011001011111110111111000010111100111111100000011110000001011101110011011110000110010111111111011111111000011111111100001011111010011101001011110100101101010 diff --git a/data/self-interpreter/machines/int206_stream_handler.lam b/data/self-interpreter/machines/int206_stream_handler.lam new file mode 100644 index 00000000..8799bfff --- /dev/null +++ b/data/self-interpreter/machines/int206_stream_handler.lam @@ -0,0 +1,12 @@ +-- Scott-handler recursion; generated by stream_handler.py. +-- E C ( ++ N) =beta C (\z.M) N for closed M. +(\h\cont\list.list (h h cont)) +(\h\cont\bit0\list1. + bit0 + (list1 + (\bit1\list2.list2 + (h h + (\exp.bit1 + (cont (\args\arg.exp (\zx\zy.zx arg (zy args)))) + (\list3.list3 (h h (\exp2.cont (\args.exp args (exp2 args))))))))) + (cont list1 (list1 list1 list1))) diff --git a/data/self-interpreter/theory/stream_handler.json b/data/self-interpreter/theory/stream_handler.json new file mode 100644 index 00000000..b07349a7 --- /dev/null +++ b/data/self-interpreter/theory/stream_handler.json @@ -0,0 +1,26 @@ +{ + "search_performed": false, + "variants": [ + { + "name": "int206_stream_handler", + "bits": 206, + "battery": { + "ok": 667, + "skipped": 1, + "failures": [] + }, + "divergent_source_suffix": true + }, + { + "name": "int196_stream_handler", + "bits": 196, + "battery": { + "ok": 667, + "skipped": 1, + "failures": [] + }, + "divergent_source_suffix": true + } + ], + "elapsed_seconds": 3.52 +} diff --git a/docs/STATUS.md b/docs/STATUS.md index e814f925..148098c7 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -203,7 +203,12 @@ with all features (three opt-in tests ignored) and 328 with default features. force canonical closed internal values, sharpening the cell/APP collision. A representation that erases β distinctions cannot have an exact decoder using only that representation; closed two-sided β-inverse coercions are - necessarily identities. These are protocol-specific handwritten proofs. + necessarily identities. A Scott-handler recursion arrangement costs + 196 bits with shared self-application, 206 without; both pass the + 667/1/0 battery and Ω suffix check in 3.5 seconds combined + (`data/self-interpreter/theory/stream_handler.json`). The adapters still + cost more than the 165's parser interface. These are protocol-specific + handwritten proofs. - **The universal machine** (`classical/self-interpreter/universal.md`): Tromp's wirings around the 165's body give 175 (non-strict) and 187 (strict), against 178 and 190 around the 168's. Wirings around the new body diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index d5988bf8..7998c116 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -497,7 +497,7 @@ Unless marked, each passes the battery and is larger than the 168. | Explicit mode flags, tag-first dispatch, two continuation slots | 203–219 | the variants that escape the uniform-handler impossibility | | **Recursion** | | | | Self-passing `next` with a shared parser, best of 72 orders | 182 | carrier plumbing exceeds the knot | -| Recursion inside the bit handler | 202 | recursive entry needs an adapter | +| Recursion inside the bit handler | 196 / 206 | shared/unshared self-application; recursive entry needs a Scott adapter (`protocol-obstructions.md`) | | Recursor passed through continuations | 204 / 206 | callback arguments plus a public adapter | | A cell holding F performs the knot: `cell(a,e) cell(a,e) = λk. a a (k e e)` | 199 | the continuation receives two extra arguments | | Both recursive call heads replaced, with the knot removed | — | 221,930,567 pairs (34 free bits): no survivor | diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index 445af20c..32b29235 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -352,6 +352,112 @@ closures do not satisfy this restriction: evaluation can return an arbitrary runtime argument. Enforcing such a domain therefore requires a changed value representation and a beta-exact root decoder. +## Recursion entered through Scott handlers + +Two explicit constructions move recursive entry to the input stream's +Scott eliminator. The direct form costs 206 bits; sharing the self-application +inside its generator gives 196. Both have handwritten correctness derivations +and pass the bounded battery and divergent-source suffix probe. Their +canonical sources are `data/self-interpreter/machines/int196_stream_handler` +and `int206_stream_handler`, each with `.lam` and `.blc` encodings. The +reproducer is `tools/self-interpreter/theory/stream_handler.py`, and current +results are in `data/self-interpreter/theory/stream_handler.json` and +`docs/STATUS.md`. + +### Equations + + +Use the current semantic constructors: + +``` +A(e) = lambda env arg. e (lambda x y. x arg (y env)) +B(e,f) = lambda env. e env (f env). +``` + +Define a generator whose two final inputs are an already-exposed bit and tail: + +``` +H = lambda h c b r. + b + (r (lambda d s. + s (h h (lambda e. + d (c A(e)) + (lambda t. t (h h (lambda f. c B(e,f)))))))) + (c r (r r r)). + +E = (lambda h c s. s (h h c)) H. +``` + +The direct source is precisely this term. The shared source replaces the body +of `lambda h` in `H` by a let `p = h h`, then uses `p` at both recursive entry +sites. That ordinary beta expansion reduces the wire size by 10 bits. + +For the argument, write + +``` +P_c = lambda s. s (H H c). +``` + +Then unfolding the generator on a Scott cell gives + +``` +P_c (cons b r) + ->* b + (r (lambda d. + P_(lambda e. d (c A(e)) P_(lambda f. c B(e,f))))) + (c r (r r r)). +``` + +This is the ordinary 168-bit parser recurrence, with the Scott elimination +performed at the call site: + +* A variable has `b = F`. Its closure is the raw unary tail `r`, and + `r r r` reduces to the remainder after the variable's terminating zero. +* A constructor has `b = K`. Reading `r` exposes its second tag `d` and the + first subterm stream. That subterm is parsed with the displayed + continuation. +* For `d = K`, the continuation returns `A(e)` and the first parse's remainder. +* For `d = F`, it parses the second subterm at that remainder, then returns + `B(e,f)` and the second remainder. + +The existing closure denotation induction therefore applies unchanged. +This is a handwritten correctness derivation and a finite battery result; +these two terms do not have separate Lean proofs. + +### Cost and limitation + +The input supplies the next tag and tail, but it does not supply the recursive +handler. The control cycle is `h h`. A recursive parse now needs the adapter + +``` +lambda stream. stream (h h continuation) +``` + +at every boundary where the old parser could be applied directly to the +continuation. Sharing `h h` helps, but those adapters remain. This route +changes the placement of recursion rather than removing its control cost, +and neither term improves the 165-bit record. + +The elementary cross-application identity explains why unary skipping is +cheaper: + +``` +(cons b r) (cons d t) ->* b d t r +s s ->* b b r r. +``` + +On `b = F`, the second equation continues as `r r`; on `b = K`, it stops at +`K r`. This loop needs no evolving constructor continuation. A general +parser must carry that continuation as well as the handler that acts on the +next stream. + +Hoisting the skip through this distributed protocol does not recover the +165's saving. The root adapter and both recursive adapters each need a +whole-stream skip. The directly derived formula costs 220 bits; no search +is needed to see that this arrangement is larger. The surviving design +question is whether an adapter can perform a required semantic operation +while carrying its control. + ## Reproduction `python tools/self-interpreter/theory/erased_skip.py --battery` checks the diff --git a/tools/self-interpreter/theory/stream_handler.py b/tools/self-interpreter/theory/stream_handler.py new file mode 100644 index 00000000..b38579de --- /dev/null +++ b/tools/self-interpreter/theory/stream_handler.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python3 +"""Two hand-derived Scott-handler recursion arrangements; no search. + +The ordinary parser is P c s = s (H H c). Every recursive entry eliminates +its Scott stream before invoking the shared recursive handler. The second +term shares H H inside its generator, reducing 206 bits to 196. +""" +from pathlib import Path +import json +import sys +import time + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +MACHINES = ROOT / "data/self-interpreter/machines" +RESULTS = ROOT / "data/self-interpreter/theory" +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery as b + + +ABS = r"(\args\arg.exp (\zx\zy.zx arg (zy args)))" +APP = r"(\args.exp args (exp2 args))" + +DIRECT = rf""" +(\h\cont\list.list (h h cont)) +(\h\cont\bit0\list1. + bit0 + (list1 + (\bit1\list2.list2 + (h h + (\exp.bit1 + (cont {ABS}) + (\list3.list3 (h h (\exp2.cont {APP}))))))) + (cont list1 (list1 list1 list1))) +""" + +SHARED = rf""" +(\h\cont\list.list (h h cont)) +(\h. + (\p\cont\bit0\list1. + bit0 + (list1 + (\bit1\list2.list2 + (p + (\exp.bit1 + (cont {ABS}) + (\list3.list3 (p (\exp2.cont {APP}))))))) + (cont list1 (list1 list1 list1))) + (h h)) +""" + + +def divergent_suffix_probe(term): + omega = b.compile_lam(r"(\x.x x) (\x.x x)") + tail_selector = b.compile_lam(r"\value\rest.rest") + probe = ("L", ("A", ("A", b.shift(term, 1), tail_selector), + b.bitlist(b.enc(omega), ("V", 0)))) + assert b.normalize(b.enc(probe), 1 << 16) == "0010" + + +def main(): + start = time.monotonic() + records = [] + for name, expected_bits, source in [ + ("int206_stream_handler", 206, DIRECT), + ("int196_stream_handler", 196, SHARED), + ]: + term = b.compile_lam(source) + bits = b.enc(term) + assert len(bits) == expected_bits + (MACHINES / f"{name}.lam").write_text( + "-- Scott-handler recursion; generated by stream_handler.py.\n" + "-- E C ( ++ N) =beta C (\\z.M) N for closed M.\n" + + source.strip() + "\n" + ) + (MACHINES / f"{name}.blc").write_text(bits + "\n") + ok, skipped, failures = b.check(term, max_bits=18, threads=2) + divergent_suffix_probe(term) + record = { + "name": name, "bits": len(bits), + "battery": {"ok": ok, "skipped": skipped, "failures": failures}, + "divergent_source_suffix": True, + } + records.append(record) + assert ok == 667 and skipped == 1 and not failures, record + results = { + "search_performed": False, + "variants": records, + "elapsed_seconds": round(time.monotonic() - start, 3), + } + (RESULTS / "stream_handler.json").write_text( + json.dumps(results, indent=2) + "\n" + ) + print(json.dumps(results, indent=2)) + + +if __name__ == "__main__": + main() From 8837d4cf068c185a97a55deb7ecb60a145d5bc51 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 13:44:12 -0400 Subject: [PATCH 10/41] Kernel-check the simply typed normal interpreter --- .../self-interpreter/theory/typed_normal.json | 4 +- docs/STATUS.md | 6 +- .../classical/self-interpreter/interpreter.md | 13 +- .../self-interpreter/protocol-obstructions.md | 62 +++++++ .../self-interpreter/typed-normal.md | 30 +++- lean/Blc.lean | 1 + lean/Blc/SelfintTyped.lean | 160 ++++++++++++++++++ tools/self-interpreter/theory/typed_normal.py | 79 ++++++++- 8 files changed, 331 insertions(+), 24 deletions(-) create mode 100644 lean/Blc/SelfintTyped.lean diff --git a/data/self-interpreter/theory/typed_normal.json b/data/self-interpreter/theory/typed_normal.json index d6ca8cbb..fac23d7d 100644 --- a/data/self-interpreter/theory/typed_normal.json +++ b/data/self-interpreter/theory/typed_normal.json @@ -4,6 +4,8 @@ "simply_typable": true, "principal_type": "(a0 -> (((((((a1 -> a1) -> ((a2 -> a2) -> a3)) -> a3) -> (a0 -> (((a0 -> (a0 -> a0)) -> (((a0 -> a0) -> a0) -> a0)) -> a4))) -> (a0 -> a4)) -> a5) -> a5))", "two_cast_witness_type": "((a0 -> (a0 -> a1)) -> (((a0 -> a1) -> a0) -> a1))", + "kernel_certificates": "lean/Blc/SelfintTyped.lean", + "cast_erasure_beta_steps": 59, "search_performed": false, "battery": { "ok": 667, @@ -11,5 +13,5 @@ "failures": [] }, "divergent_source_suffix": true, - "elapsed_seconds": 1.761 + "elapsed_seconds": 1.823 } diff --git a/docs/STATUS.md b/docs/STATUS.md index 148098c7..5ac2205b 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -184,8 +184,10 @@ with all features (three opt-in tests ignored) and 328 with default features. (`int204_normal`, L 21, A 29, X 44). Lean proves its exact wire, normality, and directed contract for every closed source and arbitrary continuation and suffix. A separate 672-bit construction is both - β-normal and simply typable, with a general handwritten reduction proof; - application to its quotation need not be simply typable. The 204, 584, + β-normal and simply typable: Lean proves its ordinary STLC judgment + through a sound annotation checker and its directed contract through + a 59-step cast-erasure trace to the literal 165. Application to its + quotation need not be simply typable. The 204, 584, 672, 742, and four erased-skip variants each pass the existing bounded battery (667 pass, one divergent expected result skipped, zero failures). Targeted divergent-source suffix checks also pass. Sources are in diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index 7998c116..0b19391c 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -329,7 +329,8 @@ These are global constraints, not separately additive module costs be β-normal; `normal.md` gives a compact construction with a kernel-checked contract. It can even be both β-normal and simply typable: `typed-normal.md` gives an explicit 672-bit construction and a general -syntactic correctness proof. The actual application to the quotation need +kernel-checked correctness proof, including its ordinary STLC typing +judgment (`Blc/SelfintTyped.lean`). The actual application to the quotation need not share that simple typing. Thus neither a β redex nor untypability of `E` follows from correctness alone. @@ -462,9 +463,11 @@ size change on the 165 (§2). Nineteen more, built on the 165, close the section | Parse under the binder: direct values | large in APP/VAR | Threading the environment and reparsing ABS bodies cost more (226 as a universal machine against 178). | | Share one combinator between the cell and APP (skeleton `a b (c d)`) | 5 | The let plus a four-λ definition costs ~32. | -The binding constraint is the contract, twice over: λ-values must be genuine -functions, which rules out every cheaper cell, and `C` must receive the real -`N`, which rules out the thunk. +With the current transparent value interface, λ-values must be genuine +functions and `C` must receive the real `N`; the cheaper cells and thunked +remainders above violate these requirements. A changed representation can +use a one-sided retraction and a public decoder, but its costs must include +those operations (`protocol-obstructions.md`). ### Measured protocol variants @@ -573,5 +576,5 @@ Open: | `tools/self-interpreter/search_fix.py` | the knot search | | `tools/self-interpreter/beta_search.py` | the Python βη component reference | | `tools/self-interpreter/theory/` | bounded checks for explicit structural witnesses and protocol equations; no candidate search | -| `lake build` in `lean/` | the 165/168, normal and two-nonlinear witnesses; unconditional normalization, capture and origin theorems | +| `lake build` in `lean/` | the 165/168, normal, simply typed and two-nonlinear witnesses; unconditional normalization, capture and origin theorems | | `data/self-interpreter/searches_165.json` | commands and totals of the joint searches of §3 | diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index 32b29235..80b3a210 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -324,6 +324,68 @@ D v = v I, for which `D (J x) ->* x` but `J (D z)` does not reduce to `z`. It also permits inverses restricted to a chosen representation domain. +## One-sided retractions and the leaky cell + +A one-sided retraction can support an exact value representation. Let `A` +and `D` be closed terms satisfying `D (A x) =beta x` for an arbitrary fresh +variable `x`. Keep the parser's control and raw unary variable selectors, +but require environment lookup to return `A a` for the corresponding source +argument `a`. The compositional value constructors can then be + +```text +V_n(e) = X_n e +V_lambda.M(e) = A (lambda a. D (V_M (Cell_A(a,e)))) +V_MN(e) = A (D (V_M e) (D (V_N e))). +``` + +Here `Cell_A(a,e)` extends the environment with `A a`. Induction on the +source term gives `V_M e =beta A (M[rho])` whenever `e` represents the +substitution `rho`. In particular, if `P_A` is the parser returning these +values and the unchanged remainder, its public adapter is + +```text +E_A C s = P_A (lambda v. C (lambda z. D (v z))) s. +``` + +For closed `M`, the arbitrary base environment `z` is unused, and this gives +`E_A C (quote(M) ++ N) =beta C (lambda z.M) N`. The argument uses finite +structural induction and beta congruence, not normalization of `M`, so it +includes divergent source terms. No two-sided inverse is needed. + +This construction does not make the existing leaky cell cheaper. Define + +```text +cons b r = lambda h. h b r +X_1(N) = cons K N +X_(n+1)(N) = cons F (X_n(N)) +L(h,e) = lambda b. b h (lambda r. r e). +``` + +The raw selectors satisfy + +```text +X_1(N) L(h,e) ->* h N +X_(n+1)(N) L(h,e) ->* X_n(N) e. +``` + +Under the compositional scheme above, the first result must be `A a`, +including for arbitrary rigid `N`. Taking `A = K`, with decoder +`D = lambda v.v I`, the head can be stored as `K (K a)`: + +```text +X_1(N) L(K (K a),e) ->* K (K a) N -> K a +L(K (K a),e) =beta lambda b. b (lambda u v.a) (lambda r.r e). +``` + +In the original cell's capture layout `[a,e,...]`, this explicit cell costs +28 bits, against 24 for `lambda b r.b a (r e)`. Both have three applications +and index excess six; the retracted leaky cell has four lambdas instead of +two. APP and the public adapter also perform decoding. Thus this particular +`K`-retraction construction does not recover the leaky cell's apparent +saving. This is an accounting result for the stated raw-selector and +compositional protocol, not a lower bound on arbitrary retractions or a +claim that `K` is the shortest possible wrapper. + ## Swapping a closure's two arguments is not an exact involution A tempting wrapper swaps a closure's environment and source-argument diff --git a/docs/classical/self-interpreter/typed-normal.md b/docs/classical/self-interpreter/typed-normal.md index c5370e08..a81d2a1c 100644 --- a/docs/classical/self-interpreter/typed-normal.md +++ b/docs/classical/self-interpreter/typed-normal.md @@ -1,11 +1,12 @@ # A simply typed beta-normal self-interpreter - -The complete construction is `data/self-interpreter/machines/int672_typed_normal.lam`, **672 bits**. It is -syntactically beta-normal and passes ordinary simple-type inference with an -occurs check. Current finite verification results are in `docs/STATUS.md` and -`data/self-interpreter/theory/typed_normal.json`. The general contract is -the syntactic reduction argument below, rather than a finite observation. +The complete construction is +`data/self-interpreter/machines/int672_typed_normal.lam`, **672 bits**. +`lean/Blc/SelfintTyped.lean` proves its exact wire length, beta-normality, +ordinary simple typing, and directed interpreter contract for every closed +source and arbitrary continuation and suffix. Current finite verification +results are in `docs/STATUS.md` and +`data/self-interpreter/theory/typed_normal.json`. The important result is the construction, rather than its size. In particular, **simple typability of the interpreter alone cannot be an @@ -87,9 +88,20 @@ simple type for `E_typed`. The actual bit `K` does not fit this assigned type; that is precisely where the evaluated application leaves the simply typed fragment. All subterms of `E_typed` remain beta-normal. -`tools/self-interpreter/theory/typed_normal.py` constructs the AST directly, round-trips its named source, -checks syntactic normality, infers a simple type, and optionally runs the -bounded battery: +The Lean proof uses a syntax-directed checker for annotated lambda terms, +proved sound for the ordinary simply typed lambda-calculus judgment +`HasType`. The checked annotation establishes +`HasType [] intL672 type672`; Python inference is only an untrusted +certificate producer. A checked 59-step beta trace removes the gate and +casts to reach the literal 165-bit interpreter on its original input. +Substitution lifts that trace to arbitrary `C,R`, and the existing 165 +contract supplies `selfint_contract672`. This proof does not normalize the +source program or require it to halt. + +`tools/self-interpreter/theory/typed_normal.py` constructs the AST directly, +round-trips its named source, checks syntactic normality, infers a simple +type, and checks that the Lean term, annotation, type, and reduction trace +match the generated certificates. It optionally runs the bounded battery: ```text python tools/self-interpreter/theory/typed_normal.py --battery diff --git a/lean/Blc.lean b/lean/Blc.lean index be4b5b3b..9d95504b 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -21,3 +21,4 @@ import Blc.SelfintNormal import Blc.SelfintCapture import Blc.SelfintOrigins import Blc.SelfintSharp +import Blc.SelfintTyped diff --git a/lean/Blc/SelfintTyped.lean b/lean/Blc/SelfintTyped.lean new file mode 100644 index 00000000..5dfee7b8 --- /dev/null +++ b/lean/Blc/SelfintTyped.lean @@ -0,0 +1,160 @@ +/- +A simply typed, beta-normal 672-bit self-interpreter. + +The type certificate is checked by a proved syntax-directed checker for the +ordinary simply typed lambda calculus. Type inference is not trusted. +An explicit finite beta trace removes the two identity casts and reaches +the literal 165-bit interpreter applied to its original input. + +Source and certificates: tools/self-interpreter/theory/typed_normal.py. +-/ +import Blc.SelfintSharp + +namespace Blc.SelfintTyped +open Term +set_option maxRecDepth 100000 +set_option maxHeartbeats 4000000 + +inductive Ty where + | base + | arr (domain codomain : Ty) + deriving DecidableEq + +/-- The ordinary simply typed lambda-calculus judgment, with de Bruijn variables. -/ +inductive HasType : List Ty → Term → Ty → Prop where + | var {Γ : List Ty} {i : Nat} {τ : Ty} : + Γ[i]? = some τ → HasType Γ (.var i) τ + | lam {Γ : List Ty} {b : Term} {σ τ : Ty} : + HasType (σ :: Γ) b τ → HasType Γ (.lam b) (.arr σ τ) + | app {Γ : List Ty} {f a : Term} {σ τ : Ty} : + HasType Γ f (.arr σ τ) → HasType Γ a σ → HasType Γ (.app f a) τ + +inductive Annotated where + | var (i : Nat) + | lam (domain : Ty) (body : Annotated) + | app (fn arg : Annotated) + +def erase : Annotated → Term + | .var i => .var i + | .lam _ b => .lam (erase b) + | .app f a => .app (erase f) (erase a) + +def check (Γ : List Ty) : Annotated → Option Ty + | .var i => Γ[i]? + | .lam σ b => (check (σ :: Γ) b).map (Ty.arr σ) + | .app f a => + match check Γ f, check Γ a with + | some (.arr σ τ), some σ' => if σ = σ' then some τ else none + | _, _ => none + +theorem check_sound {t : Annotated} {Γ : List Ty} {τ : Ty} + (h : check Γ t = some τ) : HasType Γ (erase t) τ := by + induction t generalizing Γ τ with + | var i => exact .var h + | lam σ b ih => + obtain ⟨ρ, hρ, rfl⟩ := Option.map_eq_some_iff.mp h + exact .lam (ih hρ) + | app f a ihf iha => + cases hf : check Γ f with + | none => simp [check, hf] at h + | some ft => + cases ha : check Γ a with + | none => simp [check, hf, ha] at h + | some argType => + cases ft with + | base => simp [check, hf, ha] at h + | arr σ ρ => + by_cases he : σ = argType + · subst argType + have ht : ρ = τ := by simpa [check, hf, ha] using h + subst τ + exact .app (ihf hf) (iha ha) + · simp [check, hf, ha, he] at h + +theorem betas_subst {t u : Term} (h : Betas t u) (j : Nat) (s : Term) : + Betas (substDec j s t) (substDec j s u) := by + induction h with + | refl t => exact .refl _ + | head hb hs ih => + obtain ⟨n, hp⟩ := beta_par hb + exact betas_trans (parN_betas (parN_substDec hp (parN_refl s) j)) ih + +theorem betas_inst : ∀ (as : List Term) (j : Nat) {t u : Term}, + Betas t u → Betas (instN as j t) (instN as j u) := by + intro as + induction as with + | nil => intro j t u h; exact h + | cons a as ih => + intro j t u h + exact betas_subst (ih (j + 1) h) j _ + + +def intL672 : Term := (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.app (.app (.var 1) (.lam (.app (.app (.var 0) (.lam (.var 0))) (.lam (.var 0))))) (.var 0)) (.lam (.lam (.app (.app (.var 1) (.app (.app (.var 1) (.app (.app (.var 1) (.app (.var 0) (.lam (.app (.app (.var 2) (.var 0)) (.var 0))))) (.app (.var 0) (.lam (.app (.app (.var 2) (.app (.var 1) (.lam (.app (.var 2) (.lam (.app (.app (.var 4) (.app (.var 3) (.lam (.app (.var 4) (.lam (.app (.app (.var 6) (.app (.app (.var 6) (.var 0)) (.app (.var 5) (.lam (.app (.app (.var 7) (.app (.app (.var 7) (.var 0)) (.app (.var 6) (.lam (.app (.var 7) (.lam (.app (.app (.var 9) (.var 0)) (.var 4)))))))) (.var 3)))))) (.app (.app (.var 6) (.app (.app (.var 6) (.var 0)) (.var 0))) (.var 0)))))))) (.app (.var 3) (.lam (.app (.app (.var 5) (.var 2)) (.app (.var 4) (.lam (.app (.app (.var 6) (.app (.app (.var 6) (.var 1)) (.app (.app (.var 6) (.var 2)) (.app (.var 5) (.lam (.app (.var 6) (.lam (.app (.app (.var 8) (.var 2)) (.app (.var 7) (.lam (.app (.var 8) (.lam (.app (.app (.var 10) (.app (.app (.var 10) (.var 1)) (.var 2))) (.app (.app (.var 10) (.var 0)) (.var 3))))))))))))))) (.app (.app (.var 6) (.var 3)) (.app (.var 5) (.lam (.app (.app (.var 7) (.var 3)) (.app (.var 6) (.lam (.app (.app (.var 8) (.app (.app (.var 8) (.var 2)) (.var 0))) (.app (.app (.var 8) (.var 1)) (.var 0))))))))))))))))))))) (.app (.app (.var 2) (.var 0)) (.var 0))))))) (.var 5))) (.app (.var 0) (.lam (.app (.app (.var 2) (.app (.app (.var 2) (.var 0)) (.app (.var 1) (.lam (.app (.var 2) (.lam (.var 1))))))) (.var 3))))))))))))) + +def annotated672 : Annotated := (.lam .base (.lam (.arr (.arr (.arr (.arr (.arr (.arr .base .base) (.arr (.arr .base .base) .base)) .base) (.arr .base (.arr (.arr (.arr .base (.arr .base .base)) (.arr (.arr (.arr .base .base) .base) .base)) .base))) (.arr .base .base)) .base) (.app (.var 0) (.lam (.arr (.arr (.arr (.arr .base .base) (.arr (.arr .base .base) .base)) .base) (.arr .base (.arr (.arr (.arr .base (.arr .base .base)) (.arr (.arr (.arr .base .base) .base) .base)) .base))) (.lam .base (.app (.app (.app (.var 1) (.lam (.arr (.arr .base .base) (.arr (.arr .base .base) .base)) (.app (.app (.var 0) (.lam .base (.var 0))) (.lam .base (.var 0))))) (.var 0)) (.lam (.arr .base (.arr .base .base)) (.lam (.arr (.arr .base .base) .base) (.app (.app (.var 1) (.app (.app (.var 1) (.app (.app (.var 1) (.app (.var 0) (.lam .base (.app (.app (.var 2) (.var 0)) (.var 0))))) (.app (.var 0) (.lam .base (.app (.app (.var 2) (.app (.var 1) (.lam .base (.app (.var 2) (.lam .base (.app (.app (.var 4) (.app (.var 3) (.lam .base (.app (.var 4) (.lam .base (.app (.app (.var 6) (.app (.app (.var 6) (.var 0)) (.app (.var 5) (.lam .base (.app (.app (.var 7) (.app (.app (.var 7) (.var 0)) (.app (.var 6) (.lam .base (.app (.var 7) (.lam .base (.app (.app (.var 9) (.var 0)) (.var 4)))))))) (.var 3)))))) (.app (.app (.var 6) (.app (.app (.var 6) (.var 0)) (.var 0))) (.var 0)))))))) (.app (.var 3) (.lam .base (.app (.app (.var 5) (.var 2)) (.app (.var 4) (.lam .base (.app (.app (.var 6) (.app (.app (.var 6) (.var 1)) (.app (.app (.var 6) (.var 2)) (.app (.var 5) (.lam .base (.app (.var 6) (.lam .base (.app (.app (.var 8) (.var 2)) (.app (.var 7) (.lam .base (.app (.var 8) (.lam .base (.app (.app (.var 10) (.app (.app (.var 10) (.var 1)) (.var 2))) (.app (.app (.var 10) (.var 0)) (.var 3))))))))))))))) (.app (.app (.var 6) (.var 3)) (.app (.var 5) (.lam .base (.app (.app (.var 7) (.var 3)) (.app (.var 6) (.lam .base (.app (.app (.var 8) (.app (.app (.var 8) (.var 2)) (.var 0))) (.app (.app (.var 8) (.var 1)) (.var 0))))))))))))))))))))) (.app (.app (.var 2) (.var 0)) (.var 0))))))) (.var 5))) (.app (.var 0) (.lam .base (.app (.app (.var 2) (.app (.app (.var 2) (.var 0)) (.app (.var 1) (.lam .base (.app (.var 2) (.lam .base (.var 1))))))) (.var 3))))))))))))) + +def type672 : Ty := (.arr .base (.arr (.arr (.arr (.arr (.arr (.arr (.arr .base .base) (.arr (.arr .base .base) .base)) .base) (.arr .base (.arr (.arr (.arr .base (.arr .base .base)) (.arr (.arr (.arr .base .base) .base) .base)) .base))) (.arr .base .base)) .base) .base)) + +def trace672 : List (List SelfintSharp.Direction) := [[.left], [], [], [.left], [], [.left, .left], [.left], [], [.left], [], [.left], [.left, .left], [.left, .left, .left], [.left, .left, .left], [.left, .left, .left, .under, .left], [.left, .left, .right], [.left, .left, .right, .under, .left], [.left, .left, .right, .under, .left], [.left, .left, .right, .under, .left, .under], [.left, .left, .right, .under, .left, .under, .under, .left], [.left, .left, .right, .under, .left, .under, .under, .left], [.left, .left, .right, .under, .left, .under, .under, .left, .under], [.left, .left, .right, .under, .left, .under, .under, .left, .under, .under, .left], [.left, .left, .right, .under, .left, .under, .under, .left, .under, .under, .left, .left], [.left, .left, .right, .under, .left, .under, .under, .left, .under, .under, .left, .right], [.left, .left, .right, .under, .left, .under, .under, .left, .under, .under, .left, .right, .under, .left], [.left, .left, .right, .under, .left, .under, .under, .left, .under, .under, .left, .right, .under, .left, .left], [.left, .left, .right, .under, .left, .under, .under, .left, .under, .under, .left, .right, .under, .left, .right], [.left, .left, .right, .under, .left, .under, .under, .left, .under, .under, .left, .right, .under, .left, .right, .under], [.left, .left, .right, .under, .left, .under, .under, .left, .under, .under, .left, .right, .under, .left, .right, .under, .under, .left], [.left, .left, .right, .under, .left, .under, .under, .left, .under, .under, .right, .left], [.left, .left, .right, .under, .left, .under, .under, .left, .under, .under, .right, .left, .left], [.left, .left, .right, .under, .left, .under, .under, .right], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .left], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .left], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .left, .left], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .left, .right, .left], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .left, .right, .right], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .left, .right, .right, .under], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .left, .right, .right, .under, .under, .left], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .left, .right, .right, .under, .under, .right], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .left, .right, .right, .under, .under, .right, .under], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .left, .right, .right, .under, .under, .right, .under, .under, .left], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .left, .right, .right, .under, .under, .right, .under, .under, .left, .left], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .left, .right, .right, .under, .under, .right, .under, .under, .right, .left], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .left], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right, .under, .left], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right, .under, .right], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right, .under, .right, .under, .left], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right, .under, .right, .under, .left, .left], [.left, .left, .right, .under, .left, .under, .under, .right, .under, .right, .under, .right, .right, .under, .right, .under, .right, .left], [.left, .left, .right, .under, .right, .left], [.right], [.right, .under, .left], [.right, .under, .left, .left], [.right, .under, .left, .right], [.right, .under, .left, .right, .under]] + +theorem annotated672_erases : erase annotated672 = intL672 := by decide + +theorem check672 : check [] annotated672 = some type672 := by decide + +/-- An ordinary closed STLC typing derivation, obtained from the checked annotation. -/ +theorem intL672_typed : HasType [] intL672 type672 := by + rw [← annotated672_erases] + exact check_sound check672 + +theorem intL672_closed : Closed intL672 := by decide + +theorem intL672_length : (blcCode intL672).length = 672 := by decide + +theorem intL672_nft : NFt intL672 := by decide + +theorem intL672_normal : NormalForm intL672 := fun _ h => nft_no_beta intL672_nft h + +theorem run_root672 : + SelfintSharp.replay trace672 + (.app (.app intL672 (.var 0)) (pairT churchTrue (.var 1))) + = some (.app (.app intL165 (.var 0)) (pairT churchTrue (.var 1))) := by decide + +theorem substDec_intL672 (j : Nat) (s : Term) : substDec j s intL672 = intL672 := + substDec_closed j s intL672_closed + +theorem substDec_intL165' (j : Nat) (s : Term) : substDec j s intL165 = intL165 := + substDec_closed j s isSelfInterpreter_intL165.1 + +theorem root672 (C R : Term) : + Betas (.app (.app intL672 C) (pairT churchTrue R)) + (.app (.app intL165 C) (pairT churchTrue R)) := by + have h := betas_inst [C, R] 0 (SelfintSharp.replay_sound run_root672) + simpa [instN, pairT, substDec, shift, substDec_intL672, substDec_intL165', + shift_churchTrue, substDec_churchTrue, shift_shift0, substDec_shift0, shift_zero] using h + +/-- Directed beta correctness for every closed source and arbitrary continuation and suffix. -/ +theorem selfint_contract672 (M : Term) (hM : Closed M) (C N : Term) : + Betas (.app (.app intL672 C) (streamOf (blcCode M) N)) + (.app (.app C (.lam M)) N) := by + have hzero : ∃ R, streamOf (blcCode M) N = pairT churchTrue R := by + cases M with + | var i => simp [Closed, FreeUnder] at hM + | lam M => exact ⟨_, rfl⟩ + | app M P => exact ⟨_, rfl⟩ + obtain ⟨R, hR⟩ := hzero + have hroot : Betas (.app (.app intL672 C) (streamOf (blcCode M) N)) + (.app (.app intL165 C) (streamOf (blcCode M) N)) := by + rw [hR] + exact root672 C R + exact betas_trans hroot (selfint_contract165 M hM C N) + +theorem isSelfInterpreter_intL672 : IsSelfInterpreter intL672 := + ⟨intL672_closed, fun M hM => + ⟨_, selfint_contract672 M hM (.var 0) (.var 1), .refl _⟩⟩ + +/-- A simply typed normal interpreter exists; its invocation need not be typable. -/ +theorem typed_normal_selfInterpreter : ∃ E τ, IsSelfInterpreter E ∧ + NormalForm E ∧ HasType [] E τ := + ⟨intL672, type672, isSelfInterpreter_intL672, intL672_normal, intL672_typed⟩ + +end Blc.SelfintTyped diff --git a/tools/self-interpreter/theory/typed_normal.py b/tools/self-interpreter/theory/typed_normal.py index 190ab569..3cad667a 100644 --- a/tools/self-interpreter/theory/typed_normal.py +++ b/tools/self-interpreter/theory/typed_normal.py @@ -17,6 +17,7 @@ RESULTS = ROOT / "data/self-interpreter/theory" sys.path.insert(0, str(ROOT / "tools/self-interpreter")) import battery as b +import affine_basis as certificate def app(*ts): @@ -70,6 +71,7 @@ class Types: def __init__(self): self.next_id = 0 self.assignments = {} + self.annotations = {} def fresh(self): out = self.next_id @@ -101,14 +103,15 @@ def unify(self, left, right): self.unify(left[0], right[0]) self.unify(left[1], right[1]) - def infer(self, term, context=()): + def infer(self, term, context=(), path=()): if term[0] == "V": return context[term[1]] if term[0] == "L": arg = self.fresh() - return (arg, self.infer(term[1], (arg,) + context)) - fn = self.infer(term[1], context) - arg = self.infer(term[2], context) + self.annotations[path] = arg + return (arg, self.infer(term[1], (arg,) + context, path + (0,))) + fn = self.infer(term[1], context, path + (1,)) + arg = self.infer(term[2], context, path + (2,)) result = self.fresh() self.unify(fn, (arg, result)) return result @@ -122,6 +125,23 @@ def render(self, t, names=None): return names[t] return f"({self.render(t[0], names)} -> {self.render(t[1], names)})" + def lean_type(self, t): + """Instantiate every remaining type variable with one ground base type.""" + t = self.prune(t) + if isinstance(t, int): + return ".base" + return f"(.arr {self.lean_type(t[0])} {self.lean_type(t[1])})" + + def lean_annotated(self, term, path=()): + if term[0] == "V": + return f"(.var {term[1]})" + if term[0] == "L": + domain = self.lean_type(self.annotations[path]) + body = self.lean_annotated(term[1], path + (0,)) + return f"(.lam {domain} {body})" + return (f"(.app {self.lean_annotated(term[1], path + (1,))} " + f"{self.lean_annotated(term[2], path + (2,))})") + def named_source(t, context=(), counter=None): counter = [0] if counter is None else counter @@ -134,17 +154,60 @@ def named_source(t, context=(), counter=None): return f"({named_source(t[1], context, counter)} {named_source(t[2], context, counter)})" -def main(): - start = time.monotonic() +def build(): e0 = b.compile_lam((ROOT / "data/self-interpreter/machines/int165.lam").read_text()) # At the T construction site the outer context is [rest, bit, stream, C]. source_call = app(e0, v(3), cons(K, v(0))) translated = lam(lam(cast_translation(source_call))) handler = lam(lam(app(v(1), PACKET, v(0), translated))) interpreter = lam(lam(app(v(0), handler))) + return interpreter, e0 + + +def reduction_trace(interpreter, e0): + """Remove only generated gate/cast redexes, preserving original source redexes.""" + def ml(t): + return ("L", t, True) + + def cast(t, depth=0): + if t[0] == "V": + return v(t[1] if t[1] < depth else t[1] + 2) + if t[0] == "A": + return app(v(depth + 1), cast(t[1], depth), cast(t[2], depth)) + return app(v(depth), ("L", cast(t[1], depth + 1), False)) + + source_call = app(e0, v(3), cons(K, v(0))) + identity = ml(v(0)) + packet = ml(app(v(0), identity, identity)) + translated = ml(ml(cast(source_call))) + handler = ml(ml(app(v(1), packet, v(0), translated))) + marked = ml(ml(app(v(0), handler))) + assert certificate.plain(marked) == interpreter + first_bit = ml(ml(v(1))) + stream = ml(app(v(0), certificate.shift(first_bit, 1), v(2))) + result = app(marked, v(0), stream) + trace = [] + while (step := certificate.admin_step(result)) is not None: + path, result = step + trace.append(path) + assert len(trace) < 1000 + assert certificate.plain(result) == app(e0, v(0), cons(K, v(1))) + return trace + + +def main(): + start = time.monotonic() + interpreter, e0 = build() assert is_normal(interpreter) types = Types() - principal = types.render(types.infer(interpreter)) + inferred = types.infer(interpreter) + principal = types.render(inferred) + trace = reduction_trace(interpreter, e0) + proof = (ROOT / "lean/Blc/SelfintTyped.lean").read_text() + assert f"def intL672 : Term := {certificate.lean_term(interpreter)}\n" in proof + assert f"def annotated672 : Annotated := {types.lean_annotated(interpreter)}\n" in proof + assert f"def type672 : Ty := {types.lean_type(inferred)}\n" in proof + assert f"def trace672 : List (List SelfintSharp.Direction) := {certificate.lean_trace(trace)}\n" in proof bits = b.enc(interpreter) (MACHINES / "int672_typed_normal.lam").write_text(named_source(interpreter) + "\n") (MACHINES / "int672_typed_normal.blc").write_text(bits + "\n") @@ -160,6 +223,8 @@ def main(): "simply_typable": True, "principal_type": principal, "two_cast_witness_type": witness_type, + "kernel_certificates": "lean/Blc/SelfintTyped.lean", + "cast_erasure_beta_steps": len(trace), "search_performed": False, } if "--battery" in sys.argv: From 7b750e1915504cbfe314d859ab0b42b1a25d7697 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 13:58:39 -0400 Subject: [PATCH 11/41] Prove interpreter code copying and control obstructions --- docs/STATUS.md | 19 +- .../classical/self-interpreter/interpreter.md | 9 + .../self-interpreter/protocol-obstructions.md | 71 +++++ .../self-interpreter/structural-bounds.md | 152 ++++++++++ .../self-interpreter/typed-normal.md | 8 + lean/Blc.lean | 1 + lean/Blc/SelfintControl.lean | 182 ++++++++++++ lean/Blc/SelfintOrigins.lean | 273 ++++++++++++++++++ lean/Blc/SelfintTyped.lean | 21 +- lean/README.md | 29 ++ 10 files changed, 742 insertions(+), 23 deletions(-) create mode 100644 lean/Blc/SelfintControl.lean diff --git a/docs/STATUS.md b/docs/STATUS.md index 5ac2205b..52ec6c88 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -177,8 +177,15 @@ with all features (three opt-in tests ignored) and 328 with default features. A colored reduction theorem proves that quotation-origin binders remain affine, retain one of three protected head shapes, and cannot acquire a live capture; live quotation bodies stay normal and contain only - quotation-origin abstractions. These results do not yet give an additive - size decomposition. + quotation-origin abstractions. Lean also proves that every interpreter + has a closed normal source for which every successful colored reduction + trace contains a strict increase in interpreter-origin abstractions: + a nonlinear interpreter-origin binder must copy an argument containing + interpreter-origin code. A handwritten modified SK abstraction + construction shows that all interpreter-origin output binders can share + one original binder, so distinct output roles do not force distinct + origins without a size-sensitive argument. These results do not yet give + an additive size decomposition. - **Normal and typed witnesses** (`classical/self-interpreter/normal.md`, `typed-normal.md`): the β-normal interpreter is 204 bits (`int204_normal`, L 21, A 29, X 44). Lean proves its exact wire, @@ -201,7 +208,10 @@ with all features (three opt-in tests ignored) and 328 with default features. the erased skip operand can return the continuation, parser, or generator off the input domain, producing correct 167-, 168-, and 169-bit variants. The unchanged NEXT diagonal fails for every skip function under its - handler protocol. Root transparency and context independence already + handler protocol. Lean proves `E E` cannot be β-equal to `E` for any + exact interpreter, excluding an idempotent control response whose + self-application would supply the full parser. Root transparency and + context independence already force canonical closed internal values, sharpening the cell/APP collision. A representation that erases β distinctions cannot have an exact decoder using only that representation; closed two-sided β-inverse coercions are @@ -209,7 +219,8 @@ with all features (three opt-in tests ignored) and 328 with default features. 196 bits with shared self-application, 206 without; both pass the 667/1/0 battery and Ω suffix check in 3.5 seconds combined (`data/self-interpreter/theory/stream_handler.json`). The adapters still - cost more than the 165's parser interface. These are protocol-specific + cost more than the 165's parser interface. Except for the unconditional + non-idempotence and its generator corollary, these are protocol-specific handwritten proofs. - **The universal machine** (`classical/self-interpreter/universal.md`): Tromp's wirings around the 165's body give 175 (non-strict) and 187 diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index 0b19391c..6c18808d 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -321,6 +321,9 @@ preserved by β-reduction and holds for the quotation, while the normal output for `λa b.a b` violates it. A separate colored reduction theorem tracks quotation-origin binders through unrestricted interpreter reductions: they remain affine with a protected head occurrence. +For a suitable closed normal source, every successful colored trace must +also copy interpreter-origin code at a nonlinear interpreter-origin binder. +Copying quotation-only arguments cannot create the required output. These are global constraints, not separately additive module costs (`structural-bounds.md`, `Blc/SelfintCapture.lean`, `Blc/SelfintOrigins.lean`). @@ -385,6 +388,10 @@ These are Codex's handwritten proofs, with targeted reduction checks in each requires `A c (λz.I) N` to equal `c (λz.I) R`; but they leave different remainders `R` after the misread variable. - **`E E = E` is impossible:** the identity program refutes it. + `Blc/SelfintControl.lean` proves this from the exact contract, and excludes + an idempotent control response whose self-application is `E`. The APP + control-seed consequence and its suffix assumptions are in + `protocol-obstructions.md`. - **A contract-preserving continuation that is also its own knot driver is impossible:** M = Ω refutes it. - **A shared head cannot carry the only tag dependence.** If @@ -560,6 +567,8 @@ Open: so counting more such binders cannot close the gap. A quantitative theorem must account for their connections, live captures, and quotation-origin restrictions without incorrectly adding costs of computations that share. + Code copying is necessary, but different output binding roles can all + descend from one original binder (`structural-bounds.md`). ## 8. Reproduce diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index 80b3a210..339f6b9d 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -157,6 +157,77 @@ return instruction, and that instruction performs an already-required semantic operation. An explicit adapter that merely recovers the current parser repays the hoped-for saving. A smaller protocol of this kind remains open. +## APP cannot supply the full parser through an idempotent control response + +The semantic application `lambda e.f e (g e)` already duplicates an +environment. A proposed reuse makes a special environment `q` expose a +recursion generator from each parsed value, so that this same APP operation +performs the generator's self-application. The following obstruction uses +actual source values, not independent rigid operands. + +First, **no interpreter satisfying the exact contract is idempotent**: +`E E` cannot be beta-equal to `E`. Write + +```text +I = lambda x.x +F = lambda z.I +Q(N) = quote(I) ++ N + = cons K (cons K (cons F (cons K N))). +``` + +For a fresh rigid `r`, two uses of the interpreter contract give + +```text +E E Q(Q(r)) =beta E F Q(r) =beta F F r =beta r. +``` + +If `E E =beta E`, this forces `E Q(Q(r)) =beta r`. Apply both sides to +`Q(F)` and use the contract once more: + +```text +r Q(F) =beta E Q(Q(r)) Q(F) + =beta Q(Q(r)) F F + =beta cons F (cons K (Q(r))). +``` + +The left side is beta-normal with rigid head `r`; the right side is +beta-normal with an outer lambda. Church–Rosser excludes their equality. +`Blc.SelfintControl.selfInterpreter_not_idempotent` kernel-checks this +argument from `IsSelfInterpreter`, deriving arbitrary continuation and +suffix instances from its rigid-placeholder formulation. It assumes no +parser architecture. + +Now let `V(M,N)` be a context-independent internal value for source `M` +followed by suffix `N`, allowing a changed representation and a separate +public decoder. Fix a control seed `q` and write `H(M,N) = V(M,N) q`. +Assume APP remains pointwise application at this seed: + +```text +H(M L,N) =beta H(M,quote(L) ++ N) H(L,N). +``` + +For just one suffix `R`, suppose the three actual control responses agree: + +```text +H(I,R) =beta H(I,Q(R)) =beta H(I I,R) =beta G. +``` + +The APP equation at `(I,I)` then gives `G =beta G G`. Therefore `G G` +cannot be the full exact interpreter `E`: that additional equation would +give `G =beta E` and hence `E E =beta E`, contradicting the proof above. +This last implication is also kernel-checked as +`selfInterpreter_not_idempotent_generator`; the stated APP protocol +reduction to its hypotheses is the handwritten argument above. + +A common generator response for every source and suffix implies these +hypotheses, but is stronger than necessary. Suffix independence on `I` +and invariance of the control response under `I I -> I` already suffice. +Correctness after a public decoder does **not** imply either property of +the internal values. Source-dependent responses that distinguish these +cases, a nonhomomorphic control projection, or a bootstrap targeting a +continuation-specific internal state instead of `E` remain outside this +obstruction. + ## Closed-source correctness already forces closed internal values diff --git a/docs/classical/self-interpreter/structural-bounds.md b/docs/classical/self-interpreter/structural-bounds.md index cd42c5c0..f01714fb 100644 --- a/docs/classical/self-interpreter/structural-bounds.md +++ b/docs/classical/self-interpreter/structural-bounds.md @@ -150,6 +150,158 @@ This provenance statement is stronger than saying the initial quotation is affine. Affineness alone does not identify the origin of a binder after unrestricted interpreter reductions. +## Decoding must copy interpreter-origin code + +The quotation can control computation, but duplicating only quotation +syntax cannot supply arbitrary output structure. `Blc.SelfintOrigins` +proves this as a property of reduction traces. + +Let `redCount(t)` count interpreter-origin abstractions. Substitution has +the exact accounting law + +```text +redCount(B[x := A]) = redCount(B) + occurrences(x,B) redCount(A). +``` + +A red contraction consumes its own abstraction, so with `k` occurrences +and `r` red abstractions in the argument, its change in red count is +`(k - 1) r - 1`, interpreted over integers. A blue contraction cannot +increase the count, because its binder is affine. Consequently any strict +increase must contract a nonlinear red binder and duplicate an argument +containing a red abstraction. `CodeDup` identifies such a contraction, +including beneath arbitrary application and abstraction contexts. + +For each `n`, use the closed normal source + +```text +M_0 = λx.x +M_(n+1) = λx.(x x) M_n. +``` + +It has exactly `n` nonlinear binders. All of them must be red in the +interpreter's exact output. Choose `n` one greater than the number of +abstractions in `E`: the initial colored invocation has only that many +red abstractions, while its output has at least `n`. + +`selfInterpreter_every_trace_copies_code` proves that a successful trace +exists and **every** colored trace to this source's exact output contains +a strict red-count growth step. The theorem supplies the prefix, selected +contraction, and suffix, with `CodeDup` and the strict count inequality. +Its existential corollary is `selfInterpreter_must_copy_code`. + +This excludes a decoder whose contractions duplicate only quotation-only +arguments. It does not require a separate fixed-point combinator: a +semantic operation may perform the necessary code copying. Nor does it +assign that operation an independent bit cost. + +## Different output roles need not have different origins + +The frozen-quotation theorem does not turn different output binding roles +into distinct abstraction occurrences in the interpreter. A single original +binder can supply every abstraction in an arbitrary reconstructed lambda term, +including binders with different multiplicities and capture relations. +The following is Codex's handwritten construction, not a separate Lean result. + +Let + +```text +S = λf g x.f x (g x) +K = λa b.a +I = S K K. +``` + +Mark the final `x` binder in one syntactic copy of `S` with origin `α`. +Treat `S,K` as constant symbols when constructing combinatory expressions. +Use this modified bracket abstraction, in the displayed case order: + +```text +[x]x = I +[x]T = S (K (K T)) I when x is absent from T +[x](U V) = S ([x]U) ([x]V) otherwise. +``` + +For every combinatory expression `T`, expanding the constants gives a finite +beta reduction + +```text +[x]T →* λx.T +``` + +whose displayed surviving abstraction comes from `S`'s final binder. +This is beta equality, with no eta rule: + +* `S K K →* λx.x`. +* `S (K (K T)) I →* λx.(K T) (I x) →* λx.T`. +* `S ([x]U) ([x]V)` first becomes + `λx.([x]U) x (([x]V) x)`. The two induction hypotheses turn its + subapplications into `U` and `V`; their intermediate abstraction binders + are contracted. + +In each case the selected outer `S` receives both its first arguments, so +its `f,g` binders are consumed. The auxiliary `K` and `I` binders used by +that abstraction step are consumed or erased. Copies of constants inside +`T` are left intact for subsequent steps. All variable names can first be +chosen distinct from the constant symbols and administrative binders. +Capture avoidance preserves the free variables of `T`; the application +case passes the surviving bound `x` to the two recursive expressions. +Thus the construction creates the required binding edges by substitution +and application, without accidental capture. + +Compile a source term structurally: + +```text +C(x) = x +C(M N) = C(M) C(N) +C(λx.M) = [x]C(M). +``` + +A second induction gives `C(M) →* M`. In an abstraction case first perform +the bracket reduction to `λx.C(M)`, then the source induction beneath that +lambda. In an application case reduce its two operands independently. +These reductions need not contract any redex belonging to the reconstructed +source: the result holds for non-normal and divergent `M` too. Every +source abstraction reconstructed by this path has the marked origin. + +To make this one *original* occurrence rather than repeated copies of the +same definition, share the constants: + +```text +T_M = (λs k. C(M)[S := s, K := k]) S K. +``` + +The two sharing binders are contracted first. The resulting copies of `S` +all inherit the same original `α`, so every abstraction in the final `M` +is a residual of that one syntactic binder. A small example already +separates affine and nonlinear capturing roles: + +```text +(λs k. s s (k (s k k))) S K + →* S S (K I) + →* λf. S f I + →* λf x. f x x. +``` + +Both final binders descend from the original `S.x`. The final `f` is +affine, whereas `x` is nonlinear and captures `f`. + +Apply the general construction to the literal 165-bit interpreter. +`T_int165` first beta-reduces to that exact interpreter, with every one of +its abstractions descended from `α`. It therefore satisfies the same +self-interpreter contract. Composing this path with the existing interpreter +reduction shows that all interpreter-origin output binders can descend +from `α` for every closed source. Quotation-origin output binders may still +remain; the frozen theorem continues to constrain those independently. + +Consequently no finite source binding or capture graph alone forces several +distinct interpreter origins for its complex output binders. This does not +exclude a size-sensitive argument: the combinatory code can be much larger +than 165 bits, and the structure encoded by that code still has a cost. +The counterexample rules out unqualified origin-counting arguments, not +lower bounds that account for how much syntax is needed to reuse an origin. +It supplies a chosen reduction path, not a classification of all paths. +The sharing and combinator machinery still contains other binders; this +does not contradict the two-nonlinear-binder lower bound. + ## Exact evidence boundary The three structural modules are kernel-checked, use no `sorry` or diff --git a/docs/classical/self-interpreter/typed-normal.md b/docs/classical/self-interpreter/typed-normal.md index a81d2a1c..ac09d2fb 100644 --- a/docs/classical/self-interpreter/typed-normal.md +++ b/docs/classical/self-interpreter/typed-normal.md @@ -13,6 +13,14 @@ particular, **simple typability of the interpreter alone cannot be an unconditional exclusion**. Actual applications to quotations need not admit the interpreter's inferred type. +Two-parameter delayed interpretation is an established technique: +[Tromp's paper, introduction](https://tromp.github.io/cl/LC.pdf) credits +Mogensen's encoding with the decoder `λm.m I I`, citing +*Linear-Time Self-Interpretation of the Pure Lambda Calculus* (2000). +The construction here uses this approach inside a first-bit-activated BLC +wrapper; its ordinary simple typing and exact BLC contract are checked +separately below. + Let `E0` be any closed correct interpreter, `I = λx.x`, and ```text diff --git a/lean/Blc.lean b/lean/Blc.lean index 9d95504b..8114ea2c 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -21,4 +21,5 @@ import Blc.SelfintNormal import Blc.SelfintCapture import Blc.SelfintOrigins import Blc.SelfintSharp +import Blc.SelfintControl import Blc.SelfintTyped diff --git a/lean/Blc/SelfintControl.lean b/lean/Blc/SelfintControl.lean new file mode 100644 index 00000000..1b4949d7 --- /dev/null +++ b/lean/Blc/SelfintControl.lean @@ -0,0 +1,182 @@ +/- +An exact self-interpreter cannot be its own self-application. + +This uses only the public IsSelfInterpreter contract, beta confluence, +and two projections of the Scott quotation of the identity. It imposes no +parser architecture or assumption about the interpreter's normal form. +-/ +import Blc.SelfintProof +import Blc.Confluence + +namespace Blc.SelfintControl +open Term + +theorem join_refl (t : Term) : BetaJoin t t := ⟨t, .refl t, .refl t⟩ + +theorem join_of_betas {t u : Term} (h : Betas t u) : BetaJoin t u := + ⟨u, h, .refl u⟩ + +theorem join_symm {t u : Term} (h : BetaJoin t u) : BetaJoin u t := by + obtain ⟨w, ht, hu⟩ := h + exact ⟨w, hu, ht⟩ + +theorem join_trans {t u v : Term} + (htu : BetaJoin t u) (huv : BetaJoin u v) : BetaJoin t v := by + obtain ⟨a, hta, hua⟩ := htu + obtain ⟨b, hub, hvb⟩ := huv + obtain ⟨w, haw, hbw⟩ := betas_confluent hua hub + exact ⟨w, betas_trans hta haw, betas_trans hvb hbw⟩ + +theorem join_appL (a : Term) {f g : Term} + (h : BetaJoin f g) : BetaJoin (.app f a) (.app g a) := by + obtain ⟨w, hf, hg⟩ := h + exact ⟨.app w a, betas_appL a hf, betas_appL a hg⟩ + +theorem join_appR (f : Term) {a b : Term} + (h : BetaJoin a b) : BetaJoin (.app f a) (.app f b) := by + obtain ⟨w, ha, hb⟩ := h + exact ⟨.app f w, betas_appR f ha, betas_appR f hb⟩ + +theorem betas_subst {t u : Term} (h : Betas t u) (j : Nat) (s : Term) : + Betas (substDec j s t) (substDec j s u) := by + induction h with + | refl t => exact .refl _ + | head hb hs ih => + obtain ⟨n, hp⟩ := beta_par hb + exact betas_trans (parN_betas (parN_substDec hp (parN_refl s) j)) ih + +theorem betas_inst : ∀ (as : List Term) (j : Nat) {t u : Term}, + Betas t u → Betas (instN as j t) (instN as j u) := by + intro as + induction as with + | nil => intro j t u h; exact h + | cons a as ih => + intro j t u h + exact betas_subst (ih (j + 1) h) j _ + +theorem join_inst (as : List Term) (j : Nat) {t u : Term} + (h : BetaJoin t u) : BetaJoin (instN as j t) (instN as j u) := by + obtain ⟨w, ht, hu⟩ := h + exact ⟨instN as j w, betas_inst as j ht, betas_inst as j hu⟩ + +theorem subst_pairT (j : Nat) (s A P : Term) : + substDec j s (pairT A P) = + pairT (substDec j s A) (substDec j s P) := by + unfold pairT + simp only [substDec] + rw [← shift_substDec_lt A s j 0 (Nat.zero_le j), + ← shift_substDec_lt P s j 0 (Nat.zero_le j)] + have he : ¬ 0 = j + 1 := by omega + have hlt : ¬ 0 > j + 1 := by omega + simp only [he, hlt, if_false] + +theorem subst_streamOf (j : Nat) (s : Term) (bits : List Bool) (R : Term) : + substDec j s (streamOf bits R) = + streamOf bits (substDec j s R) := by + induction bits with + | nil => rfl + | cons b bs ih => + rw [streamOf_cons, subst_pairT, ih, streamOf_cons, + substDec_closed j s (churchBit_closed b)] + +theorem inst_app (as : List Term) (j : Nat) (f a : Term) : + instN as j (.app f a) = .app (instN as j f) (instN as j a) := by + induction as generalizing j with + | nil => rfl + | cons x xs ih => simp only [instN, ih, substDec] + +theorem inst_closed (as : List Term) (j : Nat) {t : Term} (ht : Closed t) : + instN as j t = t := by + induction as generalizing j with + | nil => rfl + | cons a as ih => simp only [instN, ih, substDec_closed _ _ ht] + +theorem inst_streamOf (as : List Term) (j : Nat) (bits : List Bool) (R : Term) : + instN as j (streamOf bits R) = streamOf bits (instN as j R) := by + induction as generalizing j with + | nil => rfl + | cons a as ih => simp only [instN, ih, subst_streamOf] + +/-- The rigid two-placeholder contract entails its instance at arbitrary +continuations and remainders, without assuming directed parser correctness. -/ +theorem contract_join {E M : Term} (hE : IsSelfInterpreter E) + (hM : Closed M) (C N : Term) : + BetaJoin (.app (.app E C) (streamOf (blcCode M) N)) + (.app (.app C (.lam M)) N) := by + have hLM : Closed (.lam M) := + freeUnder_mono (t := M) (j := 0) (k := 1) (Nat.zero_le 1) hM + have h := join_inst [C, N] 0 (hE.2 M hM) + simp only [inst_app, inst_streamOf, inst_closed _ _ hE.1, + inst_closed _ _ hLM] at h + simpa [instN, substDec, shift_zero, substDec_shift] using h + +def identity : Term := .lam (.var 0) + +/-- Quotation of I followed by a supplied suffix: wire bits 0010. -/ +def quoteI (R : Term) : Term := streamOf (blcCode identity) R + +theorem quoteI_shape (R : Term) : + quoteI R = pairT churchTrue (pairT churchTrue + (pairT churchFalse (pairT churchTrue R))) := rfl + +theorem identity_contract {E : Term} (hE : IsSelfInterpreter E) (C R : Term) : + BetaJoin (.app (.app E C) (quoteI R)) + (.app (.app C churchFalse) R) := + contract_join hE (by decide : Closed identity) C R + +theorem pair_tail (A R : Term) : + Betas (.app (pairT A R) churchFalse) R := + betas_trans (betas_of_spineReds (spine_pairT A R churchFalse)) + (betas_of_spineReds (spine_false2 A R)) + +theorem quoteI_two_tails (R : Term) : + Betas (.app (.app (quoteI R) churchFalse) churchFalse) + (pairT churchFalse (pairT churchTrue R)) := by + rw [quoteI_shape] + exact betas_trans + (betas_appL churchFalse (pair_tail churchTrue _)) + (pair_tail churchTrue _) + +private theorem normal_join_eq {t u : Term} + (ht : NormalForm t) (hu : NormalForm u) (h : BetaJoin t u) : t = u := by + obtain ⟨w, htw, huw⟩ := h + exact (normalForm_betas_eq ht htw).symm.trans (normalForm_betas_eq hu huw) + +/-- No exact self-interpreter satisfies E E =beta E. -/ +theorem selfInterpreter_not_idempotent {E : Term} (hE : IsSelfInterpreter E) : + ¬ BetaJoin (.app E E) E := by + intro hEE + let R : Term := .var 0 + have hcollapse : BetaJoin (.app (.app E E) (quoteI (quoteI R))) R := + join_trans (identity_contract hE E (quoteI R)) + (join_trans (identity_contract hE churchFalse R) + (join_of_betas (betas_of_spineReds (spine_false2 churchFalse R)))) + have hone : BetaJoin (.app E (quoteI (quoteI R))) R := + join_trans (join_symm (join_appL (quoteI (quoteI R)) hEE)) hcollapse + have hext := join_appL (quoteI churchFalse) hone + have hparse := identity_contract hE (quoteI (quoteI R)) churchFalse + have hbad : BetaJoin (.app R (quoteI churchFalse)) + (pairT churchFalse (pairT churchTrue (quoteI R))) := + join_trans (join_symm hext) + (join_trans hparse (join_of_betas (quoteI_two_tails (quoteI R)))) + have hleft : NormalForm (.app R (quoteI churchFalse)) := + fun _ hb => nft_no_beta (by decide : NFt (.app (.var 0) (quoteI churchFalse))) hb + have hright : NormalForm + (pairT churchFalse (pairT churchTrue (quoteI R))) := + fun _ hb => nft_no_beta + (by decide : NFt (pairT churchFalse (pairT churchTrue (quoteI (.var 0))))) hb + have himpossible := normal_join_eq hleft hright hbad + cases himpossible + +/-- An idempotent control response cannot bootstrap the full exact parser. -/ +theorem selfInterpreter_not_idempotent_generator {E G : Term} + (hE : IsSelfInterpreter E) (hG : BetaJoin (.app G G) G) : + ¬ BetaJoin (.app G G) E := by + intro hbootstrap + have hGE := join_trans (join_symm hG) hbootstrap + have happs : BetaJoin (.app G G) (.app E E) := + join_trans (join_appL G hGE) (join_appR E hGE) + exact selfInterpreter_not_idempotent hE + (join_trans (join_symm happs) hbootstrap) + +end Blc.SelfintControl diff --git a/lean/Blc/SelfintOrigins.lean b/lean/Blc/SelfintOrigins.lean index 7355a83e..1c7da14d 100644 --- a/lean/Blc/SelfintOrigins.lean +++ b/lean/Blc/SelfintOrigins.lean @@ -8,6 +8,7 @@ not a global 165-bit size bound. import Blc.SelfintProof import Blc.Par import Blc.Confluence +import Blc.SelfintLowerBound namespace Blc.QuoteOrigins open Blc Term @@ -782,5 +783,277 @@ theorem selfInterpreter_normal_frozen {E M : Term} (hE : IsSelfInterpreter E) subst u exact quotation_origins_frozen E (blcCode M) hu +/-- Number of residual interpreter-origin abstractions, counting copies. -/ +def redCount : Marked → Nat + | .var _ => 0 + | .lam q b => redCount b + if q then 0 else 1 + | .app f a => redCount f + redCount a + +theorem redCount_shift (t : Marked) (c : Nat) : + redCount (shift c t) = redCount t := by + induction t generalizing c with + | var n => simp only [shift]; split <;> rfl + | lam q b ih => simp [shift, redCount, ih] + | app f a ihf iha => simp [shift, redCount, ihf, iha] + +/-- The exact red-abstraction accounting identity for capture-avoiding substitution. -/ +theorem redCount_subst (t s : Marked) (j : Nat) : + redCount (subst j s t) = redCount t + occ j (erase t) * redCount s := by + induction t generalizing s j with + | var n => + simp only [subst, redCount, erase, occ] + split + · simp_all + · split <;> simp_all [redCount] + | lam q b ih => + simp only [subst, redCount, erase, occ, ih, redCount_shift] + omega + | app f a ihf iha => + simp only [subst, redCount, erase, occ, ihf, iha, Nat.add_mul] + omega + +/-- Balanced natural-number form of the exact red-contraction change: +`new - old = (occurrences - 1) * argument_red_count - 1`. -/ +theorem red_beta_balance (b a : Marked) : + redCount (subst 0 a b) + redCount a + 1 = + redCount (.app (.lam false b) a) + occ 0 (erase b) * redCount a := by + simp only [redCount_subst, redCount, Bool.false_eq_true, ↓reduceIte] + omega + +/-- The selected contraction duplicates a red-containing argument at a +nonlinear red binder. The context constructors retain the selected redex. +This condition is necessary for red-count growth, but need not itself cause +growth: consuming the red contractor also removes one red abstraction. -/ +inductive CodeDup : Marked → Marked → Prop where + | beta {b a : Marked} (nonlinear : 1 < occ 0 (erase b)) + (redArgument : 0 < redCount a) : + CodeDup (.app (.lam false b) a) (subst 0 a b) + | appL {f f' : Marked} (a : Marked) : + CodeDup f f' → CodeDup (.app f a) (.app f' a) + | appR (f : Marked) {a a' : Marked} : + CodeDup a a' → CodeDup (.app f a) (.app f a') + | lam (q : Bool) {b b' : Marked} : + CodeDup b b' → CodeDup (.lam q b) (.lam q b') + +theorem codeDup_step {t u : Marked} (h : CodeDup t u) : Step t u := by + induction h with + | beta hn hr => exact .beta _ _ _ + | appL a h ih => exact .appL a ih + | appR f h ih => exact .appR f ih + | lam q h ih => exact .lam q ih + +theorem step_redCount_le_or_codeDup {t u : Marked} + (h : Step t u) (ht : Good t) : + redCount u ≤ redCount t ∨ CodeDup t u := by + induction h with + | beta q b a => + have haff : q = true → occ 0 (erase b) ≤ 1 := + (good_blueAffine ht).1.2 + cases q with + | false => + by_cases hn : 1 < occ 0 (erase b) + · by_cases hr : redCount a = 0 + · left + simp [redCount_subst, redCount, hr] + · exact Or.inr (.beta hn (by omega)) + · left + have hz : occ 0 (erase b) = 0 ∨ occ 0 (erase b) = 1 := by omega + rcases hz with hz | hz <;> simp [redCount_subst, redCount, hz] <;> omega + | true => + left + have ho := haff rfl + have hz : occ 0 (erase b) = 0 ∨ occ 0 (erase b) = 1 := by omega + rcases hz with hz | hz <;> simp [redCount_subst, redCount, hz] + | appL a h ih => + rcases ih ht.1 with hn | hd + · left; simp only [redCount]; omega + · exact Or.inr (.appL a hd) + | appR f h ih => + rcases ih ht.2 with hn | hd + · left; simp only [redCount]; omega + · exact Or.inr (.appR f hd) + | lam q h ih => + rcases ih ht.1 with hn | hd + · left; simp only [redCount]; omega + · exact Or.inr (.lam q hd) + +theorem step_redCount_growth_codeDup {t u : Marked} + (h : Step t u) (ht : Good t) (hg : redCount t < redCount u) : + CodeDup t u := by + rcases step_redCount_le_or_codeDup h ht with hn | hd + · exact (Nat.not_lt_of_ge hn hg).elim + · exact hd + +/-- A finite trace that ends with more red abstractions contains an actual +growth step, necessarily copying interpreter-origin code. Prefix and suffix +reductions locate the selected step on the supplied trace. -/ +theorem steps_redCount_growth {t u : Marked} + (h : Steps t u) (ht : Good t) (hg : redCount t < redCount u) : + ∃ a b, Steps t a ∧ Step a b ∧ CodeDup a b ∧ Steps b u ∧ + redCount a < redCount b := by + induction h with + | refl t => exact (Nat.lt_irrefl _ hg).elim + | @step t v u hs htail ih => + by_cases hlocal : redCount t < redCount v + · exact ⟨t, v, .refl _, hs, + step_redCount_growth_codeDup hs ht hlocal, htail, hlocal⟩ + · obtain ⟨a, b, hpre, hab, hdup, hpost, hinc⟩ := + ih (good_step hs ht) (by omega) + exact ⟨a, b, .step hs hpre, hab, hdup, hpost, hinc⟩ + +/-- A trace explicitly excluding code-copying contractions. -/ +inductive NoCodeDupSteps : Marked → Marked → Prop where + | refl (t : Marked) : NoCodeDupSteps t t + | step {t u v : Marked} : Step t u → ¬ CodeDup t u → + NoCodeDupSteps u v → NoCodeDupSteps t v + +theorem noCodeDupSteps_redCount {t u : Marked} + (h : NoCodeDupSteps t u) (ht : Good t) : redCount u ≤ redCount t := by + induction h with + | refl t => exact Nat.le_refl _ + | @step t v u hs hn htail ih => + have hstep : redCount v ≤ redCount t := by + rcases step_redCount_le_or_codeDup hs ht with hle | hd + · exact hle + · exact (hn hd).elim + exact Nat.le_trans (ih (good_step hs ht)) hstep + +/-- Each nonlinear residual binder must be red. -/ +theorem nonlinear_le_redCount {t : Marked} (h : BlueAffine t) : + SelfintLowerBound.nonlinear (erase t) ≤ redCount t := by + induction t with + | var n => simp [erase, SelfintLowerBound.nonlinear, redCount] + | app f a ihf iha => + have hf := ihf h.1 + have ha := iha h.2 + simp only [erase, SelfintLowerBound.nonlinear, redCount] + omega + | lam q b ih => + have hb := ih h.1 + cases q with + | true => + have ho := h.2 rfl + simp only [erase, SelfintLowerBound.nonlinear, redCount, + ↓reduceIte, Nat.add_zero] + rw [if_neg (by omega)] + omega + | false => + simp only [erase, SelfintLowerBound.nonlinear, redCount, + Bool.false_eq_true, ↓reduceIte] + split <;> omega + +theorem redCount_pair (a r : Marked) : + redCount (pair a r) = redCount a + redCount r := by + simp [pair, redCount, redCount_shift] + +theorem redCount_bit (b : Bool) : redCount (bit b) = 0 := by + cases b <;> rfl + +theorem redCount_stream (bs : List Bool) (r : Marked) : + redCount (stream bs r) = redCount r := by + induction bs with + | nil => rfl + | cons b bs ih => + change redCount (pair (bit b) (stream bs r)) = redCount r + rw [redCount_pair, redCount_bit, ih, Nat.zero_add] + +theorem redCount_source (E : Term) (bs : List Bool) : + redCount (source E bs) = redCount (red E) := by + simp [source, redCount, redCount_stream] + +/-- A closed beta-normal family with exactly n nonlinear binders. +Each new binder occurs twice at a rigid head; the smaller closed family is +an inert argument, so the construction introduces no beta redex. -/ +def manyNonlinear : Nat → Term + | 0 => .lam (.var 0) + | n + 1 => .lam (.app (.app (.var 0) (.var 0)) (manyNonlinear n)) + +theorem manyNonlinear_closed (n : Nat) : Closed (manyNonlinear n) := by + induction n with + | zero => decide + | succ n ih => + exact ⟨⟨by decide, by decide⟩, freeUnder_mono (by omega) ih⟩ + +theorem manyNonlinear_nft (n : Nat) : NFt (manyNonlinear n) := by + induction n with + | zero => trivial + | succ n ih => + exact ⟨(fun h => h), ⟨(fun h => h), trivial, trivial⟩, ih⟩ + +theorem manyNonlinear_occ (n j : Nat) : occ j (manyNonlinear n) = 0 := by + induction n generalizing j with + | zero => + simp only [manyNonlinear, occ, if_neg (Nat.zero_ne_add_one j)] + | succ n ih => + simp only [manyNonlinear, occ, if_neg (Nat.zero_ne_add_one j), ih, + Nat.zero_add] + +theorem manyNonlinear_count (n : Nat) : + SelfintLowerBound.nonlinear (manyNonlinear n) = n := by + induction n with + | zero => decide + | succ n ih => + simp [manyNonlinear, SelfintLowerBound.nonlinear, occ, manyNonlinear_occ, ih] + +/-- Every trace producing a target with more nonlinear binders than the +initial interpreter has lambdas must duplicate interpreter-origin code. -/ +theorem every_large_output_trace_copies_code (E M : Term) {u : Marked} + (hsize : redCount (red E) < SelfintLowerBound.nonlinear M) + (h : Steps (source E (blcCode M)) u) + (he : erase u = .app (.app (.var 0) (.lam M)) (.var 1)) : + ∃ a b, Steps (source E (blcCode M)) a ∧ Step a b ∧ CodeDup a b ∧ + Steps b u ∧ redCount a < redCount b := by + have hu : Good u := good_steps h (source_good E _) + have hbound := nonlinear_le_redCount (good_blueAffine hu) + have htarget : SelfintLowerBound.nonlinear M ≤ + SelfintLowerBound.nonlinear (erase u) := by + rw [he] + simp only [SelfintLowerBound.nonlinear, Nat.zero_add, Nat.add_zero] + omega + apply steps_redCount_growth h (source_good E _) + rw [redCount_source] + omega + +/-- Every self-interpreter must copy interpreter-origin code on a suitable +closed normal source. The displayed strict growth step consumes a nonlinear +red binder and duplicates an argument containing a red lambda. -/ +theorem selfInterpreter_must_copy_code {E : Term} (hE : IsSelfInterpreter E) : + ∃ M a b u, Closed M ∧ NFt M ∧ + Steps (source E (blcCode M)) a ∧ Step a b ∧ CodeDup a b ∧ Steps b u ∧ + erase u = .app (.app (.var 0) (.lam M)) (.var 1) ∧ + redCount a < redCount b := by + let M := manyNonlinear (redCount (red E) + 1) + have hc : Closed M := manyNonlinear_closed _ + have hn : NFt M := manyNonlinear_nft _ + obtain ⟨u, hu, he, _⟩ := selfInterpreter_normal_origins hE hc hn + have hsize : redCount (red E) < SelfintLowerBound.nonlinear M := by + simp only [M, manyNonlinear_count] + omega + obtain ⟨a, b, hpre, hab, hdup, hpost, hinc⟩ := + every_large_output_trace_copies_code E M hsize hu he + exact ⟨M, a, b, u, hc, hn, hpre, hab, hdup, hpost, he, hinc⟩ + +/-- There is a closed normal forcing source for every interpreter, and +every origin-preserving trace to its required output contains a code-copying +growth step. Existence of a successful trace is included, avoiding vacuity. -/ +theorem selfInterpreter_every_trace_copies_code {E : Term} + (hE : IsSelfInterpreter E) : + ∃ M, Closed M ∧ NFt M ∧ + (∃ u, Steps (source E (blcCode M)) u ∧ + erase u = .app (.app (.var 0) (.lam M)) (.var 1)) ∧ + ∀ u, Steps (source E (blcCode M)) u → + erase u = .app (.app (.var 0) (.lam M)) (.var 1) → + ∃ a b, Steps (source E (blcCode M)) a ∧ Step a b ∧ CodeDup a b ∧ + Steps b u ∧ redCount a < redCount b := by + let M := manyNonlinear (redCount (red E) + 1) + have hc : Closed M := manyNonlinear_closed _ + have hn : NFt M := manyNonlinear_nft _ + obtain ⟨u, hu, he, _⟩ := selfInterpreter_normal_origins hE hc hn + refine ⟨M, hc, hn, ⟨u, hu, he⟩, ?_⟩ + intro v hv hev + apply every_large_output_trace_copies_code E M ?_ hv hev + simp only [M, manyNonlinear_count] + omega + end Marked end Blc.QuoteOrigins diff --git a/lean/Blc/SelfintTyped.lean b/lean/Blc/SelfintTyped.lean index 5dfee7b8..3f2e6e54 100644 --- a/lean/Blc/SelfintTyped.lean +++ b/lean/Blc/SelfintTyped.lean @@ -9,6 +9,7 @@ the literal 165-bit interpreter applied to its original input. Source and certificates: tools/self-interpreter/theory/typed_normal.py. -/ import Blc.SelfintSharp +import Blc.SelfintControl namespace Blc.SelfintTyped open Term @@ -71,24 +72,6 @@ theorem check_sound {t : Annotated} {Γ : List Ty} {τ : Ty} exact .app (ihf hf) (iha ha) · simp [check, hf, ha, he] at h -theorem betas_subst {t u : Term} (h : Betas t u) (j : Nat) (s : Term) : - Betas (substDec j s t) (substDec j s u) := by - induction h with - | refl t => exact .refl _ - | head hb hs ih => - obtain ⟨n, hp⟩ := beta_par hb - exact betas_trans (parN_betas (parN_substDec hp (parN_refl s) j)) ih - -theorem betas_inst : ∀ (as : List Term) (j : Nat) {t u : Term}, - Betas t u → Betas (instN as j t) (instN as j u) := by - intro as - induction as with - | nil => intro j t u h; exact h - | cons a as ih => - intro j t u h - exact betas_subst (ih (j + 1) h) j _ - - def intL672 : Term := (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.app (.app (.var 1) (.lam (.app (.app (.var 0) (.lam (.var 0))) (.lam (.var 0))))) (.var 0)) (.lam (.lam (.app (.app (.var 1) (.app (.app (.var 1) (.app (.app (.var 1) (.app (.var 0) (.lam (.app (.app (.var 2) (.var 0)) (.var 0))))) (.app (.var 0) (.lam (.app (.app (.var 2) (.app (.var 1) (.lam (.app (.var 2) (.lam (.app (.app (.var 4) (.app (.var 3) (.lam (.app (.var 4) (.lam (.app (.app (.var 6) (.app (.app (.var 6) (.var 0)) (.app (.var 5) (.lam (.app (.app (.var 7) (.app (.app (.var 7) (.var 0)) (.app (.var 6) (.lam (.app (.var 7) (.lam (.app (.app (.var 9) (.var 0)) (.var 4)))))))) (.var 3)))))) (.app (.app (.var 6) (.app (.app (.var 6) (.var 0)) (.var 0))) (.var 0)))))))) (.app (.var 3) (.lam (.app (.app (.var 5) (.var 2)) (.app (.var 4) (.lam (.app (.app (.var 6) (.app (.app (.var 6) (.var 1)) (.app (.app (.var 6) (.var 2)) (.app (.var 5) (.lam (.app (.var 6) (.lam (.app (.app (.var 8) (.var 2)) (.app (.var 7) (.lam (.app (.var 8) (.lam (.app (.app (.var 10) (.app (.app (.var 10) (.var 1)) (.var 2))) (.app (.app (.var 10) (.var 0)) (.var 3))))))))))))))) (.app (.app (.var 6) (.var 3)) (.app (.var 5) (.lam (.app (.app (.var 7) (.var 3)) (.app (.var 6) (.lam (.app (.app (.var 8) (.app (.app (.var 8) (.var 2)) (.var 0))) (.app (.app (.var 8) (.var 1)) (.var 0))))))))))))))))))))) (.app (.app (.var 2) (.var 0)) (.var 0))))))) (.var 5))) (.app (.var 0) (.lam (.app (.app (.var 2) (.app (.app (.var 2) (.var 0)) (.app (.var 1) (.lam (.app (.var 2) (.lam (.var 1))))))) (.var 3))))))))))))) def annotated672 : Annotated := (.lam .base (.lam (.arr (.arr (.arr (.arr (.arr (.arr .base .base) (.arr (.arr .base .base) .base)) .base) (.arr .base (.arr (.arr (.arr .base (.arr .base .base)) (.arr (.arr (.arr .base .base) .base) .base)) .base))) (.arr .base .base)) .base) (.app (.var 0) (.lam (.arr (.arr (.arr (.arr .base .base) (.arr (.arr .base .base) .base)) .base) (.arr .base (.arr (.arr (.arr .base (.arr .base .base)) (.arr (.arr (.arr .base .base) .base) .base)) .base))) (.lam .base (.app (.app (.app (.var 1) (.lam (.arr (.arr .base .base) (.arr (.arr .base .base) .base)) (.app (.app (.var 0) (.lam .base (.var 0))) (.lam .base (.var 0))))) (.var 0)) (.lam (.arr .base (.arr .base .base)) (.lam (.arr (.arr .base .base) .base) (.app (.app (.var 1) (.app (.app (.var 1) (.app (.app (.var 1) (.app (.var 0) (.lam .base (.app (.app (.var 2) (.var 0)) (.var 0))))) (.app (.var 0) (.lam .base (.app (.app (.var 2) (.app (.var 1) (.lam .base (.app (.var 2) (.lam .base (.app (.app (.var 4) (.app (.var 3) (.lam .base (.app (.var 4) (.lam .base (.app (.app (.var 6) (.app (.app (.var 6) (.var 0)) (.app (.var 5) (.lam .base (.app (.app (.var 7) (.app (.app (.var 7) (.var 0)) (.app (.var 6) (.lam .base (.app (.var 7) (.lam .base (.app (.app (.var 9) (.var 0)) (.var 4)))))))) (.var 3)))))) (.app (.app (.var 6) (.app (.app (.var 6) (.var 0)) (.var 0))) (.var 0)))))))) (.app (.var 3) (.lam .base (.app (.app (.var 5) (.var 2)) (.app (.var 4) (.lam .base (.app (.app (.var 6) (.app (.app (.var 6) (.var 1)) (.app (.app (.var 6) (.var 2)) (.app (.var 5) (.lam .base (.app (.var 6) (.lam .base (.app (.app (.var 8) (.var 2)) (.app (.var 7) (.lam .base (.app (.var 8) (.lam .base (.app (.app (.var 10) (.app (.app (.var 10) (.var 1)) (.var 2))) (.app (.app (.var 10) (.var 0)) (.var 3))))))))))))))) (.app (.app (.var 6) (.var 3)) (.app (.var 5) (.lam .base (.app (.app (.var 7) (.var 3)) (.app (.var 6) (.lam .base (.app (.app (.var 8) (.app (.app (.var 8) (.var 2)) (.var 0))) (.app (.app (.var 8) (.var 1)) (.var 0))))))))))))))))))))) (.app (.app (.var 2) (.var 0)) (.var 0))))))) (.var 5))) (.app (.var 0) (.lam .base (.app (.app (.var 2) (.app (.app (.var 2) (.var 0)) (.app (.var 1) (.lam .base (.app (.var 2) (.lam .base (.var 1))))))) (.var 3))))))))))))) @@ -128,7 +111,7 @@ theorem substDec_intL165' (j : Nat) (s : Term) : substDec j s intL165 = intL165 theorem root672 (C R : Term) : Betas (.app (.app intL672 C) (pairT churchTrue R)) (.app (.app intL165 C) (pairT churchTrue R)) := by - have h := betas_inst [C, R] 0 (SelfintSharp.replay_sound run_root672) + have h := SelfintControl.betas_inst [C, R] 0 (SelfintSharp.replay_sound run_root672) simpa [instN, pairT, substDec, shift, substDec_intL672, substDec_intL165', shift_churchTrue, substDec_churchTrue, shift_shift0, substDec_shift0, shift_zero] using h diff --git a/lean/README.md b/lean/README.md index 8aa2ae8f..538b5fb2 100644 --- a/lean/README.md +++ b/lean/README.md @@ -198,6 +198,35 @@ Self-interpretation: `selfint_open165`, `parserStatement165`, `isSelfInterpreter_intL165`, and `not_selfintSizeBound_166` (the upper-bound half of optimality; the lower bound `SelfintSizeBound 165` is stated, open). +- `Blc/SelfintLowerBound.lean` — every term with at most one syntactically + nonlinear binder weakly normalizes. Consequently every self-interpreter + has at least two, and an explicit `λc s.B` has two inside `B`. A syntax + inequality gives `SelfintSizeBound 18`, without assuming a parser design. +- `Blc/SelfintCapture.lean` — absence of live capture of enclosing local + variables is preserved by substitution and β-reduction. The interpreter + contract forces such a capture in the interpreter's source. +- `Blc/SelfintOrigins.lean` — colored reduction tracks quotation-origin + abstractions through every ordinary reduction. They remain affine, and + live ones retain protected head shapes, no local capture, and normal + bodies containing only quotation-origin abstractions. A red-abstraction + accounting theorem proves that every interpreter must duplicate + interpreter-origin code along every successful trace for a suitable + closed normal source. +- `Blc/SelfintNormal.lean` — the 204-bit β-normal interpreter, including its + exact wire and directed contract for every closed source and arbitrary + continuation and suffix. +- `Blc/SelfintSharp.lean` — a sound checker for explicit contextual β traces; + a 584-bit interpreter with exactly two nonlinear binders, both closed in + isolation; and a 742-bit β-normal interpreter with the same property. + The first reduces to the literal 165; the second has a β-joinability + contract. Thus the nonlinear count is sharp even among normal interpreters. +- `Blc/SelfintTyped.lean` — the 672-bit β-normal, simply typed interpreter. + A proved annotation checker supplies an ordinary STLC judgment. A finite + cast-erasure trace transfers the 165's directed contract. Its applications + to quotations need not be simply typable. +- `Blc/SelfintControl.lean` — arbitrary continuation/suffix instances of the + β-joinability contract and the unconditional theorem that `E E` cannot + be β-equal to an exact self-interpreter `E`. Generated: From 904ae395f66877536f60f258c705aefede638a84 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 14:13:58 -0400 Subject: [PATCH 12/41] Bound correlated selector handlers and eliminate neutral skips --- docs/STATUS.md | 9 +- .../self-interpreter/handler-bound.md | 206 ++++++++++++++++-- .../classical/self-interpreter/interpreter.md | 16 +- docs/classical/self-interpreter/normal.md | 31 ++- .../self-interpreter/protocol-obstructions.md | 71 ++++++ .../self-interpreter/theory/handler_bound.py | 29 ++- 6 files changed, 333 insertions(+), 29 deletions(-) diff --git a/docs/STATUS.md b/docs/STATUS.md index 52ec6c88..734e89b2 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -160,7 +160,14 @@ with all features (three opt-in tests ignored) and 328 with default features. reader bound now permits arbitrary handlers: independent rigid laws force `|H| ≥ 27`, so `s H S` still costs at least 43 and the unchanged surrounding interpreter at least 165 (`classical/self-interpreter/handler-bound.md`). - Actual stream/selector/suffix correlations remain outside that theorem. + A second handwritten theorem allows actual unary-selector/suffix + correlations and proves the same handler minimum when its only free + variables are NEXT and the continuation. Whole-stream access remains open; + a checked 40-bit correlated handler with only one explicit lambda shows why + the independent proof's structural lemmas cannot all transfer. + For arbitrary correlated handlers, neutral operands `s next` and `s cont` + are dominated by `s`, saving 5 and 6 bits; this leaves `s` and the thunk + `s s` open (`classical/self-interpreter/protocol-obstructions.md`). The zero arm ≥ 14, APP lift ≥ 19, reader/handler knot-tree and cell/APP exclusions remain as specified in §5. - **Unconditional structure** (`classical/self-interpreter/structural-bounds.md`): diff --git a/docs/classical/self-interpreter/handler-bound.md b/docs/classical/self-interpreter/handler-bound.md index b38ee5c7..e095da39 100644 --- a/docs/classical/self-interpreter/handler-bound.md +++ b/docs/classical/self-interpreter/handler-bound.md @@ -1,10 +1,11 @@ # An unrestricted parametric handler bound -This is Codex's handwritten proof, independently reviewed by two subagents. -It is not a global 165-bit optimality theorem. It removes the syntactic restriction on the -handler in the existing reader bound while retaining the independent, -rigid-neighbour laws. In particular it does not identify a variable selector -with the stream that contains its remainder. +These are Codex's handwritten proofs; both bounds were independently +reviewed. They are not a global 165-bit optimality theorem. The first +theorem removes the syntactic restriction on +the handler while retaining independent, rigid-neighbour laws. The second +allows the actual correlation between a unary selector and its remainder, +but restricts the handler's free variables to `j,c`. ## Statement @@ -189,17 +190,188 @@ For `A≥5`, the elementary bounds `L≥1`, `X≥3` already give Together the cases prove the claim. -## What this does not prove +## Correlated selectors without ambient stream access -The stream `s` is still an independent rigid ambient variable in the two -handler laws. The selector `R` and suffix `T` are independently varied. -A real unary selector contains its suffix, and a real stream contains its -tag and tail. A handler exploiting those correlations is outside the -theorem. The reader itself is still `s H S`, and the rest of the -interpreter is fixed. No conclusion about arbitrary sub-165 programs -follows without further decomposition or a different global invariant. +Keep the ambient frame `[s,j,c,p,x]`, but now require that the only free +variables occurring in `H` are `j,c`. Internal bound variables and arbitrary +beta redexes are permitted. Define the Scott cells and unary selectors by -The four explicit witnesses and the arithmetic are checked by -`tools/self-interpreter/theory/handler_bound.py`. That script does not -enumerate terms or prove the quantified lower bound; the proof is the case -analysis above. +``` +cons b t = λh. h b t, +X₀(N) = cons K N, +Xₙ₊₁(N) = cons F Xₙ(N). +``` + +For fresh rigid variables `R,N`, suppose + +``` +H K R R =β R j, +H F Xₙ(N) N =β c Xₙ(N) N for every n ≥ 0. +``` + +Then again `|H| ≥ 27`, with equality attained by +`λb. b (λu v. v j) c`. The second law is the actual selector/remainder +correlation; it does not assert the stronger independent law `H F R T =β +c R T`. + +### Dependence on the first argument + +Both `j,c` must occur freely, so `X≥3` remains necessary. The zero law +also retains the single-abstraction obstruction above, giving `L≥2`. + +The handler must use its first argument. To see this without assuming +independent tails, suppose its first exposed abstraction were vacuous, +so `H =β λb.G` with `b` absent from `G`. The zero law gives +`G R R →* R j`. Label the two supplied occurrences of the fresh rigid +variable differently, as `r,t`. Identifying rigid variables cannot create +a beta redex, so the same reduction sequence lifts to either + +``` +G r t →* r j, or G r t →* t j. +``` + +After substituting `r := Xₙ(N)` and `t := N`, these become respectively +`j Bₙ Tₙ` or `N j`, where `Xₙ(N)=cons Bₙ Tₙ`. Their rigid heads differ +from the required `c`. Thus at least one original bound-variable leaf +is needed to receive the first argument non-vacuously. + +The head normal form has at most three leading abstractions: more would +leave a lambda after the three supplied arguments. Its head cannot be +an ambient variable, by the zero law, or the third argument, by the +variable law. Besides the Boolean head `b`, there is now a genuinely new +possibility: the second argument `r`. + +If a beta-normal handler has that head, the zero law forces all three +inputs to be bound. With only `λb r` at the front, the final external +`R` would remain as the last argument of the rigid head `R`, whereas the +required last argument is `j`. Therefore this case has the form + +``` +λb r t. r A +``` + +in head normal form. Its distinct leaves for `j,c,b,r` imply `A≥3`; +the three leading binders give `L≥3`, and these four occurrences +contribute at least `4+5+2+1=12` to `X`. Every beta-normal handler +with this head consequently costs at least 32 bits. This possibility +must be excluded by cost, not by treating the selector as rigid. + +### At most three applications, including compressed terms + +With at most two applications there are at most three leaves, already +needed for `j,c` and the first-argument binder. There is no live tail +binder and no repeated binder. Internal reductions are affine and cannot +increase the application count. The resulting head must be Boolean. +Fewer than two internal Boolean arguments fail: on the `F` branch they +leave either a lambda, the rigid `N`, or `Xₙ(N) N → N Bₙ Tₙ`. +Two internal arguments spend both available applications, leaving no +application in the zero arm that could produce `R j`. Thus `A≤2` +is impossible. + +For `A=3`, an affine internal beta contraction reduces the application +count to at most two and is impossible by the preceding paragraph. +A nonlinear contraction uses at least two of the four leaves for its +own binder, and the other two are required by `j,c`. All other +abstractions are therefore vacuous. Contracting that binder cannot +leave any non-vacuous abstraction to receive a future argument: +capture-avoiding substitution does not make a vacuous binder live. +This also fails the zero law. Hence a successful three-application +handler is beta-normal. + +Its second-argument head costs at least 32, as just shown. For a Boolean +head, the zero-law classification in the parametric proof still applies. +Three internal Boolean arguments leave only lambda chains ending in one +variable as arguments. To obtain `R j`, both tails must already be bound, +the selected zero arm must be `r` or `t`, and the common third argument +must be `j`. The selected `F` arm is then a one-leaf lambda chain applied +only to `j`. A rigid `c` leaf gives just `c j`; a selector leaf gives +`Xₙ(N) j → j Bₙ Tₙ`; other leaves and chains also cannot give +`c Xₙ(N) N`. + +With two internal Boolean arguments, one application remains: + +* If neither tail is bound, the zero arm needs that application. The + `F` arm is a one-leaf lambda chain applied to `Xₙ(N),N`; its law + forces the chain to be `c`. The zero arm is therefore + `λu v.u j` or `λu v.v j`, whose smaller total handler costs 27. +* If one tail is bound, the `F` arm needs an application to retain both + output arguments. A one-leaf lambda chain cannot manufacture `c + Xₙ(N) N`: a `c` leaf has only the one remaining external argument, + while a selector leaf applied to `N` exposes head `N`. The zero arm + is then a chain with no applications and cannot produce `R j`. +* If both tails are bound, the `F` arm has at most one application. + A normal chain alone cannot have the required output. For an + application `v D`, `D` is a one-leaf lambda chain. Head `c` gives + only one argument; heads `j,N` are wrong; head `F` leaves a lambda. + The new possibility is `v=r`, giving + `Xₙ(N) D → D Bₙ Tₙ`. For this to expose `c` with two arguments, + the chain must be exactly `D=c`, yielding `c Bₙ Tₙ`. Already + at `n=0`, its first argument `K` differs from the required Scott + cell `X₀(N)`. Any lambda in a chain ending in `c` consumes at least + one of those two arguments and leaves too few. + +This closes the only application-budget case in which the correlated +selector could replace an independently rigid tail. + +### Four or more applications + +The compressed four-application case also survives the change of laws; +it needs the zero law, the presence of `j,c`, and a live input binder, +not independent variable-arm tails. Here are the details. + +Under `A=4` and `|H|≤26`, the bounds `L≥2`, `X≥3` give `L=2`, +`X≤4`. The handler cannot begin with a lambda, because its free `j,c` +would then alone contribute at least five to `X`. Head reduction must +consume an abstraction before exposing the required leading lambda. +An affine contraction leaves at most one explicit abstraction and fails +the zero-law obstruction. A nonlinear contraction must duplicate an +argument containing the other abstraction; otherwise it too leaves at +most one abstraction. + +Of the five leaves, two are occurrences of the contracted binder and +two are `j,c`. The fifth must be a live occurrence of the remaining +binder. Thus the duplicated argument has exactly one affine abstraction. +It can expose a lambda only if it already begins with that abstraction: +consuming its sole lambda leaves only applications and rigid variables. +Write the argument as `D=λb.V`. If `V` has a rigid head, applying a +copy of `D` exposes that rigid head. Otherwise + +``` +D = λb. b W₁ ... Wq, +``` + +where all `Wi` are application-only over rigid variables. For `q>0`, +any nontrivial application tree of copies of `D` and rigid variables +becomes rigid-headed: a copy pushes its fixed nonempty rigid spine onto +its argument, and a second copy consumes a rigid argument from that +spine. For `q=0`, `D=I`, and applications of identities cannot discard +the required rigid `j,c` leaves to expose a lambda. After the nonlinear +contraction, the surrounding body contains at least two copies of `D` +and no other abstractions, so these cases exhaust it. It cannot expose +the required input-receiving lambda. + +Finally `A≥5`, `L≥1`, `X≥3` already imply `|H|≥27`. Together these +cases prove the correlated-selector bound. + +## What these bounds do not prove + +The parametric theorem permits arbitrary uses of ambient variables but +requires independent rigid neighbours. The correlated-selector theorem +uses the real unary selector and its remainder, but permits only `j,c` +as free variables. In particular it excludes access to the whole stream +`s`, whose tag and tail correlate with the arguments subsequently supplied +to the handler. The full `s`-dependent correlated handler problem remains +outside both theorems. + +The reader itself is still `s H S`, and the rest of the interpreter is +fixed. These handler bounds do not settle arbitrary skip operands or +arbitrary sub-165 programs without further decomposition or a different +global invariant. + +The five explicit witnesses and the arithmetic are checked by +`tools/self-interpreter/theory/handler_bound.py`, including the 40-bit +whole-stream handler with only one lambda explained in `normal.md`. +That witness shows why the single-abstraction obstruction does not extend +unchanged to ambient-stream access. The script does not enumerate terms +or prove the quantified lower bounds; the proofs are the case analyses +above. diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index 6c18808d..ee84a381 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -364,10 +364,18 @@ These are Codex's handwritten proofs, with targeted reduction checks in `handler-bound.md` gives the complete small-budget case proof. The skip costs at least 10 and the two applications with `s` 6, so the reader costs at least 43; with the other 122 bits unchanged the minimum is 165. - This does not cover other reader heads or handlers exploiting actual - stream/selector/suffix correlations. `normal.md` gives an explicit - correlated handler satisfying the actual-stream laws but not these - independent rigid laws. + A second theorem in that note allows the actual unary-selector/suffix + correlation and retains the 27-bit handler minimum when the only free + variables in `H` are `next,cont`. Other reader heads, access to the whole + stream or parser state, and arbitrary joint skip choices remain outside + these bounds. `normal.md` gives two 40-bit correlated handlers satisfying + the actual-stream laws but not the independent rigid laws; one has just + one explicit lambda. +- **Neutral skip operands are dominated.** For arbitrary correlated `H`, + successful readers with `T=s next` or `T=s cont` also work with `T=s`, + saving 5 or 6 bits. The proof in `protocol-obstructions.md` tracks an + inert marked operand that every successful reduction must erase. It does + not exclude the cheaper `T=s` family or the productive thunk `T=s s`. - **The zero arm costs at least 14 bits**, even with `bit0 := K` and the whole zero cell available to borrow. With `R` absent and the neighbours rigid, `Z R R = R next` forces the normal form `λu v. u next` (15) or diff --git a/docs/classical/self-interpreter/normal.md b/docs/classical/self-interpreter/normal.md index 7d4572d9..d35d9c1a 100644 --- a/docs/classical/self-interpreter/normal.md +++ b/docs/classical/self-interpreter/normal.md @@ -114,11 +114,34 @@ H = lambda b r. b (lambda t.t j) (c (lambda h.r h)) has the correct actual-stream zero and variable laws but fails the rigid variable law: it returns `c (lambda h.R h) N` instead of `c R N`. Its exact cost in `[s,j,c,p,x]` is 40 bits, well above 27. This is a scope -counterexample, not a promising small construction. +counterexample, not a promising small construction. The separate correlated +selector theorem in `handler-bound.md` nevertheless proves the same 27-bit +minimum when `H` has no free variables except `j,c`. + +Access to the whole stream changes the structural constraints further. +For example, + +```text +H = lambda b. b (b (b (s s s j))) c +``` + +has only one explicit lambda. On a zero stream `s = cons K R`, its zero +branch gives + +```text +H K R R ->* K (K (s s s j)) R R ->* s s s j ->* R j. +``` + +On a one stream the outer `F` selects `c`, so `H F X_n(N) N ->* c X_n(N) N` +for every unary selector. Its counts are `L=1,A=7,X=8`, again 40 bits. +Thus the independent-law proof's two-lambda necessity cannot be transferred +to whole-stream handlers, even though this witness is too large to improve +the reader. `tools/self-interpreter/theory/handler_bound.py` checks its size, +symbolic zero law, and unrestricted `F`-branch law. The original bare-C selector shape cannot exploit this correlation: the existing strengthened 14-bit zero-arm theorem already permits using the whole zero cell, and C is already the cheapest possible variable arm. -A useful smaller correlated reader would therefore have to change the -handler's head/argument sharing or use concrete NEXT behavior. No such -sub-27 handler was found by the reasoning here. +A useful smaller correlated reader would therefore have to use the whole +stream or other parser state, or change the reader's outer shape. +No such sub-27 handler was found by the reasoning here. diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index 339f6b9d..290fcb10 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -63,6 +63,77 @@ These are complete interpreter constructions, all larger than 165. The reset ide 168-bit variant follows by finitely unfolding its existing knot once; the script additionally checks the reset followed by parsing `I`. +## Neutral operands in a joint handler/skip reader are dominated + +Consider the ambient frame `[s,j,c,p,x]`, innermost first, with `j` the +rigid NEXT continuation and `c` the rigid result continuation. Let `H` +be any term in this frame, including one that depends on `s`; impose no +normal-form or independent-handler assumption. The required reader laws are + +```text +s = cons K R: s H T =β R j +s = 1^n 0 ++ N, n >= 1: s H T =β c (tail s) N. +``` + +**Domination theorem.** If `T = s j` satisfies these laws, replacing that +operand by `T = s`, without changing `H`, also satisfies them and saves +5 bits. The same conclusion holds for `T = s c`, saving 6 bits. + +More generally, `s a` is dominated this way when `a` is a rigid ambient +variable absent from the required outputs. In the stated frame this gives: + +| Original operand | Operand bits | Replacement | Bits saved | +|---|---:|---|---:| +| `s j` | 7 | `s` | 5 | +| `s c` | 8 | `s` | 6 | +| `s p`, with `p` rigid | 9 | `s` | 7 | +| `s x`, with `x` rigid | 10 | `s` | 8 | + +The last two rows require rigidity. They do not classify operands that +actually invoke a recursive parser or generator in those slots. + +Here is the proof for arbitrary correlated `H`. First take `R` and `N` +to be fresh rigid variables. The required outputs are then beta-normal. +Normalize just the selected third operand, using + +```text +(cons b r) a → a b r. +``` + +Confluence ensures that the reader can still reduce to the same required +normal output after this preliminary step. Mark the resulting occurrence +of `a b r` as an opaque box. It is beta-normal, has a rigid head, and +mentions no enclosing local variables. A beta reduction outside it can +copy or erase the box, but cannot split it or change its contents. +Applying it to further arguments also retains the whole box as a subterm. + +No marked box can occur in the required output: + +* With `a = j`, the zero output `R j` contains `j` only as a bare leaf; + the variable output `c r N` contains no `j`. +* With `a = c`, the zero output contains no `c`. The variable output has + only one `c`-headed subterm with two arguments, namely `c r N`, whereas + the box is `c F r`. These differ because `r` is a nonempty Scott cell, + not `F`: its lambda body is an application, while `F`'s lambda body is + another lambda. +* A different rigid ambient head absent from the outputs cannot occur + in either output at all. + +Thus every marked copy is erased by the successful reduction. Replace the +initial box by `s` and replay the same contractions outside its residuals. +Those contractions remain valid and erase every replacement copy, giving +the same output. Other occurrences of `s` inside `H` are untouched. Finally, +stability of beta reduction under capture-avoiding substitution replaces +the fresh rigid `R,N` by arbitrary suffixes, so this is a symbolic result +for every unary length and suffix. + +This is a handwritten domination proof, independently checked by two +Codex instances. It neither identifies the operands as beta-equal nor proves +a minimum reader size. It rules out these more expensive neutral operands +as a source of a new record relative to the still-open `T = s` family. +The productive thunk `T = s s` also remains open. No conclusion about +arbitrary sub-165 interpreters follows. + ## The raw NEXT diagonal still fails for every skip function The existing five-argument obstruction is stronger than its original diff --git a/tools/self-interpreter/theory/handler_bound.py b/tools/self-interpreter/theory/handler_bound.py index d51ea53c..0a865541 100644 --- a/tools/self-interpreter/theory/handler_bound.py +++ b/tools/self-interpreter/theory/handler_bound.py @@ -1,8 +1,9 @@ #!/usr/bin/env python3 -"""Check the explicit witnesses in docs/classical/self-interpreter/handler-bound.md. +"""Check explicit witnesses in the handler-bound and normal-interpreter notes. This is not a term search or a mechanical proof of the universal bound. -The reductions are small open terms with independent rigid neighbours. +The reductions use small open terms with independent rigid neighbours or +the explicitly stated stream correlations. """ from pathlib import Path import sys @@ -67,4 +68,26 @@ def laws(term): assert got == wanted, (name, got, wanted) print(f"{name}: {size} bits; L={l}, A={a}, X={x}; laws={got}") -print("PASS: four explicit witnesses; no enumeration") +# Access to the whole stream invalidates the independent-law proof's L >= 2 +# lemma. This explicit 40-bit handler has one lambda; it is not competitive +# with 27 bits. The zero equation below is symbolic in its arbitrary tail. +# Its F arm reduces to c for arbitrary other operands, covering every unary +# selector; the three small concrete selectors additionally check substitution. +correlated = handler(r"\b. b (b (b (s s s j))) c") +assert counts(correlated) == (1, 7, 8) +assert lc.size(correlated) == 40 +assert laws(correlated) == (False, True) +r, n = ("V", 5), ("V", 6) +zero_stream = lc.pair(lc.TRUE, r) +assert normal(app(lc.subst(0, zero_stream, correlated), lc.TRUE, r, r)) == app( + r, ("V", 1) +) +for k in (0, 1, 2): + tail = lc.bitlist("1" * k + "0", n) + stream = lc.pair(lc.FALSE, tail) + assert normal(app(lc.subst(0, stream, correlated), lc.FALSE, tail, n)) == app( + ("V", 2), tail, n + ) +print("whole-stream audit: 40 bits; L=1, A=7, X=8; correlated laws pass") + +print("PASS: five explicit witnesses; no enumeration") From cd511bd8278a3121d6e72363dc186673ffca0f26 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 14:42:40 -0400 Subject: [PATCH 13/41] Construct applicative remainder boxes and identify alias obstruction --- .../machines/int303_metadata.blc | 1 + .../machines/int303_metadata.lam | 7 + .../theory/applicative_retraction.json | 31 +++ .../theory/metadata_parser.json | 25 +++ docs/STATUS.md | 12 +- .../classical/self-interpreter/interpreter.md | 1 + .../self-interpreter/protocol-obstructions.md | 188 ++++++++++++++++++ .../theory/applicative_retraction.py | 125 ++++++++++++ .../theory/metadata_parser.py | 115 +++++++++++ 9 files changed, 504 insertions(+), 1 deletion(-) create mode 100644 data/self-interpreter/machines/int303_metadata.blc create mode 100644 data/self-interpreter/machines/int303_metadata.lam create mode 100644 data/self-interpreter/theory/applicative_retraction.json create mode 100644 data/self-interpreter/theory/metadata_parser.json create mode 100644 tools/self-interpreter/theory/applicative_retraction.py create mode 100644 tools/self-interpreter/theory/metadata_parser.py diff --git a/data/self-interpreter/machines/int303_metadata.blc b/data/self-interpreter/machines/int303_metadata.blc new file mode 100644 index 00000000..a429d274 --- /dev/null +++ b/data/self-interpreter/machines/int303_metadata.blc @@ -0,0 +1 @@ +010000000101111010000001011111010011100000100100011010000100010000010110000101100000011011111000000001011000010110000000000000010110000101101111111011111100001011110100111110101110111001011010100000010001100101111000000001011011100000011111000000101110111001101111001111100101100000110111001111010011010 diff --git a/data/self-interpreter/machines/int303_metadata.lam b/data/self-interpreter/machines/int303_metadata.lam new file mode 100644 index 00000000..a66ea5bc --- /dev/null +++ b/data/self-interpreter/machines/int303_metadata.lam @@ -0,0 +1,7 @@ +-- Applicative remainder metadata; generated by metadata_parser.py. +-- E C ( ++ N) =beta C (\z.M) N for closed M. +(\p\cont\list. + p list (\tag\value.cont value (tag (\u\w.w)))) ((\x.x x) (\x.(\p.(\next\list. + list (\bit.bit (\unused\r.r next) (\v\n\h.h (\r.r (\g\n\u\y\x\h.h (\r.r g n) (\e.x e (y e))) n) v)) (list list list)) + (\bit\rest. + (\v.v (bit (\tag\body\h.h tag (\env\arg.body (\b\r.b arg (r env)))) (p (v (\u\w.u) bit)))) (p rest))) (x x))) diff --git a/data/self-interpreter/theory/applicative_retraction.json b/data/self-interpreter/theory/applicative_retraction.json new file mode 100644 index 00000000..299deac3 --- /dev/null +++ b/data/self-interpreter/theory/applicative_retraction.json @@ -0,0 +1,31 @@ +{ + "search_performed": false, + "helpers": { + "tag": { + "bits": 28, + "wire": "0000000001011011110011101110" + }, + "box": { + "bits": 41, + "wire": "00000101100000000001011011110011101110110" + }, + "decode": { + "bits": 12, + "wire": "000110000010" + } + }, + "rigid_equations": [ + "retraction", + "application", + "identity_image_is_idempotent", + "lookup_preserves_first_variable", + "lookup_preserves_middle_variable", + "lookup_preserves_third_variable", + "alias_loses_middle_variable" + ], + "distinct_normal_forms": [ + "box_is_not_identity", + "identity_image_is_not_false" + ], + "elapsed_seconds": 0.032 +} diff --git a/data/self-interpreter/theory/metadata_parser.json b/data/self-interpreter/theory/metadata_parser.json new file mode 100644 index 00000000..4dec38c7 --- /dev/null +++ b/data/self-interpreter/theory/metadata_parser.json @@ -0,0 +1,25 @@ +{ + "search_performed": false, + "sizes": { + "generator": 62, + "box_constructor": 90, + "abs_handler": 51, + "interpreter": 303 + }, + "rigid_equations": [ + "payload_projection", + "remainder_projection", + "application_keeps_right_remainder", + "abstraction_keeps_remainder" + ], + "battery": { + "ok": 667, + "skipped": 1, + "failures": [] + }, + "divergent_source_suffixes": [ + "omega", + "lambda_omega" + ], + "elapsed_seconds": 1.8 +} diff --git a/docs/STATUS.md b/docs/STATUS.md index 734e89b2..23474dd5 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -226,7 +226,17 @@ with all features (three opt-in tests ignored) and 328 with default features. 196 bits with shared self-application, 206 without; both pass the 667/1/0 battery and Ω suffix check in 3.5 seconds combined (`data/self-interpreter/theory/stream_handler.json`). The adapters still - cost more than the 165's parser interface. Except for the unconditional + cost more than the 165's parser interface. + A proper one-sided applicative retraction preserves application exactly: + `D(A x) →* x` and `(A x)(A y) →* A(x y)`. Its seven rigid equations and + two distinct-normal-form checks pass; a scoped missing-variable argument + still excludes the raw-selector cell/APP alias with context-independent + wrappers (`data/self-interpreter/theory/applicative_retraction.json`). + A complete parser carrying the remainder in applicative metadata costs + 303 bits. Its four rigid equations, 667/1/0 battery, and Ω / λa.Ω suffix + probes pass in 1.8 seconds (`data/self-interpreter/theory/metadata_parser.json`). + Eliminating its boxes against the public consumer recovers the 165's + CPS interface without a further saving. Except for the unconditional non-idempotence and its generator corollary, these are protocol-specific handwritten proofs. - **The universal machine** (`classical/self-interpreter/universal.md`): diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index ee84a381..4b71a8a8 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -503,6 +503,7 @@ Unless marked, each passes the battery and is larger than the 168. | Indices parsed into Scott selectors by `intL` | 222 | zero/successor parsing and accessors | | Absolute de Bruijn levels | 449 | depth state and runtime append | | Values that also return their code suffix | 273 | cell 24 → 36, APP value 19 → 52 | +| Applicative boxes carrying the remainder | 303 | direct boxed application keeps the right remainder; tag and boxing costs exceed the saved APP plumbing (`protocol-obstructions.md`) | | Cell/APP alias: APP's value `\args. args exp exp2`, since `cell a e (K M) (K P) = M P` | 164, *fails* | fails 577 programs: at the root the environment is the contract's arbitrary `z`, and inside an environment `λz.I` equals the input bit `1`; no cell of any size repairs it (§5) | | **Control and calling convention** | | | | `next` inside `\list` | 170 | +2 of depth | diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index 290fcb10..df0fd262 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -528,6 +528,194 @@ saving. This is an accounting result for the stated raw-selector and compositional protocol, not a lower bound on arbitrary retractions or a claim that `K` is the shortest possible wrapper. +## A proper applicative retraction + +One-sided representations can preserve application exactly. Codex's explicit +construction is + +```text +F = lambda a b.b +t = lambda r y x h.h r (x y) +A x = lambda h.h t x +D v = v F. +``` + +The projection gives `D (A x) ->* x`, while + +```text +(A x) (A y) + ->* (A y) t x + ->* t t y x + ->* lambda h.h t (x y) + = A (x y). +``` + +These are finite reductions with `x,y` rigid, so substitution extends them +to arbitrary terms, including divergent ones. The closed `A` is a proper +representation: its beta-normal form differs from `I`. Its image of `I` is +idempotent under application and is not `F`. Thus the earlier transparent +collision `V(I) = F` does not apply to this representation. In particular, +application preservation plus a one-sided decoder does not force the +representation to be the identity. + +The explicit closed terms cost 28 bits for `t`, 41 for `A` with `t` inlined, +and 12 for `D`. These are construction sizes, not minimum claims. The +targeted script `tools/self-interpreter/theory/applicative_retraction.py` +checks these sizes and all displayed equations with rigid parameters; +its report is `data/self-interpreter/theory/applicative_retraction.json`. +This supplies a representation, not a complete smaller interpreter. + +### The ordinary wrapped environment still loses information + +The retraction does not repair the cell/APP alias while the ordinary +extension protocol remains. This has a representation-independent +obstruction. Let `A,D` be any closed terms with `D (A x) =beta x`; no +application-preservation assumption is needed. Retain raw variable values +and the usual extension with represented heads: + +```text +X1(N) = cons K N +X(n+1)(N) = cons F (Xn(N)) +Cell(a,e) = lambda b r.b (A a) (r e) +APP(f,g) = lambda e.e f g. +``` + +The selectors satisfy `X1(N) Cell(a,e) ->* A a` and +`X(n+1)(N) Cell(a,e) ->* Xn(N) e`. Require the compositional value +interpretation `V(M) e =beta A(M[rho])` under the represented environment. + +Take fresh rigid variables `a,b,c,z,N`, set + +```text +e = Cell(c, Cell(b, Cell(a,z))) +R = quote(var 2) ++ N = cons F (cons F (cons K N)), +``` + +and consider the source application `var 1 var 2`. Its left parsed value is +`X1(R)`, and its right value is `X2(N)`. Keeping this actual suffix +correlation, the alias reduces as follows: + +```text +e X1(R) X2(N) + ->* X1(R) (A c) (X2(N) (Cell(b, Cell(a,z)))) + ->* (A c) K R (A a). +``` + +The final term contains no `b`, whatever the closed representation `A`. +Neither applying the closed decoder `D` nor beta reduction can introduce a +fresh free `b`. Correctness instead requires its decoded result to be +`c b`, a beta-normal term containing `b`. Church–Rosser gives a +contradiction. + +Thus no one-sided retraction, including an applicative one, makes this +alias correct with raw selectors and this extension interface. The script +checks the information-losing equation with `A` itself rigid. This argument +uses the stated compositional interpretation for open terms; it is not a +new unconditional theorem about the closed-source interpreter contract. +An environment-dependent wrapper carrying additional context, a different +extension operation, or extra source information remains outside it. + +### A complete parser with applicative remainder metadata + +An explicit construction uses the box tag to carry the source remainder. +Application combines ordinary closure payloads pointwise and propagates +the right operand's remainder: + +```text +S(x,y) = lambda e.x e (y e) +G = lambda g n u y x h.h (lambda r.r g n) (S(x,y)) +t_N = lambda r.r G N +B_N(x) = lambda h.h t_N x. +``` + +The unused `u` absorbs the extra metadata supplied by self-application. +For arbitrary, independently chosen `M,N,x,y`, + +```text +t_N F ->* N +B_N(x) F ->* x +B_M(x) K F ->* M +B_M(x) B_N(y) ->* B_N(S(x,y)). +``` + +For the last equation, `t_M t_N y x` reduces to `G G N M y x`. +Thus the tag retains the right remainder even when the two input tags +differ. This exactly matches parsing an application: the left operand's +remainder begins with the right operand, and the right operand's remainder +is the result's remainder. + +The abstraction map preserves the existing tag: + +```text +Abs = lambda tag body h. + h tag (lambda env arg.body (lambda b r.b arg (r env))). + +B_N(f) Abs ->* B_N(lambda env arg.f (Cell(arg,env))). +``` + +Here `Cell` is the original unwrapped environment cell. Define a +continuation-free parser `P` by the following recursive equations: + +```text +P (1^n 0 ++ N) ->* B_N(Xn(N)) +P (00 ++ code(M) ++ N) ->* (P (code(M) ++ N)) Abs +P (01 ++ code(M) ++ code(L) ++ N) + ->* v (P (v K F)), where v = P (code(M) ++ code(L) ++ N). +``` + +In the application equation, if `R = code(L) ++ N`, the first parse +returns `v = B_R(f)`, so `v K F` +returns the correct second-parse stream `R`. The final application returns +`B_N(S(f,g))`. + +The implementation uses the 165's whole-stream reader with +`Box = lambda v n h.h (lambda r.r G n) v` as its variable continuation. +Its second-tag handler factors the first boxed value across both branches: + +```text +Next bit rest = + (lambda v.v (bit Abs (P (v K bit)))) (P rest). +``` + +On APP, the actual `bit` is `F` and supplies the second suffix projection; +on ABS, that entire expression is erased. The public boundary is + +```text +E C s = P s (lambda tag value.C value (tag F)). +``` + +Structural induction on the source gives the same closure semantics as the +165, with the remainder stored in the box. The public boundary consequently +reduces to `C (lambda z.M) N` for every closed source `M`. This handwritten +argument does not normalize `M`; it includes divergent source terms. + +The complete interpreter costs **303 bits**: its closed parser is 259, +the public adapter is 42, and their application costs two. Nested within +the parser, `G` costs 62, the closed variable-box constructor 90, and `Abs` +51; these nested sizes are not an additional sum. The separate tag and +boxing code outweigh the saved application plumbing. A smaller construction +would need to share those operations with the parser itself. + +`tools/self-interpreter/theory/metadata_parser.py` generates +`data/self-interpreter/machines/int303_metadata.{lam,blc}` and checks the +rigid projection, application, and abstraction equations. The complete +interpreter passes the standard battery, and tail-projecting probes return +the exact rigid suffix on both `Omega` and `lambda a.Omega`. The report is +`data/self-interpreter/theory/metadata_parser.json`; current measurements +belong in `docs/STATUS.md`. No candidate enumeration is involved. + +Pushing the public consumer +`lambda tag value.C value (tag F)` into the recursive productions removes +the boxes and their tags. On genuine source encodings, the resulting clauses +are exactly `C Xn N`, `C (ABS f) N`, and `C (S(f,g)) N`: the ordinary CPS +interface of the 165. In particular, the separate `G` disappears because +its rebuilt tag is immediately projected to the remainder. This fusion +removes the added representation overhead but leaves no concrete bit saving +over the 165. A further saving would require the tag operation to perform +another necessary control task before consumption. These source-domain +equations do not assert beta equality of the two complete parsers on +arbitrary inputs. + ## Swapping a closure's two arguments is not an exact involution A tempting wrapper swaps a closure's environment and source-argument diff --git a/tools/self-interpreter/theory/applicative_retraction.py b/tools/self-interpreter/theory/applicative_retraction.py new file mode 100644 index 00000000..81298b76 --- /dev/null +++ b/tools/self-interpreter/theory/applicative_retraction.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python3 +"""Exact checks of a hand-derived applicative retraction; no search. + +All equations bind their symbolic parameters outside both sides, so the +Rust KN normalizer checks them with those parameters rigid. The obstruction +identity leaves the representation constructor rigid as well. +""" +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import json +import sys +import time + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery as b + + +K = r"(\a\b.a)" +F = r"(\a\b.b)" +I = r"(\x.x)" +TAG = r"(\r\y\x\a.a r (x y))" +BOX = rf"(\x\a.a {TAG} x)" +DECODE = rf"(\v.v {F})" + + +def pair(head, tail): + return rf"(\h.h ({head}) ({tail}))" + + +def stream(bits, tail): + for bit in reversed(bits): + tail = pair(K if bit == "0" else F, tail) + return tail + + +def cell(value, tail): + # These binders must not capture the outer semantic variables a,b,c. + return rf"(\cb\cr.cb (box {value}) (cr ({tail})))" + + +def normalize(source): + term = b.compile_lam(source) + result = b.normalize(b.enc(term), 1 << 14) + assert result is not None, source + return result + + +def main(): + start = time.monotonic() + helpers = {} + for name, source, expected in [ + ("tag", TAG, 28), ("box", BOX, 41), ("decode", DECODE, 12), + ]: + wire = b.enc(b.compile_lam(source)) + assert len(wire) == expected, (name, len(wire)) + helpers[name] = {"bits": len(wire), "wire": wire} + + # At the application var1 var2, the left selector's suffix is the + # *whole* right operand's code, while the right selector lacks its + # first 1. These correlations are retained in the exact equation. + right_code = stream("110", "n") + left_value = pair(K, right_code) + right_value = stream("10", "n") + environment = cell("c", cell("b", cell("a", "z"))) + alias = rf"({environment}) ({left_value}) ({right_value})" + lost_middle = rf"(box c) {K} ({right_code}) (box a)" + + cases = [ + ("retraction", rf"\x.{DECODE} ({BOX} x)", r"\x.x"), + ("application", rf"\x\y.({BOX} x) ({BOX} y)", + rf"\x\y.{BOX} (x y)"), + ("identity_image_is_idempotent", rf"({BOX} {I}) ({BOX} {I})", + rf"{BOX} {I}"), + ("lookup_preserves_first_variable", + rf"\box\a\b\c\z\n.({stream('0', 'n')}) ({environment})", + r"\box\a\b\c\z\n.box c"), + ("lookup_preserves_middle_variable", + rf"\box\a\b\c\z\n.({stream('10', 'n')}) ({environment})", + r"\box\a\b\c\z\n.box b"), + ("lookup_preserves_third_variable", + rf"\box\a\b\c\z\n.({stream('110', 'n')}) ({environment})", + r"\box\a\b\c\z\n.box a"), + ("alias_loses_middle_variable", + rf"\box\a\b\c\z\n.{alias}", + rf"\box\a\b\c\z\n.{lost_middle}"), + ] + sources = [source for _, left, right in cases for source in (left, right)] + with ThreadPoolExecutor(max_workers=2) as pool: + results = list(pool.map(normalize, sources)) + checks = [] + for index, (name, _, _) in enumerate(cases): + assert results[2 * index] == results[2 * index + 1], name + checks.append(name) + + # The proper embedding does not coincide with the identity and, unlike + # the transparent closure for I, its image of I is not Boolean false. + distinct_pairs = [ + ("box_is_not_identity", BOX, I), + ("identity_image_is_not_false", rf"{BOX} {I}", F), + ] + sources = [source for _, left, right in distinct_pairs for source in (left, right)] + with ThreadPoolExecutor(max_workers=2) as pool: + results = list(pool.map(normalize, sources)) + distinct = [] + for index, (name, _, _) in enumerate(distinct_pairs): + assert results[2 * index] != results[2 * index + 1], name + distinct.append(name) + + report = { + "search_performed": False, + "helpers": helpers, + "rigid_equations": checks, + "distinct_normal_forms": distinct, + "elapsed_seconds": round(time.monotonic() - start, 3), + } + path = ROOT / "data/self-interpreter/theory/applicative_retraction.json" + path.write_text(json.dumps(report, indent=2) + "\n") + print(json.dumps(report, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/tools/self-interpreter/theory/metadata_parser.py b/tools/self-interpreter/theory/metadata_parser.py new file mode 100644 index 00000000..c5fc9610 --- /dev/null +++ b/tools/self-interpreter/theory/metadata_parser.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python3 +"""A continuation-free parser using an applicative metadata box; no search. + +The box tag carries the unconsumed source. Application combines closure +payloads pointwise and retains the right box's tag. The construction is a +complete 303-bit interpreter, not a record-sized candidate. +""" +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import json +import sys +import time + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery as b + + +K = r"(\u\w.u)" +F = r"(\u\w.w)" +GENERATOR = r"(\g\n\u\y\x\h.h (\r.r g n) (\e.x e (y e)))" +BOX = rf"(\v\n\h.h (\r.r {GENERATOR} n) v)" +ABS_HANDLER = r"(\tag\body\h.h tag (\env\arg.body (\b\r.b arg (r env))))" +NEXT = rf"""(\bit\rest. + (\v.v (bit {ABS_HANDLER} (p (v {K} bit)))) (p rest))""" +BODY = rf"""(\next\list. + list (\bit.bit (\unused\r.r next) {BOX}) (list list list)) + {NEXT}""" +PARSER = rf"((\x.x x) (\x.(\p.{BODY}) (x x)))" +SOURCE = rf"""(\p\cont\list. + p list (\tag\value.cont value (tag {F}))) {PARSER}""" + + +def normalize(source): + term = b.compile_lam(source) + result = b.normalize(b.enc(term), 1 << 16) + assert result is not None, source + return result + + +def divergent_suffix_probe(interpreter, source): + term = b.compile_lam(source) + probe = ("L", ("A", ("A", b.shift(interpreter, 1), b.FALSE), + b.bitlist(b.enc(term), ("V", 0)))) + result = b.normalize(b.enc(probe), 1 << 18) + assert result == "0010", (source, result) + + +def main(): + start = time.monotonic() + sizes = { + name: len(b.enc(b.compile_lam(source))) + for name, source in [ + ("generator", GENERATOR), + ("box_constructor", BOX), + ("abs_handler", ABS_HANDLER), + ("interpreter", SOURCE), + ] + } + assert sizes == { + "generator": 62, "box_constructor": 90, + "abs_handler": 51, "interpreter": 303, + }, sizes + cases = [ + ("payload_projection", rf"\n\x.({BOX} x n) {F}", r"\n\x.x"), + ("remainder_projection", rf"\n\x.({BOX} x n) {K} {F}", r"\n\x.n"), + ("application_keeps_right_remainder", + rf"\m\n\x\y.({BOX} x m) ({BOX} y n)", + rf"\m\n\x\y.{BOX} (\e.x e (y e)) n"), + ("abstraction_keeps_remainder", + rf"\n\x.({BOX} x n) {ABS_HANDLER}", + rf"\n\x.{BOX} (\env\arg.x (\b\r.b arg (r env))) n"), + ] + sources = [source for _, left, right in cases for source in (left, right)] + with ThreadPoolExecutor(max_workers=2) as pool: + results = list(pool.map(normalize, sources)) + for index, (name, _, _) in enumerate(cases): + assert results[2 * index] == results[2 * index + 1], name + + interpreter = b.compile_lam(SOURCE) + wire = b.enc(interpreter) + machines = ROOT / "data/self-interpreter/machines" + name = "int303_metadata" + (machines / f"{name}.lam").write_text( + "-- Applicative remainder metadata; generated by metadata_parser.py.\n" + "-- E C ( ++ N) =beta C (\\z.M) N for closed M.\n" + + SOURCE.strip() + "\n" + ) + (machines / f"{name}.blc").write_text(wire + "\n") + ok, skipped, failures = b.check(interpreter, max_bits=18, threads=2) + assert (ok, skipped, len(failures)) == (667, 1, 0), failures + divergent_sources = { + "omega": r"(\x.x x) (\x.x x)", + "lambda_omega": r"\a.(\x.x x) (\x.x x)", + } + with ThreadPoolExecutor(max_workers=2) as pool: + list(pool.map(lambda source: divergent_suffix_probe(interpreter, source), + divergent_sources.values())) + report = { + "search_performed": False, + "sizes": sizes, + "rigid_equations": [name for name, _, _ in cases], + "battery": {"ok": ok, "skipped": skipped, "failures": failures}, + "divergent_source_suffixes": list(divergent_sources), + "elapsed_seconds": round(time.monotonic() - start, 3), + } + path = ROOT / "data/self-interpreter/theory/metadata_parser.json" + path.write_text(json.dumps(report, indent=2) + "\n") + print(json.dumps(report, indent=2)) + + +if __name__ == "__main__": + main() From 706ba00a8ef74d95d39cc2d3962cb79009ab41a9 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 14:47:11 -0400 Subject: [PATCH 14/41] Bound whole-stream handlers and cheap-tail lambda counts --- docs/STATUS.md | 25 +- .../self-interpreter/cheap-tail-bound.md | 175 ++++++++ .../self-interpreter/handler-bound.md | 401 +++++++++++++++++- .../classical/self-interpreter/interpreter.md | 12 +- .../self-interpreter/theory/handler_bound.py | 56 ++- 5 files changed, 636 insertions(+), 33 deletions(-) create mode 100644 docs/classical/self-interpreter/cheap-tail-bound.md diff --git a/docs/STATUS.md b/docs/STATUS.md index 23474dd5..17471637 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -160,14 +160,19 @@ with all features (three opt-in tests ignored) and 328 with default features. reader bound now permits arbitrary handlers: independent rigid laws force `|H| ≥ 27`, so `s H S` still costs at least 43 and the unchanged surrounding interpreter at least 165 (`classical/self-interpreter/handler-bound.md`). - A second handwritten theorem allows actual unary-selector/suffix - correlations and proves the same handler minimum when its only free - variables are NEXT and the continuation. Whole-stream access remains open; - a checked 40-bit correlated handler with only one explicit lambda shows why - the independent proof's structural lemmas cannot all transfer. + The strengthened handwritten theorem also permits the actual stream, + tag, selector, and suffix correlations, including whole-stream access + inside `H`, with the skip fixed to `s s s` and other ambient parameters + independent and rigid. Its minimum is still 27. A checked 40-bit + correlated handler with only one explicit lambda shows why the proof + must price applications rather than transfer every independent-case lemma. For arbitrary correlated handlers, neutral operands `s next` and `s cont` - are dominated by `s`, saving 5 and 6 bits; this leaves `s` and the thunk - `s s` open (`classical/self-interpreter/protocol-obstructions.md`). + are dominated by `s`, saving 5 and 6 bits. A separate handwritten + theorem proves that handlers for `T=s` and `T=s s` need at least two + explicit lambdas, even with whole-stream access and beta redexes. + Their numerical thresholds remain open + (`classical/self-interpreter/cheap-tail-bound.md`, + `classical/self-interpreter/protocol-obstructions.md`). The zero arm ≥ 14, APP lift ≥ 19, reader/handler knot-tree and cell/APP exclusions remain as specified in §5. - **Unconditional structure** (`classical/self-interpreter/structural-bounds.md`): @@ -324,9 +329,9 @@ GHC 9.10.3; `uni.rs` with rustc), all three harnesses in 11 minutes: and build prefix-tree conditional predictions under `m` and `S`. Infinite streams belong to the separate monotone-machine `ref/AIT` lane. 9. **The self-interpreter below 165** (`classical/self-interpreter/interpreter.md` - §7): correlated readers outside the independent rigid laws, a changed - NEXT protocol that can use the reader's diagonal, and the capped fills of - the reader searches. Look for another shared computation of the kind the + §7): joint reader/skip changes, exploitation of actual NEXT/parser + behaviour, a changed NEXT protocol that can use the reader's diagonal, + and the capped fills of the reader searches. Look for another shared computation of the kind the reader is, by reasoning first. The two-nonlinear count is sharp even though the current witness is large; a stronger lower bound must price connections, captures, and protected quotation origins. Upstreaming the 165, 175 and 187 diff --git a/docs/classical/self-interpreter/cheap-tail-bound.md b/docs/classical/self-interpreter/cheap-tail-bound.md new file mode 100644 index 00000000..1e9d3b73 --- /dev/null +++ b/docs/classical/self-interpreter/cheap-tail-bound.md @@ -0,0 +1,175 @@ +# A two-lambda floor for the cheap reader operands + +This is Codex's handwritten proof. It concerns the reader `s H T` in +the ambient frame `[s,j,c,p,x]`, with `j,c,p,x` independent rigid variables. +The handler may use every ambient variable and arbitrary beta redexes. +The two operands considered here are `T=s` and `T=s s`. + +Write + +``` +K = λa b.a, F = λa b.b, +cons b r = λh.h b r, +P₀ = cons K N, Pᵢ₊₁ = cons F Pᵢ, +I = λa.a, Q = K N. +``` + +Here `N` is a fresh rigid variable. On a variable stream `s=Pₘ`, +`m≥1`, the required reader law is + +``` +H F Pₘ₋₁ T =β c Pₘ₋₁ N. +``` + +For `T=s`, the final argument is `Pₘ`; for `T=s s`, it reduces to `Q`. +Both are beta-normal abstractions, distinct from the rigid `N`. +Correctness on all variable streams alone forces **at least two explicit +lambdas in H**. The zero-stream law is not needed for this floor. + +This does not settle either joint size threshold. A reader improvement +requires `|H|≤34` with `T=s`, or `|H|≤30` with `T=s s`; two lambdas +alone do not exclude those budgets. + +## The application-only data algebra + +Consider application-only expressions generated by the `Pᵢ`, `F`, +and rigid variables. Their normal forms are either one of the functional +data values + +``` +Pᵢ, F, I, Q +``` + +or a rigid-headed neutral. Arguments inside a neutral may contain normal +data, including a bare `K`; its rigid head prevents their extraction. +Every functional data value contains only `N` as a possible free variable, +and in particular contains no `c`. + +The following application table proves closure. Write `tail₀=N`, +`tailᵢ₊₁=Pᵢ`, `bit₀=K`, and `bitᵢ₊₁=F`. + +| Function and argument | Reduct | +|---|---| +| `F V` | `I` | +| `I V` | `V` | +| `Q V` | `N` | +| `Pᵢ F` | `tailᵢ` | +| `P₀ I` | `Q` | +| `Pᵢ₊₁ I` | `I` | +| `Pᵢ Q` | `N tailᵢ` | +| `P₀ P₀` | `Q` | +| `P₀ Pⱼ₊₁` | `I` | +| `Pᵢ₊₁ P₀` | `N Pᵢ` | +| `Pᵢ₊₁ Pⱼ₊₁` | `Pⱼ Pᵢ` | +| `Pᵢ (z A₁ … Aₖ)` | `z A₁ … Aₖ bitᵢ tailᵢ` | + +Applying a neutral to another argument preserves its rigid head. +The recursive pair/pair row decreases the sum of its indices. More +generally all data abstractions are affine, so application-only expressions +over these data normalize. Induction on the applicative expression, +using this table, establishes the claimed normal-form grammar. + +The exclusion of bare `K` from the functional values matters. For example, +`P₀ K → K`; that would invalidate the grammar if `K` were freely +available as a function. It is not an initial generator here. `P₀ I` +and `P₀ P₀` expose only `K N`, while a `K` delivered to a rigid +neutral remains trapped in that neutral's argument spine. + +## No explicit lambda + +If `H` has no lambda, substitute `s=Pₘ` and normalize it in this +algebra. A functional data result contains no `c`, so applying it to +`F,Pₘ₋₁,T` cannot produce head `c`. A rigid-headed result keeps +that head and receives three additional arguments. If its head is `c`, +it therefore has at least three arguments, whereas the required normal +form has exactly two. Other rigid heads also fail. + +## One leading lambda + +Suppose `H=λb.B` and `B` contains no lambdas. After applying the first +argument `F`, the body belongs to the same application-only algebra. +A functional data normal form again contains no `c`. A rigid normal +form with head `c` receives the two remaining arguments `Pₘ₋₁,T`. +Matching the required two-argument spine forces the body's normal form +to be exactly `c`, and then forces `T=βN`. This is false for both +cheap operands. Other rigid heads fail immediately. + +## An arbitrarily placed single lambda + +A syntactic beta redex in a one-lambda `H` consumes that unique lambda. +Contract it before substituting the stream. The reduct is application-only, +so the preceding zero-lambda obstruction applies. It remains to consider +beta-normal `H` whose unique lambda is not necessarily at the root. + +Write that lambda as `D=λz.B`, where `B` is application-only. Replace +its single occurrence by a fresh opaque rigid marker `d`. The remaining +syntax is an application-only context `C[d]`. Let `a` be its number of +applications, counting the marker as one leaf. Choose a variable stream +`Pₘ` with `m>a+1`. + +Normalize `C[d]` bottom-up while retaining `d` as rigid: first normalize +both children of an application, then use the data-algebra table. All +participating data binders are affine, so the marker is never copied. +The data-algebra grammar remains valid with `d` among the rigid heads. + +There is also an index invariant: + +> Every Scott cell obtained as a functional normal form of a subexpression +> is `Pₘ₋ₖ` with `0≤k≤` the number of applications in that subexpression. + +Induct on the application tree. The source leaves have index `m`. +Identity forwards an already obtained value. The only table entry that +returns a new Scott value is `Pᵢ F→Pᵢ₋₁`, spending one application +for one decrement. Pair/pair interaction returns `I`, `Q`, or an +`N`-headed neutral; it never returns a Scott value. Other entries do +not introduce one. + +In this normalization order, pair/pair reductions involve no marker. +Only a normalized functional Scott value applied to a `d`-headed +neutral can invoke the marker as a handler, so the index invariant +makes its index positive. In + +``` +Pᵢ (d A₁ … Aₖ) → d A₁ … Aₖ F Pᵢ₋₁, +``` + +the newly supplied bit is always `F`, never terminal `K`. +The first argument of a `d`-headed normal form therefore comes either +from an explicit application, whose operand normalized in the safe +algebra, or from such a positive-index Scott invocation. It is a safe +data value or a rigid neutral, never a bare functional `K`. +Cells or bare bits buried inside rigid neutrals cannot be extracted. +The marker's uniqueness ensures that none of its arguments contains +another copy of the marker. + +There are now three possibilities for the normalized context: + +* A functional data value has erased the marker. It contains no `c` + and fails as in the zero-lambda case. +* A rigid neutral with head other than `d` remains rigid after replacing + the marker by its lambda, even if that lambda occurs in an argument. + Appending the three external arguments cannot produce the required + two-argument `c` spine. +* The result is `d A₁ … Aₖ`. If `k=0`, restoring `D` gives the + leading-lambda case: the first external argument is `F`, leaving + `Pₘ₋₁,T`. If `k>0`, contract `D A₁` before appending any external + arguments. Its body was application-only and its argument is safe; + the remaining expression therefore belongs to the safe algebra, + allowing rigid neutrals as additional opaque operands. Its functional + data results still contain no `c`, and its rigid results retain all + three external arguments. Neither can give the required output. + +Thus a single lambda cannot meet the variable law for all lengths. +The long-prefix choice is essential to this proof: a callback activated +at a terminal `P₀` can receive bare `K`, after which it could construct +constant functions carrying arbitrary code. The index invariant excludes +that activation for the chosen stream rather than assuming it impossible. + +## Remaining boundary + +This is a lambda-count obstruction for two specified operands, not a +27-bit handler bound or a 37-bit joint handler/operand bound. Handlers +with two or more lambdas, including compressed terms and whole-stream +control, remain to be priced. The original independent-neighbour and +restricted correlated-selector bounds live in `handler-bound.md`; +neutral-operand domination is in `protocol-obstructions.md`. diff --git a/docs/classical/self-interpreter/handler-bound.md b/docs/classical/self-interpreter/handler-bound.md index e095da39..1d09f9a8 100644 --- a/docs/classical/self-interpreter/handler-bound.md +++ b/docs/classical/self-interpreter/handler-bound.md @@ -1,11 +1,13 @@ -# An unrestricted parametric handler bound +# A 27-bit bound for reader handlers -These are Codex's handwritten proofs; both bounds were independently +These are Codex's handwritten proofs; all three bounds were independently reviewed. They are not a global 165-bit optimality theorem. The first theorem removes the syntactic restriction on the handler while retaining independent, rigid-neighbour laws. The second allows the actual correlation between a unary selector and its remainder, -but restricts the handler's free variables to `j,c`. +but restricts the handler's free variables to `j,c`. The third also permits +access to the whole stream, while keeping the other ambient parameters +independent and rigid. ## Statement @@ -353,25 +355,388 @@ the required input-receiving lambda. Finally `A≥5`, `L≥1`, `X≥3` already imply `|H|≥27`. Together these cases prove the correlated-selector bound. -## What these bounds do not prove +## Whole-stream correlated handlers + +Allow all five ambient variables in `H`. Write `H[S]` for substitution of +`S` for its free stream variable `s`, and retain the definitions of `cons` +and `X_n` above. Suppose + +``` +H[cons K R] K R R =β R j, +H[cons F X_n(N)] F X_n(N) N =β c X_n(N) N for every n ≥ 0, +``` + +with `R,N,j,c,p,x` independent rigid parameters. Then `|H|≥27`. +The usual 27-bit handler attains the bound. This is still a theorem about +the fixed outer reader `s H (s s s)`, not arbitrary universal programs. + +The parameters `p,x` can be removed without loss: substitute `j` for both. +Neither occurs in the required outputs, so both laws remain valid, and +replacing a higher free index by `j` can only decrease size. Hence it is +enough to consider free variables `s,j,c`. Both `j,c` must occur, giving +`X≥3`. A term with `A` applications has `A+1` leaves. + +### No handler with only vacuous abstractions + +This lemma has no size restriction. Compare the zero stream and the first +one stream: + +``` +P = cons K R, +T = cons K N, +Q = cons F T. +``` + +Consider expressions generated by `s,j,c`, application, and vacuous +abstraction. Their evaluations at `s=P` and `s=Q` have related head values +of the following three kinds: + +* `P` on the left corresponds to `Q` on the right; +* a constant function `λ_.U` corresponds to `λ_.V` when `U,V` are related; +* a rigid head corresponds to the same rigid head, except that `R` on + the left corresponds to `N` on the right. Its arguments are immaterial + for this head relation. + +This relation is preserved by application. The only nontrivial cell cases +are + +``` +P P →* K R, Q Q →* K N, +P (λ_.U) →* U R, Q (λ_.V) →* V T. +``` + +For the second line, inspect the related values of `U,V`. Constant +functions discard `R,T` and return related bodies. Rigid heads retain +their related heads. The cell case gives + +``` +P R → R K R, Q T →* N T, +``` + +again the related rigid heads `R,N`. Applying a cell to a rigid-headed +value preserves that value's head; applying a constant discards the +argument. These observations prove closure by structural induction on the +expression. All abstractions in the expanded expressions are affine, so +these head evaluations terminate. In particular, a bare `T` is never a +new functional value in the relation; it appears only in the displayed +special-argument calculation or inside ignored arguments. + +Now apply the external arguments `K,R,R` on the left and `F,T,N` on the +right. An exposed rigid head cannot give `R j` while any external `R` +remains: the last such argument would remain last. An exposed `P` with +three, two, or one remaining external arguments gives respectively +`R`, `R K R R`, or `R K R`, none equal to `R j`. Therefore the zero law +requires three constant-function heads in succession, followed by a +rigid head `R`. The corresponding right evaluation discards its three +external arguments and has rigid head `N`, contradicting the required +head `c`. + +Thus a valid handler has at least one non-vacuous abstraction. This also +excludes zero-abstraction handlers, without any application bound. + +### A one-abstraction handler needs at least five applications + +A one-abstraction handler cannot contain a syntactic beta redex: +contracting its sole abstraction would leave an equivalent +zero-abstraction handler. Thus it is beta-normal. + +For the zero stream, use the macro constants `P=cons K R` and `K`, with +rules + +``` +P U → U K R, K U V → U. +``` + +Partial applications `K U` are retained as constant-function values. +This terminating macro calculus is simply a presentation of the same +beta reductions. Mark every application node originating in `H`. +The only new applications introduced by `P` have right operands `K` and +`R`. Consequently an application whose right subtree contains the rigid +`j` must come from a marked node. The rules neither duplicate such nodes +nor create `j`. + +First suppose `H=λb.B`. After `b:=K`, the body is an application tree over +`P,K` and rigid variables. Its possible functional head values are `P`, +`K`, and `K U`. Inspecting them against the two remaining arguments shows -The parametric theorem permits arbitrary uses of ambient variables but -requires independent rigid neighbours. The correlated-selector theorem -uses the real unary selector and its remainder, but permits only `j,c` -as free variables. In particular it excludes access to the whole stream -`s`, whose tag and tail correlate with the arguments subsequently supplied -to the handler. The full `s`-dependent correlated handler problem remains -outside both theorems. +``` +B[K/b] R R →* R j implies B[K/b] →* K (K (R j)). +``` + +The three displayed applications with `j` in their right subtrees are +three distinct surviving marked nodes. At least two additional marked +nodes must have been consumed to expose `R` as the head of `R j`. +Here is the small accounting argument. Before any marked node is consumed, +no rule can fire. If at most one is consumed, the first rule must be +`P U`: an initial `K U V` contraction consumes two marked nodes. +Thereafter only generated nodes may be contracted. An application-rooted +`U` cannot expose a functional head without contracting its marked head +application. Thus the only non-rigid possibilities for `U` are the leaves +`P,K`. They give `P P →* K R` and `P K →* K`; neither produces an +`R`-headed application. A rigid-headed `U` remains rigid-headed, with +`R` only a newly appended argument. Hence exposing `R j` requires a +second consumed marked node, distinct from the three surviving nodes. +Therefore `A≥5`. + +Now suppose the one-abstraction handler is application-headed. Its head +must be `s`. Replace its sole abstraction `D=λb.B` by an opaque marker. +In application trees over `P` and rigid markers the only functional head +values are `P` and `K R`. Moreover, in a beta-normal source tree, a +nontrivial expression that reaches a marker as head supplies it first +with `K,R`. This follows by induction on an application: applying `P` +to a marker introduces precisely those arguments; applying `K R` returns +`R`; and an already rigid head retains its preceding arguments. The +exception of a marker already in function position is excluded by source +beta-normality. + +The handler must activate `D`; otherwise it cannot satisfy the zero law. +Its first argument is therefore `K`. After this contraction only +`P,K` and rigid variables remain, and no `j`-bearing application is +duplicated. All three external arguments are still pending, so inspection +of the same functional head values gives + +``` +H[P] →* K (K (K (R j))). +``` + +This requires four distinct surviving marked `j`-bearing applications. +The initial application of the source head `s` already consumed another +marked node. Again `A≥5`. + +Consequently every handler with `L=1` costs at least +`2+4·5+2+3=27` bits. Notice that this does not assert `L≥2`: the +40-bit witness in `normal.md` remains a valid one-abstraction handler. + +### At most three applications + +If `s` is absent, the preceding correlated-selector theorem applies. +If `s` is present and `A≤2`, the required leaves `s,j,c` leave no bound +variable occurrence, so the all-vacuous lemma applies. + +For `A=3`, a second occurrence of `s` likewise leaves no bound variable +occurrence. Otherwise the four leaves are exactly `s,j,c,v`, where `v` +is the sole bound-variable occurrence. Every abstraction is affine. +A syntactic beta contraction would reduce the application count to at +most two, already impossible. Thus `H` is beta-normal. Its head normal +form has at most three leading binders. A fixed head `j` or `c` fails. +The remaining cases are a bound head or the unique free `s`. + +For a bound head, only its one occurrence is live. If it receives the +second or third external argument, the zero law forces all three inputs +to be bound and the body to be `v A`, with `A[P]→*j`. The two applications +inside `A` have exactly the leaves `s,j,c`, and all its abstractions are +vacuous. In beta-normal form the only way for it to discard the cell's +`K,R` and the extra `c` and return bare `j` is +`A=s (λu v w.j) C`, where `C` is a vacuous chain ending in `c`. +This needs three additional abstractions, giving `L≥6` and already more +than 26 bits. + +If the bound head receives the first external argument, fewer than two +internal Boolean arguments fail on the `F` branch, as in the previous +theorem. With two internal arguments the zero arm has at most one +application. Its only possible non-rigid free head is the unique `s`, +whose callback is a vacuous chain ending in `j`; this exposes head `j`, +not `R`. With three internal arguments each arm is a one-leaf vacuous +chain. The selected zero arm either has fixed head `j/c`, or exposes `P`. +That `P` can next receive only a chain ending in `j/c`, a rigid `R`, or +no argument. These give a fixed head, an `R`-head with first argument `K`, +or a remaining lambda, respectively. None gives `R j`. + +For the free head `s`, write + +``` +H = λa₁ ... a_m. s A₁ ... A_k, m≤3. +``` + +There is one bound leaf `v`, and all other binders are vacuous. The zero +cell passes `K,R` to `A₁`, then the remaining `A_i`, then the `3-m` +external arguments. The following cases exhaust the three applications: + +| Source arguments `k` | Remaining callback structure | Consequence of the zero law | +| --- | --- | --- | +| `1` | `A₁` contains two applications and leaves `v,j,c` | Its head must be `v`. If `v` receives `R`, its fixed argument spine is either too long or contains both `j,c`; if it receives `K`, selection exposes a chain headed `j/c`. The zero law fails. | +| `2`, one application in `A₂` | `A₁` is a one-leaf chain; `A₂` contains `j,c` | Selecting `A₂` exposes `j/c`; making `R` the head cannot turn the beta-normal two-leaf `A₂` into bare `j`. The zero law fails. | +| `2`, one application in `A₁` | The only possible successful head is a bound `R` applied to bare `j` | All the cell arguments, the other source argument, and the remaining external arguments must be consumed first. This requires at least `(2+1+3-m)+m=6` source abstractions. | +| `3` | All `A_i` are one-leaf chains | A direct `R` head requires at least six abstractions. The remaining zero possibility binds all three external inputs, leaves the common arguments `C,j`, and makes the callback return `K` after consuming the cell's first argument. On the one stream the same callback returns `F`, so the result is `C j`, with `C` a vacuous chain ending in `c`; this is never `c X_n(N) N`. | + +For completeness, in the final row write the callback as +`A₁=λu₁ ... u_l.v`. The common arguments are one-leaf vacuous chains +ending in `j,c`. A callback ending instead in a free `j/c` cannot have +head `R`, so its leaf must be the unique bound occurrence `v`. +Its supplied argument list on the zero stream is + +``` +K, R, A₂, A₃, followed by the 3-m unbound external arguments. +``` + +If `v` selects either common argument, its eventual head is `j/c`. +If it selects a rigid `R` (or refers to an outer tail binder), the only +possible surviving argument is bare `j`. That `j` must be `A₃`, and no +external argument may follow it. Thus `m=3`, and the callback must consume +`K,R,A₂` before exposing its `R` head: `l=3`, so `m+l=6`. + +The remaining possibility is that `v` is `K`. To obtain `R j`, that `K` +must receive the cell tail `R`, discard the other common argument, and +then leave the final `j`. Inspection of the displayed ordered list gives +exactly `m=3`, `l=1`, `A₂=C`, and `A₃=j`, with `C` a vacuous chain +ending in `c`. With no callback binder, `K` instead first receives the +cell tag `K`; with two or more callback binders it has already lost the +cell tail `R`. Choosing a later external `K` likewise loses both common +arguments, including `j`. The callback's only possible live leaves are +therefore its own sole binder or the first outer binder. Up to names, the +two zero-compatible forms are + +``` +λa b d. s (λu.u) C j, +λa b d. s (λu.a) C j. +``` + +On a one stream both callbacks return `F` after consuming the cell tag, +and the result is `C j`: either `c j`, bare `c`, or a remaining lambda, +according to the length of `C`. None is `c X_n(N) N`. This explicitly +covers dependence on the stream tag without requiring the first external +argument to be live. + +Every successful three-application case has therefore been excluded +below 27 bits. + +### Four applications below 27 bits + +If `s` is absent, the earlier correlated-selector theorem already applies. +Assume it occurs, and suppose `A=4` and `|H|≤26`. The preceding +one-abstraction result gives `L≥2`; hence `L=2` and `X≤4`. +The handler cannot begin with a lambda, +since its required `j,c` leaves would already contribute five to `X`. + +An affine syntactic beta contraction leaves at most one abstraction and +at most three applications, already excluded. In a nonlinear contraction, +the two occurrences of its binder, together with `s,j,c`, exhaust the +five leaves. The other abstraction is vacuous. Contracting the nonlinear +binder leaves a handler with only vacuous abstractions, even if its +argument is copied; capture-avoiding substitution cannot make a vacuous +binder live. The all-vacuous lemma excludes this case. Thus `H` is +beta-normal, with head `s`. + +The index budget now makes a short complete syntax classification +possible. The mandatory `j,c` contribute three. At most one further unit +can be spent on a free leaf lying under a lambda, or on an outer binder +occurring below the inner lambda. A duplicate `j` spends that unit itself; +a duplicate `c` is impossible. Write `I=λa.a`, `C_Z=λ_.Z`, and +`Δ=λa.a a`. An *outermost lambda block* means a lambda subterm not inside +another lambda. Such blocks cannot occur in source function position, +because the source is beta-normal. + +If all binders are affine, the complete list is as follows. In the second +half, `Z` is the sole free leaf under one lambda; all other free leaves +are outside both lambdas. + +| Placement | Lambda blocks | +| --- | --- | +| No free leaf under a lambda; disjoint blocks | `I,I` | +| No free leaf under a lambda; one block | `K`, `F`, `λa b.a b`, `λa b.b a`, or `λa.a I` | +| One free leaf under a lambda; disjoint blocks | `I,C_Z`; or `I,λa.a Z`; or `I,λa.Z a` | +| One free leaf under a lambda; one vacuous outer binder | `λu.Z I` | +| One free leaf under a lambda; both binders live | `λa.a I Z`, `λa.a Z I`, `λa.a(Z I)`, `λa.Z(a I)`, `λa.Z a I`, `λa.Z I a` | + +This list follows directly from the two leaves available after `s,j,c`. +With disjoint closed blocks each is `I`. A closed block with one bound +leaf is `K/F`; with two affine bound leaves it has the three listed +one-application forms. If a free `Z` lies under a lambda, no binder may +cross the inner lambda. The inner live lambda is therefore an `I`, +and the six beta-normal binary trees on `a,Z,I` give the last row; +trees having `I` in function position are excluded. With only one live +binder, the two possibilities are disjoint `I,C_Z` or `λu.Z I`. +In the rows `I,λa.a Z`, `I,λa.Z a`, and the last row, the five leaves +force `Z=j/c` and exactly one free `s`, outside the blocks. + +Here are their zero evaluations. Before the first source block is +activated, the opaque-marker argument from the one-abstraction case +applies: its first supplied arguments are `K,R`. + +* `I,I`: the first callback gives `P I→*K R`. There is no other free + `s` to activate the remaining `I`; the constant either discards it or + exposes a rigid `R` head with the external arguments still pending. +* For `λa b.a b`, `λa b.b a`, and `λa.a I`, application through `P` + gives respectively `K R`, `R K`, and `I`. The pending original `j,c` + yield a wrong rigid head or leave external arguments on the final `R`. +* With `I,λa.a Z` or `I,λa.Z a`, activating the latter block gives + head `Z`. Activating `I` first gives `K R`, as above. +* `P (λu.Z I)→*Z I R`. For `Z=j/c` the head is wrong. For `Z=s`, + this becomes `P I R→*R`; all external arguments remain pending. +* In the six-member final row, the first block gives, respectively, + `R`, `Z R`, `Z I`, or one of the three rigid `Z`-headed expressions. + The only result not headed by `Z` is the first result `R`, but the + remaining original argument and the external `K,R,R` still follow it. + +The blocks `K/F` and the disjoint pair `I,C_Z` admit a uniform check that +also allows their extra free `s` occurrence. Use macro rules for +`P,K,F,I,C_Z`; normalize a partial `F U` to `I`. The only possible +functional values are `P,K,K U,F,I,C_Z`. In the case `Z=s`, regard +`C_s` as the constant function returning `P`. Exposing `P`, `F`, `I`, +or a constant returning a bare `j,c,P` at any of the three external +positions cannot yield `R j`. The zero law therefore requires +`K(K(K(R j)))` again. Its four `j`-bearing applications must all descend +from original applications: the extra rules create no applications, and +`P` only creates arguments `K,R`. The first activation of the source +head `s` consumes a fifth original application. This contradicts `A=4`. + +It remains to classify a beta-normal nonlinear binder. Its two bound +leaves together with `s,j,c` exhaust all leaves, so the other binder is +vacuous and `s` occurs once. If `j/c` lies inside the live duplicating +lambda, its extra index spends the entire allowance; the other vacuous +lambda must then add another unit, which is impossible. The surviving +possibilities are + +``` +Δ together with C_Z, Z=j or c, +λu.Δ, +λv.v (λu.v), +λu.Z Δ, Z=j or c. +``` + +The first two-lambda block is an outer vacuous wrapper around `Δ`. +The alternative `λv u.v v` has two outer-binder occurrences below the +inner lambda and exceeds `X≤4`. The tree `(λu.v) v` contains a source +beta redex. These observations exhaust the position of the second lambda. + +If `Δ` is activated before a disjoint `C_Z`, then `P Δ→*K`; the +remaining arguments have only heads `j/c` and no source `s` remains. +If `C_Z` is activated first, the head is immediately `Z`. The other +three blocks give + +``` +P (λu.Δ) →* R R, +P (λv.v (λu.v)) →* λu.K, +P (λu.Z Δ) →* Z Δ R. +``` + +The first and third already have a wrong rigid head/spine. In the middle +case, if `j,c` are separate pending arguments, the first consumes the +constant wrapper and the second supplies a rigid `j/c` argument to `K`. +If they form one pending application, that whole application is discarded +and the result is bare `K`. Neither result, applied to external `K,R,R`, +is `R j`. Thus every nonlinear case also fails. + +Finally, for `A≥5`, the already established `L≥1` and `X≥3` imply +`|H|≥27`. This proves the whole-stream correlated bound. + +## What these bounds do not prove -The reader itself is still `s H S`, and the rest of the interpreter is -fixed. These handler bounds do not settle arbitrary skip operands or -arbitrary sub-165 programs without further decomposition or a different -global invariant. +The whole-stream theorem permits the actual stream/tag/tail correlations +and arbitrary syntax inside `H`. It still treats `j,c,p,x` as independent +rigid parameters and fixes the skip to `s s s`. Exploiting the actual +behaviour of NEXT or the recursive parser is outside its hypotheses. +Other reader heads, arbitrary skip operands, and arbitrary sub-165 programs +remain open without further decomposition or a different global invariant. +`cheap-tail-bound.md` proves a separate two-lambda floor for `T=s` and +`T=s s`, but not their numerical handler thresholds. The five explicit witnesses and the arithmetic are checked by `tools/self-interpreter/theory/handler_bound.py`, including the 40-bit whole-stream handler with only one lambda explained in `normal.md`. That witness shows why the single-abstraction obstruction does not extend -unchanged to ambient-stream access. The script does not enumerate terms -or prove the quantified lower bounds; the proofs are the case analyses -above. +unchanged to ambient-stream access; the whole-stream proof instead prices +one-abstraction handlers by their applications. The script also checks the +nine displayed callback equations, six data identities, and two residual +three-application tag-return shapes. It does not enumerate terms or prove +the quantified lower bounds; the proofs are the case analyses above. diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index 4b71a8a8..0b835280 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -364,10 +364,11 @@ These are Codex's handwritten proofs, with targeted reduction checks in `handler-bound.md` gives the complete small-budget case proof. The skip costs at least 10 and the two applications with `s` 6, so the reader costs at least 43; with the other 122 bits unchanged the minimum is 165. - A second theorem in that note allows the actual unary-selector/suffix - correlation and retains the 27-bit handler minimum when the only free - variables in `H` are `next,cont`. Other reader heads, access to the whole - stream or parser state, and arbitrary joint skip choices remain outside + The stronger theorem in that note retains the 27-bit minimum under + actual stream/tag/selector/suffix correlations, including whole-stream + access inside `H`, for the fixed skip `s s s`. Other ambient parameters + remain independent and rigid. Other reader heads, exploitation of actual + NEXT/parser behaviour, and arbitrary joint skip choices remain outside these bounds. `normal.md` gives two 40-bit correlated handlers satisfying the actual-stream laws but not the independent rigid laws; one has just one explicit lambda. @@ -376,6 +377,9 @@ These are Codex's handwritten proofs, with targeted reduction checks in saving 5 or 6 bits. The proof in `protocol-obstructions.md` tracks an inert marked operand that every successful reduction must erase. It does not exclude the cheaper `T=s` family or the productive thunk `T=s s`. + `cheap-tail-bound.md` proves that both families require at least two + explicit lambdas in `H`, even with arbitrary whole-stream use and beta + redexes; it does not yet exclude their numerical handler budgets. - **The zero arm costs at least 14 bits**, even with `bit0 := K` and the whole zero cell available to borrow. With `R` absent and the neighbours rigid, `Z R R = R next` forces the normal form `λu v. u next` (15) or diff --git a/tools/self-interpreter/theory/handler_bound.py b/tools/self-interpreter/theory/handler_bound.py index 0a865541..25798b73 100644 --- a/tools/self-interpreter/theory/handler_bound.py +++ b/tools/self-interpreter/theory/handler_bound.py @@ -90,4 +90,58 @@ def laws(term): ) print("whole-stream audit: 40 bits; L=1, A=7, X=8; correlated laws pass") -print("PASS: five explicit witnesses; no enumeration") +# These are the nine displayed callback equations in the whole-stream proof. +# The list is fixed: it checks no other syntax and proves no quantified bound. +j = ("V", 1) +c = ("V", 2) +identity = handler(r"\i. i") +delta = handler(r"\v. v v") +constant_k = handler(r"\u.\a.\b. a") +callback_equations = [ + ("a I j", r"\a. a (\i.i) j", 16, r), + ("a j I", r"\a. a j (\i.i)", 16, app(j, r)), + ("a (j I)", r"\a. a (j (\i.i))", 16, app(j, identity)), + ("j (a I)", r"\a. j (a (\i.i))", 16, + app(j, app(lc.TRUE, identity), r)), + ("j a I", r"\a. j a (\i.i)", 16, app(j, lc.TRUE, identity, r)), + ("j I a", r"\a. j (\i.i) a", 16, app(j, identity, lc.TRUE, r)), + ("constant delta", r"\u.\v. v v", 10, app(r, r)), + ("nested constant", r"\v. v (\u.v)", 11, constant_k), + ("constant j delta", r"\u. j (\v.v v)", 16, app(j, delta, r)), +] +for name, source, size, expected in callback_equations: + term = handler(source) + l, a, x = counts(term) + assert lc.size(term) == size == 2 * l + 4 * a + 2 + x, name + assert normal(app(zero_stream, term)) == normal(expected), name + +# The head-value relation uses precisely this first variable stream. +terminal = lc.pair(lc.TRUE, n) +one_stream = lc.pair(lc.FALSE, terminal) +data_equations = [ + ("P P", app(zero_stream, zero_stream), app(lc.TRUE, r)), + ("Q Q", app(one_stream, one_stream), app(lc.TRUE, n)), + ("P R", app(zero_stream, r), app(r, lc.TRUE, r)), + ("Q T", app(one_stream, terminal), app(n, terminal)), + ("P delta", app(zero_stream, delta), lc.TRUE), + # A compound pending j/c argument leaves bare K in the nonlinear case. + ("K K R R", app(lc.TRUE, lc.TRUE, r, r), app(lc.TRUE, r)), +] +for name, term, expected in data_equations: + assert normal(term) == normal(expected), name + +# These are the two exact zero-compatible A=3 tag-return shapes. +tag_return_shapes = [ + r"\a.\b.\d. s (\u.u) c j", + r"\a.\b.\d. s (\u.a) c j", +] +for source in tag_return_shapes: + term = handler(source) + assert normal(app(lc.subst(0, zero_stream, term), lc.TRUE, r, r)) == app(r, j) + assert normal( + app(lc.subst(0, one_stream, term), lc.FALSE, terminal, n) + ) == app(c, j) + +print("whole-stream proof audit: nine callback sizes/equations, six data equations, " + "two tag-return shapes pass") +print("PASS: five explicit witnesses and fixed proof equations; no enumeration") From c6daebc10ff3fbbc101c8fd15fe7bd1dec7f957f Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 15:05:04 -0400 Subject: [PATCH 15/41] Prove scoped cheap-reader shape and compression constraints --- docs/STATUS.md | 7 +- .../self-interpreter/cheap-tail-bound.md | 420 +++++++++++++++++- .../classical/self-interpreter/interpreter.md | 11 +- docs/classical/self-interpreter/normal.md | 13 +- 4 files changed, 432 insertions(+), 19 deletions(-) diff --git a/docs/STATUS.md b/docs/STATUS.md index 17471637..1e9550dc 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -170,7 +170,12 @@ with all features (three opt-in tests ignored) and 328 with default features. are dominated by `s`, saving 5 and 6 bits. A separate handwritten theorem proves that handlers for `T=s` and `T=s s` need at least two explicit lambdas, even with whole-stream access and beta redexes. - Their numerical thresholds remain open + Further reviewed shape exclusions rule out a consecutive two-lambda + block for either improving budget and exactly three leading lambdas + for `T=s`. For `T=s s`, affine reductions preserve the 30-bit budget; + a minimum successful handler with at most four applications would have + to be beta-normal. The five-application compression cases and complete + numerical thresholds remain open (`classical/self-interpreter/cheap-tail-bound.md`, `classical/self-interpreter/protocol-obstructions.md`). The zero arm ≥ 14, APP lift ≥ 19, reader/handler knot-tree and cell/APP diff --git a/docs/classical/self-interpreter/cheap-tail-bound.md b/docs/classical/self-interpreter/cheap-tail-bound.md index 1e9d3b73..1664d24f 100644 --- a/docs/classical/self-interpreter/cheap-tail-bound.md +++ b/docs/classical/self-interpreter/cheap-tail-bound.md @@ -1,4 +1,4 @@ -# A two-lambda floor for the cheap reader operands +# Constraints on the cheap reader operands This is Codex's handwritten proof. It concerns the reader `s H T` in the ambient frame `[s,j,c,p,x]`, with `j,c,p,x` independent rigid variables. @@ -165,11 +165,417 @@ at a terminal `P₀` can receive bare `K`, after which it could construct constant functions carrying arbitrary code. The index invariant excludes that activation for the chosen stream rather than assuming it impossible. +## A nonleading consecutive two-lambda block is too expensive + +There is a further exclusion for a beta-normal, application-headed +handler whose two source lambdas form one consecutive block + +``` +D = λa b.B. +``` + +There are exactly two source lambdas in the entire handler, so `B` and +the surrounding context are application-only. The block need not be the +initial argument of `s`. This shape cannot fit either improving budget: +`|H|≤34` for `T=s`, or `|H|≤30` for `T=s s`. + +For this size bound, higher ambient variables `p,x` can first be replaced +by `j`. Their absence from the required outputs makes the replacement +law-preserving, and their indices are higher than `j`'s. It suffices to +consider free variables `s,j,c`. + +Use the zero stream `P=cons K R`, with `R` rigid and independent of +`j,c`. A valid application-headed handler has head `s`; the other free +heads are rigid and retain the three external arguments. A source block +in function position would be a beta redex, so `D` occurs as an +application argument. Its function subtree is application-only. +Such a subtree normalizes to `P`, `K R`, or a rigid neutral. The last +two cases respectively erase the block or trap it under a rigid head; +a successful handler must activate it through `P`. An application-only +subtree over `P` and rigids can normalize to `P` only when it is the +literal source `s`. Thus there is a direct source subterm `s D`. + +Reduce this local subterm first. Both source lambdas consume the cell's +`K,R`, before the three external arguments. The resulting value occurs +once in the surrounding application-only context. The remaining +reductions have macro rules + +``` +P U → U K R, K U V → U. +``` + +The functional normal forms are `P`, `K`, and `K U`; the other normal +forms have a rigid head. A `K U` is a constant function whose body `U` +has a normal form in the same grammar. All remaining abstractions are +affine, so these reductions terminate. + +For either final operand `T=P` or `T=K R`, inspection of these heads gives + +``` +H[P] K R T →* R j implies H[P] →* K (K (K (R j))). +``` + +Indeed, exposing `P` with three remaining external arguments gives `R`; +with two it gives `R K R T`; and with one it gives `K R` or `R R`. +Exposing bare `K` gives a remaining lambda or bare `R`. A rigid head +cannot discard the remaining arguments. The only successful possibility +is therefore three consecutive constant functions followed by `R j`. + +Mark all application nodes originating in the source `H`. The four +displayed applications whose right subtree contains `j` must descend from +four distinct marked nodes: the Scott rule only introduces applications +with right operands `K,R`, and the two source lambda substitutions insert +only those same `j`-free values. No source application is copied. +Activating the source subterm `s D` consumes a fifth marked application. + +The mandatory `c` must also be erased. This Scott contraction +preserves its callback, and the callback's two lambda contractions receive +only `c`-free arguments. A later erasure of `c` by `K` must therefore +discard a `c`-bearing right argument at another marked application. +This sixth node is distinct from the callback activation and the four +surviving nodes. Hence this shape requires at least six applications. + +If either `j` or `c` occurs in `B`, its occurrence lies under both source +lambdas. Their mandatory contribution to the index sum is consequently at +least five. The size identity then gives + +``` +|H| = 2L + 4A + 2 + X ≥ 4 + 24 + 2 + 5 = 35. +``` + +If both `j,c` are outside the block, the zero law is impossible +regardless of size. To see this, normalize +`V=B[K/a,R/b,s:=P]`. It is `j,c`-free and belongs to the larger macro +grammar above. The surrounding context uses only `P,j,c` and contains +this value once. Expressions not containing it have normal forms in +the smaller, application-closed grammar + +``` +P, K R, or a rigid-headed neutral. +``` + +Call these values safe; arguments inside a rigid neutral may have +arbitrary normal forms. A context containing one `V` has one of three +kinds of normal form: a `j,c`-free macro value, a safe value, or `K A` +with `A` safe. This invariant is preserved whichever child of an +application contains `V`. In function position a `j,c`-free `K U` +discards the safe argument, bare `K` adds one wrapper, and a safe +function stays safe; an existing `K A` returns `A`. In argument position, +the only non-rigid safe functions are `P` and `K R`. The latter erases +the argument. For `P`, a `j,c`-free argument stays `j,c`-free after +receiving `K,R`, a safe argument stays safe, and +`P(K A)→A R` is safe. None of the three kinds is the required +three constant wrappers around `R j`. + +These two cases complete the exclusion for this specified block shape. +They do not classify other placements of two source lambdas. + +## Three leading lambdas do not fit the whole-stream operand + +For `T=s`, a beta-normal handler with exactly three source lambdas, +all leading, cannot satisfy both reader laws at size at most 34: + +``` +H = λb r t.B, B application-only. +``` + +As above, higher ambient variables can be replaced by `j` without +increasing size. Both required rigid variables `j,c` must occur. + +First suppose `b` is absent. This case fails regardless of size. +For the zero law, split the two origins of the remainder: substitute a +rigid `R₀` for the direct argument `r`, and substitute +`P=cons K R₁` for both `s,t`, with `R₁` independently rigid. +Application-only expressions over `P` and rigid variables normalize to +`P`, `K R₁`, or a rigid neutral. Identifying `R₀,R₁` with `R` +does not create beta redexes, so the zero law's normal form `R j` +must lift to either `R₀ j` or `R₁ j`. + +The first alternative forces the literal source body `B=r j`. A +rigid function gains one argument when applied, a cell applied to a +neutral adds two arguments, and `K R₁` erases its argument. None +forwards a neutral unchanged. Thus a normal form headed by `R₀` +with the single argument `j` can only come from the direct application +`r j`; the same argument shows that bare `j` cannot be produced by a +nontrivial application-only expression. This body lacks the mandatory +`c`. + +For the second alternative, compare the zero cell `P` to the variable +stream `Q=Pₘ(N)`, keeping `r=R₀` rigid for now. Pair functional values +`P` with `Q` and `K R₁` with `K N`; pair rigid neutrals by their +heads, mapping `R₁` to `N` and fixing `R₀,j,c`. The relevant +application rules are + +``` +P P →* K R₁, Q Q →* K N, +P(K R₁) →* R₁ R₁, Q(K N) →* N Pₘ₋₁(N). +``` + +Cells applied to rigid neutrals preserve their heads, and constant +functions discard their arguments. These cases prove the head relation +by structural induction. A zero result headed by `R₁` therefore becomes +rigidly `N`-headed on the variable stream. Finally substituting +`R₀=Pₘ₋₁(N)` cannot change that `N` head. It cannot yield the +required `c` head. This completes the `b`-absent obstruction. + +Now suppose `b` occurs. Under the three leading lambdas, mandatory +occurrences of `b,j,c` contribute at least `2+4+5=11` to the +zero-based index sum. Four applications would therefore cost at least +`6+16+2+11=35` bits. Hence an improving handler has at most three +applications and four leaves. + +Besides `b,j,c`, a fourth leaf `r,t`, or free `s` is necessary to +supply the rigid `R` in the zero result. With `r`, the zero body is +an application tree over one occurrence each of `K,R,j,c`. The +single `K` contraction must erase precisely `c` while preserving the +application `R j`. There are exactly three ways to place this erasure: + +| Source body | Variable-stream result | +| --- | --- | +| `b r c j` | `c j` | +| `b (r j) c` | `c` | +| `r (b j c)` | `c bitₘ₋₁ tailₘ₋₁` | + +The first two have the wrong argument count. For the last, already +`m=1` gives `c K N`, whose first argument is not `P₀(N)`. + +With `t` or free `s` as the fourth leaf, the zero body has one +occurrence each of `P,K,j,c`. It cannot expose the payload `R` +as its head. A bare `K` callback gives `P K→K`; a partial callback +`K Z` gives `P(K Z)→Z R`, with `Z` headed by `j` or `c`; +and a rigid callback preserves its `j/c` head. The single `P` +cannot be copied, and there is no other source of an `R` head. +Thus these cases also fail. + +This proves the stated 34-bit exclusion for exactly three leading +lambdas. It does not cover a fourth lambda in the body, nor does it +transfer the three displayed zero-compatible bodies to `T=s s`. + +## Affine reductions preserve the 30-bit budget + +The following compression results concern `T=s s` and require both laws: + +``` +H[cons K R] K R (K R) =β R j, +H[Pₘ(N)] F Pₘ₋₁(N) (K N) =β c Pₘ₋₁(N) N for every m≥1. +``` + +All remainder variables are fresh and rigid, as are `j,c,p,x`. In +particular, both `j,c` occur freely in every successful handler and +every beta-equivalent reduct of it. + +Suppose `|H|≤30` and a source redex `(λu.B) D` uses `u` exactly +once, at depth `d` inside `B`. Let `f` count the free-variable +occurrences of `D`, relative to `D` itself, and let `r` count the +other occurrences in `B` whose indices decrease when the binder `u` +is removed. The exact change in BLC size on contraction is + +``` +Δ = d(f−1) − 6 − r. +``` + +The contraction removes the variable encoding of size `d+2`, removes +four bits for the redex's application and lambda, shifts each of `D`'s +`f` free occurrences under `d` binders, and decreases the other `r` +indices by one. These are precisely the four contributions above. + +Let `L,A,X` be the source lambda count, application count, and zero-based +index sum. The path to the bound occurrence gives `L≥d+1`; the +argument's leaves and the redex application give `A≥f`; and the bound +occurrence together with mandatory `j,c` gives `X≥d+3`. Consequently + +``` +30 ≥ |H| = 2L+4A+2+X ≥ 3d+4f+7. +``` + +For nonnegative integers satisfying this inequality, +`d(f−1)≤6`: for `f=0,1` the product is nonpositive or zero, and +for `f=2,3,4,5` its maxima are respectively `5,6,6,4`. +Larger `f` is impossible. Thus the contraction cannot increase size. +It also strictly decreases the number of source AST nodes. A vacuous +contraction strictly decreases both size and node count, since its +argument is erased and the remaining free indices only decrease. + +Therefore, if a successful handler of size at most 30 exists, choose one +minimizing `(BLC size, AST node count)` lexicographically. It has no +affine beta redex. This is a reduction of the remaining search space, +not an exclusion of all compressed handlers: the smaller reduct may +still be a successful handler whose shape has not been priced. + +## All-vacuous handlers fail the self-application operand + +This obstruction has no size restriction. A source abstraction is +*vacuous* when its bound variable does not occur in its body. Suppose +every source abstraction in `H` is vacuous, while free occurrences of +`s,j,c,p,x` and arbitrary applications are allowed. + +Compare the zero stream with the shortest variable stream: + +``` +P = cons K R, U = cons K N, Q = cons F U. +``` + +For expressions made from these source operations, pair their head +values at `s=P` and `s=Q` as follows: + +* `P` corresponds to `Q`; +* constant functions correspond when their bodies have related head + values; +* rigid-headed values correspond by their heads, mapping `R` to `N` + and fixing `j,c,p,x`; their argument spines need not agree. + +The relation is closed under application. Constants discard their +arguments, and rigid heads persist. The nontrivial cell cases are + +``` +P P →* K R, Q Q →* K N, +P (λ_.V) →* V R, Q (λ_.W) →* W U. +``` + +In the second line, related constant bodies again discard their +arguments, and related rigid bodies retain their heads. Related cell +bodies give `P R→R K R` and `Q U→*N U`, which have the related +rigid heads `R,N`. A cell applied to a rigid-headed value preserves +that value's head. These cases establish the relation by structural +induction. All source and data binders in these expressions are affine, +so the head evaluations terminate. + +Now supply external arguments `K,R,K R` on the zero side. If the +head `P` is exposed with three, two, or one argument still pending, +the results are respectively + +``` +P K R (K R) →* R, +P R (K R) →* R K R (K R), +P (K R) →* R R. +``` + +None is `R j`. A rigid head exposed before the arguments are exhausted +retains the final functional argument `K R`, so it cannot become +`R j` either. The zero law therefore forces three successive +constant-function heads, discarding all three arguments, followed by a +rigid head `R`. + +The related variable evaluation discards `F,U,K N` through three +corresponding constant functions and ends at rigid head `N`. This +contradicts its required head `c`. Thus an all-vacuous handler cannot +satisfy both laws for `T=s s`. + +## Nonlinear redexes with at most four applications + +Continue with the two `T=s s` laws above. In a minimum handler of +size at most 30, the affine-reduction lemma removes all affine source +redexes from consideration. A remaining source redex must bind its +variable at least twice. Such a redex is impossible when the handler +has at most four applications. + +First record a consequence of having no free `s`. Any successful +handler with this restriction must use its first input non-vacuously. +Its zero behavior forces a leading lambda after head reduction. If +that first lambda were vacuous, write the handler as `λb.G`; the +zero law would give + +``` +G R (K R) →* R j. +``` + +Split the two sources of `R` into independently rigid `R₀,R₁`. +Identifying rigid variables creates no beta redexes, so the same +reduction lifts to either + +``` +G R₀ (K R₁) →* R₀ j, or G R₀ (K R₁) →* R₁ j. +``` + +Substituting `R₀:=Pₘ₋₁(N)` and `R₁:=N` gives respectively +a `j`-headed or an `N`-headed result, not the required `c` head. +This proves the first-input dependence. + +It also excludes a no-`s` handler with at most one live source +binder, even if that binder has several occurrences and additional +vacuous binders are allowed. Its unique live binder must survive to +receive the first input `K`. After this substitution the only live +functional code is copied `K`; all other source lambdas are vacuous. +Their reductions merely select or erase subtrees and preserve the +left-to-right order of surviving rigid leaves. Every source `j` +precedes every `R` in the remaining external arguments `R,K R`, +whereas the required output `R j` reverses this order. + +A handler with `A` applications has `A+1` variable leaves. At `A≤2`, +the two occurrences of a nonlinear binder and the mandatory `j,c` +already exceed that count. At `A=3`, these four leaves exhaust it; +after the nonlinear contraction every remaining source binder is +vacuous, contradicting the preceding obstruction. + +At `A=4`, there is only one further leaf. If it is another occurrence +of the nonlinear binder or any ambient variable, all remaining source +binders are again vacuous after contraction. The only case left has +exactly the leaves + +``` +u, u, j, c, v, +``` + +where `v` is the sole occurrence bound by another live binder. In +particular, there is no free `s`. + +Unless the argument of the nonlinear redex contains both that live +binder and its occurrence, contraction leaves at most one live binder. +It may now have repeated occurrences, but the no-`s` obstruction just +proved still applies. Otherwise call the copied argument `D`. +It contains one live binder, used once, and all its other binders are +vacuous. Its only possible free leaves are `j,c`. The absence of +affine source redexes makes `D` beta-normal. + +If `D` has no rigid leaves, it is a pure projection: a chain of lambdas +ending in its one bound-variable leaf. After copying it, the remaining +source consists only of projections, vacuous lambdas, applications, +and rigid variables. Including the supplied `K`, all reductions still +select or erase subtrees and preserve surviving rigid-leaf order. +They cannot move an external `R` before a source `j`. + +Suppose instead that `D` contains a rigid `j/c` leaf. A live binder +capable of receiving an external argument must lie in `D`'s leading +lambda chain. Otherwise a rigid head guards it permanently: for +example, the live binder in `λw.j (λv.v)` cannot become the +head function. Merely containing a rigid leaf is therefore not enough; +this accessibility qualification is essential. + +For an accessible live binder `v`, all rigid leaves of `D` occur +in its body. After any remaining leading vacuous lambdas, that body's +beta-normal head is either rigid or has the form + +``` +v A₁ ... A_q, q>0. +``` + +The case `q=0` would leave no place for a rigid leaf. Each `A_i` +contains only rigid `j/c` leaves and vacuous lambdas, since the sole +occurrence of `v` is already the head. Giving this live binder `K` +therefore produces either a rigid `j/c` head or selects `A₁`, +which can only expose a rigid `j/c` head or leave a lambda. It cannot +produce head `R`. + +This property persists for every copied residual of the accessible +binder. Its preceding binders are vacuous, and there is no other free +bound-variable occurrence through which surrounding reductions could +insert a different body. First-input dependence requires the external +`K` to enter one of these live residuals, contradicting the zero law. +This completes the nonlinear-redex exclusion at `A≤4`. + +Consequently a minimum successful handler of size at most 30, if one +exists, is beta-normal whenever it has at most four applications. +Five-application nonlinear compression is not covered by this argument. + ## Remaining boundary -This is a lambda-count obstruction for two specified operands, not a -27-bit handler bound or a 37-bit joint handler/operand bound. Handlers -with two or more lambdas, including compressed terms and whole-stream -control, remain to be priced. The original independent-neighbour and -restricted correlated-selector bounds live in `handler-bound.md`; -neutral-operand domination is in `protocol-obstructions.md`. +The general result here is a lambda-count obstruction for two specified +operands, with the two explicitly scoped shape exclusions above. For +`T=s s`, the compression lemmas additionally reduce a minimum +30-bit candidate with at most four applications to beta-normal syntax. +They do not exclude every such normal form or settle the +five-application nonlinear cases. Neither improving budget is fully +excluded, and these results are not a global optimality theorem. +The standard-skip handler bounds, including whole-stream access, live +in `handler-bound.md`; neutral-operand domination is in +`protocol-obstructions.md`. diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index 0b835280..d7e9cd5d 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -379,7 +379,9 @@ These are Codex's handwritten proofs, with targeted reduction checks in not exclude the cheaper `T=s` family or the productive thunk `T=s s`. `cheap-tail-bound.md` proves that both families require at least two explicit lambdas in `H`, even with arbitrary whole-stream use and beta - redexes; it does not yet exclude their numerical handler budgets. + redexes. It also excludes a consecutive two-lambda block for either + improving budget and exactly three leading lambdas for `T=s`. + It does not yet exclude their complete numerical handler budgets. - **The zero arm costs at least 14 bits**, even with `bit0 := K` and the whole zero cell available to borrow. With `R` absent and the neighbours rigid, `Z R R = R next` forces the normal form `λu v. u next` (15) or @@ -563,10 +565,9 @@ argument. Open: -- readers outside the parametric class bounded in §5: other reader heads, - the correlation between a variable's selector - and its suffix, and readers with a different `next` protocol beyond those - priced in §3 and §6; +- readers outside the classes bounded in §5: other reader heads, joint + handler/skip changes, exploitation of actual NEXT/parser behaviour, and + readers with a different `next` protocol beyond those priced in §3 and §6; - the reader's diagonal `R Z →* next next` (§2): the 165 already contains the self-application a knot needs, and a sub-165 along this line would have `next`'s zero arm serve as the knot's generator. Built with a separate diff --git a/docs/classical/self-interpreter/normal.md b/docs/classical/self-interpreter/normal.md index d35d9c1a..92587982 100644 --- a/docs/classical/self-interpreter/normal.md +++ b/docs/classical/self-interpreter/normal.md @@ -114,9 +114,9 @@ H = lambda b r. b (lambda t.t j) (c (lambda h.r h)) has the correct actual-stream zero and variable laws but fails the rigid variable law: it returns `c (lambda h.R h) N` instead of `c R N`. Its exact cost in `[s,j,c,p,x]` is 40 bits, well above 27. This is a scope -counterexample, not a promising small construction. The separate correlated -selector theorem in `handler-bound.md` nevertheless proves the same 27-bit -minimum when `H` has no free variables except `j,c`. +counterexample, not a promising small construction. The correlated proofs +in `handler-bound.md` establish the same 27-bit minimum, including when +`H` can inspect the whole stream. Access to the whole stream changes the structural constraints further. For example, @@ -142,6 +142,7 @@ symbolic zero law, and unrestricted `F`-branch law. The original bare-C selector shape cannot exploit this correlation: the existing strengthened 14-bit zero-arm theorem already permits using the whole zero cell, and C is already the cheapest possible variable arm. -A useful smaller correlated reader would therefore have to use the whole -stream or other parser state, or change the reader's outer shape. -No such sub-27 handler was found by the reasoning here. +The whole-stream handler bound now excludes a saving from stream access +alone under the standard skip and rigid ambient-parameter laws. A smaller +reader must change the skip or outer shape, or exploit the actual behaviour +of other parser state beyond those laws. From 5253956352b1e55c58ad88b8637aa11cb4144e0d Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 16:01:30 -0400 Subject: [PATCH 16/41] Prove exact remainder parsing and beta wire costs Add the kernel-checked 93-bit remainder extractor and exact substitution cost theorems. Strengthen scoped reader constraints, record head decomposition and metadata identities, and preserve unfinished arguments with explicit provisional status. --- data/self-interpreter/machines/rem93.blc | 1 + data/self-interpreter/machines/rem93.lam | 6 + .../theory/head_decomposition.json | 54 ++ .../theory/metadata_parser.json | 7 +- data/self-interpreter/theory/remainder.json | 20 + docs/STATUS.md | 50 +- .../self-interpreter/cheap-tail-bound.md | 727 +++++++++++++++--- .../self-interpreter/head-decomposition.md | 257 +++++++ .../classical/self-interpreter/interpreter.md | 26 +- .../self-interpreter/protocol-obstructions.md | 14 + docs/classical/self-interpreter/remainder.md | 136 ++++ lean/Blc.lean | 2 + lean/Blc/SelfintRemainder.lean | 149 ++++ lean/Blc/SelfintWireCost.lean | 288 +++++++ .../self-interpreter/theory/handler_bound.py | 22 +- .../theory/head_decomposition.py | 143 ++++ .../theory/metadata_parser.py | 7 + tools/self-interpreter/theory/remainder.py | 97 +++ 18 files changed, 1905 insertions(+), 101 deletions(-) create mode 100644 data/self-interpreter/machines/rem93.blc create mode 100644 data/self-interpreter/machines/rem93.lam create mode 100644 data/self-interpreter/theory/head_decomposition.json create mode 100644 data/self-interpreter/theory/remainder.json create mode 100644 docs/classical/self-interpreter/head-decomposition.md create mode 100644 docs/classical/self-interpreter/remainder.md create mode 100644 lean/Blc/SelfintRemainder.lean create mode 100644 lean/Blc/SelfintWireCost.lean create mode 100644 tools/self-interpreter/theory/head_decomposition.py create mode 100644 tools/self-interpreter/theory/remainder.py diff --git a/data/self-interpreter/machines/rem93.blc b/data/self-interpreter/machines/rem93.blc new file mode 100644 index 00000000..e5878c3c --- /dev/null +++ b/data/self-interpreter/machines/rem93.blc @@ -0,0 +1 @@ +010001101000010000010110000101100000011000000111111110010111010011111111010100101101010011010 diff --git a/data/self-interpreter/machines/rem93.lam b/data/self-interpreter/machines/rem93.lam new file mode 100644 index 00000000..26dcbf7e --- /dev/null +++ b/data/self-interpreter/machines/rem93.lam @@ -0,0 +1,6 @@ +-- 93-bit exact remainder extractor, for arbitrary well-formed BLC syntax. +-- R ( ++ N) ->* N, including open and divergent source M. +-- Factor the common recursive call across the second-tag alternatives. +(\x.x x) (\x.(\p.\s. + s (\b.b (\u\r.r (\t\u.p (t u (p u)))) b) (s s s)) + (x x)) diff --git a/data/self-interpreter/theory/head_decomposition.json b/data/self-interpreter/theory/head_decomposition.json new file mode 100644 index 00000000..23302726 --- /dev/null +++ b/data/self-interpreter/theory/head_decomposition.json @@ -0,0 +1,54 @@ +{ + "affine_examples": [ + { + "n": 0, + "source_bits": 17, + "head_form_bits": 11, + "affine": true + }, + { + "n": 7, + "source_bits": 38, + "head_form_bits": 39, + "affine": true + } + ], + "int165": { + "source_bits": 165, + "head_form_bits": 755, + "head_contractions": 4, + "leading_lambdas": 2, + "head": "stream", + "head_arguments": 2, + "source_redex_costs": [ + { + "path": "root", + "occurrences": 2, + "total_depth": 0, + "argument_free_leaves": 0, + "outer_body_leaves": 0, + "argument_bits": 155, + "delta_bits": 147 + }, + { + "path": "root.argument.body", + "occurrences": 2, + "total_depth": 5, + "argument_free_leaves": 2, + "outer_body_leaves": 0, + "argument_bits": 6, + "delta_bits": 3 + }, + { + "path": "root.argument.body.function.body.body", + "occurrences": 1, + "total_depth": 4, + "argument_free_leaves": 4, + "outer_body_leaves": 1, + "argument_bits": 92, + "delta_bits": 5 + } + ] + }, + "seconds": 0.0073 +} diff --git a/data/self-interpreter/theory/metadata_parser.json b/data/self-interpreter/theory/metadata_parser.json index 4dec38c7..810835a3 100644 --- a/data/self-interpreter/theory/metadata_parser.json +++ b/data/self-interpreter/theory/metadata_parser.json @@ -10,7 +10,10 @@ "payload_projection", "remainder_projection", "application_keeps_right_remainder", - "abstraction_keeps_remainder" + "abstraction_keeps_remainder", + "identity_closure_is_pointwise_idempotent", + "parser_metadata_box_is_idempotent", + "parser_metadata_box_projects_parser" ], "battery": { "ok": 667, @@ -21,5 +24,5 @@ "omega", "lambda_omega" ], - "elapsed_seconds": 1.8 + "elapsed_seconds": 1.92 } diff --git a/data/self-interpreter/theory/remainder.json b/data/self-interpreter/theory/remainder.json new file mode 100644 index 00000000..6718db3f --- /dev/null +++ b/data/self-interpreter/theory/remainder.json @@ -0,0 +1,20 @@ +{ + "bits": 93, + "explicit_variants": { + "shared_body": 97, + "factored_inline": 93 + }, + "symbolic_head_clause_steps": { + "knot": 1, + "unfold": 3, + "variable": 6, + "zero": 6, + "abstraction_head": 3, + "application_head": 3, + "abstraction_argument": 2, + "application_argument": 2 + }, + "formal_contract": "forall M N, rem93 (streamOf (blcCode M) N) ->* N", + "source_restrictions": "none: open and divergent source syntax included", + "seconds": 0.0069 +} diff --git a/docs/STATUS.md b/docs/STATUS.md index 1e9550dc..764f41a2 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -170,12 +170,19 @@ with all features (three opt-in tests ignored) and 328 with default features. are dominated by `s`, saving 5 and 6 bits. A separate handwritten theorem proves that handlers for `T=s` and `T=s s` need at least two explicit lambdas, even with whole-stream access and beta redexes. - Further reviewed shape exclusions rule out a consecutive two-lambda - block for either improving budget and exactly three leading lambdas - for `T=s`. For `T=s s`, affine reductions preserve the 30-bit budget; - a minimum successful handler with at most four applications would have - to be beta-normal. The five-application compression cases and complete - numerical thresholds remain open + The strengthened theorem rules out every beta-normal handler with at + most two lambdas for either operand, regardless of size. Explicit + beta-normal three-lambda handlers cost 49 and 45 bits respectively; + `handler_bound.py` checks their zero laws and fixed variable instances. + Exactly three leading lambdas are excluded at the improving `T=s` + budget. For `T=s s`, affine reductions preserve the 30-bit budget; + the reviewed nonlinear-redex classification now also excludes the + five-application compressed cases, including proper argument contexts. + Any 30-bit improvement therefore has a beta-normal minimum + representative with at least three lambdas and exactly four + applications. The remaining normal forms and complete numerical + thresholds remain open; the further affine and four-application + arguments in the proof record are explicitly provisional (`classical/self-interpreter/cheap-tail-bound.md`, `classical/self-interpreter/protocol-obstructions.md`). The zero arm ≥ 14, APP lift ≥ 19, reader/handler knot-tree and cell/APP @@ -203,6 +210,35 @@ with all features (three opt-in tests ignored) and 328 with default features. one original binder, so distinct output roles do not force distinct origins without a size-sensitive argument. These results do not yet give an additive size decomposition. +- **Head decomposition** (`classical/self-interpreter/head-decomposition.md`): + the unconditional head-normal-form dichotomy has exactly two leading + lambdas, headed by either the continuation or the stream. In the former + case, continuation occurrences inside the two payloads can be replaced + by the stream, preserving the full contract and saving one bit each. + These are handwritten results. Head normalization is not size-monotone + even for fully affine terms. The literal 165 expands to a 755-bit head + form in four contractions; its two lambdas, stream head, and two + arguments are checked by `tools/self-interpreter/theory/head_decomposition.py` + with two fixed affine examples, in 0.007 seconds + (`data/self-interpreter/theory/head_decomposition.json`). + Lean's `SelfintWireCost` proves the exact local beta size balance, + including copied code and index movement, and applies it to every + redex of a globally minimum interpreter. Such a minimum has no + erasing redex; a linear redex needs at least two free argument + occurrences and sufficient index savings to offset its six removed + bits plus outer-reference decrements. These conditions give no + numerical minimum yet. The literal 165's three existing redexes + increase size by 147, 3, and 5 bits when contracted individually; + the same fixed check validates each charge. + The separate syntactic remainder task has a 93-bit construction + (`rem93`, `classical/self-interpreter/remainder.md`): Lean proves exact + suffix extraction for every source term, including open and divergent + sources, and every suffix. The fixed source/wire and symbolic-clause + check takes 0.007 seconds (`data/self-interpreter/theory/remainder.json`). + This is an unrestricted upper bound for a parser projection, not a + self-interpreter or a beta-normal remainder bound. The same note + records an unproved infinite-zero-prefix route to a nonlinear-binder + lower bound, with its missing obligations explicit. - **Normal and typed witnesses** (`classical/self-interpreter/normal.md`, `typed-normal.md`): the β-normal interpreter is 204 bits (`int204_normal`, L 21, A 29, X 44). Lean proves its exact wire, @@ -244,7 +280,7 @@ with all features (three opt-in tests ignored) and 328 with default features. wrappers (`data/self-interpreter/theory/applicative_retraction.json`). A complete parser carrying the remainder in applicative metadata costs 303 bits. Its four rigid equations, 667/1/0 battery, and Ω / λa.Ω suffix - probes pass in 1.8 seconds (`data/self-interpreter/theory/metadata_parser.json`). + probes pass in 1.92 seconds (`data/self-interpreter/theory/metadata_parser.json`). Eliminating its boxes against the public consumer recovers the 165's CPS interface without a further saving. Except for the unconditional non-idempotence and its generator corollary, these are protocol-specific diff --git a/docs/classical/self-interpreter/cheap-tail-bound.md b/docs/classical/self-interpreter/cheap-tail-bound.md index 1664d24f..faf0b473 100644 --- a/docs/classical/self-interpreter/cheap-tail-bound.md +++ b/docs/classical/self-interpreter/cheap-tail-bound.md @@ -1,10 +1,14 @@ # Constraints on the cheap reader operands -This is Codex's handwritten proof. It concerns the reader `s H T` in +This is Codex's handwritten proof record. It concerns the reader `s H T` in the ambient frame `[s,j,c,p,x]`, with `j,c,p,x` independent rigid variables. The handler may use every ambient variable and arbitrary beta redexes. The two operands considered here are `T=s` and `T=s s`. +The sections explicitly marked **Provisional argument** have not completed +independent review. They are retained as proposed extensions and are not +used by the established boundary stated at the end. + Write ``` @@ -24,7 +28,8 @@ H F Pₘ₋₁ T =β c Pₘ₋₁ N. For `T=s`, the final argument is `Pₘ`; for `T=s s`, it reduces to `Q`. Both are beta-normal abstractions, distinct from the rigid `N`. Correctness on all variable streams alone forces **at least two explicit -lambdas in H**. The zero-stream law is not needed for this floor. +lambdas in H**, and **at least three when H is beta-normal**. The +zero-stream law is not needed for these floors. This does not settle either joint size threshold. A reader improvement requires `|H|≤34` with `T=s`, or `|H|≤30` with `T=s s`; two lambdas @@ -165,110 +170,172 @@ at a terminal `P₀` can receive bare `K`, after which it could construct constant functions carrying arbitrary code. The index invariant excludes that activation for the chosen stream rather than assuming it impossible. -## A nonleading consecutive two-lambda block is too expensive +## A beta-normal handler requires three source lambdas -There is a further exclusion for a beta-normal, application-headed -handler whose two source lambdas form one consecutive block +For both cheap operands, the variable law alone excludes every +beta-normal handler with at most two source lambdas, at any size. +The preceding arguments handle zero or one lambda. Suppose now that +`H` is beta-normal with exactly two, and let `A` be its number of +source applications. Choose ``` -D = λa b.B. +m > A+2. ``` -There are exactly two source lambdas in the entire handler, so `B` and -the surrounding context are application-only. The block need not be the -initial argument of `s`. This shape cannot fit either improving budget: -`|H|≤34` for `T=s`, or `|H|≤30` for `T=s s`. +We first extend the one-marker argument slightly. Allow initial safe +functional data `Pₘ,Pₘ₋₁,F,I,Q`, and at most one source abstraction +`D=λv.W` with application-only body. Treat that unique abstraction as +an opaque marker during bottom-up normalization. With at most `A` +macro applications, every Scott cell obtained as a functional value +has index at least `m−1−A>0`: each predecessor extraction spends an +application, and the other table rows return no new Scott cell. +The marker therefore receives a safe first argument, never bare `K`. +Any syntactic redex headed by `D` can also be handled this way: its +argument has no source lambdas, so normalizing that argument first +makes it safe. + +Suppose at least two external safe arguments are still pending, +with final argument `T`, where `T` is the original `Pₘ` or `Q`. +If the marker is activated internally, consuming its first safe +argument leaves an application-only expression in the safe algebra; +all pending external arguments remain. If it is returned bare, it +consumes the first pending argument and leaves at least the final +`T`. A functional safe result contains no `c`. A rigid-headed +result retains every still-pending argument. In particular a result +headed by `c` has last argument `T`, which is not beta-equivalent +to `N`. A marker trapped inside a rigid argument cannot change the +rigid head. These cases exclude the desired `c Pₘ₋₁ N`. + +If `H` begins with a lambda, contract it against the first external +`F`. Substitution may copy `F`, but cannot copy the other source +lambda. The result has at most one source lambda, no more than `A` +macro applications when safe data are counted as atoms, and the two +pending arguments `Pₘ₋₁,T`. The extended one-marker argument applies. + +It remains to consider application-headed `H`. Its source lambdas +occur inside argument positions, since `H` is beta-normal. Before +any such lambda is activated, replace each outermost lambda block +by a distinct opaque rigid marker. Application-only expressions over +`S=Pₘ` and rigid markers have functional normal forms only -For this size bound, higher ambient variables `p,x` can first be replaced -by `j`. Their absence from the required outputs makes the replacement -law-preserving, and their indices are higher than `j`'s. It suffices to -consider free variables `s,j,c`. +``` +S, Q. +``` -Use the zero stream `P=cons K R`, with `R` rigid and independent of -`j,c`. A valid application-headed handler has head `s`; the other free -heads are rigid and retain the three external arguments. A source block -in function position would be a beta redex, so `D` occurs as an -application argument. Its function subtree is application-only. -Such a subtree normalizes to `P`, `K R`, or a rigid neutral. The last -two cases respectively erase the block or trap it under a rigid head; -a successful handler must activate it through `P`. An application-only -subtree over `P` and rigids can normalize to `P` only when it is the -literal source `s`. Thus there is a direct source subterm `s D`. +Indeed, `S S→*Q`, `S Q→*N Pₘ₋₁`, and `Q V→N`; +application to a rigid neutral preserves a rigid head. A nontrivial +application subtree cannot return `S`. Thus, if any source lambda +is activated before the external arguments are supplied, a first +activation can be chosen at a literal source subterm `s D`, with +`D=λv.W`: the function subtree can return the calling cell only +when that subtree is literally `s`. If none is activated, the +result is safe data or a rigid neutral with all three external +arguments pending, and already fails. -Reduce this local subterm first. Both source lambdas consume the cell's -`K,R`, before the three external arguments. The resulting value occurs -once in the surrounding application-only context. The remaining -reductions have macro rules +Contract that literal subterm directly: ``` -P U → U K R, K U V → U. +s (λv.W) →* W[F/v] Pₘ₋₁. ``` -The functional normal forms are `P`, `K`, and `K U`; the other normal -forms have a rigid head. A `K U` is a constant function whose body `U` -has a normal form in the same grammar. All remaining abstractions are -affine, so these reductions terminate. +This consumes one source lambda without copying the other. It also +preserves the macro application count: the source application +`s D` is replaced by the application to `Pₘ₋₁`, and each +substituted `F` is a safe atom. All initial Scott values in the +residual expression have index `m` or `m−1`. The residual has at +most one source lambda and all three external arguments pending. +The extended one-marker argument again excludes the required output. + +Therefore a beta-normal successful handler has at least three source +lambdas. The long-prefix witness is finite and explicit; this proof +does not assume that terminal callbacks are inaccessible on every +input. -For either final operand `T=P` or `T=K R`, inspection of these heads gives +The lambda count is sharp for each operand. These beta-normal handlers +use exactly three source lambdas and satisfy both corresponding reader +laws: ``` -H[P] K R T →* R j implies H[P] →* K (K (K (R j))). +T=s s: λb r t.b (r j) (c r (t t)), +T=s: λb r t.b (r j) (c r (t t t)). ``` -Indeed, exposing `P` with three remaining external arguments gives `R`; -with two it gives `R K R T`; and with one it gives `K R` or `R R`. -Exposing bare `K` gives a remaining lambda or bare `R`. A rigid head -cannot discard the remaining arguments. The only successful possibility -is therefore three consecutive constant functions followed by `R j`. +For the first, `t=K N` gives `t t→N`; for the second, +`t=Pₘ` gives `t t t→N`. The zero branch discards the continuation +branch in either case. Their measured encodings and rigid-law checks +are recorded in `STATUS.md` and the handler-bound fixture; sharpness +of the lambda count does not imply either handler meets its improving +size budget. -Mark all application nodes originating in the source `H`. The four -displayed applications whose right subtree contains `j` must descend from -four distinct marked nodes: the Scott rule only introduces applications -with right operands `K,R`, and the two source lambda substitutions insert -only those same `j`-free values. No source application is copied. -Activating the source subterm `s D` consumes a fifth marked application. +## Affine source lambdas and pending arguments -The mandatory `c` must also be erased. This Scott contraction -preserves its callback, and the callback's two lambda contractions receive -only `c`-free arguments. A later erasure of `c` by `K` must therefore -discard a `c`-bearing right argument at another marked application. -This sixth node is distinct from the callback activation and the four -surviving nodes. Hence this shape requires at least six applications. +**Provisional argument.** The generalization below still needs review of +the macro-application bound and the treatment of nested opaque closures. +The preceding three-lambda floor does not depend on this generalization. -If either `j` or `c` occurs in `B`, its occurrence lies under both source -lambdas. Their mandatory contribution to the index sum is consequently at -least five. The size identity then gives +A source term is affine here when every source binder has at most one +bound occurrence. This condition is preserved by beta reduction: an +affine source binder cannot copy its argument, and every data binder +in the Scott cells, `F,I,Q` is also affine. In particular, a source +lambda moved inside another closure remains a single occurrence. -``` -|H| = 2L + 4A + 2 + X ≥ 4 + 24 + 2 + 5 = 35. -``` +The preceding opaque-marker argument extends to any affine source +term. Suppose it contains `k` source lambdas and has `n≥k+1` +safe external arguments still pending, with final argument `T` equal +to the original `Pₘ` or `Q`. For a sufficiently long variable +prefix, it cannot yield `c Pₘ₋₁ N`. -If both `j,c` are outside the block, the zero law is impossible -regardless of size. To see this, normalize -`V=B[K/a,R/b,s:=P]`. It is `j,c`-free and belongs to the larger macro -grammar above. The surrounding context uses only `P,j,c` and contains -this value once. Expressions not containing it have normal forms in -the smaller, application-closed grammar +To make the long-prefix choice explicit, let `A` count the initial +macro applications, including those inside source lambda bodies, +with Scott values counted as atoms. Allow initial functional Scott +values `Pₘ,Pₘ₋₁`. It suffices to choose ``` -P, K R, or a rigid-headed neutral. +m > 2^(k+1) (A+2). ``` -Call these values safe; arguments inside a rigid neutral may have -arbitrary normal forms. A context containing one `V` has one of three -kinds of normal form: a `j,c`-free macro value, a safe value, or `K A` -with `A` safe. This invariant is preserved whichever child of an -application contains `V`. In function position a `j,c`-free `K U` -discards the safe argument, bare `K` adds one wrapper, and a safe -function stays safe; an existing `K A` returns `A`. In argument position, -the only non-rigid safe functions are `P` and `K R`. The latter erases -the argument. For `P`, a `j,c`-free argument stays `j,c`-free after -receiving `K,R`, a safe argument stays safe, and -`P(K A)→A R` is safe. None of the three kinds is the required -three constant wrappers around `R j`. - -These two cases complete the exclusion for this specified block shape. -They do not classify other placements of two source lambdas. +Normalize the outer application context while treating its outermost +source-lambda blocks as distinct rigid markers. The data-algebra +table applies with these additional markers. In one normalization +phase the macro application count at most doubles: each table row +adds at most two applications for an original application. A source +lambda contraction cannot increase the macro application count, +since its argument is used at most once. Across at most `k` source +activations, the successive counts are therefore bounded by +`A,2A,...,2^k A`. + +A functional Scott predecessor spends an application, so the same +phase can increase a functional Scott index's offset from `m` by +at most its starting application count plus one. This also covers +the tail supplied when a Scott value invokes a marker. The displayed +choice of `m` exceeds the sum of all these bounds, including the +initial offset one. Pair/pair normalization may place shorter cells +inside an ordinary rigid neutral, but they remain trapped there and +cannot become functional values or standalone arguments of a source +callback. Consequently no source activation receives bare terminal +`K`. Its first argument is safe data, a marker-bearing expression, +or an ordinary rigid neutral. + +Now induct on `k`. A functional data result has no `c`; an ordinary +rigid result retains the pending arguments and therefore retains final +`T≠βN`. If the result is a marked source lambda with an internal +argument, restore and contract it. At least one source lambda is +removed, none is copied, and all `n` external arguments remain. +Continue the induction on the resulting source term; a marker-bearing +argument need not become plain data when substituted. If instead the +result is a bare source lambda, supply the first pending external +argument. One source lambda and one pending argument are consumed, +leaving `n−1≥(k−1)+1`. These are all possibilities, proving the +claim. + +In particular, a **beta-normal, application-headed affine handler +with at most three source lambdas fails the variable law**, for either +cheap operand. Before its first source activation, the application-only +context over `Pₘ` and rigid markers has functional values only +`Pₘ,Q`; a nontrivial context cannot return a bare marker. A source +lambda must therefore be activated internally before the external +arguments are supplied. This leaves at most two source lambdas and +all three pending arguments, so the lemma applies. ## Three leading lambdas do not fit the whole-stream operand @@ -565,17 +632,501 @@ This completes the nonlinear-redex exclusion at `A≤4`. Consequently a minimum successful handler of size at most 30, if one exists, is beta-normal whenever it has at most four applications. -Five-application nonlinear compression is not covered by this argument. + +## Five-application nonlinear compression + +The remaining compressed case has `A=5`. The two-lambda floor and +`X≥3`, together with `|H|≤30`, force + +``` +L=2, X≤4. +``` + +Choose a source redex. Contracting it must copy an argument containing +the other source lambda: otherwise its reduct has at most one explicit +lambda, contradicting the variable-law floor. Hence the whole handler +has the form + +``` +E[(λu.B) C[D]], D=λv.W, +``` + +where `B,C,E,W` are application-only, `C` has one hole, and `B` +contains at least two occurrences of `u`. The argument `C[D]` is +beta-normal. Indeed, a redex headed by `D` there has a lambda-free +argument; contracting it leaves at most the outer source lambda, +again contradicting the floor. This argument also covers nonlinear +`D`; absence of affine redexes alone would not establish normality. + +Neither source lambda lies inside the other. Every `u/v` leaf has +zero-based index zero, while each ambient leaf beneath either lambda +pays one extra index unit. Therefore + +``` +X = #j + 2#c + 3#p + 4#x + #(ambient leaves beneath a source lambda). +``` + +The mandatory `j,c` already cost three. Thus `p,x` are absent and +at most one ambient occurrence lies beneath either lambda. There are +only six variable leaves in total. + +### No ambient leaf inside D + +Here `W` is a pure application tree of `v`. The six-leaf budget +leaves only `D=I` or `D=Δ=λv.v v`. For `D=I`, substituting a +variable stream turns `C[D]`, then `B[C[D]/u]`, and finally the +whole surrounding context into expressions in the application-only +data algebra. This cannot satisfy the variable law. + +For `D=Δ`, the leaves are exactly `u,u,v,v,j,c`, so there is no +free `s`. At most one of `j,c` occurs in `B`. If `C[D]` is not +the bare `D`, its beta-normal head is a rigid `j/c`, and the core +and surrounding context cannot expose a useful functional head. +Otherwise `B[D/u]` is either `D D`, or an application tree over +two copies of `D` and one rigid variable. The former has no head +normal form. In the latter, a `D` applied to a rigid-headed term +has a rigid head, while `D D` has no head normal form. These cases +exhaust the tree's possible head reductions. A rigid head retains +all three external arguments; a divergent head cannot yield the +required normal form. Neither succeeds. + +### One ambient leaf inside D + +Write that leaf as `a∈{s,j,c}`. Now `B` is a pure application tree +of `u`. If `v` occurs at most once, `D` is one of + +``` +C_a = λv.a, R_a = λv.v a, L_a = λv.a v. +``` + +These cases allow a uniform treatment of proper argument contexts +`C[D]`, including `s D`. Fix a variable stream `S=Pₘ(N)`, `m≥1`, +and adjoin the single value `D` to the base functional data +`Pᵢ,F,I,Q`. Rigid neutrals may contain `D` inside their arguments. +The enlarged grammar remains closed under application. Besides +`F D→I`, `I D→D`, and `Q D→N`, the useful rows are + +| Added value | Its action | Scott invocation | +| --- | --- | --- | +| `C_a` | `C_a V→a` | `Pᵢ C_a→a tailᵢ` | +| `R_a` | `R_a V→V a` | `P₀ R_a→a`; `Pᵢ₊₁ R_a→Pᵢ` | +| `L_a` | `L_a V→a V` | `Pᵢ L_a→a bitᵢ tailᵢ` | + +For rigid `a`, the indicated rigid heads persist. For `a=S`, +pair/pair applications return base data or neutrals, and the remaining +special cases are + +``` +R_S F→I, R_S I→S, R_S Q→N, R_S R_S→Q, +L_S F→Pₘ₋₁, L_S I→I, L_S Q→N Pₘ₋₁, L_S L_S→Q, +P₀ L_S→I, Pᵢ₊₁ L_S→Pₘ₋₁ Pᵢ. +``` + +All source and data binders in these cases are affine, so bottom-up +normalization terminates. It follows that an arbitrary argument +context `C[D]` normalizes to base data, to `D` itself, or to a rigid +neutral. A base-data result stays in the base algebra through the pure +`u` tree; a rigid result stays rigid. It remains to check that a +nontrivial tree of bare copies of `D` does not leave `D` exposed. + +For rigid `a`, every such tree is rigid-headed: `C_a C_a→a`, +`R_a R_a→a a`, and `L_a L_a→a L_a`, and further applications +preserve this property. For `R_S,L_S`, two copies give `Q` and +three or more give an `N`-headed neutral. For `C_S`, the leaf count +is essential: `k` copies in the body use `k+3` source leaves, +including `s,j,c`, so `k≤3`. The possible trees give + +``` +C_S C_S→S, +C_S(C_S C_S)→S, +(C_S C_S)C_S→S C_S→S Pₘ₋₁. +``` + +All are base data or neutrals. Four copies are not available; this +restriction cannot be dropped, since further applications can expose +`C_S` again. + +If `v` occurs twice, the six leaves force `a` to be rigid and exclude +every free `s`. A proper `C[D]` is again rigid-headed. For the bare +argument, `B=u u`, and the possible bodies `W` are + +``` +v(v a), v(a v), a(v v), (v v)a, (v a)v, (a v)v. +``` + +Their self-applications have rigid head `a`, except `(v v)a`, +whose self-application repeatedly returns to itself with one more +argument and has no head normal form. More occurrences of `v` +exceed the leaf budget. This completes the remaining cases. + +In every affine added-value case the core reduces into the original +base data algebra before any external argument is supplied, and the +application-only surrounding context preserves that algebra. Functional +base results contain no `c`; rigid results retain three additional +arguments and cannot become the required two-argument `c` spine. +The exceptional nonlinear cases already fail by their head behavior. +Thus five-application nonlinear compression is also impossible. + +Since `A≥6` would cost at least `2·2+4·6+2+3=33` bits, +these results prove that **if a successful `T=s s` handler of size +at most 30 exists, one of minimum size is beta-normal**. This does +not assert that all such normal forms have been excluded. + +## Normal handlers with at most three applications + +A beta-normal minimum candidate for `T=s s` cannot have `A≤3`. +We already know `L≥3`. An `A`-application term has `A+1` variable +leaves, including mandatory occurrences of `j,c`. At `A≤2`, if +`s` occurs then all source binders are vacuous; if it does not, there +is at most one live source binder. Both cases were excluded above. + +For `A=3`, the same obstructions leave exactly two leaf patterns: + +``` +j,c,u,v: two distinct live bound variables, with no free s; +j,c,s,v: one live bound variable, with one free s. +``` + +Each displayed leaf occurs once. Every source binder is therefore +affine. Let `k` count the leading lambdas of `H`; the zero law +forces `k≤3`, since a fourth unconsumed leading lambda cannot equal +`R j`. A rigid `j/c` body head is immediately impossible. + +### No free s + +First-input dependence forces the first leading binder `b` to be +one of the two live binders. A body headed by the second input `r` +would retain the final external `K R` unless `k=3`. At `k=3`, +mandatory leaves `b,r,j,c` have index sum at least `2+1+4+5=12`, +so their size is at least 32. A body headed by the third input `t` +gives the functional value `K N` or rigid head `N` on variable +streams. Thus the body head must be `b`. + +The case `k=3` already costs at least 31: `b,j,c` contribute +`2+4+5=11` to the index sum, even allowing zero contribution from +the remaining leaf. It remains to consider `k=1,2` and a Boolean +head + +``` +b A₁ ... A_q. +``` + +For `q=1`, the variable branch `F A₁` erases the sole source of +`c`, so it cannot work. For `q=2`, `j` must lie in `A₁` and +`c` in `A₂`. There is only one remaining application and one +remaining bound-variable leaf. Thus one branch is a lambda chain +over its single rigid leaf. If it is the zero branch, that branch +cannot acquire head `R`. If it is the `c` branch, after receiving +the pending arguments its result is a lambda, bare `c`, or `c` +applied to a suffix of the pending arguments. Any nonempty suffix +ends in `K N`; none is `c Pₘ₋₁ N`. + +For `q=3`, all three arguments are lambda chains over single +leaves. The zero branch must contain the live leaf, the variable +branch `c`, and the shared third argument `j`; any other allocation +makes the zero head rigidly `j/c` or loses one required rigid leaf. +The zero branch is a projection or a constant returning a leading +input. Its argument order is the `j`-bearing shared argument first, +then the still-pending external arguments, ending in `K R`. +Projections and constants select or erase this ordered list. They +cannot move the earlier `j` after a later `R` to form `R j`; +exposing a rigid `R` sooner retains the final `K R` instead. +Selecting the last external `R` through `K` can also erase that +final argument, but then yields bare `R`. This +excludes the no-`s` pattern. + +### One free s and a bound body head + +Suppose the body head is the unique live bound variable. A second-input +head again requires `k=3` to avoid retaining the final external +`K R`; its mandatory `r,s,j,c` then have index sum at least 13, +which costs at least 33. A third-input head again fails by its +variable-stream head `N`. Only the first-input head `b` remains. + +If `k=2`, the four leaves `b,s,j,c` contribute at least ten to +the index sum. Since `L≥3`, an additional lambda lies beneath the +leading pair and increases at least one of those leaf indices. This +costs at least `6+12+2+11=31`. For `k=3` the bound is larger. +Hence only `k=1` needs consideration. + +With two Boolean arguments, the zero branch must contain `s,j` +and the variable branch is a lambda chain over its single `c`. +That branch fails by the same final-argument obstruction. With three +arguments, all argument blocks are constant chains over `s,j,c`. +To obtain a zero result with head `R`, the selected first block must +return `P=cons K R`, and the shared third block must contain `j`. +The selected block receives, in order, that `j` block, then `R`, +then `K R`. Depending on how many arguments its constant chain +erases, exposing `P` gives a `j` head, `R K R (K R)`, `R R`, +or an unconsumed lambda. None is `R j`. One Boolean argument +again erases `c` on the variable branch. + +### Free s as the body head + +Write + +``` +H = λ^k.s A₁ ... A_q. +``` + +On the zero stream, the first argument receives `K,R`, followed +by `A₂,...,A_q` and the `3−k` pending external arguments. All +source lambdas except the binder of the single leaf `v` are +vacuous. + +For `q=3`, each argument is a lambda chain over one leaf. The +first must contain `v`, and the other two contain `j,c`. Its +activation is therefore just projection or constant selection from +that argument list. If `k<3`, the final external `K R` again +prevents the result `R j`: once `R` is exposed it retains that +last argument, while selection of the last `K R` leaves a lambda; selecting the +last external `R` through `K` can instead yield bare `R`. +The one-leaf blocks cannot construct a constant wrapper around an +already formed `R j`. For `k=3`, at least one callback lambda is +needed. Thus `L≥4`, while `s,j,c` already contribute +`3+4+5=12` to the index sum, for size at least 34. + +For `q=2`, one argument contains the sole remaining application. +If it is `A₂`, then `A₁` is a projection or constant chain over +`v`, while `A₂` contains `j,c` in a rigid application. The latter +can never produce bare `j`, so no selection gives `R j`. +Otherwise the only possible non-rigid head of `A₁` is `v`, and +its shape is a lambda chain over `v J`, where `J` is a constant +chain over one of `j,c`; `A₂` is a chain over the other. + +If `J` contains `j`, the live variable must receive `R` and +`J` must be bare `j`. To avoid trailing arguments, `A₁` must +consume all `6−k` supplied arguments before exposing `v j`. +Hence `L≥6`, and the deeply bound `j` alone contributes seven +index units; together with mandatory `c`, the size is at least 35. +If `J` contains `c`, the only way to discard it while producing +`R` before the remaining `j` argument is to give `v` the value +`K R`. The `j` argument must be last, so `k=3`; `v` must be +the outer third input, and two callback lambdas consume `K,R`. +Then `L≥5`, with `c` beneath five lambdas and `j` beneath three, +again exceeding 30. + +For `q=1`, both remaining applications lie inside the first callback. +Its head must be `v`. A single argument containing the rigid +application of `j,c` cannot yield bare `j`: beta-normality rules +out a vacuous lambda in function position that could erase the other +rigid leaf. With two separate +arguments, only the body `v C j`, where `C` contains `c`, can +produce `R j`, and only when `v=K R`. This value either arrives +as the last pending external argument or is the outer third input +after consuming the Scott `K,R`. In either case at least five +source lambdas have been consumed, with both `j,c` beneath them. +Thus `L≥5`, `X≥6+7=13`, and the size is at least 37. + +These cases exhaust the three-application normal shapes. Every +possible 30-bit improvement therefore has exactly four applications. + +## One bound leaf in a nonleading four-application handler + +**Provisional argument.** This proposed exclusion depends on the affine +pending-argument generalization above and its remaining shape analysis. +It is not counted as an established exclusion. + +Consider a beta-normal, application-headed handler with `A=4` +and exactly one bound-variable leaf `v`. Its other four leaves +include `s,j,c` and one further ambient variable. Every source +binder is affine. The size budget gives either `L=3,X≤6` or +`L=4,X≤4`. The affine pending-argument lemma already excludes +the three-lambda case. + +For `L=4`, mandatory `j,c` account for at least three index +units, so at most one further unit is available. A source lambda +not above the unique bound leaf must enclose an ambient leaf and +therefore spend at least one such unit. At least three lambdas +must consequently lie above `v`. + +If all four lie above `v` and no ambient leaf lies below them, +they form one closed four-argument projection. The live variable +is its last or penultimate binder, since its index is at most one. +A first activation by a Scott cell consumes two source lambdas +before the external arguments arrive. At most two remain, so the +affine pending-argument lemma excludes the variable law. + +Every other possibility contains the closed final projection + +``` +D = λa b v.v +``` + +and one additional vacuous lambda. Indeed, the single available +index unit is spent by an ambient leaf below that additional lambda; +the live variable must then have index zero. The extra lambda may +be separate, as `λu.a`, or may surround an application `a D`. +Beta-normality excludes `D a` inside that scope. These are the +only ways to distribute the single ambient leaf and the three-lambda +projection without paying a second index unit. + +If `D` is activated internally before the extra vacuous lambda, +its first activation is a direct Scott invocation and consumes two +source lambdas. If it is activated after that extra lambda, even +one contraction of `D` makes two internal source activations in +total. Either case leaves at most two source lambdas with all three +external arguments pending, and the affine lemma applies. + +It remains to consider reductions with no internal activation of +`D`. A source lambda reaching the head of the original normal, +application-headed term must first be activated internally. Thus +any useful source activation in this case consumes the unique +vacuous lambda. Normalize the resulting application context with +`D` opaque; its other operations are now safe data. If no source +activation occurs at all, the initial safe algebra already fails. +A functional data result has no `c`; an ordinary +rigid result retains final `T`; and a result headed by `D` with +an internal argument is the already excluded case. If the result +is bare `D`, its three external arguments give + +``` +D F Pₘ₋₁ T →* T, +``` + +which is not the required output. Thus the four-lambda case also +fails. This excludes every nonleading four-application candidate +having exactly one bound-variable leaf. + +## Two bound leaves in a nonleading four-application handler + +**Provisional argument.** The proposed ordered-spine proof below still +needs independent review, particularly its bound on useful `K` +contractions and its treatment of duplicated vacuous closures. +It is not counted as an established exclusion. + +Consider the other nonleading case: the five leaves are exactly +`s,j,c,v,w`, where `v,w` are bound occurrences, possibly of the same +binder. There is only one free `s`. The size constraint gives either +`L=3,X≤6` or `L=4,X≤4`. + +The normal source has the form + +``` +H = s D A₂ ... A_k, 1≤k≤4. +``` + +The first argument `D` must begin with a lambda. Otherwise its normal +head is `j/c`, since the unique `s` is already the outer head, and +the zero evaluation has the wrong rigid head. Expanding that outer +zero cell leaves the ordered input list + +``` +D K R A₂ ... A_k K R Q, Q=K R. +``` + +There are `n=k+4` input application edges. Distinguish these edges +from fixed applications inside the source arguments. + +### The ordered input edges + +Until consumed, the input edges remain on the outer application +spine in their original order. A head contraction may insert fixed +source-body applications before the remaining input suffix, but it +cannot move an existing input edge inside an argument. In particular, +an earlier common argument `A_i` that reduces to `j` cannot remain +as the final application `R j` while the later `Q` edge is still +outside it. Consuming that later edge first requires the earlier +prefix to expose a lambda, which consumes the earlier input edges. + +Since `Q` is a lambda and is not beta-equal to `j`, the zero result +`R j` cannot retain the last input edge. Consequently it retains +none of the original input edges. Its application to `j` comes from +a fixed source-body application, after all `n` input edges have +been consumed. + +A source block with no remaining bound-variable occurrence consists +only of vacuous lambdas and rigid `j/c` leaves. It can discard inputs +or expose its fixed rigid head; it cannot put an input `R` into the +function position of a fixed source-body application. That requires +a live bound occurrence. The final useful live occurrence on a +successful zero path must therefore expose an input `R`, or expose +`Q` and apply it to fixed source arguments to obtain `R j`. + +There are at most two such live source occurrences on the path. +For distinct affine binders, neither source nor data reduction copies +them. If a binder is nonlinear, its two occurrences already use both +bound leaves. An argument copied by its contraction cannot contain +another live source binder: that would require a third bound leaf. +Nor can that argument contain the contracting binder itself: the +normal source has only its single occurrence as a lambda subterm, +and the Scott inputs and external inputs contain no source code. +Copied source closures are therefore vacuous. They do not create +additional live source occurrences. + +Before the final useful occurrence, the other occurrence can expose +at most one useful `K` head. Forwarding a common argument containing +the other occurrence merely advances to that occurrence. Exposing +an `R` too early makes the head rigid while the final input suffix +remains. A source `j/c` block has the wrong head. + +A final live occurrence that instead exposes `K` cannot produce +`R j`. If its first selected operand is a fixed source block, that +block either has a fixed `j/c` head or would require a further live +capture of `R`. If selection reaches the pending inputs, selecting +the earlier cell `R` retains a suffix ending in `Q`; selecting the +last external `K` gives `K R Q→R`, with no source `j` after it. +Vacuous wrappers only discard inputs and do not change this order. +This also excludes the two `K` residuals of a duplicated input `K`: +the second residual is precisely this unsuccessful final-`K` case. + +Thus at most one useful `K` contraction precedes a successful +`R j`. A source lambda consumes at most one original input edge, +and that `K` consumes at most two. The ordered-spine invariant gives +the necessary inequality + +``` +L+2 ≥ n=k+4, hence L≥k+2. +``` + +### The equality cases + +If `L=3`, the inequality forces `k=1` and equality. The useful +`K` must then consume two original input edges; a fixed source +argument to that head would use one of its contractions without +consuming an input edge. Hence its source head has no fixed argument +spine: `D` is a one-leaf projection, and the other live occurrence +must lie in a common argument `A_i`. There is no common argument +when `k=1`. This is impossible. + +If `L=4`, the inequality leaves `k=1,2`. For `k=1`, both `j,c` +lie inside the leading lambda of `D`, already giving `X≥5>4`. + +For `k=2`, equality again makes `D` a one-leaf projection and puts +the other live occurrence in `A₂`. The only projection that can +expose that argument through the useful `K` is + +``` +D = λa b.a. +``` + +It consumes the cell's `K,R`, then uses that `K` to select `A₂` +and discard the external `K`, leaving `A₂ R Q`. A one-lambda +projection returns the cell `K` too early and selects the cell +`R`; a projection consuming three or more inputs either loses +`A₂`, returns a rigid input, or leaves too few source lambdas for +the remaining live occurrence. + +Both `j,c` and the remaining two lambdas lie in `A₂`. Its single +live occurrence cannot expose an `R` head with `Q` still pending; +therefore both lambdas must be leading to obtain `R j` from +`A₂ R Q`. The two rigid leaves then contribute at least `3+4=7` +to `X`, and the outer-variable occurrence in `D` contributes one +more. This contradicts `X≤4`. + +Hence the two-bound-leaf case also cannot meet the 30-bit budget. ## Remaining boundary -The general result here is a lambda-count obstruction for two specified -operands, with the two explicitly scoped shape exclusions above. For -`T=s s`, the compression lemmas additionally reduce a minimum -30-bit candidate with at most four applications to beta-normal syntax. -They do not exclude every such normal form or settle the -five-application nonlinear cases. Neither improving budget is fully -excluded, and these results are not a global optimality theorem. +The general results here are lambda-count obstructions for two specified +operands, together with the scoped three-leading-lambda exclusion for +`T=s`. For `T=s s`, the compression lemmas and the beta-normal +lambda floor reduce every possible 30-bit improvement to a beta-normal +minimum candidate with `L≥3` and `A=4`. The proposed four-application +exclusions above remain provisional, and the remaining beta-normal +shapes have not all been excluded. Neither improving +budget is fully excluded, and these results are not a global +optimality theorem. The standard-skip handler bounds, including whole-stream access, live in `handler-bound.md`; neutral-operand domination is in `protocol-obstructions.md`. diff --git a/docs/classical/self-interpreter/head-decomposition.md b/docs/classical/self-interpreter/head-decomposition.md new file mode 100644 index 00000000..af32320f --- /dev/null +++ b/docs/classical/self-interpreter/head-decomposition.md @@ -0,0 +1,257 @@ +# An unconditional head decomposition + +This develops the head-normal-form classification already stated in +`interpreter.md` §5, with Codex's continuation-independence argument and +exact accounting for beta wire costs. It assumes only that `E` is closed and that, +for every closed source `M` and independent rigid `C,N`, + +``` +E C (stream(M,N)) =β C (λz.M) N. +``` + +The equality is beta joinability. In particular, a value projection need +not reduce directly to the literal `λz.M` when `M` is divergent. There +is no parser-architecture or open-source correctness assumption here. + +Every such `E` has a head normal form of exactly one of the following +two shapes, up to renaming bound variables: + +``` +λc s. c A B, +λc s. s A₁ … Aₖ, k ≥ 1. +``` + +The arguments may contain beta redexes and arbitrary uses of both `c,s`. +This is a structural decomposition of a head normal form. It is not a +decomposition into separately priced source subterms of the original `E`. + +## Existence and exact interface arity + +Take the normal closed source `I=λx.x`, and keep `C,N` rigid. The +required result `C (λz.I) N` is beta-normal, so joinability gives a +finite reduction of `E C (stream(I,N))` to that result. Head +factorization then gives a finite head-normalizing reduction. The +factorization theorem itself is already proved in `Blc/Factor.lean`. + +Head normalizability reflects from an application to its function: +if `U V` has a head normal form, so does `U`. Here is the required +reflection argument. Until `U` exposes a lambda or a rigid head, each +head step of `U V` is a head step in `U`. A rigid head finishes the +argument. At a lambda `λx.B`, the application contracts to `B[V/x]`. +If this substituted body head-normalizes, then `B` head-normalizes: +every defined head step in `B` survives substitution as a head step, +so the terminating substituted trace bounds the number of head steps +possible before `B` reaches a head normal form. Lift the resulting +trace under the lambda. This proves reflection by induction on the +terminating application trace. The substitution stability used here is +already `headStep_substDec` in `Blc/SelfintProof.lean`; the reflection +lemma and the shape classification below have not been mechanized here. + +Applying reflection twice shows that `E` has a head normal form `H`. +Closedness is preserved by reduction, so + +``` +H = λx₁ … xₙ. xᵢ B₁ … Bₖ, 1 ≤ i ≤ n. +``` + +There cannot be zero leading lambdas: a closed head normal form cannot +have a free head variable. If there are at least three, applying `C` +and the stream leaves an outer lambda. Every reduct retains that lambda, +so it cannot join the rigidly `C`-headed required result. + +If there is just one leading lambda, its head must be that bound +variable. After applying the two public arguments, the result has the +rigid spine + +``` +C B₁[C/x₁] … Bₖ[C/x₁] stream(I,N). +``` + +Rigid beta reduction preserves the number and order of spine arguments. +The required two-argument `C` spine would force `k=1` and then force +`stream(I,N)=βN`. That is impossible: the nonempty Scott stream retains +an outer lambda, whereas `N` is rigid. + +Thus there are exactly two leading lambdas. Closedness makes their head +either `c` or `s`. With head `c`, comparison of rigid spines forces +exactly two arguments. With head `s`, zero arguments would return the +nonempty Scott stream itself, again leaving a lambda rather than the +required `C` head. Hence at least one argument is necessary. + +## Continuation-headed forms have independent projections + +Suppose the head normal form is + +``` +H = λc s.c A(c,s) B(c,s). +``` + +Fix any closed `M`, write `S=stream(M,N)`, and keep `C,N` rigid. +Reduction of the two interface redexes followed by rigid-spine +projection of the contract gives + +``` +A(C,S) =β λz.M, +B(C,S) →* N. +``` + +The second relation is directed because `N` is normal. The first is +only asserted as a beta join; for normal `M` it is also directed. + +Neither required result contains `C`. Apply capture-avoiding +substitution `C:=S` to their finite reduction diagrams. The stream +contains only the independent remainder `N`, so it is unchanged by +this substitution. Consequently + +``` +A(S,S) =β λz.M, +B(S,S) →* N. +``` + +It follows that the closed term + +``` +H' = λc s.c A(s,s) B(s,s) +``` + +is also a self-interpreter for every closed source, including divergent +ones. Its two payloads contain no occurrences of the continuation binder. +Equivalently, it supplies a closed value decoder and a closed exact +remainder extractor + +``` +D = λs.A(s,s), R = λs.B(s,s), +D (stream(M,N)) =β λz.M, R (stream(M,N)) →* N. +``` + +This replacement preserves the contract, not necessarily the behavior on +other inputs or beta equivalence between `H,H'`. + +There is an exact size saving at the head-normal-form level. If `q` is +the number of occurrences of the free parameter `c` inside `A,B`, +then + +``` +|H'|_BLC = |H|_BLC - q. +``` + +Below any additional local binders, `c` has an index exactly one larger +than `s`. Replacing it by `s` deletes one unary index bit and changes +no lambda or application node. Thus a minimum-size continuation-headed +self-interpreter within the head-normal fragment uses its continuation +only at the displayed root. Variable-for-variable replacement also +preserves beta normality, so the same conclusion holds within the +beta-normal fragment. + +These are two semantic projections, not a lower bound obtained by adding +two independent implementation costs. They can contain copies descended +from shared code in the original `E`. + +## Stream-headed forms retain unrestricted control + +The other case is + +``` +H = λc s.s A₁(c,s) … Aₖ(c,s). +``` + +For a closed source, the first code bit is `K`. If its stream is +`S=cons K T`, the first Scott contraction gives + +``` +A₁(C,S) K T A₂(C,S) … Aₖ(C,S). +``` + +This does not impose the 165-bit reader's `NEXT` protocol, a fixed skip, +or independence from the whole stream. All arguments may retain `S` and +share computation through it. The handler bounds in `handler-bound.md` +and `cheap-tail-bound.md` do not apply to this unrestricted form without +additional hypotheses. + +## Why this does not yet price the original interpreter + +The source `E` may be much smaller than its head normal form. Nonlinear +head reduction can duplicate code, and even affine contraction can +increase BLC size by moving free occurrences under more binders. + +For an explicit closed affine example, take + +``` +Tₙ = λr u.(λx.λa₁ … aₙ.x) (r u), +Uₙ = λr u.λa₁ … aₙ.r u. +``` + +One beta contraction gives the head normal form `Uₙ`, and every binder +in both terms occurs at most once. Nevertheless, the size identity gives + +``` +|Tₙ| = 3n + 17, |Uₙ| = 4n + 11. +``` + +The size increases by `n-6` when `n>6`: the contraction duplicates no +subterm, but the occurrences of `r,u` each acquire `n` additional index bits. +Therefore even an affine reduction cannot simply be assumed to preserve +or decrease the wire length. + +This distinction also matters for the current best interpreter: its +literal source expands substantially when reduced only to head normal +form. The fixed symbolic check and measured sizes are recorded in +`docs/STATUS.md`. + +## Exact beta wire costs + +`Blc.SelfintWireCost` formalizes the local accounting needed to distinguish +these effects. For a redex `(λx.B) A`, define: + +- `k`: the number of occurrences of the contracted variable `x` in `B`; +- `D`: the sum, over those occurrences, of the number of local lambdas + between the root of `B` and that occurrence; +- `f`: the number of free variable occurrences in `A`, counted with + multiplicity, relative to the root of `A`; +- `g`: the number of occurrences in `B` referring outside `λx.B`. + +Occurrences bound by internal lambdas of `A` do not contribute to `f`. +Occurrences of `x` do not contribute to `g`. These definitions apply to +open redexes under arbitrary surrounding binders. + +Writing `Δ = |B[A/x]| - |(λx.B) A|` over integers, the kernel proves + +``` +Δ = (k-1)|A| + (f-1)D - 2k - 4 - g. +``` + +Each substituted occurrence at local depth `d` removes its original +`d+2` wire bits and receives a copy of `A` with `f d` extra unary index +bits. The old application and lambda cost four bits, the old argument +costs `|A|`, and each of the `g` outer references loses one index bit. +Summing gives the formula. The general substitution theorem handles an +arbitrary de Bruijn cut; the displayed identity is its beta instance. + +For the fully affine family above, `k=1`, `f=2`, `D=n`, and `g=0`, so the +identity gives `Δ=n-6` directly. + +This also gives necessary conditions for a globally minimum-size +self-interpreter. Beta reduction preserves closedness and the full +closed-source beta-join contract, by confluence. Replacing a selected +redex in any context adds exactly the same context cost before and +afterward. Consequently every redex in a minimum interpreter must have +`Δ≥0`: + +- No redex can erase its argument: `k=0` always gives `Δ<0`. +- For a linear redex, `k=1`, the exact condition is + `(f-1)D ≥ 6+g`. In particular, its argument must have at least two + free occurrences, and its unique substituted occurrence must lie + beneath at least one local lambda. + +These are restrictions on redexes already present in the interpreter's +syntax. They do not forbid an interpreter from erasing data after receiving +its public arguments, and they assign no separate price to parsing or +recursion. A beta-normal minimum satisfies the local restrictions +vacuously. + +The wire-cost module is kernel-checked, without `sorry`, and its main +theorems use only `propext` and `Quot.sound`. The head decomposition and +continuation-independence arguments above remain handwritten. Charging +index movement and shared-code copying across an entire decoding trace +still has not yielded a useful global numerical lower bound; none of +these results establishes 165-bit optimality. diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index d7e9cd5d..a713ecca 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -301,7 +301,21 @@ forces it to equal `N`, but `⌜M⌝ ++ N ≠β N`. So `n = 2`; head `c` forces exactly two arguments, and head `s` needs one to consume the stream's outer λ. Both shapes occur: the 165 and 168 are `s`-headed; parsing twice, `λc s. c (E (λv r. v) s) (E (λv r. r) s)`, is a correct `c`-headed -interpreter. +interpreter. In the continuation-headed case, replacing every occurrence of +`c` inside `A,B` by `s` preserves the contract and saves one bit per +occurrence. Thus a minimum such head form has separate value and remainder +projections independent of its continuation. This is a bound on the head +form, not the original source: even fully affine head reduction can increase +BLC size. `head-decomposition.md` gives the detailed proof and the exact +index-movement example; STATUS records the literal 165's head expansion. +`Blc/SelfintWireCost.lean` proves the exact beta size balance and its +consequences for global minimum interpreters: no erasing source redex, +and every linear source redex must save enough index bits to offset +the contraction's removed syntax. +`remainder.md` gives a separate exact syntactic remainder extractor, +with its all-source contract proved in `Blc/SelfintRemainder.lean`. +It calibrates that projection without supplying an additive lower bound +or reconstructing the source value; STATUS records its size and checks. **Duplication.** At least two syntactic binders of `E` occur at least twice. Lean proves that every term with at most one such binder weakly normalizes; @@ -379,8 +393,14 @@ These are Codex's handwritten proofs, with targeted reduction checks in not exclude the cheaper `T=s` family or the productive thunk `T=s s`. `cheap-tail-bound.md` proves that both families require at least two explicit lambdas in `H`, even with arbitrary whole-stream use and beta - redexes. It also excludes a consecutive two-lambda block for either - improving budget and exactly three leading lambdas for `T=s`. + redexes. Every beta-normal handler needs at least three lambdas, + regardless of size; explicit three-lambda constructions show this + count is sharp. Exactly three leading lambdas are excluded at the + improving `T=s` budget. + For `T=s s`, every possible 30-bit improvement has a beta-normal + minimum representative: affine contractions preserve its budget, and + the remaining nonlinear source-redex cases are excluded. It must + have at least three lambdas and exactly four applications. It does not yet exclude their complete numerical handler budgets. - **The zero arm costs at least 14 bits**, even with `bit0 := K` and the whole zero cell available to borrow. With `R` absent and the neighbours rigid, diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index df0fd262..f74b2289 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -299,6 +299,20 @@ cases, a nonhomomorphic control projection, or a bootstrap targeting a continuation-specific internal state instead of `E` remain outside this obstruction. +The pointwise metadata construction below gives another precise distinction. +Write `F = lambda e.I`, so `S(F,F) =beta F`, and place an arbitrary +parser `P` in the remainder field of `G = B_P(F)`. Its application and +projection equations give + +```text +G G =beta G, G K F ->* P. +``` + +Thus an idempotent value can store a parser without satisfying the excluded +equation `G G =beta P`. This does not bootstrap the parser: the definition +of `G` already contains `P`. It supplies no smaller interpreter or saving +in the recursion code by itself. + ## Closed-source correctness already forces closed internal values diff --git a/docs/classical/self-interpreter/remainder.md b/docs/classical/self-interpreter/remainder.md new file mode 100644 index 00000000..c9ba991d --- /dev/null +++ b/docs/classical/self-interpreter/remainder.md @@ -0,0 +1,136 @@ +# Exact syntactic remainder extraction + +An exact remainder extractor discards one complete BLC source encoding and +returns its untouched suffix: + +``` +R (stream(M,N)) →* N. +``` + +The source `M` may be open or divergent, and `N` may be any lambda term. +This task recognizes syntax; it does not evaluate the encoded source. +It is one of the independent projections supplied by a continuation-headed +self-interpreter in `head-decomposition.md`. + +Codex's construction `rem93` satisfies this contract in 93 bits. Its +named source and exact wire are +`data/self-interpreter/machines/rem93.lam` and `rem93.blc`. +This is an upper bound, not an optimality result for remainder extraction. +The term contains beta redexes, so it does not give this upper bound for +the beta-normal fragment. + +## Construction + +Write `P` for the recursive parser and define + +``` +NEXT = λt u.P (t u (P u)), +H = λb.b (λu r.r NEXT) b, +P s = s H (s s s). +``` + +The actual finite term ties the recursion with self-application, sharing +`p=x x` and inlining `NEXT` inside the reader: + +``` +(λx.x x) (λx.(λp s. + s (λb.b (λu r.r (λt u.p (t u (p u)))) b) (s s s)) + (x x)). +``` + +The bit polarity is `0=K=λa b.a`, `1=F=λa b.b`. The reader uses the +first bit itself as its variable-branch continuation. With a first bit +`F`, it returns the third argument directly. With a first bit `K`, it +applies that argument to `NEXT`: + +``` +(cons F r) H S →* S, +(cons K r) H S →* S NEXT. +``` + +The existing skip identity gives `s s s →* N` when the stream starts +with a variable's unary index `1ⁿ0`, and `s s s →* r` when +`s=cons K r`. Thus a variable returns its suffix immediately. For an +abstraction or application, the remaining second tag selects + +``` +NEXT K u →* P u, +NEXT F u →* P (P u). +``` + +An abstraction discards one recursively encoded body. An application +discards its first child and then its second child. Uniformity in the +suffix permits the second child's entire encoding to be the first +child's suffix. + +## Kernel proof and fixed checks + +`Blc.SelfintRemainder.rem93_contract` proves + +``` +∀ M N, Betas (rem93 (streamOf (blcCode M) N)) N. +``` + +The proof first checks symbolic head-reduction clauses for the knot, +unfolding, the two first-bit branches, and the two second-bit prefixes. +The latter reach `P (K u (P u))` and `P (F u (P u))`; two contextual +beta steps inside the outer argument then select `P u` or `P (P u)`. +It lifts them to arbitrary terms with the existing substitution theorem, +then uses structural induction on `M`. The application case reduces the +inner parse under an application context before the outer parse. +The proof imposes no source closedness, normality, or suffix restriction. + +The kernel also checks closedness, the literal 93-bit length, and the +exact wire. `tools/self-interpreter/theory/remainder.py` pins the named +source to that wire and replays the same fixed symbolic clauses. It +compares only two explicit constructions: the displayed inlined factored +form and a shared `λt u.(t I P)(P u)`, which gives a 97-bit complete extractor. +`data/self-interpreter/theory/remainder.json` records those checks. +No source census or candidate search is involved. + +This construction separates the remainder task from value reconstruction +without pricing them as independent modules in arbitrary interpreters. +A source that is itself continuation-headed has disjoint value and +remainder payloads; a smaller term may instead share code before reaching +that head form, or fuse both tasks in a stream-headed handler. + +## Open lower-bound route: an infinite zero prefix + +The following is a proposed argument, not an established theorem or a +Lean result. Introduce a formal infinite zero-stream constant `Z` with +the rewrite rule + +``` +Z A → A K Z. +``` + +Application-only expressions over `K,Z` and opaque source closures appear +to admit a terminating data-normalization phase. The candidate normal +forms are iterated partial applications of `K` around `K`, `Z`, or an +opaque-headed expression. The useful equations include + +``` +Z K →* K, Z Z →* K Z, +Z (K A) →* A Z, Z (K (K A)) →* A. +``` + +If that phase and its interaction with source closures can be proved, +an affine closed source should weak-head normalize on `Z`: every source +contraction consumes a source lambda. The same argument may extend to a +source with at most one nonlinear binder, because its first nonlinear +weak-head contraction would leave affine source code. Weak-head reduction +is essential here; reducing under lambdas can move nonlinearity to an +enclosing binder. + +A finite reduction on `Z` inspects only a bounded zero prefix. A rigorous +simulation by sufficiently long finite encodings of `λⁿ.I` would then +give a lambda-headed result, contradicting exact extraction of a rigid +suffix. This would force at least two nonlinear binders in a remainder +extractor, and two inside the body of an explicit `λs.B` interface. + +The missing obligations are termination of the extended data algebra, +preservation of the source-binder accounting, and finite-prefix +simulation. No nonlinear-binder lower bound for remainder extraction is +claimed here. In particular, absence of a strict increase in the number +of source lambdas is insufficient: copying can recycle code with zero +net growth. diff --git a/lean/Blc.lean b/lean/Blc.lean index 8114ea2c..df887ea3 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -23,3 +23,5 @@ import Blc.SelfintOrigins import Blc.SelfintSharp import Blc.SelfintControl import Blc.SelfintTyped +import Blc.SelfintWireCost +import Blc.SelfintRemainder diff --git a/lean/Blc/SelfintRemainder.lean b/lean/Blc/SelfintRemainder.lean new file mode 100644 index 00000000..c7af6caf --- /dev/null +++ b/lean/Blc/SelfintRemainder.lean @@ -0,0 +1,149 @@ +/- +A 93-bit exact syntactic remainder extractor. It parses arbitrary BLC +terms, including open and divergent terms, without evaluating the source. +The proof is structural induction, with fixed symbolic head clauses. +This is a construction, not an optimality result for remainder extraction. +-/ +import Blc.Selfint165 + +namespace Blc +open Term +namespace SelfintRemainder + +/-- NEXT, with parser p free at index j outside its two local binders. -/ +def nextAt (j : Nat) : Term := + .lam (.lam (.app (.var (j + 2)) + (.app (.app (.var 1) (.var 0)) (.app (.var (j + 2)) (.var 0))))) + +/-- The inline reader under p and s. -/ +def handlerBody : Term := + .lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (nextAt 4))))) (.var 0)) + +def body : Term := + .lam (.lam (.app (.app (.var 0) handlerBody) + (.app (.app (.var 0) (.var 0)) (.var 0)))) + +def knot : Term := .lam (.app body (.app (.var 0) (.var 0))) +def parser : Term := .app knot knot +def rem93 : Term := .app (.lam (.app (.var 0) (.var 0))) knot + +def rem93Wire : List Bool := [false, true, false, false, false, true, true, false, true, false, false, false, false, true, false, false, false, false, false, true, false, true, true, false, false, false, false, true, false, true, true, false, false, false, false, false, false, true, true, false, false, false, false, false, false, true, true, true, true, true, true, true, true, false, false, true, false, true, true, true, false, true, false, false, true, true, true, true, true, true, true, true, false, true, false, true, false, false, true, false, true, true, false, true, false, true, false, false, true, true, false, true, false] + +theorem wire_rem93 : blcCode rem93 = rem93Wire := by decide + +def next : Term := + .lam (.lam (.app parser + (.app (.app (.var 1) (.var 0)) (.app parser (.var 0))))) + +def handler : Term := + .lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) next)))) (.var 0)) + +theorem parser_closed : Closed parser := by decide +theorem next_closed : Closed next := by decide +theorem handler_closed : Closed handler := by decide +theorem rem93_closed : Closed rem93 := by decide +theorem rem93_size : (blcCode rem93).length = 93 := by decide + +theorem subst_parser (j : Nat) (s : Term) : substDec j s parser = parser := + substDec_closed j s parser_closed +theorem subst_next (j : Nat) (s : Term) : substDec j s next = next := + substDec_closed j s next_closed +theorem subst_handler (j : Nat) (s : Term) : substDec j s handler = handler := + substDec_closed j s handler_closed + +theorem run_knot : spineSteps 1 rem93 = some parser := by decide + +theorem run_unfold : spineSteps 3 (.app parser (.var 0)) = + some (.app (.app (.var 0) handler) + (.app (.app (.var 0) (.var 0)) (.var 0))) := by decide + +theorem run_var : + spineSteps 6 (.app (.app (pairT churchFalse (.var 0)) handler) (.var 1)) = + some (.var 1) := by decide + +theorem run_zero : + spineSteps 6 (.app (.app (pairT churchTrue (.var 0)) handler) (.var 1)) = + some (.app (.var 1) next) := by decide + +theorem run_lam : spineSteps 3 (.app (pairT churchTrue (.var 0)) next) = + some (.app parser (.app (.app churchTrue (.var 0)) (.app parser (.var 0)))) := by decide + +theorem run_app : spineSteps 3 (.app (pairT churchFalse (.var 0)) next) = + some (.app parser (.app (.app churchFalse (.var 0)) (.app parser (.var 0)))) := by decide + +theorem unfold_parser (s : Term) : + SpineReds (.app parser s) (.app (.app s handler) (.app (.app s s) s)) := by + have h := spineReds_instN [s] 0 (spineReds_of_spineSteps _ run_unfold) + simpa [instN, substDec, shift, subst_parser, subst_handler, shift_zero] using h + +theorem variable_clause (r S : Term) : + SpineReds (.app (.app (pairT churchFalse r) handler) S) S := by + have h := spineReds_instN [r, S] 0 (spineReds_of_spineSteps _ run_var) + simpa [instN, pairT, substDec, shift, subst_handler, shift_churchFalse, + substDec_churchFalse, shift_shift0, substDec_shift0, shift_zero] using h + +theorem zero (r S : Term) : + SpineReds (.app (.app (pairT churchTrue r) handler) S) (.app S next) := by + have h := spineReds_instN [r, S] 0 (spineReds_of_spineSteps _ run_zero) + simpa [instN, pairT, substDec, shift, subst_handler, subst_next, shift_churchTrue, + substDec_churchTrue, shift_shift0, substDec_shift0, shift_zero] using h + +theorem abstraction (r : Term) : + Betas (.app (pairT churchTrue r) next) (.app parser r) := by + have h := spineReds_instN [r] 0 (spineReds_of_spineSteps _ run_lam) + have h' : SpineReds (.app (pairT churchTrue r) next) + (.app parser (.app (.app churchTrue r) (.app parser r))) := by + simpa [instN, pairT, substDec, shift, subst_next, subst_parser, shift_churchTrue, + substDec_churchTrue, substDec_shift0, shift_zero] using h + exact betas_trans (betas_of_spineReds h') + (betas_appR parser (betas_of_spineReds (spine_true2 r (.app parser r)))) + +theorem application (r : Term) : + Betas (.app (pairT churchFalse r) next) (.app parser (.app parser r)) := by + have h := spineReds_instN [r] 0 (spineReds_of_spineSteps _ run_app) + have h' : SpineReds (.app (pairT churchFalse r) next) + (.app parser (.app (.app churchFalse r) (.app parser r))) := by + simpa [instN, pairT, substDec, shift, subst_next, subst_parser, shift_churchFalse, + substDec_churchFalse, substDec_shift0, shift_zero] using h + exact betas_trans (betas_of_spineReds h') + (betas_appR parser (betas_of_spineReds (spine_false2 r (.app parser r)))) + +/-- The recursion theorem is uniform in the entire suffix, so the APP +case can use another complete term's stream as that suffix. -/ +theorem parser_contract : ∀ (M N : Term), + Betas (.app parser (streamOf (blcCode M) N)) N := by + intro M + induction M with + | var i => + intro N + refine betas_trans (betas_of_spineReds (unfold_parser _)) ?_ + rw [code_var, streamOf_cons] + exact betas_trans (betas_of_spineReds (variable_clause _ _)) + (betas_of_spineReds (pastZero_self (.var i) N _ (.refl _))) + | lam M ih => + intro N + refine betas_trans (betas_of_spineReds (unfold_parser _)) ?_ + refine betas_trans (betas_of_spineReds (zero _ _)) ?_ + refine betas_trans (betas_appL next + (betas_of_spineReds (pastZero_self (.lam M) N _ (.refl _)))) ?_ + exact betas_trans (abstraction _) (ih N) + | app M Q ihM ihQ => + intro N + refine betas_trans (betas_of_spineReds (unfold_parser _)) ?_ + refine betas_trans (betas_of_spineReds (zero _ _)) ?_ + refine betas_trans (betas_appL next + (betas_of_spineReds (pastZero_self (.app M Q) N _ (.refl _)))) ?_ + refine betas_trans (application _) ?_ + change Betas (.app parser (.app parser (streamOf (blcCode M ++ blcCode Q) N))) N + rw [streamOf_append] + exact betas_trans (betas_appR parser (ihM (streamOf (blcCode Q) N))) (ihQ N) + +/-- Exact remainder extraction for every syntactically valid source, +with no closedness, normalization, or suffix hypothesis. -/ +theorem rem93_contract (M N : Term) : + Betas (.app rem93 (streamOf (blcCode M) N)) N := + betas_trans (betas_appL _ (betas_of_spineReds + (spineReds_of_spineSteps _ run_knot))) (parser_contract M N) + +end SelfintRemainder +end Blc diff --git a/lean/Blc/SelfintWireCost.lean b/lean/Blc/SelfintWireCost.lean new file mode 100644 index 00000000..647d85dd --- /dev/null +++ b/lean/Blc/SelfintWireCost.lean @@ -0,0 +1,288 @@ +/- +Exact BLC wire-length accounting for capture-avoiding beta substitution. +The identity separates copied argument code, movement under local binders, +and decrementing references to binders outside the contracted abstraction. +It is a local cost theorem, not a numerical self-interpreter lower bound. +-/ +import Blc.SelfintLowerBound + +namespace Blc +open Term +namespace SelfintWireCost +open SelfintLowerBound + +/-- BLC wire length, including the unary de Bruijn indices. -/ +def wire (t : Term) : Nat := (blcCode t).length + +@[simp] theorem wire_var (n : Nat) : wire (.var n) = n + 2 := by + simp [wire, blcCode] + +@[simp] theorem wire_lam (b : Term) : wire (.lam b) = wire b + 2 := by + simp [wire, blcCode] + +@[simp] theorem wire_app (f a : Term) : wire (.app f a) = wire f + wire a + 2 := by + simp [wire, blcCode, Nat.add_comm, Nat.add_left_comm, Nat.add_assoc] + +/-- Each shifted free occurrence gains exactly `d` unary index bits. -/ +theorem wire_shift (t : Term) (d c : Nat) : + wire (shift d c t) = wire t + d * freeLeaves c t := by + induction t generalizing c with + | var n => + simp only [shift, freeLeaves] + split <;> simp_all <;> omega + | lam b ih => simp only [shift, wire_lam, freeLeaves, ih]; omega + | app f a ihf iha => + simp only [shift, wire_app, freeLeaves, ihf, iha, Nat.mul_add] + omega + +theorem freeLeaves_shift (t : Term) (d c k : Nat) (h : k ≤ c) : + freeLeaves k (shift d c t) = freeLeaves k t := by + induction t generalizing c k with + | var n => + simp only [shift, freeLeaves] + repeat' first | split | simp_all [freeLeaves] | omega + | lam b ih => + simp only [shift, freeLeaves] + exact ih (c + 1) (k + 1) (by omega) + | app f a ihf iha => simp only [shift, freeLeaves, ihf c k h, iha c k h] + +/-- Sum of the numbers of local lambdas above the occurrences of free +variable `j`. The variable index increments when traversing a lambda. -/ +def occDepth (j : Nat) : Term → Nat + | .var _ => 0 + | .lam b => occDepth (j + 1) b + occ (j + 1) b + | .app f a => occDepth j f + occDepth j a + +/-- Exact substitution accounting, balanced over natural numbers. +`freeLeaves (j+1) t` counts precisely the old outer references whose +indices decrement. `occDepth` charges the argument's movement under +local binders, net of the old substituted occurrence's own index bits. -/ +theorem wire_subst (t s : Term) (j : Nat) : + wire (substDec j s t) + (j + 2) * occ j t + occDepth j t + + freeLeaves (j + 1) t = + wire t + occ j t * wire s + freeLeaves 0 s * occDepth j t := by + induction t generalizing s j with + | var n => + by_cases hn : n = j + · subst n + have hh : ¬ j + 1 ≤ j := by omega + simp [substDec, occ, occDepth, freeLeaves, hh, Nat.add_comm] + · by_cases hj : j < n + · have hh : j + 1 ≤ n := by omega + simp only [substDec, if_neg hn, if_pos hj, occ, occDepth, + freeLeaves, if_pos hh, wire_var, Nat.mul_zero, Nat.add_zero] + omega + · have hh : ¬ j + 1 ≤ n := by omega + simp only [substDec, if_neg hn, if_neg hj, occ, occDepth, + freeLeaves, if_neg hh, wire_var, Nat.mul_zero, Nat.zero_mul, Nat.add_zero] + | lam b ih => + have hb := ih (shift 1 0 s) (j + 1) + rw [wire_shift, freeLeaves_shift s 1 0 0 (by omega)] at hb + simp only [substDec, wire_lam, occ, occDepth, freeLeaves] + simp only [Nat.add_mul, Nat.mul_add, Nat.one_mul] at hb ⊢ + rw [Nat.mul_comm (occ (j + 1) b) (freeLeaves 0 s)] at hb + omega + | app f a ihf iha => + have hf := ihf s j + have ha := iha s j + simp only [substDec, wire_app, occ, occDepth, freeLeaves, + Nat.add_mul, Nat.mul_add] + simp only [Nat.add_mul] at hf ha + omega + +/-- Exact beta wire-length change over integers. The four terms charge +argument copying, index movement, deleted occurrences/redex, and outer +index decrements, respectively. -/ +theorem wire_beta_delta (b a : Term) : + (wire (contract b a) : Int) - wire (.app (.lam b) a) = + ((occ 0 b : Int) - 1) * wire a + + ((freeLeaves 0 a : Int) - 1) * occDepth 0 b - + 2 * occ 0 b - 4 - freeLeaves 1 b := by + have h := wire_subst b a 0 + simp only [Nat.zero_add] at h + simp only [contract, wire_app, wire_lam] + have hz := congrArg (fun n : Nat => (n : Int)) h + simp only [Int.natCast_add, Int.natCast_mul, + Int.sub_mul, Int.one_mul] at hz ⊢ + omega + +theorem occDepth_zero {t : Term} {j : Nat} (h : occ j t = 0) : + occDepth j t = 0 := by + induction t generalizing j with + | var n => rfl + | lam b ih => + simp only [occ] at h + simp only [occDepth, h, ih h, Nat.add_zero] + | app f a ihf iha => + simp only [occ] at h + have hf : occ j f = 0 := by omega + have ha : occ j a = 0 := by omega + simp only [occDepth, ihf hf, iha ha, Nat.add_zero] + +/-- A syntactically erasing beta redex always shortens its wire. -/ +theorem erasing_beta_shrinks (b a : Term) (h : occ 0 b = 0) : + wire (contract b a) < wire (.app (.lam b) a) := by + have hw := wire_subst b a 0 + simp only [h, occDepth_zero h, Nat.mul_zero, Nat.add_zero] at hw + simp only [contract, wire_app, wire_lam] + omega + +/-- A linear beta redex whose argument has at most one free occurrence +always shortens its wire, however deep the unique substituted occurrence. -/ +theorem linear_small_free_beta_shrinks (b a : Term) (h : occ 0 b = 1) + (hf : freeLeaves 0 a ≤ 1) : + wire (contract b a) < wire (.app (.lam b) a) := by + have hw := wire_subst b a 0 + have hd := Nat.mul_le_mul_right (occDepth 0 b) hf + simp only [h, Nat.mul_one, Nat.one_mul] at hw hd + simp only [contract, wire_app, wire_lam] + omega + +/-- In the linear case only index movement can offset the six bits +removed by the application, lambda, and substituted variable. -/ +theorem linear_beta_delta (b a : Term) (h : occ 0 b = 1) : + (wire (contract b a) : Int) - wire (.app (.lam b) a) = + ((freeLeaves 0 a : Int) - 1) * occDepth 0 b - + 6 - freeLeaves 1 b := by + have hw := wire_beta_delta b a + simp only [h] at hw + omega + +private theorem shift_freeUnder (t : Term) (d c k : Nat) + (h : FreeUnder k t) : FreeUnder (k + d) (shift d c t) := by + induction t generalizing c k with + | var n => + simp only [shift] + split <;> simp only [FreeUnder] at h ⊢ <;> omega + | lam b ih => + simp only [shift, FreeUnder] at h ⊢ + have hb := ih (c + 1) (k + 1) h + simpa only [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using hb + | app f a ihf iha => + exact ⟨ihf c k h.1, iha c k h.2⟩ + +private theorem subst_freeUnder (t s : Term) (j k : Nat) (hjk : j ≤ k) + (ht : FreeUnder (k + 1) t) (hs : FreeUnder k s) : + FreeUnder k (substDec j s t) := by + induction t generalizing s j k with + | var n => + simp only [substDec] + split + · exact hs + · split <;> simp only [FreeUnder] at ht ⊢ <;> omega + | lam b ih => + simp only [substDec, FreeUnder] at ht ⊢ + exact ih (shift 1 0 s) (j + 1) (k + 1) (by omega) ht + (shift_freeUnder s 1 0 k hs) + | app f a ihf iha => + exact ⟨ihf s j k hjk ht.1 hs, iha s j k hjk ht.2 hs⟩ + +theorem beta_freeUnder {t u : Term} (h : Beta t u) (k : Nat) + (ht : FreeUnder k t) : FreeUnder k u := by + induction h generalizing k with + | beta b a => exact subst_freeUnder b a 0 k (by omega) ht.1 ht.2 + | lam h ih => exact ih (k + 1) ht + | appL a h ih => exact ⟨ih k ht.1, ht.2⟩ + | appR f h ih => exact ⟨ht.1, ih k ht.2⟩ + +/-- The full closed-source beta-join contract survives arbitrary beta +reduction of the interpreter's syntax, including under abstractions. -/ +theorem selfInterpreter_beta {E E' : Term} (hE : IsSelfInterpreter E) + (h : Beta E E') : IsSelfInterpreter E' := by + refine ⟨beta_freeUnder h 0 hE.1, ?_⟩ + intro M hM + obtain ⟨w, hw, ho⟩ := hE.2 M hM + have hs : Betas + (.app (.app E (.var 0)) (streamOf (blcCode M) (.var 1))) + (.app (.app E' (.var 0)) (streamOf (blcCode M) (.var 1))) := + .head (.appL _ (.appL _ h)) (.refl _) + obtain ⟨v, hv, hwv⟩ := betas_confluent hs hw + exact ⟨v, hv, betas_trans ho hwv⟩ + +/-- Minimality is global among all closed self-interpreters, with no +parser or reduction-strategy hypothesis. -/ +def MinimalInterpreter (E : Term) : Prop := + IsSelfInterpreter E ∧ ∀ E', IsSelfInterpreter E' → wire E ≤ wire E' + +/-- Every one-step reduct of a globally minimum interpreter costs at +least as many bits. Together with `wire_beta_delta`, this applies a +necessary cost inequality to every selected redex in every context. -/ +theorem minimal_beta_nonshrinking {E E' : Term} (hm : MinimalInterpreter E) + (h : Beta E E') : wire E ≤ wire E' := + hm.2 E' (selfInterpreter_beta hm.1 h) + +/-- A syntactic one-hole context. Filling below a lambda uses the local +de Bruijn indices already belonging to that occurrence of the subterm. -/ +inductive Context where + | hole + | lam (C : Context) + | appL (C : Context) (a : Term) + | appR (f : Term) (C : Context) + +def Context.fill : Context → Term → Term + | .hole, t => t + | .lam C, t => .lam (C.fill t) + | .appL C a, t => .app (C.fill t) a + | .appR f C, t => .app f (C.fill t) + +def Context.cost : Context → Nat + | .hole => 0 + | .lam C => C.cost + 2 + | .appL C a => C.cost + wire a + 2 + | .appR f C => wire f + C.cost + 2 + +theorem wire_fill (C : Context) (t : Term) : + wire (C.fill t) = wire t + C.cost := by + induction C with + | hole => simp [Context.fill, Context.cost] + | lam C ih => simp only [Context.fill, Context.cost, wire_lam, ih]; omega + | appL C a ih => simp only [Context.fill, Context.cost, wire_app, ih]; omega + | appR f C ih => simp only [Context.fill, Context.cost, wire_app, ih]; omega + +theorem beta_fill (C : Context) {t u : Term} (h : Beta t u) : + Beta (C.fill t) (C.fill u) := by + induction C with + | hole => exact h + | lam C ih => exact .lam ih + | appL C a ih => exact .appL a ih + | appR f C ih => exact .appR f ih + +/-- A selected redex in any syntactic position of a minimum interpreter +must be nonshrinking. Outer context costs cancel exactly. -/ +theorem minimal_redex_nonshrinking (C : Context) (b a : Term) + (hm : MinimalInterpreter (C.fill (.app (.lam b) a))) : + wire (.app (.lam b) a) ≤ wire (contract b a) := by + have h := minimal_beta_nonshrinking hm (beta_fill C (.beta b a)) + simp only [wire_fill] at h + omega + +theorem minimal_no_erasing (C : Context) (b a : Term) + (hm : MinimalInterpreter (C.fill (.app (.lam b) a))) : 0 < occ 0 b := by + have hw := minimal_redex_nonshrinking C b a hm + by_cases h : occ 0 b = 0 + · have hs := erasing_beta_shrinks b a h + omega + · omega + +theorem minimal_linear_free_count (C : Context) (b a : Term) + (hm : MinimalInterpreter (C.fill (.app (.lam b) a))) + (h : occ 0 b = 1) : 2 ≤ freeLeaves 0 a := by + have hw := minimal_redex_nonshrinking C b a hm + by_cases hf : freeLeaves 0 a ≤ 1 + · have hs := linear_small_free_beta_shrinks b a h hf + omega + · omega + +/-- Every linear redex remaining in a minimum interpreter must save at +least six bits plus the outer-reference decrements through index hoisting. -/ +theorem minimal_linear_index_charge (C : Context) (b a : Term) + (hm : MinimalInterpreter (C.fill (.app (.lam b) a))) + (h : occ 0 b = 1) : + (6 + freeLeaves 1 b : Int) ≤ + ((freeLeaves 0 a : Int) - 1) * occDepth 0 b := by + have hw := minimal_redex_nonshrinking C b a hm + have hd := linear_beta_delta b a h + omega + +end SelfintWireCost +end Blc diff --git a/tools/self-interpreter/theory/handler_bound.py b/tools/self-interpreter/theory/handler_bound.py index 25798b73..16334d7c 100644 --- a/tools/self-interpreter/theory/handler_bound.py +++ b/tools/self-interpreter/theory/handler_bound.py @@ -142,6 +142,26 @@ def laws(term): app(lc.subst(0, one_stream, term), lc.FALSE, terminal, n) ) == app(c, j) +# The three-lambda floor for beta-normal cheap-tail handlers is attained. +# These are two explicit constructions, not a search for their minimum sizes. +cheap_tail_witnesses = [ + ("self-application operand", r"\b\r\t. b (r j) (c r (t t))", + 45, (3, 6, 13), True), + ("whole-stream operand", r"\b\r\t. b (r j) (c r (t t t))", + 49, (3, 7, 13), False), +] +for name, source, size, stats, thunk in cheap_tail_witnesses: + term = handler(source) + assert counts(term) == stats and lc.size(term) == size + zero_operand = app(lc.TRUE, r) if thunk else zero_stream + assert normal(app(term, lc.TRUE, r, zero_operand)) == app(r, j) + for unary_length in (1, 2, 4): + tail = lc.bitlist("1" * (unary_length - 1) + "0", n) + stream = lc.pair(lc.FALSE, tail) + operand = app(lc.TRUE, n) if thunk else stream + assert normal(app(term, lc.FALSE, tail, operand)) == app(c, tail, n) + print(f"{name}: {size} bits; L,A,X={stats}; fixed correlated laws pass") + print("whole-stream proof audit: nine callback sizes/equations, six data equations, " "two tag-return shapes pass") -print("PASS: five explicit witnesses and fixed proof equations; no enumeration") +print("PASS: seven explicit witnesses and fixed proof equations; no enumeration") diff --git a/tools/self-interpreter/theory/head_decomposition.py b/tools/self-interpreter/theory/head_decomposition.py new file mode 100644 index 00000000..6760ed72 --- /dev/null +++ b/tools/self-interpreter/theory/head_decomposition.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python3 +"""Fixed head-reduction accounting checks; no candidate enumeration. + +The universal head-decomposition argument is handwritten. These checks only +verify its two explicit affine examples and the existing 165's head form. +""" +from pathlib import Path +import json +import sys +import time + +sys.dont_write_bytecode = True +ROOT = Path(__file__).resolve().parents[3] +sys.path.insert(0, str(ROOT / "tools" / "self-interpreter")) +import battery +import lc + + +def head_step(term): + """One head contraction, including beneath leading lambdas.""" + if term[0] == "L": + body = head_step(term[1]) + return None if body is None else ("L", body) + if term[0] == "A": + if term[1][0] == "L": + return lc.beta(term[1], term[2]) + function = head_step(term[1]) + return None if function is None else ("A", function, term[2]) + return None + + +def occurrences(term, index=0): + if term[0] == "V": + return int(term[1] == index) + if term[0] == "L": + return occurrences(term[1], index + 1) + return occurrences(term[1], index) + occurrences(term[2], index) + + +def affine(term): + if term[0] == "V": + return True + if term[0] == "L": + return occurrences(term[1]) <= 1 and affine(term[1]) + return affine(term[1]) and affine(term[2]) + + +def free_leaves(term, cutoff=0): + if term[0] == "V": + return int(term[1] >= cutoff) + if term[0] == "L": + return free_leaves(term[1], cutoff + 1) + return free_leaves(term[1], cutoff) + free_leaves(term[2], cutoff) + + +def occurrence_depths(term, depth=0): + if term[0] == "V": + return [depth] if term[1] == depth else [] + if term[0] == "L": + return occurrence_depths(term[1], depth + 1) + return occurrence_depths(term[1], depth) + occurrence_depths(term[2], depth) + + +def redex_costs(term, path="root"): + """Visit only existing source redexes; do not generate other terms.""" + rows = [] + if term[0] == "A": + if term[1][0] == "L": + body, argument = term[1][1], term[2] + depths = occurrence_depths(body) + k, d = len(depths), sum(depths) + f, g = free_leaves(argument), free_leaves(body, 1) + argument_bits = lc.size(argument) + delta = (k - 1) * argument_bits + (f - 1) * d - 2 * k - 4 - g + assert delta == lc.size(lc.beta(term[1], argument)) - lc.size(term) + rows.append(dict(path=path, occurrences=k, total_depth=d, + argument_free_leaves=f, outer_body_leaves=g, + argument_bits=argument_bits, delta_bits=delta)) + rows += redex_costs(term[1], path + ".function") + rows += redex_costs(term[2], path + ".argument") + elif term[0] == "L": + rows += redex_costs(term[1], path + ".body") + return rows + + +def main(): + start = time.monotonic() + examples = [] + for n in (0, 7): + binders = "".join("\\a" + str(i) for i in range(n)) + body = binders + ".x" if n else "x" + source = battery.compile_lam("\\r\\q.(\\x." + body + ")(r q)") + result = head_step(source) + assert result is not None and head_step(result) is None + assert affine(source) and affine(result) + assert lc.size(source) == 3 * n + 17 + assert lc.size(result) == 4 * n + 11 + examples.append(dict(n=n, source_bits=lc.size(source), + head_form_bits=lc.size(result), affine=True)) + + source = battery.compile_lam( + (ROOT / "data/self-interpreter/machines/int165.lam").read_text()) + assert lc.enc(source) == ( + ROOT / "data/self-interpreter/machines/int165.blc").read_text().strip() + assert lc.size(source) == 165 + costs = redex_costs(source) + assert [row["delta_bits"] for row in costs] == [147, 3, 5] + result = source + contractions = 0 + for _ in range(32): + next_term = head_step(result) + if next_term is None: + break + result = next_term + contractions += 1 + else: + raise AssertionError("fixed head-reduction budget exhausted") + assert contractions == 4 and lc.size(result) == 755 + body = result + leading = 0 + while body[0] == "L": + leading += 1 + body = body[1] + arguments = 0 + while body[0] == "A": + arguments += 1 + body = body[1] + assert (leading, body, arguments) == (2, ("V", 0), 2) + report = dict( + affine_examples=examples, + int165=dict(source_bits=165, head_form_bits=755, + head_contractions=contractions, leading_lambdas=leading, + head="stream", head_arguments=arguments, + source_redex_costs=costs), + seconds=round(time.monotonic() - start, 4), + ) + (ROOT / "data/self-interpreter/theory/head_decomposition.json").write_text( + json.dumps(report, indent=2) + "\n") + print(json.dumps(report, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/tools/self-interpreter/theory/metadata_parser.py b/tools/self-interpreter/theory/metadata_parser.py index c5fc9610..7cea4cc9 100644 --- a/tools/self-interpreter/theory/metadata_parser.py +++ b/tools/self-interpreter/theory/metadata_parser.py @@ -72,6 +72,13 @@ def main(): ("abstraction_keeps_remainder", rf"\n\x.({BOX} x n) {ABS_HANDLER}", rf"\n\x.{BOX} (\env\arg.x (\b\r.b arg (r env))) n"), + ("identity_closure_is_pointwise_idempotent", + rf"\e.{F} e ({F} e)", F), + ("parser_metadata_box_is_idempotent", + rf"\p.({BOX} {F} p) ({BOX} {F} p)", + rf"\p.{BOX} {F} p"), + ("parser_metadata_box_projects_parser", + rf"\p.({BOX} {F} p) {K} {F}", r"\p.p"), ] sources = [source for _, left, right in cases for source in (left, right)] with ThreadPoolExecutor(max_workers=2) as pool: diff --git a/tools/self-interpreter/theory/remainder.py b/tools/self-interpreter/theory/remainder.py new file mode 100644 index 00000000..2992f20d --- /dev/null +++ b/tools/self-interpreter/theory/remainder.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +"""Two explicit remainder parsers and fixed symbolic head clauses. + +No source or candidate enumeration. Lean proves the all-syntax contract; +this script pins the named source/wire and checks its defining clauses. +""" +from pathlib import Path +import json +import re +import sys +import time + +sys.dont_write_bytecode = True +ROOT = Path(__file__).resolve().parents[3] +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery +import lc + + +def app(f, a): + return ("A", f, a) + + +def head_step(term): + if term[0] == "L": + body = head_step(term[1]) + return None if body is None else ("L", body) + if term[0] == "A": + if term[1][0] == "L": + return lc.beta(term[1], term[2]) + function = head_step(term[1]) + return None if function is None else app(function, term[2]) + return None + + +def check_clause(source, target, expected_steps): + result = source + for _ in range(expected_steps): + result = head_step(result) + assert result is not None + assert result == target, (result, target) + return expected_steps + + +def main(): + start = time.monotonic() + named = (ROOT / "data/self-interpreter/machines/rem93.lam").read_text() + source = battery.compile_lam(named) + bits = lc.enc(source) + assert bits == (ROOT / "data/self-interpreter/machines/rem93.blc").read_text().strip() + assert len(bits) == 93 + + proof = (ROOT / "lean/Blc/SelfintRemainder.lean").read_text() + literal = re.search(r"def rem93Wire : List Bool := \[([^]]+)\]", proof)[1] + proof_bits = "".join("1" if b.strip() == "true" else "0" for b in literal.split(",")) + assert bits == proof_bits + + reader = r"(\n.\s.s(\b.b(\u\r.r n)b)(s s s))" + shared_body = battery.compile_lam( + r"(\x.x x)(\x.(\p." + reader + r"(\t\u.(t (\i.i) p)(p u)))(x x))") + factored_inline = battery.compile_lam( + r"(\x.x x)(\x.(\p.\s.s(\b.b(\u\r.r(\t\u.p(t u(p u))))b)(s s s))(x x))") + assert factored_inline == source + variants = {"shared_body": lc.size(shared_body), "factored_inline": lc.size(factored_inline)} + assert variants == {"shared_body": 97, "factored_inline": 93} + + parser = app(source[2], source[2]) + next_term = lc.beta(battery.compile_lam(r"\p.\t\u.p(t u(p u))"), parser) + handler = lc.beta(battery.compile_lam(r"\n.\b.b(\u\r.r n)b"), next_term) + r, suffix = ("V", 0), ("V", 1) + clauses = { + "knot": check_clause(source, parser, 1), + "unfold": check_clause(app(parser, r), app(app(r, handler), app(app(r, r), r)), 3), + "variable": check_clause(app(app(lc.pair(lc.FALSE, r), handler), suffix), suffix, 6), + "zero": check_clause(app(app(lc.pair(lc.TRUE, r), handler), suffix), app(suffix, next_term), 6), + "abstraction_head": check_clause(app(lc.pair(lc.TRUE, r), next_term), + app(parser, app(app(lc.TRUE, r), app(parser, r))), 3), + "application_head": check_clause(app(lc.pair(lc.FALSE, r), next_term), + app(parser, app(app(lc.FALSE, r), app(parser, r))), 3), + "abstraction_argument": check_clause(app(app(lc.TRUE, r), app(parser, r)), r, 2), + "application_argument": check_clause(app(app(lc.FALSE, r), app(parser, r)), app(parser, r), 2), + } + report = { + "bits": len(bits), + "explicit_variants": variants, + "symbolic_head_clause_steps": clauses, + "formal_contract": "forall M N, rem93 (streamOf (blcCode M) N) ->* N", + "source_restrictions": "none: open and divergent source syntax included", + "seconds": round(time.monotonic() - start, 4), + } + (ROOT / "data/self-interpreter/theory/remainder.json").write_text( + json.dumps(report, indent=2) + "\n") + print(json.dumps(report, indent=2)) + + +if __name__ == "__main__": + main() From 78a70bc1a0cc0d26b237d3b61d701219efa08524 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 16:50:05 -0400 Subject: [PATCH 17/41] =?UTF-8?q?Credit=20OEIS=20A333479=20for=20the=20BB?= =?UTF-8?q?=CE=BB=20values=20and=20drop=20the=20census=20bound=20past=2035?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BBλ(33..35) are Tromp's published values; the census and Lean adjudications confirm them independently. A333479 already lists a(36) = 5·2^256 + 6, so the lambda-wrap bound BBλ(41) >= 38,127,987,424,947 was true but uninformative. The docket's first item becomes checking a(36), then a(37). --- README.md | 15 ++++++++------- contrib/PR_KIT.md | 15 +++++++++------ docs/STATUS.md | 18 +++++++++++------- docs/classical/certificates/busy-beaver.md | 10 ++++++---- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index b89c6eb7..a6edae7b 100644 --- a/README.md +++ b/README.md @@ -81,13 +81,14 @@ tools. ## Results The classical census covers all 526,039,969 closed terms through 41 bits. -With kernel-checked adjudications of every program it leaves open at those -sizes, it establishes **BBλ(33) = 1,812**, **BBλ(34) = 327,686**, and -**BBλ(35) = 38,127,987,424,941 normal-form bits**, the last a symbolically -proved Church numeral 3^27; the exhaustive census itself remains a Rust -computation ([proof record](docs/classical/certificates/busy-beaver.md), -formalizing Tromp's hand arguments). It also gives -BBλ(41) ≥ 38,127,987,424,947 and the finite-range halting mass +With kernel-checked adjudications of every program it leaves open at 33–35 +bits, it independently confirms Tromp's busy-beaver values +**BBλ(33) = 1,812**, **BBλ(34) = 327,686**, and +**BBλ(35) = 38,127,987,424,941 normal-form bits** +([OEIS A333479](https://oeis.org/A333479)), the last a symbolically proved +Church numeral 3^27; the exhaustive census itself remains a Rust computation +([proof record](docs/classical/certificates/busy-beaver.md), formalizing +Tromp's hand arguments). It also gives the finite-range halting mass ```text Omega|<=41 in [0.124105086841, 0.124105091271] diff --git a/contrib/PR_KIT.md b/contrib/PR_KIT.md index 1f96bac0..d774a57b 100644 --- a/contrib/PR_KIT.md +++ b/contrib/PR_KIT.md @@ -205,16 +205,19 @@ int4, ko2kp, nf and the pairup programs - Pointer: `docs/classical/self-interpreter/interpreter.md` (and `universal.md` for the 175/187). - **Busy-beaver and Ω results** (if still worth mentioning): - - BBλ(33) = 1,812, BBλ(34) = 327,686, BBλ(35) = 38,127,987,424,941: his - BB.txt hand arguments for the programs the census leaves open, formalized - as kernel-checked Lean proofs (the 35-bit champion is Church 3^27, proved - symbolically). The exhaustive census itself is Rust, not Lean. + - His A333479 values BBλ(33) = 1,812, BBλ(34) = 327,686, + BBλ(35) = 38,127,987,424,941, independently confirmed: his BB.txt hand + arguments for the programs the census leaves open, formalized as + kernel-checked Lean proofs (the 35-bit champion is Church 3^27, proved + symbolically). The exhaustive census itself is Rust, not Lean. The values + are his; the news is the machine checking. + - His a(36) = 5·2²⁵⁶ + 6 is not checked here yet (30 open programs). + Don't quote a census lower bound past 35: anything the census can + reach sits far below his a(36). - The 32-bit loop term the ledger excludes by hand has a machine-checked divergence proof, a "ratchet" certificate; 305 frontier kills across four certificate classes are each a kernel-checked Lean theorem (no `sorry`, no mathlib). - - The census covers every closed term of 4..41 bits: - BBλ(41) ≥ 38,127,987,424,947 bits. - Ω restricted to programs of at most 41 bits lies in [0.124105086841, 0.124105091271]; over all sizes, the closed-term Ω (normalizing terms, not his universal-machine Ω) is pinned to nine diff --git a/docs/STATUS.md b/docs/STATUS.md index 764f41a2..5dd516ce 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -24,14 +24,16 @@ Last updated: 2026-10-20. transitions on the 36..37-bit frontier), so transition-bound rescues run 10-13× faster than plain stepping. - **BBλ(33) = 1,812**, **BBλ(34) = 327,686**, and - **BBλ(35) = 38,127,987,424,941** normal-form bits, exact by the exhaustive - Rust census plus kernel-checked adjudications of every program the census - left open at those sizes (the census itself is not formalized). The eighteen - open 35-bit programs are sixteen divergers and two halters with outputs of + **BBλ(35) = 38,127,987,424,941** normal-form bits: Tromp's published values + (OEIS A333479), confirmed independently by the exhaustive Rust census plus + kernel-checked adjudications of every program the census left open at those + sizes (the census itself is not formalized). The eighteen open 35-bit + programs are sixteen divergers and two halters with outputs of 4,186,155,666 and 38,127,987,424,941 bits; the latter is the Church numeral 3^27, proved symbolically. Tromp's hand notes identify the same behaviours - (`classical/certificates/busy-beaver.md`). Lambda wrapping gives - **BBλ(41) ≥ 38,127,987,424,947**. + (`classical/certificates/busy-beaver.md`). A333479 also lists + a(36) = 5·2²⁵⁶ + 6 (the Church numeral 2^2^2^3), which this project has not + yet checked; its terms end there, so a(37) would be the first new value. - `data/classical/unknowns.txt` is the certified frontier: 4,109 terms (36: 30, 37: 70, 38: 182, 39: 438, 40: 1,063, 41: 2,326). Regeneration checks the exact partition @@ -344,7 +346,9 @@ GHC 9.10.3; `uni.rs` with rustc), all three harnesses in 11 minutes: ### Classical docket -1. **BB(36).** n=36 has 30 open programs. The direct-proof machinery +1. **BB(36), then BB(37).** Checking Tromp's a(36) = 5·2²⁵⁶ + 6 means + adjudicating all 30 open programs at n=36; a(37), 70 open programs, is + not yet published anywhere. The direct-proof machinery (open-payload head cycles, productive descent, growing spines, confluence, symbolic normal forms) is the starting point; the BB(35) pass adjudicated only its eighteen seeds and their lambda wraps. diff --git a/docs/classical/certificates/busy-beaver.md b/docs/classical/certificates/busy-beaver.md index c0b4d3bc..65e78ebf 100644 --- a/docs/classical/certificates/busy-beaver.md +++ b/docs/classical/certificates/busy-beaver.md @@ -23,10 +23,12 @@ census's own adjudications, and the maximum-output measurements rely on the Rust census. This is the same boundary as the established BBλ(32) result; it is not an end-to-end formalization of the census. -**Attribution.** Tromp's checked-in `ref/AIT/BB/BB.txt`, around lines 65–258, -already gives hand arguments for these programs. The contribution here is -their formalization, reusable proof machinery, and integration into the -project's certificate accounting, rather than new busy-beaver values. +**Attribution.** The three values are Tromp's, published in OEIS +[A333479](https://oeis.org/A333479), which also lists a(36) = 5·2²⁵⁶ + 6. +His checked-in `ref/AIT/BB/BB.txt`, around lines 65–258, already gives hand +arguments for these programs. The contribution here is their formalization, +reusable proof machinery, and integration into the project's certificate +accounting, rather than new busy-beaver values. ## The eleven 33/34-bit seeds From 6381bbb19805f77286820b682ed02b3e337857bb Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 18:07:34 -0400 Subject: [PATCH 18/41] Record the second golf round: 40 programs, 1,143 bits, upstream as tromp/AIT#13 The upstream golf branch now carries readable sources for 36 of the sweep's gains and the hand redesigns, several beyond the sweep: - uni8 344 -> 304 strict (38 bytes) / 283 non-strict (36): split read, the parser taking the read bit, and get get get as an unsolvable bottom; - uni28 500 -> 390 / 370 (a non-recursive reader, one shared delta), uni2 340 -> 332 (one fix, fix fix as the bottom); - blc.lam 195 -> 186; uniK 903 -> 826, and 599 with eager weakening; - ko2kp 541 (KP <= KO + 541), nf 538, pairupKP 756, pairupK_p 651, pairup_Kp 1273; loader 1781, tweet 2134, tree_ordinals 726. golf.md gains sections on the BLC2 machines' new reader, blc.lam and uniK, and cheaper bottoms, and states that uni28's one-sided byte-battery inputs are call-by-name budget effects. data/golf/machines holds the new sources and bits (no move paths left: every source compiles to its best term). table.py renders a source column and the gains kept out of the branch, and scott_numerals joins the demos (its in term is a test), so the sweep counts 44 programs and 463 bits. --- README.md | 11 +- contrib/PR_KIT.md | 175 ++++++----- data/golf/machines/blc.blc | 1 + data/golf/machines/blc.lam | 22 ++ data/golf/machines/ko2kp.blc | 2 +- data/golf/machines/ko2kp.lam | 88 +++--- data/golf/machines/ko2kp.path | 10 - data/golf/machines/nf.blc | 2 +- data/golf/machines/nf.lam | 36 ++- data/golf/machines/nf.path | 10 - data/golf/machines/pairupKP.blc | 2 +- data/golf/machines/pairupKP.lam | 78 ++--- data/golf/machines/pairupKP.path | 6 - data/golf/machines/pairupK_p.blc | 2 +- data/golf/machines/pairupK_p.lam | 27 +- data/golf/machines/pairupK_p.path | 2 - data/golf/machines/pairup_Kp.blc | 2 +- data/golf/machines/pairup_Kp.lam | 99 +++--- data/golf/machines/pairup_Kp.path | 17 - data/golf/machines/uni2.blc | 2 +- data/golf/machines/uni2.lam | 37 +-- data/golf/machines/uni28.blc | 2 +- data/golf/machines/uni28.lam | 54 ++-- data/golf/machines/uni28.path | 10 - data/golf/machines/uni28_nonstrict.blc | 2 +- data/golf/machines/uni28_nonstrict.lam | 56 ++-- data/golf/machines/uni28_nonstrict.path | 3 - data/golf/machines/uni2_nonstrict.blc | 2 +- data/golf/machines/uni2_nonstrict.lam | 37 +-- data/golf/machines/uni8.blc | 2 +- data/golf/machines/uni8.blc8 | Bin 41 -> 38 bytes data/golf/machines/uni8.lam | 64 ++-- data/golf/machines/uni8_nonstrict.blc | 2 +- data/golf/machines/uni8_nonstrict.blc8 | 2 +- data/golf/machines/uni8_nonstrict.lam | 68 ++-- data/golf/machines/uniK.blc | 1 + data/golf/machines/uniK.lam | 51 +++ data/golf/machines/uniK_lazy.blc | 1 + data/golf/machines/uniK_lazy.lam | 69 +++++ docs/STATUS.md | 34 +- docs/classical/golf.md | 395 ++++++++++++++++-------- tools/golf/sweep.py | 1 + tools/golf/table.py | 69 ++++- 43 files changed, 913 insertions(+), 643 deletions(-) create mode 100644 data/golf/machines/blc.blc create mode 100644 data/golf/machines/blc.lam delete mode 100644 data/golf/machines/ko2kp.path delete mode 100644 data/golf/machines/nf.path delete mode 100644 data/golf/machines/pairupKP.path delete mode 100644 data/golf/machines/pairupK_p.path delete mode 100644 data/golf/machines/pairup_Kp.path delete mode 100644 data/golf/machines/uni28.path delete mode 100644 data/golf/machines/uni28_nonstrict.path create mode 100644 data/golf/machines/uniK.blc create mode 100644 data/golf/machines/uniK.lam create mode 100644 data/golf/machines/uniK_lazy.blc create mode 100644 data/golf/machines/uniK_lazy.lam diff --git a/README.md b/README.md index a6edae7b..4dce2c1f 100644 --- a/README.md +++ b/README.md @@ -125,11 +125,12 @@ proven. share. The same reader gives universal machines of 175 (non-strict) and 187 (strict) bits, against Tromp's 178 and 190 ([universal](docs/classical/self-interpreter/universal.md)). -- **The rest of tromp/AIT** ([golf](docs/classical/golf.md)): the IOCCC - BLC8 universal machine shrinks from 43 bytes to 41 (strict) and 38 - (non-strict), the bytewise BLC2 machine from 500 to 399 bits, the programs - behind the KP ≤ KO + c and symmetry-of-information constants by up to 77 - bits, and 45 programs under certified β-golf alone. +- **The rest of tromp/AIT** ([golf](docs/classical/golf.md), sent upstream as + [tromp/AIT#13](https://github.com/tromp/AIT/pull/13)): 40 programs shrink by + 1,143 bits in all. The IOCCC BLC8 universal machine goes from 43 bytes to 38 + (strict) and 36 (non-strict), the bytewise BLC2 machine from 500 to 390 + bits, KP(x) ≤ KO(x) + c from c = 615 to 541, the symmetry-of-information + constants by up to 129 bits, and Loader's number fits in 1781 bits. The qBLC operator census covers the same population. Its successful mass is `3424188513 / 2^40`; entangled successful outputs first occur at 41 bits. diff --git a/contrib/PR_KIT.md b/contrib/PR_KIT.md index d774a57b..4e98fcc6 100644 --- a/contrib/PR_KIT.md +++ b/contrib/PR_KIT.md @@ -6,18 +6,17 @@ instrumental, so they can be written out in full when the PRs go up. ## Where things are -- Two branches on the a9lim/AIT fork, each cut from upstream master: - - `uni-rs`: one commit, `uni.rs` at the repo root. - - `golf`: fourteen commits, one program each, so Tromp can take any subset: - the original eight, then six that move the self-interpreter's reader to - `int.lam`, `uni.lam`, `int4`, `ko2kp`, `nf` and `pairup_Kp`. -- Open each PR from its branch into `tromp/AIT` `master`. Both branches are - three commits behind the fork's master (upstream moved since they were - cut), so rebase each onto current upstream first. -- blam 3.0.0 is released: point every link in the PRs and the letter at the - `v3.0.0` tag (stable permalinks), not at `dev`. The 165's record and the - Lean self-interpreter proofs came after 3.0.0, so link those at a commit - permalink on `dev` or cut a release first. +- Two branches on the a9lim/AIT fork, each rebased on upstream master: + - `uni-rs`: one commit, `uni.rs` at the repo root. Not opened yet. + - `golf`: [tromp/AIT#13](https://github.com/tromp/AIT/pull/13), opened + 2026-10-20 with a short body; Tromp is travelling and will review at the + end of October. 54 commits, one per program and change, so Tromp can take + any subset: the original fourteen (uni8, uni28, int4, ko2kp, nf, the + pairups, then the 165's reader in six programs) and forty more pushed + the same day (below). +- blam 3.0.0 is released: point links at the `v3.0.0` tag where the content + predates it, and at a `dev` commit permalink for the 165's record, the Lean + self-interpreter proofs, and the golf record (`docs/classical/golf.md`). - The fork's `master` is unchanged: upstream plus `uni.rs`. blam's `ref/AIT` pins it, and blam's CI checks that it only *adds* files over upstream. - `golf` modifies upstream files, so it must not land on the fork's master. @@ -44,6 +43,17 @@ instrumental, so they can be written out in full when the PRs go up. `ko2kp`, `nf` and `pairup_Kp`, the verification, and the Lean proofs that the 168 and the 165 are self-interpreters: Claude. - The pairup programs: Codex (keep the old loop only to record `ps`). + - The second round (2026-10-20), by part: + - `uni8` 321 → 304 / 283, `uni28` 416 → 390 / 370, `blc.lam` 195 → 186, + `uniK` 903 → 826 → 599, and the cheaper bottoms (`get get get` in + uni8, `fix fix` in uni2, with the unsolvability proofs): Codex, in + design consults. + - The readable sources for every certified β-descent (nf, ko2kp, the + pairups, uni2, loader, tweet, tree_ordinals and the other BB records, + the list, numeral and sequence programs, bf, mpi, pi, and the rest): + Claude agents. + - Independent re-verification of every result, the BLC2 and truncated + batteries, and the integration: Claude. - The size-search tools and the verification behind every number: Claude, in blam (`blam golf`, `docs/classical/golf.md`). Since 3.0.0 a plain `cargo install blam` includes `blam golf` (no `--features lab`). @@ -82,78 +92,65 @@ instrumental, so they can be written out in full when the PRs go up. `(cat hilbert; echo '12') | ./uni`, if Tromp wants it. - **Credit:** see above. -## PR 2: `golf` - -**Title:** A 165-bit self-interpreter, and smaller sources for uni8, uni28, -int4, ko2kp, nf and the pairup programs - -- **Shape of the PR.** - - Fourteen commits, one per program and change; each commit message - carries its own design note and verification. The last six depend only - on their own program's earlier commit (`int.lam`, `uni.lam` on none). - - Every size is what the current `blc` toolchain gives the new source. - - | program | before | after | - |---|---:|---:| - | `uni8` (BLC8 universal machine) | 355 (IOCCC uni8.Blc: 344) | 321 (41 bytes); non-strict 300 (38 bytes) | - | `uni28` (BLC2 universal machine) | 500 | 416; non-strict 393 | - | `int.lam` (self-interpreter) | 168 | 165 | - | `uni.lam` (universal machine) | 190; non-strict 178 | 187; non-strict 175 | - | `int4` | 189 | 178, then 175 | - | `ko2kp` | 615 | 569, then 566, so KP(x) ≤ KO(x) + 566 | - | `nf` | 600 | 562, then 559 | - | `pairupKP` | 778 | 774 | - | `pairupK_p` | 657 | 653 | - | `pairup_Kp` | 1402 | 1360, then 1357 | - -- **The self-interpreter's reader.** `skipvar` (`\l. l l l`) skips past the - first 0 of any stream. Applied to the whole input before the tag is read, - it is right for both cases: after a leading 0 it gives the stream past the - tag, which the zero branch reads, and after a leading 1 the rest past the - variable, which the variable returns. And `list H (skipvar list)` hands - `list1` to the variable case, which becomes `cont` itself: - `\list. list (\bit0. bit0 (\list1\rest. rest next) cont) (skipvar list)`. - One λ more, one application fewer, one bit less of index: 3 bits. Every - program that embeds `int.lam`'s reader drops 3 bits the same way. -- **The two universal machines.** One bit reader, `get`, serves every read. - In uni8 a refill always lands on a fresh 8-bit byte, so the reader needs - no recursion. -- **The ports.** - - `int4` is rebuilt on `int.lam`'s design. Its cells also swallow the - successor tag bit that follows a 1, and skipvar carries over unchanged. - - `ko2kp`, `nf` and the pairup programs get `int.lam`'s cons'/skipvar - parser in their embedded evaluators. - - The pairup programs keep the old loop only to record the consumed bits. -- **Verification.** Exact normal-form comparison against the originals: - - the universal machines: every closed program up to 18 bits followed by - data; - - ko2kp and nf: every closed program up to 13 bits plus data bits; - - pairup: 60 contract-valid inputs in every IF_DIRTY/IFCPS setting; - pairupKP also on raw pairs of closed programs; - - int4: the exact self-interpreter contract on 236 programs; - - int.lam: the exact contract on every closed program through 21 bits - (3,341), and a Lean proof for every closed program - (`lean/Blc/Selfint165.lean` in blam; the 168's is - `lean/Blc/SelfintProof.lean`); uni.lam: the universal-machine contract on - 667 programs, and strictness probes. - - No differences, and no input halting on only one side. -- **Caveat.** `pairupK_p` and `pairup_Kp` agree with the originals on every - contract-valid input, but differ when the first program is not a valid - description. For example, `p = \x. x` returns the rest of the input - instead of a pair. The second parse then meets an open term, where the two - dirty base environments give different garbage. With `!IFDIRTY` the - differences vanish. -- **More if wanted.** - - A β-only search (let-floating and sharing, which the beam-search - optimizer never does) finds smaller β-convertible terms for 45 - programs in the repo, 470 bits in all. Examples outside this PR: `tweet` - 2230 → 2168, `uniK` 903 → 854, `primes256` 286 → 252. - - The β-only descents of six of this PR's programs (measured before the - reader change) go further still: nf 541, ko2kp 557, uni28 399 - (non-strict 382), pairupKP 771, pairupK_p 651, pairup_Kp 1325. - - These exist only as terms so far. Offer to turn any of them into source. -- **Credit:** see above. +## PR 2: `golf` (tromp/AIT#13, open) + +a9 opened it with the title "165 bit self-interpreter" and a two-line body. +The commit messages carry each change's design note and verification, so +the body can stay short; the comment below summarizes the whole branch for +the review. Posting it is a9's call. + +**Draft comment for #13:** + +> While you're away I've added forty more commits on the same terms: one +> program per commit, each with its design note and how it was checked, so +> you can take any subset. Every size is what your compiler gives the new +> source. Altogether the branch now changes 40 programs and saves 1,143 bits. +> +> | program | before | after | +> |---|---:|---:| +> | `uni8` (BLC8 universal machine) | 355 (IOCCC uni8.Blc: 344, 43 bytes) | 304 (38 bytes); non-strict 283 (36 bytes) | +> | `uni28` (BLC2 over bytes) | 500 | 390; non-strict 370 | +> | `uni2` | 340 | 332; closed-program variant 321 | +> | `int.lam` (self-interpreter) | 168 | 165 | +> | `uni.lam` | 190; non-strict 178 | 187; non-strict 175 | +> | `int4` | 189 | 175 | +> | `blc.lam` | 195 | 186 | +> | `uniK` | 903 | 826 (same algorithm); 599 with eager weakening | +> | `ko2kp` | 615 | 541, so KP(x) ≤ KO(x) + 541 | +> | `nf` | 600 | 538 | +> | `pairupKP` | 778 | 756 | +> | `pairupK_p` | 657 | 651 | +> | `pairup_Kp` | 1402 | 1273 | +> | `loader` | 1797 | 1781 | +> | `tweet` | 2230 | 2134 | +> | `tree_ordinals` | 752 | 726 | +> | 24 more (bf, mpi, pi, SKint, hydra, patcail, primes256, squares, sort, sort2, …) | | 1–34 bits each | +> +> Most of these are β-convertible to your versions: a certified local search +> over let-floating, λ-lifting, sharing and anti-unification (moves your +> beam search, which only reduces, can't make), then written back as +> source. Those have the same normal form, or none, under every input, which +> is what the records need. The machine redesigns (uni8, uni28, blc.lam, +> uniK's eager weakening) aren't β-convertible and were checked by exact +> normal forms instead: every closed program up to 18–20 bits with data, and +> for the byte machines also truncated input, nested self-interpretation, +> and uni.c reproducing take256.blc8 byte for byte. +> +> Two of the machine steps use an unsolvable term as the strict bottom in +> place of Ω: `get get get` in uni8 and `fix fix` in uni2. Each commit +> message has the reduction showing it has no head normal form; by the +> genericity lemma that leaves every program's normal form, or its absence, +> unchanged. +> +> The uniK eager-weakening commit changes the algorithm (the generated +> combinator terms differ, the results don't), so drop it if you'd rather +> keep Kiselyov's lazy weakening at 826. The pairupK_p and pairup_Kp +> caveat from the first commits still applies: they agree on every +> contract-valid input but differ when the first program isn't a valid +> description. +> +> Found with Claude and Codex, as before; the record is +> https://github.com/a9lim/blam/blob/dev/docs/classical/golf.md ## Letter to John @@ -164,8 +161,8 @@ int4, ko2kp, nf and the pairup programs the work. - **The two PRs.** - `uni.rs`: byte-identical with uni.py, about 18× faster. - - `golf`: int.lam 168 → 165, uni.lam 190 → 187 (non-strict 178 → 175), and - the smaller uni8/uni28/int4/ko2kp/nf/pairup sources. + - `golf` (#13, already open): int.lam 168 → 165, uni.lam 190 → 187 + (non-strict 178 → 175), and 38 more programs, 1,143 bits in all. - **His tools in blam (3.0.0).** `blam blc ACTION FILE` is his `blc`, all 31 actions, without GHC; `blam uni` is his universal machine. - Checked byte for byte against his own `blc`, built from AIT with GHC @@ -176,8 +173,10 @@ int4, ko2kp, nf and the pairup programs instant), streams endless output (`primes.lam | head`), and `blam blc blc` reproduces every checked-in `.blc`. - Maybe useful to him: a GHC-free `blc` for people trying the repo. - - The golf sources: the BLC8 machine is down to 41 bytes, and int.lam's - parser is now in ko2kp, nf, int4 and the pairup programs. + - The golf sources: the IOCCC BLC8 machine is down from 43 bytes to 38 + (36 non-strict), KP(x) ≤ KO(x) + 541, pairup_Kp 1402 → 1273, Loader's + number in 1781 bits, and int.lam's parser is now in ko2kp, nf, int4 and + the pairup programs. - **The self-interpreter: 165 bits.** - Palmer's 168 with one change to the reader: skipvar applied to the whole stream before the tag is read is right for both cases (the stream past a diff --git a/data/golf/machines/blc.blc b/data/golf/machines/blc.blc new file mode 100644 index 00000000..646b0996 --- /dev/null +++ b/data/golf/machines/blc.blc @@ -0,0 +1 @@ +010100011010000100000000010111001111100001011100111110000001111000010110110111001111110000111111000010111101001110100101100111100001101100101111100001111100001110011011101001101000011010 diff --git a/data/golf/machines/blc.lam b/data/golf/machines/blc.lam new file mode 100644 index 00000000..0fea9ad0 --- /dev/null +++ b/data/golf/machines/blc.lam @@ -0,0 +1,22 @@ +let + 0 = \x\y.x; + 1 = \x\y.y; + + -- all cont = TREE (\free.term) + -- Every code starts with two bits, so all takes both up front: + -- abstraction and application share the parse of their first subterm, + -- and a variable's second bit is also the first bit of the rest. + all = \cont\bit0\bit1.bit0 + (all (\exp.bit1 + (cont (\args\arg.exp (\z.z arg args))) + (all (\exp2.cont (\args.exp args (exp2 args)))))) + (bit1 (cont (\args.args bit1)) + (all (\var.cont (\args.var (args bit1))) bit1)); -- needed int-e to come up with taking 1 subtree + + blc = all (\z.z z); -- size 186 + + -- inline blc! + 2 = blc 0 0 0 0 0 1 1 1 0 0 1 1 1 0 1 0; + 3 = blc 0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 1 0; + +in blc -- 2 (3 2) diff --git a/data/golf/machines/ko2kp.blc b/data/golf/machines/ko2kp.blc index 05b8aeeb..9039fb27 100644 --- a/data/golf/machines/ko2kp.blc +++ b/data/golf/machines/ko2kp.blc @@ -1 +1 @@ -00000100010001000101111100101010111100010001000011010111110010101011110000000000111101111010000101000110100000000101010111111100101111110011111010011100000001010100110000101111101111000011111001000110000101111111111001011111111110100111000011110011111101011100000000001111011110001011111000010101100010110001100100011010000001010110000101111011100110000000110101000000100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100001111111110000111100000010111011100110111100111110000111110000101111111110011110100111010011010 \ No newline at end of file +0000010001000101111001010101100010001000011010111100101000100010001011011110000101111111000000001010101111111100101111111001111101001110000000101010011000011111000011111001111111100000011100001011100101110100111100001111100111111101011110001000010110000000000111101111011000010101100010110001100111000000101011000011110011000000011010101111000000111100000010000010110000101100000011011111011110010110101000011110000101110011110000111111110000111100000010111011100110111100111110000111110000101111111100111101001110100001000110100001110011010 diff --git a/data/golf/machines/ko2kp.lam b/data/golf/machines/ko2kp.lam index 01f31293..b86e4133 100644 --- a/data/golf/machines/ko2kp.lam +++ b/data/golf/machines/ko2kp.lam @@ -1,23 +1,16 @@ --- tromp/AIT ko2kp.lam with its generic evaluator `uni` replaced by the --- 2025-12 parser design (cons' environment cells, the variable's own code as --- its lookup, skipvar = \l. l l l, the `next` let): 615 -> 569 bits. --- ko2kp.blc (557 bits) is the beta-only descent of this source (blam golf --- component --descend --no-eta), certified step by step by blam golf check --- --path ko2kp.path. Verified against tromp/AIT's ko2kp by --- `blam golf check --io progs --max-bits 14`: every closed program through --- 14 bits followed by up to three data bits, 0 differ, 0 halting on one --- side only. Open programs are outside the KP <= KO + c contract, and the --- two base environments give them different garbage. --- showing KP(x) <= KO(x) + 620 +-- showing KP(x) <= KO(x) + 541 \io\p. let + -- one fixpoint combinator shared by the three recursive functions + Y = \f. (\x. x x) (\x. f (x x)); id = \x. x; true = \t\f. t; false = \t\f. f; - omega = omega; + omega = Y id; -- replace `omega` used as the initial variable context by the closest -- variable; this is fine for closed terms as required by KP. + -- (IF_DIRTY = false gives 563 bits) IF_DIRTY = true; -- generic evaluator -- really just parser + translation to HOAS @@ -30,48 +23,55 @@ -- -> r -- -- (the returned program takes a context defining its free variables) - uni = \abs\app. (\x. x x) (\x. (\uni0. \cnt. - (\next. \xs. xs (\b0\ys. b0 (ys next) (cnt ys (ys ys ys)))) + -- parser after int.lam (cons' cells, the variable's code as its lookup, + -- skipvar), ported by a9lim + uni = \abs\app. Y (\uni0. \cnt. + (\next. \xs. xs (\b0. b0 (\ys\rest. rest next) cnt) (xs xs xs)) (\b1. uni0 (\v1. b1 (cnt (\ctx. abs (\v2. v1 (\zx\zy. zx v2 (zy ctx))))) - (uni0 (\v2. cnt (\ctx. app (v1 ctx) (v2 ctx))))))) - (x x)); + (uni0 (\v2. cnt (\ctx. app (v1 ctx) (v2 ctx))))))); - -- data T = A (V -> V) -- abstraction - -- | V -- free variable - -- | O -- "Omega" marking the end of the available input - caseT = \t\a\v\o. t a v o; - A = \f. \a\v\o. a f; - V = \a\v\o. v; - O = \a\v\o. o; + -- the KP side, scoped to the argument of p that uses it + kp = let + -- data T = A (V -> V) -- abstraction + -- | V -- free variable + -- | O -- "Omega" marking the end of the available input + caseT = \t\a\v\o. t a v o; + V = \a\v\o. v; + O = \a\v\o. o; - nfT = \t. caseT t - (\f. nfT (f V)) -- A: apply to a free variable to further reduce whnf - t -- V: done, this is a normal form - t; -- O: done, we've hit the "Omega" + nfT = Y (\nfT. \t. caseT t + (\f. nfT (f V)) -- A: apply to a free variable to further reduce whnf + t -- V: done, this is a normal form + t); -- O: done, we've hit the "Omega" - appT = \t\u. caseT t - (\f. f u) -- A: apply - (nfT u) -- V: reduce argument to normal form next - t; -- O: preserve O - appT = \t. caseT t (\f. f) nfT (\u. t); -- same but smaller + appT = \t\u. caseT t + (\f. f u) -- A: apply + (nfT u) -- V: reduce argument to normal form next + t; -- O: preserve O + appT = \t. caseT t (\f. f) nfT (\u. t); -- same but smaller - absT = A; + -- pass T's abstraction A = \f. \a\v\o. a f and its application appT to + -- a builder that is generic in both, as uni is + withT = \b. b (\f. \a\v\o. a f) appT; - boolT = \x. absT (\t. absT (\f. x t f)); - consT = \x\xs. absT (\p. appT (appT p x) xs); + -- generic in abstraction and application + boolT = \abs\x. abs (\t. abs (\f. x t f)); + consT = \abs\app\x\xs. abs (\p. app (app p x) xs); - rest = \prog. - let go = \is\xs. - caseT (nfT (appT (prog (IF_DIRTY xs omega)) (is O))) - xs -- A: impossible case - xs -- V: we've found the remainder - -- O: start over with a longer input list - (xs (\x\xs. go (\tl. is (consT (boolT x) tl)) xs)) - in go id; + rest = \prog. + let go = Y (\go. \is\xs. + caseT (nfT (appT (prog (IF_DIRTY xs omega)) (is O))) + xs -- A: impossible case + xs -- V: we've found the remainder + -- O: start over with a longer input list + (xs (\x\xs. go (\tl. is (withT (\abs\app. + consT abs app (boolT abs x) tl))) xs))) + in go id + in withT uni rest in p (uni id id (\prog\rs. prog (IF_DIRTY prog omega) rs) io) - (uni absT appT rest io) + (kp io) -- template for showing KO(x) <= KP(x) + 15: -- 00 01 01 10 01 01 110 = \io. io (\t\f. t) diff --git a/data/golf/machines/ko2kp.path b/data/golf/machines/ko2kp.path deleted file mode 100644 index 68398a0d..00000000 --- a/data/golf/machines/ko2kp.path +++ /dev/null @@ -1,10 +0,0 @@ -00000100010001000101111100101010111100010001000011010111110010101011110000000000111101111010000101000110100000000101010111111100101111110011111010011100000001010100110000101111101111000011111001000000000111101111000010111111111001011111111101000000001111000000000011110011111111111011110110001011111000010101100010110001100100011010000001010110000101111011100110000000110101000000100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100001111111110000111100000010111011100110111100111110000111110000101111111110011110100111010011010 -00000100010001000101111100101010111100010001000011010111110010101011110000000000111101111010000101000110100000000101010111111100101111110011111010011100000001010100110000101111101111000011111001000000000111101111000010111111111001011111111101001000000000111101111000000000011110011111111011110110001011111000010101100010110001100100011010000001010110000101111011100110000000110101000000100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100001111111110000111100000010111011100110111100111110000111110000101111111110011110100111010011010 -00000100010001000101111100101010111100010001000011010111110010100010101111101011000010100011010000000010101011111111001011111110011111010011100000001010100110000101111101111000011111001111111100001011111111110010111111111101001111111110000000000111100111111110111101100010000000000111101111011111000010101100010110001100100011010000001010110000101111011100110000000110101000000100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100001111111110000111100000010111011100110111100111110000111110000101111111110011110100111010011010 -000001000100010001011111001010101111000100010000110101111100101000101011111010110000101000110100000000101010111111110010111111100111110100111000000010101001100001011111011110000111110010001100001011111111111001011111111111010011100000000001111001111111110111101110111111100010000000000111101111011111000010101100010110001100100011010000001010110000101111011100110000000110101000000100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100001111111110000111100000010111011100110111100111110000111110000101111111110011110100111010011010 -00000100010001000101111100101010111100010001000011010111110010101011110000000000111101111010000101000110100000000101010111111100101111110011111010011100000001010100110000101111101111000011111001000110000101111111111001011111111110100111000000000011110011111111101111011100000000001111011110001011111000010101100010110001100100011010000001010110000101111011100110000000110101000000100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100001111111110000111100000010111011100110111100111110000111110000101111111110011110100111010011010 -00000100010001000101111100101010111100010001000011010111110010101011110000000000111101111010000101000110100000000101010111111100101111110011111010011100000001010100110000101111101111000011111001000110000101111111111001011111111110100111000010000000001111011110011111101011100000000001111011110001011111000010101100010110001100100011010000001010110000101111011100110000000110101000000100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100001111111110000111100000010111011100110111100111110000111110000101111111110011110100111010011010 -0000010001000100010111110010101011110001000100001101011111001010001010111110101100001010001101000000001010101111111100101111111001111101001110000000101010011000010111110111100001111100100011000010111111111110010111111111110100111000011111111111001111110101110111111100010000000000111101111011111000010101100010110001100100011010000001010110000101111011100110000000110101000000100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100001111111110000111100000010111011100110111100111110000111110000101111111110011110100111010011010 -00000100010001000101111100101010111100010001000011010111110010100010101111101011000010100011010000000010101011111111001011111110011111010011100000001010100110000101111101111000011111001111111100001011111111110010111111111101001111111110000111111111100111110101100010000000000111101111011111000010101100010110001100100011010000001010110000101111011100110000000110101000000100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100001111111110000111100000010111011100110111100111110000111110000101111111110011110100111010011010 -000001000100010001011111001010101111000100010000110101111100101000101011111010110000101000110100000000101010111111110010111111100111110100111000000010101001100001011111011110000111110010001100001011111111111001011111111111010011100001111001111110101110111111100010000000000111101111011111000010101100010110001100100011010000001010110000101111011100110000000110101000000100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100001111111110000111100000010111011100110111100111110000111110000101111111110011110100111010011010 -00000100010001000101111100101010111100010001000011010111110010101011110000000000111101111010000101000110100000000101010111111100101111110011111010011100000001010100110000101111101111000011111001000110000101111111111001011111111110100111000011110011111101011100000000001111011110001011111000010101100010110001100100011010000001010110000101111011100110000000110101000000100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100001111111110000111100000010111011100110111100111110000111110000101111111110011110100111010011010 diff --git a/data/golf/machines/nf.blc b/data/golf/machines/nf.blc index e9c43fdf..ddb2da66 100644 --- a/data/golf/machines/nf.blc +++ b/data/golf/machines/nf.blc @@ -1 +1 @@ -0100010110000001000001100000010111001101111001011111101001011010100001111000010111001111000000000011110000111111100000010111011100110111111100111110000111110000101000100010101110001000110100000000000010111011111101111001111010011101000010101110000001000001010111100000011111001111100101011111110011100000000110111111000000111001011111101101010000000011111100100000101100000101100101011111111011101111001010111111110110111101000000101110000110000010010111100000010110000010110011111010000001011000001101100110100000100001000110100001110011010 \ No newline at end of file +0100010110000001000001011000010110000001101111101111001011010100001111000010111001111000000000011110000111111100000010111011100110111111100111110000111110000101000100010101110001000110100000000000010111011111101111001111010011101000010101110000001000001010111100000011111001111100101011111110011100000000110111111000000111001011111101101010000000011111100100000101100000101100101011111111011101111001010111111110110111101000000101110000110000010010111100000010110000010110011111010000001011000001101100110100000100001000110100001110011010 diff --git a/data/golf/machines/nf.lam b/data/golf/machines/nf.lam index c8575af8..859cbf03 100644 --- a/data/golf/machines/nf.lam +++ b/data/golf/machines/nf.lam @@ -1,22 +1,15 @@ --- tromp/AIT nf.lam with its parser `parseval` replaced by the 2025-12 design --- (cons' environment cells, the variable's own code as its lookup, --- skipvar = \l. l l l, the `next` let): 600 -> 562 bits. nf.blc (541 bits) --- is the beta-only descent of this source, certified step by step by --- blam golf check --path nf.path. Verified against tromp/AIT's nf by --- `blam golf check --io progs --max-bits 16`: every closed program through --- 16 bits followed by up to three data bits, 3,390 inputs, all identical. -- nf outputs the normal form of the input blc term let + -- one fixpoint combinator shared by both recursive functions + Y = \f. (\x. x x) (\x. f (x x)); + id = \x.x; true = \t\f.t; false = \t\f.f; nil = false; cons = \x\y\z. z x y; - cons0 = cons true; cons1 = cons false; compose = \f\g\x. f (g x); - cons00 = compose cons0 cons0; - cons01 = compose cons0 cons1; tail = \l. l false; succ = \n\f\x.f (n f x); zero = false; @@ -30,21 +23,30 @@ let A = \t1\t2. \l\a\v. a t1 t2; V = \d. \l\a\v. v d; - parseval = (\x. x x) (\x. (\parseval. \cont. - (\next. \xs. xs (\b0\ys. b0 (ys next) (cont ys (ys ys ys)))) + -- apply t to u: beta reduce if t is a Lam, else build an App; + -- A1 drops V's field, and under one more \_ both of A's + appT = \t. let A1 = \_. A t in caseT t id (\_. A1) A1; + + -- parser after int.lam (cons' cells, the variable's code as its lookup, + -- skipvar), ported by a9lim + parseval = Y (\parseval. \cont. + (\next. \xs. xs (\b0. b0 (\ys\rest. rest next) cont) (xs xs xs)) (\b1. parseval (\t1. b1 (cont (\ctx. L (\v. t1 (\zx\zy. zx v (zy ctx))))) - (parseval (\t2. cont (\ctx. let tc1 = t1 ctx; A1 = A tc1 - in tc1 (\f. f) (\_\_. A1) (\_. A1) (t2 ctx))))))) - (x x)); + (parseval (\t2. cont (\ctx. appT (t1 ctx) (t2 ctx))))))); - ser = \t\lvl. caseT t + -- cons0 is bound inside ser, where its de Bruijn index is small + ser = Y (\ser. \t. let + cons0 = cons true; + cons00 = compose cons0 cons0; + cons01 = compose cons0 cons1 + in \lvl. caseT t -- Lambda: apply to a free variable to further reduce whnf (\f. compose cons00 (ser (f (V lvl)) (succ lvl))) -- Application (\t1\t2. compose cons01 (compose (ser t1 lvl) (ser t2 lvl))) -- Variable - (\v. compose (v tail) (compose (lvl cons1) cons0)); + (\v. compose (v tail) (compose (lvl cons1) cons0))); nf = parseval (\t. ser (t t) zero) in nf diff --git a/data/golf/machines/nf.path b/data/golf/machines/nf.path deleted file mode 100644 index 6d29bc56..00000000 --- a/data/golf/machines/nf.path +++ /dev/null @@ -1,10 +0,0 @@ -0100010100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100000000001111000011111110000001011101110011011111110011111000011111000010001000101010111000100000111000110011111011100000000001011101111101111001111010011010000101010001101000010000000101011100000011111111100111111111001010111111001110000000011011111100000011100101111110110101000000001111111111001000001011000001011001010111111101110111100101011111110110111101000000101110000110000010010111100000010110000010110011111111101001101001101000001000000101100000110110 -01000101000110100001000001000001100000010111001101111001011111101001011010100001111000010111001111000000000011110000111111100000010111011100110111111100111110000111110000100010001010101110001000001110001100111110111000000000010111011111011110011110100110100001010100011010000100000100000101011110000001111100111110010101111111001110000000011011111100000011100101111110110101000000001111110010000010110000010110010101111111101110111100101011111111011011110100000010111000011000001001011110000001011000001011001111101011111001101001101000001000000101100000110110 -0101000110100001000001000001100000010111001101111001011111101001011010100001111000010111001111000000000011110000111111100000010111011100110111111100111110000111110000100010001010101110001000001110001100111110111000000000010111011111011110011110100110100001010100011010000100000100000101011110000001111100111110010101111111001110000000011011111100000011100101111110110101000000001111110010000010110000010110010101111111101110111100101011111111011011110100000010111000011000001001011110000001011000001011001111101000000101100000110110011010011010000010 -01010001101000010000010000011000000101110011011110010111111010010110101000011110000101110011110000000000111100001111111000000101110111001101111111001111100001111100001000100010100010101111000100011010001100111110111000000000010111011111011110011110100110100001010100011010000100000100000101011110000001111100111110010101111111001110000000011011111100000011100101111110110101000000001111110010000010110000010110010101111111101110111100101011111111011011110100000010111000011000001001011110000001011000001011001111101000000101100000110110011010011010000010 -01010001101000010000010000011000000101110011011110010111111010010110101000011110000101110011110000000000111100001111111000000101110111001101111111001111100001111100001000101000101011100010001101000000000000101110111111011110011110110011110100110100001010100011010000100000100000101011110000001111100111110010101111111001110000000011011111100000011100101111110110101000000001111110010000010110000010110010101111111101110111100101011111111011011110100000010111000011000001001011110000001011000001011001111101000000101100000110110011010011010000010 -01010001101000010000010000011000000101110011011110010111111010010110101000011110000101110011110000000000111100001111111000000101110111001101111111001111100001111100001000101000100010101110001000110100000000000010111011111101111010011110110011110100110100001010100011010000100000100000101011110000001111100111110010101111111001110000000011011111100000011100101111110110101000000001111110010000010110000010110010101111111101110111100101011111111011011110100000010111000011000001001011110000001011000001011001111101000000101100000110110011010011010000010 -010100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100000000001111000011111110000001011101110011011111110011111000011111000010100010001010111000100011010000000000001011101111110111100111101001110100110100001010100011010000100000100000101011110000001111100111110010101111111001110000000011011111100000011100101111110110101000000001111110010000010110000010110010101111111101110111100101011111111011011110100000010111000011000001001011110000001011000001011001111101000000101100000110110011010011010000010 -01010001101000010000010000011000000101110011011110010111111010010110101000011110000101110011110000000000111100001111111000000101110111001101111111001111100001111100001010001000101011100010001101000000000000101110111111011110011110100111010011010000101010001101000010100000001000001010111100000011111001111100101011111110011100000000110111111000000111001011111101101010000000011111100111111111001010111111110111011110010101111111101101111010000001011100001100000100101111011111110011111010000001011000001101100000010110000010110011010011010000010 -010001011000000100000110000001011100110111100101111110100101101010000111100001011100111100000000001111000011111110000001011101110011011111110011111000011111000010100010001010111000100011010000000000001011101111110111100111101001110100001010111001000000010000010101111000000111110011111001010111111100111000000001101111110000001110010111111011010100000000111111001111111110010101111111101110111100101011111111011011110100000010111000011000001001011110111111100111110100000010110000011011000000101100000101100110100000100001000110100001110011010 -0100010110000001000001100000010111001101111001011111101001011010100001111000010111001111000000000011110000111111100000010111011100110111111100111110000111110000101000100010101110001000110100000000000010111011111101111001111010011101000010101110000001000001010111100000011111001111100101011111110011100000000110111111000000111001011111101101010000000011111100100000101100000101100101011111111011101111001010111111110110111101000000101110000110000010010111100000010110000010110011111010000001011000001101100110100000100001000110100001110011010 diff --git a/data/golf/machines/pairupKP.blc b/data/golf/machines/pairupKP.blc index efe3c63c..21a159a9 100644 --- a/data/golf/machines/pairupKP.blc +++ b/data/golf/machines/pairupKP.blc @@ -1 +1 @@ -000100010001000101000101011011110000101000110100000000001010101111111110010111111110011111101001111000000010100001000101110011011111111111100101101110011111000001001010101111111111100010001000100010011000010101111110111110000111111001111111110000001110000101110010111010000000011110000111111110011111111110101111000011111000010110111011000100010000101100000000001111011110110111100001010110001011000110010001101000000101011000010111101110011000000011010100000010001101000000000010101100001000000000111100001010111111100111100001011100111100001111111111111110000111100000010111011100110111100111110000111110000101111111111111110011110100111010010110011101111001000000111001010111100001111011111011111011110000111111100001011011101100001111100001011011101100111110111101110 \ No newline at end of file +000101000101000001010101110000000000111101111010000101000110100000000001010101111111110010111111100111111010011110000000101000010001011100110111111111110010110111001111100000100101010111111111000100010001000100110000101011111101111100001111110010001100001011111111111001011111111111010011100001111001111110101110000000000111101111000011111000010110111011000100010000001000110100000000001010110000100000000011110000101011111110011110000101110011110000111111111111111000011110000001011101110011011110011111000011111000010111111111111111001111010011101001011001110111100100000011100101011110000111101111101111101111000011111110000101101110110000111110000101101110110011111011110111000010101100010110001100100011010000001010110000101111011100110000000110101010 diff --git a/data/golf/machines/pairupKP.lam b/data/golf/machines/pairupKP.lam index 748aaaa5..31ff24d1 100644 --- a/data/golf/machines/pairupKP.lam +++ b/data/golf/machines/pairupKP.lam @@ -1,31 +1,44 @@ --- tromp/AIT pairupKP.lam (778 bits) with the 2025-12 parser design ported in. --- Port (Codex, 2026-10-12): environment cells become cons' cells and the --- variable's value is the stream after its leading 1, which looks itself up; --- the old bit-by-bit variable loop stays, only to record the consumed bits --- `ps`, which skipvar would not. --- This source compiles to 774; pairupKP.blc (771 bits) is its beta-only --- descent, certified step by step by blam golf check --path pairupKP.path. --- Verified against tromp/AIT's pairupKP by `blam golf check --io pairs --- --max-bits 16` (two closed programs then a data bit: 0 differ, 0 halting --- on one side only) and by 60 contract-valid inputs whose normal forms --- match an independently constructed expected result. --- See docs/classical/golf.md. -- pairup operator for KP. -- -- pairup (ps ++ pi ++ qs ++ qi) evaluates to , provided that -- 1) ps and qs represent the lambda calculus programs p and q, respectively, -- 2) p (pi ++ Omega) evaluates to the normal form po -- 3) q qi (ps ++ pi) evaluates to qo. -\io. let +-- +-- The definitions form three nested scopes: the first doesn't mention uni, +-- the second defines uni, and the third takes appT as a parameter, applied +-- from outside the second, so that appT's reference to nfT stays one binder +-- shallower. The whole input io is applied outside all of them. +\io. (let id = \x.x; true = \x\y.x; false = \x\y.y; nil = false; omega = omega; - -- IF_DIRTY: 784 bits / !IF_DIRTY: 823 bits + -- IF_DIRTY: 756 bits / !IF_DIRTY: 795 bits IF_DIRTY = true; + -- data T = A (V -> V) -- abstraction + -- | V -- free variable + -- | O -- "Omega" marking the end of the available input + caseT = \t\a\v\o. t a v o; + A = \f. \a\v\o. a f; + V = \a\v\o. v; + O = \a\v\o. o; + + nfT = \t. caseT t + (\f. nfT (f V)) -- A: apply to a free variable to further reduce whnf + t -- V: done, this is a normal form + t; -- O: done, we've hit the "Omega" + + appT = \t\u. caseT t + (\f. f u) -- A: apply + (nfT u) -- V: reduce argument to normal form next + t; -- O: preserve O + -- the smaller appT actually used is passed in at the end + +in (let ---------------------------------------------------------------------------- -- parse binary lambda calculus using HOAS, capturing program. -- uni :: ((t -> t) -> t) -- abstraction @@ -36,9 +49,11 @@ -- -> [Bool] -- input -- -> r - -- cons' lookup: the original ys stream is the variable's value. + -- cons' lookup (after int.lam, ported by a9lim): the original ys stream + -- is the variable's value. -- Keep the old bit-recording recursion for ps; discard its variable value. -- The initial ys captured by cnt stays intact across every unary step. + -- The recursion past a unary 1 is bound outside the two arguments it ignores. uni = \abs\app.let uni0 = \cnt\ps\xs. xs (\b0.let ps0 = \ts.ps (\p.p b0 ts) in \ys\uni0\cnt.ys (\b1. @@ -46,33 +61,16 @@ b0 (uni0 (\v1.(b1 (cnt (\ctx.abs (\v2.v1 (\zx\zy.zx v2 (zy ctx))))) (uni0 (\v2.cnt (\ctx.app (v1 ctx) (v2 ctx))))))) (b1 (cnt ys) - (\d\d.uni0 (\v.cnt ys) ps0 ys)) ps1)) uni0 cnt + (let more = uni0 (\v.cnt ys) ps0 ys in \d\d.more)) ps1)) uni0 cnt in uni0; - -- data T = A (V -> V) -- abstraction - -- | V -- free variable - -- | O -- "Omega" marking the end of the available input - caseT = \t\a\v\o. t a v o; - A = \f. \a\v\o. a f; - V = \a\v\o. v; - O = \a\v\o. o; - - nfT = \t. caseT t - (\f. nfT (f V)) -- A: apply to a free variable to further reduce whnf - t -- V: done, this is a normal form - t; -- O: done, we've hit the "Omega" - - appT = \t\u. caseT t - (\f. f u) -- A: apply - (nfT u) -- V: reduce argument to normal form next - t; -- O: preserve O - appT = \t. caseT t (\f. f) nfT (\u. t); -- same but smaller - +in \appT. let absT = A; boolT = \x. absT (\t. absT (\f. x t f)); consT = \x\xs. absT (\p. appT (appT p x) xs); - + consBitT = \x\xs. let abs = absT in -- consT (boolT x) xs, sharing absT + abs (\p. appT (appT p (abs (\t. abs (\f. x t f)))) xs); result = \pspi\rs. \p. let uni1 = uni id id (\prog\ps\rs. prog (IF_DIRTY ps omega) rs) id in @@ -84,13 +82,15 @@ xs -- A: impossible case (result (pspi nil) xs) -- V: we've found the remainder -- O: start over with a longer input list - (xs (\x\xs. go (\tl. is (consT (boolT x) tl)) + (xs (\x\xs. go (\tl. is (consBitT x tl)) (\tl. pspi (\p. p x tl)) xs)) in go id ps; - pairup = uni absT appT rest id io; + pairup = uni absT appT rest id; -in pairup +in pairup) + (\t. caseT t (\f. f) nfT (\u. t)) -- appT, same but smaller + ) io -- 0 -> 0 aka "" -- 1 0 "" -> 0+1 = 1 aka "0" diff --git a/data/golf/machines/pairupKP.path b/data/golf/machines/pairupKP.path deleted file mode 100644 index 558a46a8..00000000 --- a/data/golf/machines/pairupKP.path +++ /dev/null @@ -1,6 +0,0 @@ -000100010001000101010101111000000000011110111101000010100011010000000000101010111111110010111111100111111010011110000000101000010001011100110111111111110010110111001111100000100101010111111111100010001000100010011000010101111110111110000111111001000000000111101111000010111111111100101111111111010000000011110000000000111100111111111110111101100001111100001011011101100010001011110000101011000101100011001000110100000010101100001011110111001100000001101010000001000110100000000001010110000100000000011110000101011111110011110000101110011110000111111111111111000011110000001011101110011011110011111000011111000010111111111111111001111010011101001011001110111100000010101111110000111111011111110111111101111110000111111100001011011101100001111100001011011101100111110111101110 -0001000100010001010101011110000000000111101111010000101000110100000000001010101111111100101111111001111110100111100000001010000100010111001101111111111100101101110011111000001001010101111111111000100010001000100110000101011111101111100001111110010000000001111011110000101111111111001011111111110100000000111100000000001111001111111111101111011000011111000010110111011000100010111100001010110001011000110010001101000000101011000010111101110011000000011010100000010001101000000000010101100001000000000111100001010111111100111100001011100111100001111111111111110000111100000010111011100110111100111110000111110000101111111111111110011110100111010010110011101111001000000111001010111100001111011111011111011110000111111100001011011101100001111100001011011101100111110111101110 -0001000100010001010101011110000000000111101111010000101000110100000000001010101111111100101111111001111110100111100000001010000100010111001101111111111100101101110011111000001001010101111111111000100010001000100110000101011111101111100001111110010000000001111011110000101111111111001011111111110100000000111100001000000000111101111001111111101011000011111000010110111011000100010111100001010110001011000110010001101000000101011000010111101110011000000011010100000010001101000000000010101100001000000000111100001010111111100111100001011100111100001111111111111110000111100000010111011100110111100111110000111110000101111111111111110011110100111010010110011101111001000000111001010111100001111011111011111011110000111111100001011011101100001111100001011011101100111110111101110 -00010001000100010101010111100000000001111011110100001010001101000000000010101011111111001011111110011111101001111000000010100001000101110011011111111111001011011100111110000010010101011111111110001000100010001001100001010111111011111000011111100100010000000001111011110000101110010111010000000011110000100000000011110111100111111111010111011111111000011111000010110111011000100010111100001010110001011000110010001101000000101011000010111101110011000000011010100000010001101000000000010101100001000000000111100001010111111100111100001011100111100001111111111111110000111100000010111011100110111100111110000111110000101111111111111110011110100111010010110011101111001000000111001010111100001111011111011111011110000111111100001011011101100001111100001011011101100111110111101110 -000100010001000101010101111000000000011110111101000010100011010000000000101010111111110010111111100111111010011110000000101000010001011100110111111111110010110111001111100000100101010111111111100010001000100010011000010101111110111110000111111001010000011100001011100101110100000000111100001111111100111111111101011110000000000111101111011111111000011111000010110111011000100010111100001010110001011000110010001101000000101011000010111101110011000000011010100000010001101000000000010101100001000000000111100001010111111100111100001011100111100001111111111111110000111100000010111011100110111100111110000111110000101111111111111110011110100111010010110011101111001000000111001010111100001111011111011111011110000111111100001011011101100001111100001011011101100111110111101110 -000100010001000101000101011011110000101000110100000000001010101111111110010111111110011111101001111000000010100001000101110011011111111111100101101110011111000001001010101111111111100010001000100010011000010101111110111110000111111001111111110000001110000101110010111010000000011110000111111110011111111110101111000011111000010110111011000100010000101100000000001111011110110111100001010110001011000110010001101000000101011000010111101110011000000011010100000010001101000000000010101100001000000000111100001010111111100111100001011100111100001111111111111110000111100000010111011100110111100111110000111110000101111111111111110011110100111010010110011101111001000000111001010111100001111011111011111011110000111111100001011011101100001111100001011011101100111110111101110 diff --git a/data/golf/machines/pairupK_p.blc b/data/golf/machines/pairupK_p.blc index 9537a551..0fd20d46 100644 --- a/data/golf/machines/pairupK_p.blc +++ b/data/golf/machines/pairupK_p.blc @@ -1 +1 @@ -010001010101100000110000110000010000000010001011001111011000000101011110100101010101010111111101010010111110010001101000000000000101101100001010101100000100000000111111111011000001001011111001111111011111100001111100001011011111110110111110000010000000001000001100000100000000101100001011011111101111011001010101111100010001000101000100000010001101000000000010101100001000000000111100001010111111100111100001011100111100001111111111111110000111100000010111011100110111100111110000111110000101111111111111110011110100111010010110011101111001000000111001010111100001111011111011111011110000111111100001011011101100001111100001011011101100111110111101110 \ No newline at end of file +010001010101100000110000110000010000000010001011001111011000000101011110100101010101010111111101010010111110010001101000000000000101101100001010101100000100000000111111111011000001001011111001111111011111100001111100001011011111110110111110000010000000001000001100000100000000101100001011011111101111011001010101111100010001000101000100000010001101000000000010101100001000000000111100001010111111100111100001011100111100001111111111111110000111100000010111011100110111100111110000111110000101111111111111110011110100111010010110011101111001000000111001010111100001111011111011111011110000111111100001011011101100001111100001011011101100111110111101110 diff --git a/data/golf/machines/pairupK_p.lam b/data/golf/machines/pairupK_p.lam index 0d46a1f9..36427073 100644 --- a/data/golf/machines/pairupK_p.lam +++ b/data/golf/machines/pairupK_p.lam @@ -1,20 +1,3 @@ --- tromp/AIT pairupK_p.lam (657 bits) with the 2025-12 parser design ported in. --- Port (Codex, 2026-10-12): environment cells become cons' cells and the --- variable's value is the stream after its leading 1, which looks itself up; --- the old bit-by-bit variable loop stays, only to record the consumed bits --- `ps`, which skipvar would not. --- This source compiles to 653; pairupK_p.blc (651 bits) is its beta-only --- descent, certified step by step by blam golf check --path pairupK_p.path. --- Verified on 60 contract-valid inputs (payload indices to 12, nesting, --- consumed data), whose normal forms match the original and an --- independently constructed expected result. It differs from the original --- on 24 of the 182 raw `golf check --io pairs` inputs, all outside the --- contract: the first program is not a valid description (p = \x.x hands --- back the rest of the input instead of a pair), so the second parse --- starts inside the second program and meets an open term, where the old --- dirty base environment and the new one give different garbage. With --- divergent base environments in both, the raw differences vanish. --- See docs/classical/golf.md. -- pairup operator for Kp. -- pairup (ps ++ pi ++ qs ++ qi) evaluates to <, rs>, provided that -- 1) ps and qs represent the lambda calculus programs p and q, respectively, @@ -27,8 +10,8 @@ let nil = false; -- Enabling IFDIRTY replaces some omegas by suitable variables to save space. - -- IFDIRTY, !CPS: 657 bits / CPS: 718 - -- !IFDIRTY, !CPS: 787 bits / CPS: 787 + -- IFDIRTY, !CPS: 651 bits / CPS: 712 + -- !IFDIRTY, !CPS: 777 bits / CPS: 791 IFDIRTY = true; IFCPS = false; @@ -42,9 +25,11 @@ let -- -- In the continuation, ps contains the consumed bits as a difference list. - -- cons' lookup: the original ys stream is the variable's value. + -- cons' lookup (after int.lam, ported by a9lim): the original ys stream + -- is the variable's value. -- Keep the old bit-recording recursion for ps; discard its variable value. -- The initial ys captured by cnt stays intact across every unary step. + -- The recursion past a unary 1 is bound outside the two arguments it ignores. uni = \abs\app.let uni0 = \cnt\ps\xs. xs (\b0.let ps0 = \ts.ps (\p.p b0 ts) in \ys\uni0\cnt.ys (\b1. @@ -52,7 +37,7 @@ let b0 (uni0 (\v1.(b1 (cnt (\ctx.abs (\v2.v1 (\zx\zy.zx v2 (zy ctx))))) (uni0 (\v2.cnt (\ctx.app (v1 ctx) (v2 ctx))))))) (b1 (cnt ys) - (\d\d.uni0 (\v.cnt ys) ps0 ys)) ps1)) uni0 cnt + (let more = uni0 (\v.cnt ys) ps0 ys in \d\d.more)) ps1)) uni0 cnt in uni0; ---------------------------------------------------------------------------- diff --git a/data/golf/machines/pairupK_p.path b/data/golf/machines/pairupK_p.path deleted file mode 100644 index 43c26682..00000000 --- a/data/golf/machines/pairupK_p.path +++ /dev/null @@ -1,2 +0,0 @@ -01000101010110000011000011000001000000001000101100111101100000010101111010010101010101011111110101001011111001000110100000000000010110110000101010110000010000000011111111101100000100101111100111111101111110000111110000101101111111011011111000001000000000100000110000010000000010110000101101111110111101100101010111110001000100010100010000001000110100000000001010110000100000000011110000101011111110011110000101110011110000111111111111111000011110000001011101110011011110011111000011111000010111111111111111001111010011101001011001110111100000010101111110000111111011111110111111101111110000111111100001011011101100001111100001011011101100111110111101110 -010001010101100000110000110000010000000010001011001111011000000101011110100101010101010111111101010010111110010001101000000000000101101100001010101100000100000000111111111011000001001011111001111111011111100001111100001011011111110110111110000010000000001000001100000100000000101100001011011111101111011001010101111100010001000101000100000010001101000000000010101100001000000000111100001010111111100111100001011100111100001111111111111110000111100000010111011100110111100111110000111110000101111111111111110011110100111010010110011101111001000000111001010111100001111011111011111011110000111111100001011011101100001111100001011011101100111110111101110 diff --git a/data/golf/machines/pairup_Kp.blc b/data/golf/machines/pairup_Kp.blc index 7245f9ec..dc61eafd 100644 --- a/data/golf/machines/pairup_Kp.blc +++ b/data/golf/machines/pairup_Kp.blc @@ -1 +1 @@ -01000001011101000000101011111010010100010100011010000100000001100000011000010001011111001111111100000010111110010111111111000011111001111010000000011110111100111111111100000010111111111110000111111100111111001111010000000010111011111101111000010101000110100000000110000101100111100001100010010111110111100001111100111111111111111101000010111111111000011111001010111000001101110100000000110111101111000000101101111100001011011110111001101000000001111001010101010101010001000110100000000000010101010001010100011010000100000001010111000000000011110000101111111110111110000101101101111111000000101010101111110110111000011001011111110110111100000001000000010000101100000011000001101100110100000000101110001111100111111111110000010000000001100000010111011111100111111000000001101111111011011001100001010101111111011111101111100100000111111100000000111100000000101110000000010111000000001100001100010111111111110111111100111111110100111111111111011100001000000000111100000000111100000000110010111111111110001000011000100110111110110001000011000101000001101000001000000001100001111100001111100000010110111100111101101110000000010110000101101111110111101100101000110100001000001000001100000010111001101111001011111101001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001101000011010 \ No newline at end of file +0100000101110100000010101111101001010001010001101000010000000110000001100001000101111100111111110000001011111001011110110000000011110111100111111111100000010111111000011111100111101000000001011101111110111100001010100011010000000011000010110011110000110001001011111011110000111110011111111111111110100001011110010110000011011000000001101111011110000111111100000010110111111000010110111110011111011100110100000000111100101010101010101000110100100000000000001010101010100011010000100000001010111000000000011110000101111111110111110000101101101111111000000101010101111110110111000011001011111110110111100000001000000010000101100000011000001101100110100101111111000000101110111111001111110000000011011111110000010000000001101101100110000101010111111101111110111110000111111001000000000111100011111000000101110010111111111110000001100001100010111101110011111111111101110000001000000000101110001111111000000001111000000001111000000001101111111111111001010110111111000100001100010110001000011000101000001101000001000000001100001111100001111100000010110111100111101101110000000010110000101101111110111101100101000110100001000001000001011000010110000001101111101111001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001101000011010 diff --git a/data/golf/machines/pairup_Kp.lam b/data/golf/machines/pairup_Kp.lam index ada2643c..372ab85f 100644 --- a/data/golf/machines/pairup_Kp.lam +++ b/data/golf/machines/pairup_Kp.lam @@ -1,17 +1,3 @@ --- tromp/AIT pairup_Kp.lam (1402 bits) with the 2025-12 parser design ported in. --- Port (Codex, 2026-10-12): its interpreter `intL` is replaced by the --- cons'/skipvar one; the separate prefix-capture machinery is unchanged. --- This source compiles to 1360; pairup_Kp.blc (1325 bits) is its beta-only --- descent, certified step by step by blam golf check --path pairup_Kp.path. --- Verified on 60 contract-valid inputs (payload indices to 12, nesting, --- consumed data), whose normal forms match the original and an --- independently constructed expected result. It differs from the original --- on 24 of the 182 raw `golf check --io pairs` inputs (and halts on 5 where --- the original runs out of budget), all outside the contract, as for --- pairupK_p: an invalid first program shifts the second parse into an open --- term. With divergent base environments in both, the raw differences --- vanish. --- See docs/classical/golf.md. -- this is a rather inefficient pairup for Kp -- a much better one is in pairupKp.lam, while pairupKP.lam is for the new prefix complexity let @@ -21,51 +7,62 @@ let id = \x.x; -- numbers a la splitAt: n cont list = cont prefix_take_n_list drop_n_list zero = \cont.cont id; - succ = \n\cont\list.list (\h.n (\pref.cont (\r\z.z h (pref r)))); -- binary LC interpreter + -- parser after int.lam (cons' cells, the variable's code as its lookup, + -- skipvar), ported by a9lim intL = (\x. x x) (\x. let intL = x x in \cont. let next = (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args)))))) - in \list.list (\bit0\list1.bit0 (list1 next) - (cont list1 (list1 list1 list1)))); + in \list.list (\bit0.bit0 (\list1\rest. rest next) cont) (list list list)); + -- program list returns the program at the start of binary stream list + -- its helpers are local to it, which makes it a closed term + program = let + succ = \n\cont\list.list (\h.n (\pref.cont (\r\z.z h (pref r)))); + -- read varables of the form 1 1^k 0 + readvar = \cont\list.list (\bit0.bit0 + (cont zero) + (readvar (\v.cont (succ v)))); + -- binary LC parser + readc = \cont\list.list (\bit0\list1.list1 (\bit1. + -- continue with bit0 bit1 in front of the bits read by pref + let cont01 = \pref.cont (\suff\z.z bit0 (\z.z bit1 (pref suff))) in + bit0 + (readc (\pref1\exp1.bit1 + (cont01 pref1 (\l\a\v.l exp1)) + (readc (\pref2\exp2.cont01 (\suff.pref1 (pref2 suff)) + (\l\a\v.a exp1 exp2))))) + (\list2.readvar (\var.cont01 (var true list2) + (\l\a\v.v var)) list1))); + -- partial symbolic reduction using Thorsten Altenkirch's technique + eval = \term\env.term + (\body\f\k\n.f (\x.eval body (\z.z x env))) + (\term1\term2.(eval term1 env) (\f.f (eval term2 env)) (\f\k\n.n) (\f\k\n.n)) + (\var.var (\pref\rest.rest true) env); + -- mink returns the smallest number of at least k bits of data that prog + -- will "read" from it to produce a pair <_,restofdata> + -- it does so by symbolically reducing prog applied to data applied to false + -- note that variable (\l\a\v.v k) is free in the expression + -- one k is just a dummy since the reduction should never yield a lambda + -- (the knot is written out to bind appsym outside its self-application) + mink = (\x. x x) (let + -- application and variable terms below are written \l.(\a\v. ...), so + -- that their \a\v part can be built outside the binders it doesn't use + -- appsym m b is the term \l.m applied to the term for bit b + appsym = \m\b.let n = b succ id zero in + \l\a\v.a (\l.m) (\l\a\v.l (\l\a\v.l (\l\a\v.v n))); + in \x. let mink = x x in \prog\prefsymbits\k\data. + eval (appsym (\a\v.a prog (prefsymbits (\l\a\v.v k))) false) + (\z\f\k\n.k) + k + k + (data (\b.mink prog (\z.prefsymbits (let body = \a\v.a + (appsym (\a\v.v zero) b) z in \l\a\v.l (\l.body)))(succ k)))); + in readc (\pref\prog\data.pref ((mink prog id zero data) true data false)); -- binary LC universal machine allowing open programs + -- (defined after program, so that blc keeps one shared copy) uniL1 = intL (\x.x x); - -- read varables of the form 1 1^k 0 - readvar = \cont\list.list (\bit0.bit0 - (cont zero) - (readvar (\v.cont (succ v)))); - -- binary LC parser - readc = \cont\list.list (\bit0\list1.list1 (\bit1.(\pref01.bit0 - (readc (\pref1\exp1.bit1 - (cont (\suff.pref01 (pref1 suff)) (\l\a\v.l exp1)) - (readc (\pref2\exp2.cont (\suff.pref01 (pref1 (pref2 suff))) - (\l\a\v.a exp1 exp2))))) - (\list2.readvar (\var.cont (\suff.pref01 (var true list2 suff)) - (\l\a\v.v var)) list1)) - (\suff\z.z bit0 (\z.z bit1 suff)))); - -- partial symbolic reduction using Thorsten Altenkirch's technique - eval = \term\env.term - (\body\f\k\n.f (\x.eval body (\z.z x env))) - (\term1\term2.(eval term1 env) (\f.f (eval term2 env)) (\f\k\n.n) (\f\k\n.n)) - (\var.var (\pref\rest.rest true) env); - symbit = \x\l\a\v.l (\l\a\v.l (\l\a\v.v (x succ id zero))); - -- mink returns the smallest number of at least k bits of data that prog - -- will "read" from it to produce a pair <_,restofdata> - -- it does so by symbolically reducing prog applied to data applied to false - -- note that variable (\l\a\v.v k) is free in the expression - -- one k is just a dummy since the reduction should never yield a lambda - mink = \prog\prefsymbits\k\data. - eval (\l\a\v.a (\l\a\v.a - prog (prefsymbits (\l\a\v.v k))) (symbit false)) - (\z\f\k\n.k) - k - k - (data (\b.mink prog (\z.prefsymbits (\l\a\v.l (\l\a\v.a - (\l\a\v.a (\l\a\v.v zero) (symbit b)) z)))(succ k))); - -- program list returns the program at the start of binary stream list - program = readc (\pref\prog\data.pref ((mink prog id zero data) true data false)); -- pairup listpq returns <,z> if the binary stream listpq -- starts with a program p for x, followed by a program q for -- computing y given p, followed by the remainder stream z diff --git a/data/golf/machines/pairup_Kp.path b/data/golf/machines/pairup_Kp.path deleted file mode 100644 index b3f0aaf4..00000000 --- a/data/golf/machines/pairup_Kp.path +++ /dev/null @@ -1,17 +0,0 @@ -0100010001000100000101011111000011010100000010101011111110000110101001010100011010000100000001100000011000010001011111001111111100000010111110010111111111000011111001111010000000011110111100111111111100000010111111111110000111111100111111001111010000000010111011111101111000010101000110100000000110000101100111100001100010010111110111100001111100111111111111111111111101000010111111111000011111001010111000001101110100000000110111101111000000101101111100001011011110111001101000000001111001010101010101111111101100010000110001010000011010000010111000000001011000010110111111011110110010001101000000000000101010101010001101000010000000101011100000000001111000010111111111011111000010110110111111100000010101010111111011011100001100101111111011011110000000100000001000010110000001100000110110011010000000010111000000001011101111111111001111111111000000001101111111111100111111111100000100000000011011011001100001010101111111011111101111100001111110000000011110000000010111000000001011100000000110000110001001111111111111111110111111111110111111100111111111101110000000000111100000000111100000000110010101111111111101111111111110001000011000100100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100000011110000001011101110011011110011111000011111000010111101001110100110100000000110000111110000111110000001011011110011110110 -010001000100010001000001011101000000101011111010010101000110100001000000011000000110000100010111110011111111000000101111100101111111110000111110011110100000000111101111001111111111000000101111111111100001111111001111110011110100000000101110111111011110000101010001101000000001100001011001111000011000100101111101111000011111001111111111111111111111101000010111111111000011111001010111000001101110100000000110111101111000000101101111100001011011110111001101000000001111001010101010101111111110110001000011000101000001101000001011100000000101100001011011111101111011001111000011010010001101000000000000101010101010001101000010000000101011100000000001111000010111111111011111000010110110111111100000010101010111111011011100001100101111111011011110000000100000001000010110000001100000110110011010000000010111000000001011101111111111001111111111000000001101111111111100111111111100000100000000011011011001100001010101111111011111101111100001111110000000011110000000010111000000001011100000000110000110001001111111111111111110111111111110111111100111111111101110000000000111100000000111100000000110010101111111111101111111111110001000011000100100011010000100000100000110000001011100110111100101111110100101101010000111100001011100111100000011110000001011101110011011110011111000011111000010111101001110100110100000000110000111110000111110000001011011110011110110 -0100010001000100000101110100000010101111101001010100011010000100000001100000011000010001011111001111111100000010111110010111111111000011111001111010000000011110111100111111111100000010111111111110000111111100111111001111010000000010111011111101111000010101000110100000000110000101100111100001100010010111110111100001111100111111111111111111111101000010111111111000011111001010111000001101110100000000110111101111000000101101111100001011011110111001101000000001111001010101010101111111110110001000011000101000001101000001011100000000101100001011011111101111011001010001101000010000010000011000000101110011011110010111111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010000110100100011010000000000001010101010100011010000100000001010111000000000011110000101111111110111110000101101101111111000000101010101111110110111000011001011111110110111100000001000000010000101100000011000001101100110100000000101110000000010111011111111110011111111110000000011011111111111001111111111000001000000000110110110011000010101011111110111111011111000011111100000000111100000000101110000000010111000000001100001100010011111111111111111101111111111101111111001111111110111000000000011110000000011110000000011001010111111111110111111111110001000011000100000000110000111110000111110000001011011110011110110 -0100010001000100000101110100000010101111101001010100011010000100000001100000011000010001011111001111111100000010111110010111111111000011111001111010000000011110111100111111111100000010111111111110000111111100111111001111010000000010111011111101111000010101000110100000000110000101100111100001100010010111110111100001111100111111111111111111111101000010111111111000011111001010111000001101110100000000110111101111000000101101111100001011011110111001101000000001111001010101010101111111110110001000011000101000001101000001011100000000101100001011011111101111011001010001101000010000010000011000000101110011011110010111111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010000110100100011010000000000001010101010100011010000100000001010111000000000011110000101111111110111110000101101101111111000000101010101111110110111000011001011111110110111100000001000000010000101100000011000001101100110100000000101110000000010111011111111110011111111110000000011011111111111001111111111000001000000000110110110011000010101011111110111111011111000011111100000000111100000000101110000000010111000000001100001100010011111111111111111101111111111101111111001111111110111000010000000001111000000001111000000001100101111111111100010000110001001101100000000110000111110000111110000001011011110011110110 -0100010001000100000101110100000010101111101001010100011010000100000001100000011000010001011111001111111100000010111110010111111111000011111001111010000000011110111100111111111100000010111111111110000111111100111111001111010000000010111011111101111000010101000110100000000110000101100111100001100010010111110111100001111100111111111111111111111101000010111111111000011111001010111000001101110100000000110111101111000000101101111100001011011110111001101000000001111001010101010101111111110110001000011000101000001101000001011100000000101100001011011111101111011001010001101000010000010000011000000101110011011110010111111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010000110100100011010000000000001010101010100011010000100000001010111000000000011110000101111111110111110000101101101111111000000101010101111110110111000011001011111110110111100000001000000010000101100000011000001101100110100000000101110000000010111011111111110011111111110000000011011111111111001111111111000001000000000110110110011000010101011111110111111011111001000001111111000000001111000000001011100000000101110000000011000011000101111111111101111111001111111101001111111110111000010000000001111000000001111000000001100101111111111100010000110001001101100000000110000111110000111110000001011011110011110110 -010001000100010000010111010000001010111110100101010001101000010000000110000001100001000101111100111111110000001011111001011111111100001111100111101000000001111011110011111111110000001011111111111000011111110011111100111101000000001011101111110111100001010100011010000000011000010110011110000110001001011111011110000111110011111111111111111111110100001011111111100001111100101011100000110111010000000011011110111100000010110111110000101101111011100110100000000111100101010101010111111111011000100001100010100000110100000101110000000010110000101101111110111101100101000110100001000001000001100000010111001101111001011111101001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001101000011010010001101000000000000101010100010101000110100001000000010101110000000000111100001011111111101111100001011011011111110000001010101011111101101110000110010111111101101111000000010000000100001011000000110000011011001101000000001011100011111001111111111100000100000000011000000101110111111001111110000000011011111110110110011000010101011111110111111011111001000001111111000000001111000000001011100000000101110000000011000011000101111111111101111111001111111101001111111110111000010000000001111000000001111000000001100101111111111100010000110001001101100000000110000111110000111110000001011011110011110110 -010001000100010000010111010000001010111110100101010001101001000001000000011000000110000100010111110011111111000000101111100101111111110000111110011110100000000111101111001111111111000000101111111111100001111111001111110011110100000000101110111111011110000101111111111100001011111111100001111100101011100000110111010000000011011110111100000010110111110000101101111011100110100100011010000000011000010110011110000110001001011111011110000111110011111111111110100000000111100101010101010111111111011000100001100010100000110100000101110000000010110000101101111110111101100101000110100001000001000001100000010111001101111001011111101001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001101000011010010001101000000000000101010100010101000110100001000000010101110000000000111100001011111111101111100001011011011111110000001010101011111101101110000110010111111101101111000000010000000100001011000000110000011011001101000000001011100011111001111111111100000100000000011000000101110111111001111110000000011011111110110110011000010101011111110111111011111001000001111111000000001111000000001011100000000101110000000011000011000101111111111101111111001111111101001111111110111000010000000001111000000001111000000001100101111111111100010000110001001101100000000110000111110000111110000001011011110011110110 -0100010001000100010000010111010000001010111110100101011111100100000100000001100000011000010001011111001111111100000010111110010111111111000011111001111010000000011110111100111111111100000010111111111110000111111100111111001111010000000010111011111101111000010111111111110000101111111110000111110010101110000011011101000000001101111011110000001011011111000010110111101110011010011111100000000110000101100111100001100010010111110111100001111100111111111111110100000000111100101010101010111111111101100010000110001010000011010000010111000000001011000010110111111011110110010110000100000100000110000001011100110111100101111110100101101010000111100001011100111100000011110000001011101110011011110011111000011111000010111101001110100110101000011010010001101000000000000101010100010101000110100001000000010101110000000000111100001011111111101111100001011011011111110000001010101011111101101110000110010111111101101111000000010000000100001011000000110000011011001101000000001011100011111001111111111100000100000000011000000101110111111001111110000000011011111110110110011000010101011111110111111011111001000001111111000000001111000000001011100000000101110000000011000011000101111111111101111111001111111101001111111110111000010000000001111000000001111000000001100101111111111100010000110001001101100000000110000111110000111110000001011011110011110110 -0100010001000100010100000001011101000000101011111010011111101110000000010110000101101111110111101100101100100000100000001100000011000010001011111001111111100000010111110010111111111000011111001111010000000011110111100111111111100000010111111111110000111111100111111001111010000000010111011111101111000010111111111110000101111111110000111110010101110000011011101000000001101111011110000001011011111000010110111101110011010011000000001100001011001111000011000100101111101111000011111001111111111010000000011110010101010101011111101100010000110001010000011010000010010110000100000100000110000001011100110111100101111110100101101010000111100001011100111100000011110000001011101110011011110011111000011111000010111101001110100110101000011010010001101000000000000101010100010101000110100001000000010101110000000000111100001011111111101111100001011011011111110000001010101011111101101110000110010111111101101111000000010000000100001011000000110000011011001101000000001011100011111001111111111100000100000000011000000101110111111001111110000000011011111110110110011000010101011111110111111011111001000001111111000000001111000000001011100000000101110000000011000011000101111111111101111111001111111101001111111110111000010000000001111000000001111000000001100101111111111100010000110001001101100000000110000111110000111110000001011011110011110110 -01000100010001010000000101110100000010101111101001111110111000000001011000010110111111011110110010110010000010000000110000001100001000101111100111111110000001011111001011111111100001111100111101000000001111011110011111111110000001011111111111000011111110011111100111101000000001011101111110111100001011111111111000010111111111000011111001010111000001101110100000000110111101111000000101101111100001011011110111001101001100000000110000101100111100001100010010111110111100001111100111111111010000000011110010101010101010100011010000000000001010101000101010001101000010000000101011100000000001111000010111111111011111000010110110111111100000010101010111111011011100001100101111111011011110000000100000001000010110000001100000110110011010000000010111000111110011111111111111100000100000000011000000101110111111001111110000000011011111110110110011000010101011111110111111011111001000001111111000000001111000000001011100000000101110000000011000011000101111111111101111111001111111111110100111111111111101110110001000011000101000001101000001001011000010000010000011000000101110011011110010111111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010100001101000010000000001111000000001111000000001100101111111111100010000110001001101100000000110000111110000111110000001011011110011110110 -01000100010001010000000101110100000010101111101001111110111000000001011000010110111111011110110010110010000010000000110000001100001000101111100111111110000001011111001011111111100001111100111101000000001111011110011111111110000001011111111111000011111110011111100111101000000001011101111110111100001011111111111000010111111111000011111001010111000001101110100000000110111101111000000101101111100001011011110111001101001100000000110000101100111100001100010010111110111100001111100111111111010000000011110010101010101010100010001101000000000000101010100010101000110100001000000010101110000000000111100001011111111101111100001011011011111110000001010101011111101101110000110010111111101101111000000010000000100001011000000110000011011001101000000001011100011111001111111111100000100000000011000000101110111111001111110000000011011111110110110011000010101011111110111111011111001000001111111000000001111000000001011100000000101110000000011000011000101111111111101111111001111111101001111111111111101110111110110001000011000101000001101000001001011000010000010000011000000101110011011110010111111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010100001101000010000000001111000000001111000000001100101111111111100010000110001001101100000000110000111110000111110000001011011110011110110 -010001000101000000010111010000001010111110100111111011100000000101100001011011111101111011001011001000001000000011000000110000100010111110011111111000000101111100101111111110000111110011110100000000111101111001111111111000000101111111111100001111111001111110011110100000000101110111111011110000101111111111100001011111111100001111100101011100000110111010000000011011110111100000010110111110000101101111011100110100110000000011000010110011110000110001001011111011110000111110011111111010000000011110010101010101010100010001101000000000000101010100010101000110100001000000010101110000000000111100001011111111101111100001011011011111110000001010101011111101101110000110010111111101101111000000010000000100001011000000110000011011001101000000001011100011111001111111111100000100000000011000000101110111111001111110000000011011111110110110011000010101011111110111111011111001000001111111000000001111000000001011100000000101110000000011000011000101111111111101111111001111111101001111111111111011100001000000000111100000000111100000000110010111111111110001000011000100110111111011000100001100010100000110100000100101100001000001000001100000010111001101111001011111101001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001101010000110100000000110000111110000111110000001011011110011110110 -010001000101000000010111010000001010111110100111111011100000000101100001011011111101111011001000101110010000010000000110000001100001000101111100111111110000001011111001011111111100001111100111101000000001111011110011111111110000001011111111111000011111110011111100111101000000001011101111110111100001011111111111000010111111111000011111001010111000001101110100000000110111101111000000101101111100001011011110111001101001110000000011000010110011110000110001001011111011110000111110011111110100000000111100101010101010101000100011010000000000001010101000101010001101000010000000101011100000000001111000010111111111011111000010110110111111100000010101010111111011011100001100101111111011011110000000100000001000010110000001100000110110011010000000010111000111110011111111111000001000000000110000001011101111110011111100000000110111111101101100110000101010111111101111110111110010000011111110000000011110000000010111000000001011100000000110000110001011111111111011111110011111111010011111111111101110000100000000011110000000011110000000011001011111111111000100001100010011011111011000100001100010100000110100000101100101100001000001000001100000010111001101111001011111101001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001101010000110100000000110000111110000111110000001011011110011110110 -01000101000000010111010000001010111110100111111011100000000101100001011011111101111011001000101110010000010000000110000001100001000101111100111111110000001011111001011111111100001111100111101000000001111011110011111111110000001011111111111000011111110011111100111101000000001011101111110111100001011111111111000010111111111000011111001010111000001101110100000000110111101111000000101101111100001011011110111001101001110000000011000010110011110000110001001011111011110000111110011111110100000000111100101010101010101000100011010000000000001010101000101010001101000010000000101011100000000001111000010111111111011111000010110110111111100000010101010111111011011100001100101111111011011110000000100000001000010110000001100000110110011010000000010111000111110011111111111000001000000000110000001011101111110011111100000000110111111101101100110000101010111111101111110111110010000011111110000000011110000000010111000000001011100000000110000110001011111111111011111110011111111010011111111111101110000100000000011110000000011110000000011001011111111111000100001100010011011111011000100001100010100000110100000100000000110000111110000111110000001011011110011110110010110000100000100000110000001011100110111100101111110100101101010000111100001011100111100000011110000001011101110011011110011111000011111000010111101001110100110101000011010 -010001000001011101000000101011111010010100010111111100100000100000001100000011000010001011111001111111100000010111110010111111111000011111001111010000000011110111100111111111100000010111111111110000111111100111111001111010000000010111011111101111000010111111111110000101111111110000111110010101110000011011101000000001101111011110000001011011111000010110111101110011010011111110000000011000010110011110000110001001011111011110000111110011111110100000000111100101010101010101000100011010000000000001010101000101010001101000010000000101011100000000001111000010111111111011111000010110110111111100000010101010111111011011100001100101111111011011110000000100000001000010110000001100000110110011010000000010111000111110011111111111000001000000000110000001011101111110011111100000000110111111101101100110000101010111111101111110111110010000011111110000000011110000000010111000000001011100000000110000110001011111111111011111110011111111010011111111111101110000100000000011110000000011110000000011001011111111111000100001100010011011111011000100001100010100000110100000100000000110000111110000111110000001011011110011110110111000000001011000010110111111011110110010110000100000100000110000001011100110111100101111110100101101010000111100001011100111100000011110000001011101110011011110011111000011111000010111101001110100110101000011010 -01000001011101000000101011111010010100010100011010010000010000000110000001100001000101111100111111110000001011111001011111111100001111100111101000000001111011110011111111110000001011111111111000011111110011111100111101000000001011101111110111100001011111111111000010111111111000011111001010111000001101110100000000110111101111000000101101111100001011011110111001101001000110100000000110000101100111100001100010010111110111100001111100111111101000000001111001010101010101010001000110100000000000010101010001010100011010000100000001010111000000000011110000101111111110111110000101101101111111000000101010101111110110111000011001011111110110111100000001000000010000101100000011000001101100110100000000101110001111100111111111110000010000000001100000010111011111100111111000000001101111111011011001100001010101111111011111101111100100000111111100000000111100000000101110000000010111000000001100001100010111111111110111111100111111110100111111111111011100001000000000111100000000111100000000110010111111111110001000011000100110111110110001000011000101000001101000001000000001100001111100001111100000010110111100111101101110000000010110000101101111110111101100101000110100001000001000001100000010111001101111001011111101001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001101000011010 -01000001011101000000101011111010010100010100011010000100000001100000011000010001011111001111111100000010111110010111111111000011111001111010000000011110111100111111111100000010111111111110000111111100111111001111010000000010111011111101111000010101000110100000000110000101100111100001100010010111110111100001111100111111111111111101000010111111111000011111001010111000001101110100000000110111101111000000101101111100001011011110111001101000000001111001010101010101010001000110100000000000010101010001010100011010000100000001010111000000000011110000101111111110111110000101101101111111000000101010101111110110111000011001011111110110111100000001000000010000101100000011000001101100110100000000101110001111100111111111110000010000000001100000010111011111100111111000000001101111111011011001100001010101111111011111101111100100000111111100000000111100000000101110000000010111000000001100001100010111111111110111111100111111110100111111111111011100001000000000111100000000111100000000110010111111111110001000011000100110111110110001000011000101000001101000001000000001100001111100001111100000010110111100111101101110000000010110000101101111110111101100101000110100001000001000001100000010111001101111001011111101001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001101000011010 diff --git a/data/golf/machines/uni2.blc b/data/golf/machines/uni2.blc index 72318251..a80d9a95 100644 --- a/data/golf/machines/uni2.blc +++ b/data/golf/machines/uni2.blc @@ -1 +1 @@ -010001011000010000010000011000010110000110111100101010001101000000001000001100001011001111100010111001010111101110000000011000011111000011111001111100101110100111111110100001011011011100001101100001111110000101110100000110000111100001011100111100000011110000101101101110011111000011111000010111101001110100110100001100111011000011010 \ No newline at end of file +01000101100000010000011000010110000110111100101011111110000000000110000101100111100010010111111000000001100001111100001111100111110010111010011111111110100001011011110111110000110110000111111000010111010000011000011110000101110011110000001111000010110110111001111100001111100001011110100111010000110011101100001000110100001110011010 diff --git a/data/golf/machines/uni2.lam b/data/golf/machines/uni2.lam index 94190b70..ce8320a5 100644 --- a/data/golf/machines/uni2.lam +++ b/data/golf/machines/uni2.lam @@ -1,8 +1,3 @@ --- BLC2 universal machine (tromp/AIT uni2.lam), strict: this is Tromp's --- source, unchanged; it compiles to 340 bits. uni2.blc (333 bits) is --- beta-convertible to it: the exact let search (blam golf letopt) gives 334 --- and a beta-only descent 333, and blam golf check finds the 333 reducing --- to the 340 in three steps. See docs/classical/golf.md. -- universal machine for levenshtein binary lambda calculus (BLC2) let id = \x.x; @@ -11,31 +6,37 @@ let -- readbit f cont n (bit->blob) = cont (n . n . if bit then f else id) blob readbit = \f\cont\n\blob.blob (\bit.cont (\x. n (n (bit x (f x))))); + -- fixpoint combinator, shared by delimit, int2 and omega + fix = \f.(\x.x x) (\x.f (x x)); + -- delimit f cont (levenstein_code_for_n ++ blob) = cont (f^n) blob - delimit = \f\cont\blob.blob (\bit.bit (cont id) - (delimit (readbit f) (\n. n cont f))); + delimit = fix (\delimit\f\cont. + let rest = delimit (readbit f) (\n. n cont f) + in \blob.blob (\bit.bit (cont id) rest)); -- binary LC interpreter -- int2 cont bits = cont (\free.parsed) unparsed_bits - int2 = \cont\blob.blob (\bit0. bit0 -- 314 bits - (\blob1.blob1 (\bit1. - int2 (\exp.bit1 (cont (\args\arg.exp (\z.z arg args))) - (int2 (\exp2.cont (\args.exp args (exp2 args))))))) - (delimit (\l.l bit0) (\n. cont (\args. n args true))) - ); - + int2 = fix (\int2\cont. -- 311 bits + -- parse the rest of an abstraction (bit1 = 0) or application (bit1 = 1) + let lam_or_app = \bit1. + int2 (\exp.bit1 (cont (\args\arg.exp (\z.z arg args))) + (int2 (\exp2.cont (\args.exp args (exp2 args))))) + in \blob.blob (\bit0. bit0 + (\blob1.blob1 lam_or_app) + (delimit (\l.l bit0) (\n. cont (\args. n args true))))); + -- blob cont = cont bytes nextbit nextblob blob = \bits\bytes\cont. let go = \bs\bit\bits1\z. cont bytes bit (blob bits1 bs) in bits (go bytes) (bytes (\byte\bytes1. byte (go bytes1) bytes1)); - + -- loop - omega = omega; -- 18 bits + omega = fix fix; -- no head normal form -- binary LC universal machine for closed programs - uni2 = int2 (\z.z omega); -- 340 bits + uni2 = int2 (\z.z omega); -- 332 bits -- save some bits by assuming closed programs - -- uni2 = int2 (\z. z z); -- 324 bits + -- uni2 = int2 (\z. z z); -- 321 bits in uni2 diff --git a/data/golf/machines/uni28.blc b/data/golf/machines/uni28.blc index c46dbd7d..178ce712 100644 --- a/data/golf/machines/uni28.blc +++ b/data/golf/machines/uni28.blc @@ -1 +1 @@ -000110010001011000010100000001110000101100111100001111110000101110011111000000111100001011011011100111111100001111110000101111010011101001010111111100000000111111100001011001110001001010111110111100000011111111110000111100001111001111001011101001111111101000010110111011110000110110000111100001011101000001100110100001111000000101100000000101111111011101100001100111101110000001110011110111000011010 \ No newline at end of file +000110010001011000010000010001100001011001110000111111000010111001111110000001111000010110110111001111111000011111110000101111010011101001010111111100000000111111000010110011100010010101111101111000000111111111000011110000111100111100101110100111111110100001011011101111000011011000011111000010111010000011000000101100000000101111110111011000011000011011110011010000001110011110111000011010 diff --git a/data/golf/machines/uni28.lam b/data/golf/machines/uni28.lam index e1fc332a..f9dd669c 100644 --- a/data/golf/machines/uni28.lam +++ b/data/golf/machines/uni28.lam @@ -1,22 +1,34 @@ --- BLC2 universal machine over BLC8 bytes (tromp/AIT uni28.lam), strict. --- tromp/AIT's uni28.lam compiles to 500 bits. This source compiles to 416; --- uni28.blc (399 bits) is its beta-only descent (blam golf component --- --descend --no-eta), certified step by step with blam golf check --path. --- Design (Codex, 2026-10-12): one bit reader `get` serves the parser, the --- Levenshtein delimiter and the digit accumulator, with its continuation --- held outside the reader's fixpoint. Verified against the 500 by --- `blam golf check --io bytes --max-bits 18` (0 differ, 0 halting on one --- side only) and by direct-evaluation tests through index 255 and --- three-level self-interpretation; see docs/classical/golf.md. +-- universal machine for Levenshtein binary lambda calculus (BLC2): 390 bits +-- a9lim reduced it from 500 bits: one bit reader, get, serves the parser, +-- the Levenshtein delimiter and the digit accumulator. A fresh byte always +-- has a first bit, so get reads it directly and needs no recursion. +-- One self-application, delta, serves the parser's and the delimiter's +-- fixpoints and the loop. +\bytes.bytes ( let - id = \x.x; - true = \x\y.x; - get = \k.let loop = \bits.bits (\b\tail\ignored.k b tail) (\bytes.bytes loop) in loop; - readbit = \f\cont\n.get (\bit.cont (\x.n (n (bit x (f x))))); - delimit = \f\cont.get (\bit.bit (cont id) (delimit (readbit f) (\n.n cont f))); - int = \cont.get (\bit0.bit0 - (get (\bit1.int (\exp.bit1 (cont (\args\arg.exp (\z.z arg args))) - (int (\exp2.cont (\args.exp args (exp2 args))))))) - (delimit (\l.l bit0) (\n.cont (\args.n args true)))); - omega = omega -in \bytes.bytes (int (\exp\bits.exp omega)) + delta = \x.x x; + build = \int\cont. + let + -- get k (bit:bits) = k bit bits, reading the next byte when bits is nil + get = \k\bits.bits (\b\tail\ignored.k b tail) (\bytes.bytes (\byte.byte k)); + + -- readbit f cont n input = cont (n . n . if next_input_bit then f else id) input' + readbit = \f\cont\n.get (\bit.cont (\x.n (n (bit x (f x))))); + + -- delimit f cont (levenstein_code_for_n_on_input) = cont (f^n) input' + delimit = delta (\self\f\cont.get (\bit.bit + (cont (\x.x)) + (self self (readbit f) (\n.n cont f)))) + in + -- binary LC interpreter + -- int cont input = cont (\free.parsed) input' + get (\bit0.bit0 + (get (\bit1.int (\exp.bit1 + (cont (\args\arg.exp (\z.z arg args))) + (int (\exp2.cont (\args.exp args (exp2 args))))))) + (delimit (\l.l bit0) (\n.cont (\args.n args (\x\y.x))))) +in + -- binary LC universal machine for closed programs; free variables loop + -- assuming closed programs, (\x.x) for the last argument gives a + -- non-strict machine of 370 bits + delta (\self.build (self self)) (\exp\bits.exp (delta delta))) diff --git a/data/golf/machines/uni28.path b/data/golf/machines/uni28.path deleted file mode 100644 index d93db841..00000000 --- a/data/golf/machines/uni28.path +++ /dev/null @@ -1,10 +0,0 @@ -01000001100101000110100001000001111110000101100111111100001111100001011100111110000001111000010110110111001111110000111111000010111101001110100101010001101000000001111111111000010110011100010010101111101111000000111111111111100001111000011110011110010111010011111111010000101101110111100001101100001111000010111010000011001101000000111001000110100001101000010001101000000101100000000101111111011101100001100111101110 -0100000110010100011010000100000100011000010110011100001111110000101110011111100000011110000101101101110011111110000111111100001011110100111010010101000110100000000111111000010110011100010010101111101111000000111111111000011110000111100111100101110100111111110100001011011101111000011011000011111000010111010000011011111001101000000111001000110100001101000010001101000000101100000000101111111011101100001100111101110 -000110010100011010000100000100011000010110011100001111110000101110011111100000011110000101101101110011111110000111111100001011110100111010010101000110100000000111111000010110011100010010101111101111000000111111111000011110000111100111100101110100111111110100001011011101111000011011000011111000010111010000011000010001101000000101100000000101111111011101100001100111101110011010000001110010001101000011010 -0001100100010110000100000100011000010110011100001111110000101110011111100000011110000101101101110011111110000111111100001011110100111010010101111111000000001111110000101100111000100101011111011110000001111111110000111100001111001111001011101001111111101000010110111011110000110110000111110000101110100000110000111111000000101100000000101111111011101100001100111101110011010000001110011110111000011010 -000110010001010001110000100000100011000010110011100001111110000101110011111100000011110000101101101110011111110000111111100001011110100111010010101111111100000000111111000010110011100010010101111101111000000111111111000011110000111100111100101110100111111110100001011011101111000011011000011111000010111010000011011110011010000111000000101100000000101111111011101100001100111101110000001110011110111000011010 -000110010001010001110000100000111110000101100111111000011111000010111001111100000011110000101101101110011111100001111110000101111010011101001010111111100000000111111111000010110011100010010101111101111000000111111111111000011110000111100111100101110100111111110100001011011101111000011011000011110000101110100000110011010000111000000101100000000101111111011101100001100111101110000001110011110111000011010 -000110010001010001110000100010000011100001011001111000011111100001011100111110000001111000010110110111001111111000011111100001011110100111010010101111111100000000111111100001011001110001001010111110111100000011111111110000111100001111001111001011101001111111101000010110111011110000110110000111100001011101000001101110011010000111000000101100000000101111111011101100001100111101110000001110011110111000011010 -0001100100010110000100010000011100001011001111000011111100001011100111110000001111000010110110111001111111000011111100001011110100111010010101111111000000001111111000010110011100010010101111101111000000111111111100001111000011110011110010111010011111111010000101101110111100001101100001111000010111010000011000011111000000101100000000101111111011101100001100111101110011010000001110011110111000011010 -000110010001011000010000011100001011001111000010111111011111000010111001111100000011110000101101101110010111111101111110000111111000010111101001110100101011111100000000111111100001011001110001001010111110111100000011111111110000111100001111001111001011101001111111101000010110111011110000110110000111100001011101000001100001111000000101100000000101111111011101100001100111101110000001110011110111000011010 -000110010001011000010100000001110000101100111100001111110000101110011111000000111100001011011011100111111100001111110000101111010011101001010111111100000000111111100001011001110001001010111110111100000011111111110000111100001111001111001011101001111111101000010110111011110000110110000111100001011101000001100110100001111000000101100000000101111111011101100001100111101110000001110011110111000011010 diff --git a/data/golf/machines/uni28_nonstrict.blc b/data/golf/machines/uni28_nonstrict.blc index 4eafc965..8c4c39f4 100644 --- a/data/golf/machines/uni28_nonstrict.blc +++ b/data/golf/machines/uni28_nonstrict.blc @@ -1 +1 @@ -0001100101000110100001000001000110000101100111000011111100001011100111111000000111100001011011011100111111100001111111000010111101001110100101010001101000000001111110000101100111000100101011111011110000001111111110000111100001111001111001011101001111111101000010110111011110000110110000111110000101110100000110000100011010000001011000000001011111110111011000011001111011100110100010 \ No newline at end of file +0001100101000110100001000001000110000101100111000011111100001011100111111000000111100001011011011100111111100001111111000010111101001110100101010001101000000001111110000101100111000100101011111011110000001111111110000111100001111001111001011101001111111101000010110111011110000110110000111110000101110100000110000001011000000001011111101110110000110000110111100110100010 diff --git a/data/golf/machines/uni28_nonstrict.lam b/data/golf/machines/uni28_nonstrict.lam index 2f443ecd..7717a739 100644 --- a/data/golf/machines/uni28_nonstrict.lam +++ b/data/golf/machines/uni28_nonstrict.lam @@ -1,24 +1,34 @@ --- BLC2 universal machine over BLC8 bytes (tromp/AIT uni28.lam), non-strict. --- tromp/AIT's uni28.lam compiles to 500 bits. This source compiles to 393; --- uni28_nonstrict.blc (382 bits) is its beta-only descent (blam golf --- component --descend --no-eta), certified step by step with blam golf --- check --path. Design (Codex, 2026-10-12): one bit reader `get` serves the --- parser, the Levenshtein delimiter and the digit accumulator, with its --- continuation held outside the reader's fixpoint; the final continuation --- is the identity, so cont exp bits bytes = M bytes for closed M. --- Verified against the 500 by `blam golf check --io bytes --max-bits 18` --- (0 differ; the inputs that halt here only are complete open programs) --- and by direct-evaluation tests through index 255 and three-level --- self-interpretation; see docs/classical/golf.md. +-- universal machine for Levenshtein binary lambda calculus (BLC2): 390 bits +-- a9lim reduced it from 500 bits: one bit reader, get, serves the parser, +-- the Levenshtein delimiter and the digit accumulator. A fresh byte always +-- has a first bit, so get reads it directly and needs no recursion. +-- One self-application, delta, serves the parser's and the delimiter's +-- fixpoints and the loop. +\bytes.bytes ( let - id = \x.x; - true = \x\y.x; - get = \k.let loop = \bits.bits (\b\tail\ignored.k b tail) (\bytes.bytes loop) in loop; - readbit = \f\cont\n.get (\bit.cont (\x.n (n (bit x (f x))))); - delimit = \f\cont.get (\bit.bit (cont id) (delimit (readbit f) (\n.n cont f))); - int = \cont.get (\bit0.bit0 - (get (\bit1.int (\exp.bit1 (cont (\args\arg.exp (\z.z arg args))) - (int (\exp2.cont (\args.exp args (exp2 args))))))) - (delimit (\l.l bit0) (\n.cont (\args.n args true)))); - omega = omega -in \bytes.bytes (int id) + delta = \x.x x; + build = \int\cont. + let + -- get k (bit:bits) = k bit bits, reading the next byte when bits is nil + get = \k\bits.bits (\b\tail\ignored.k b tail) (\bytes.bytes (\byte.byte k)); + + -- readbit f cont n input = cont (n . n . if next_input_bit then f else id) input' + readbit = \f\cont\n.get (\bit.cont (\x.n (n (bit x (f x))))); + + -- delimit f cont (levenstein_code_for_n_on_input) = cont (f^n) input' + delimit = delta (\self\f\cont.get (\bit.bit + (cont (\x.x)) + (self self (readbit f) (\n.n cont f)))) + in + -- binary LC interpreter + -- int cont input = cont (\free.parsed) input' + get (\bit0.bit0 + (get (\bit1.int (\exp.bit1 + (cont (\args\arg.exp (\z.z arg args))) + (int (\exp2.cont (\args.exp args (exp2 args))))))) + (delimit (\l.l bit0) (\n.cont (\args.n args (\x\y.x))))) +in + -- binary LC universal machine for closed programs; free variables loop + -- assuming closed programs, (\x.x) for the last argument gives a + -- non-strict machine of 370 bits + delta (\self.build (self self)) (\x.x)) diff --git a/data/golf/machines/uni28_nonstrict.path b/data/golf/machines/uni28_nonstrict.path deleted file mode 100644 index 0c158d58..00000000 --- a/data/golf/machines/uni28_nonstrict.path +++ /dev/null @@ -1,3 +0,0 @@ -010000011001010001101000010000011111100001011001111111000011111000010111001111100000011110000101101101110011111100001111110000101111010011101001010100011010000000011111111110000101100111000100101011111011110000001111111111111000011110000111100111100101110100111111110100001011011101111000011011000011110000101110100000110011010001000010001101000000101100000000101111111011101100001100111101110 -01000001100101000110100001000001000110000101100111000011111100001011100111111000000111100001011011011100111111100001111111000010111101001110100101010001101000000001111110000101100111000100101011111011110000001111111110000111100001111001111001011101001111111101000010110111011110000110110000111110000101110100000110111110011010001000010001101000000101100000000101111111011101100001100111101110 -0001100101000110100001000001000110000101100111000011111100001011100111111000000111100001011011011100111111100001111111000010111101001110100101010001101000000001111110000101100111000100101011111011110000001111111110000111100001111001111001011101001111111101000010110111011110000110110000111110000101110100000110000100011010000001011000000001011111110111011000011001111011100110100010 diff --git a/data/golf/machines/uni2_nonstrict.blc b/data/golf/machines/uni2_nonstrict.blc index 864abe2f..1d60743e 100644 --- a/data/golf/machines/uni2_nonstrict.blc +++ b/data/golf/machines/uni2_nonstrict.blc @@ -1 +1 @@ -010100011010000100000100000110000101100001101111001010100011010000000010000011000010110011111000101110010101111011100000000110000111110000111110011111001011101001111111101000010110110111000011011000011111100001011101000001100001111000010111001111000000111100001011011011100111110000111110000101111010011101001101000011010 \ No newline at end of file +010100011010000100000100000110000101100001101111001010100011010000000010000011000010110011111000101110010101111011100000000110000111110000111110011111001011101001111111101000010110110111000011011000011111100001011101000001100001111000010111001111000000111100001011011011100111110000111110000101111010011101001101000011010 diff --git a/data/golf/machines/uni2_nonstrict.lam b/data/golf/machines/uni2_nonstrict.lam index 4f9e5bdb..3158fcbf 100644 --- a/data/golf/machines/uni2_nonstrict.lam +++ b/data/golf/machines/uni2_nonstrict.lam @@ -1,8 +1,3 @@ --- BLC2 universal machine (tromp/AIT uni2.lam), non-strict: Tromp's --- source with his commented non-strict top (int2 (\z. z z)); it compiles --- to 324 bits. uni2_nonstrict.blc (321 bits) is --- beta-convertible to it, found by the exact let search (blam golf letopt, --- three cuts) and certified by blam golf check. -- universal machine for levenshtein binary lambda calculus (BLC2) let id = \x.x; @@ -11,31 +6,37 @@ let -- readbit f cont n (bit->blob) = cont (n . n . if bit then f else id) blob readbit = \f\cont\n\blob.blob (\bit.cont (\x. n (n (bit x (f x))))); + -- fixpoint combinator, shared by delimit, int2 and omega + fix = \f.(\x.x x) (\x.f (x x)); + -- delimit f cont (levenstein_code_for_n ++ blob) = cont (f^n) blob - delimit = \f\cont\blob.blob (\bit.bit (cont id) - (delimit (readbit f) (\n. n cont f))); + delimit = fix (\delimit\f\cont. + let rest = delimit (readbit f) (\n. n cont f) + in \blob.blob (\bit.bit (cont id) rest)); -- binary LC interpreter -- int2 cont bits = cont (\free.parsed) unparsed_bits - int2 = \cont\blob.blob (\bit0. bit0 -- 314 bits - (\blob1.blob1 (\bit1. - int2 (\exp.bit1 (cont (\args\arg.exp (\z.z arg args))) - (int2 (\exp2.cont (\args.exp args (exp2 args))))))) - (delimit (\l.l bit0) (\n. cont (\args. n args true))) - ); - + int2 = fix (\int2\cont. -- 311 bits + -- parse the rest of an abstraction (bit1 = 0) or application (bit1 = 1) + let lam_or_app = \bit1. + int2 (\exp.bit1 (cont (\args\arg.exp (\z.z arg args))) + (int2 (\exp2.cont (\args.exp args (exp2 args))))) + in \blob.blob (\bit0. bit0 + (\blob1.blob1 lam_or_app) + (delimit (\l.l bit0) (\n. cont (\args. n args true))))); + -- blob cont = cont bytes nextbit nextblob blob = \bits\bytes\cont. let go = \bs\bit\bits1\z. cont bytes bit (blob bits1 bs) in bits (go bytes) (bytes (\byte\bytes1. byte (go bytes1) bytes1)); - + -- loop - omega = omega; -- 18 bits + omega = fix id; -- 18 bits -- binary LC universal machine for closed programs - uni2 = int2 (\z. z z); -- 324 bits + uni2 = int2 (\z. z z); -- 321 bits -- save some bits by assuming closed programs - -- uni2 = int2 (\z.z omega); -- 340 bits, strict + -- uni2 = int2 (\z. z z); -- 321 bits in uni2 diff --git a/data/golf/machines/uni8.blc b/data/golf/machines/uni8.blc index f9e6d5ae..da60b5a4 100644 --- a/data/golf/machines/uni8.blc +++ b/data/golf/machines/uni8.blc @@ -1 +1 @@ -000110010001011000010100000001111000011111000000101111001011111100001011110011111100000011110000101101101110011111110000111111100001011110100111010100101110010111110000110111010010111111000011111100001110011011110000101101110110000100000101101100001100001011011110100000000101111101110110011010000001110011110111000011010 \ No newline at end of file +0001100100011001010001101000010000000111111000010111001111111001111100001011100111110000001111000010110110111001111111100111111000011111100001011110100111010010110011110000110110010111110000111110000111001101110100110100000011100101111011101110000100000101101100001100001011011110100000000101111101110110 diff --git a/data/golf/machines/uni8.blc8 b/data/golf/machines/uni8.blc8 index 846c2ae67969248ccecbc43f25640105051d0583..84fc0f91688e5f7d803fefda8ff238213fef16a7 100644 GIT binary patch literal 38 wcmV+>0NMW;8AgN$;dA-$x$rzKx&D41h3V4I4VS~=&C@{T?%@Tn!rp*ic9!85JOBUy literal 41 zcmV+^0M`E*78D1Ez`VZ;&%p4u=kWd)r&8tc-7mxN=J2;+1+c>2fM0fK9QO?X;b<1- diff --git a/data/golf/machines/uni8.lam b/data/golf/machines/uni8.lam index 745bad4f..85071da9 100644 --- a/data/golf/machines/uni8.lam +++ b/data/golf/machines/uni8.lam @@ -1,33 +1,37 @@ --- BLC8 universal machine for closed programs, strict: 321 bits (41 bytes). --- The IOCCC 2012 uni8.Blc is 344 bits (43 bytes); tromp/AIT's uni8.lam --- compiles to 355. Same contract: read from the bits of the leading --- bytes, discard the rest of the last byte touched, return M applied to the --- remaining bytes; a free variable in M diverges (base environment omega). --- --- The design reads every bit through one reader, get (Codex, 2026-10-12), --- instead of two inline reads with their own refills. A refill moves to the --- next byte, and a byte always has eight bits, so the refilled read can never --- meet nil again: get needs no recursion (Claude). The variable parse is the --- old one: Scott-pair environment, re-entering int8 with the second bit --- pushed back. Verified against the 344 by `blam golf check --io bytes` --- (every closed program to 18 bits, with and without a data byte, plus random --- bytes: 0 differ, 0 halting on one side only) and by nested --- self-interpretation; see docs/classical/golf.md. --- --- test with --- cat id.Blc id.lam | ./blc run8 uni8.lam +-- BLC8 universal machine for closed programs: 304 bits (38 bytes) +-- a9lim reduced it from 355 bits (344 for the IOCCC uni8.Blc): +-- every bit is read through one reader, get, which refills from the next +-- byte when the current one runs out. A refill always lands on a fresh byte +-- of eight bits, so get never needs to refill twice and is not recursive. +-- The parser branches on a code's first bit before reading the second, and +-- step takes that first bit as an argument: after a variable's tag 11, the +-- second 1 is also the first bit of the rest of its code, so step re-enters +-- with it instead of pushing it back onto the stream. +-- Variables keep the Scott-pair environment. \bytes.bytes ( -let dbl = \x.x x -in - (dbl (\self. - (\get\int8\cont.get (\b.get (\c\tail.b +let + -- get k bits = k bit bits', reading the next byte when bits is nil + get = \k.(\h\bits.bits h (\bytes.bytes (\byte.byte h byte))) + (\b\tail\ignored.k b tail); + -- step cont b bits parses a term whose first bit b is already read + step = + let int8 = \cont.get (step cont) + in \cont\b.get (\c.b (int8 (\exp.c (cont (\args\arg.exp (\z.z arg args))) - (int8 (\exp2.cont (\args.exp args (exp2 args))))) tail) - (c (cont (\args.args c) tail) - (int8 (\var.cont (\args.var (args c))) - (\f.f c tail)))))) - -- get k bits = k bit tail, reading the next byte when bits is nil - (\k. (\h\bits. bits h (\bytes.bytes (\byte. byte h byte))) (\b\tail\ignored.k b tail)) - (self self)) - (\exp\bits.exp (dbl dbl)))) + (int8 (\exp2.cont (\args.exp args (exp2 args)))))) + (c (cont (\args.args c)) + (step (\var.cont (\args.var (args c))) c))) +in + -- free variables diverge in the base environment get get get, which + -- has no head normal form: it reduces to ever more leading lambdas and + -- never to a head variable, so like (\x.x x) (\x.x x) it gives every + -- program the same normal form, or none. + -- (\x.x) instead gives a non-strict machine of 283 bits (36 bytes): + -- cont exp bits bytes = exp bits bytes = M bytes for closed M + get (step (\exp\bits.exp (get get get)))) + +-- test with +-- cat id.Blc id.lam | ./blc run8 uni8.lam +-- which should output +-- \x.x diff --git a/data/golf/machines/uni8_nonstrict.blc b/data/golf/machines/uni8_nonstrict.blc index 941ca385..55a2c714 100644 --- a/data/golf/machines/uni8_nonstrict.blc +++ b/data/golf/machines/uni8_nonstrict.blc @@ -1 +1 @@ -000110010100011010000101000000011110000111110000001011110010111111000010111100111111000000111100001011011011100111111100001111111000010111101001110101001011100101111100001101110100101111110000111111000011100110111100001011011101100001000001011011000011000010110111101000000001011111011101100110100010 \ No newline at end of file +0001100100011001010001101000010000000111111000010111001111111001111100001011100111110000001111000010110110111001111111100111111000011111100001011110100111010010110011110000110110010111110000111110000111001101110100110100010000100000101101100001100001011011110100000000101111101110110 diff --git a/data/golf/machines/uni8_nonstrict.blc8 b/data/golf/machines/uni8_nonstrict.blc8 index 7889d4fc..a3e7db7a 100644 --- a/data/golf/machines/uni8_nonstrict.blc8 +++ b/data/golf/machines/uni8_nonstrict.blc8 @@ -1 +1 @@ -F…áð//Âóð<-¹ü?…éԹ|7Kðü9¼-ØAl0· ݚ \ No newline at end of file +F„ásùð¹ð<-¹þ~…éÒÏ —ÃáÍÓD ¶[Ð îÀ \ No newline at end of file diff --git a/data/golf/machines/uni8_nonstrict.lam b/data/golf/machines/uni8_nonstrict.lam index 1285dde9..dfd93f63 100644 --- a/data/golf/machines/uni8_nonstrict.lam +++ b/data/golf/machines/uni8_nonstrict.lam @@ -1,37 +1,37 @@ --- BLC8 universal machine for closed programs, non-strict: 300 bits (38 bytes). --- The IOCCC 2012 uni8.Blc is 344 bits (43 bytes); tromp/AIT's uni8.lam --- compiles to 355. Same contract: read from the bits of the leading --- bytes, discard the rest of the last byte touched, return M applied to the --- remaining bytes. Non-strict: the final continuation is the identity, so --- cont exp bits bytes = exp bits bytes, which is M bytes for closed M (the --- leftover bits of the last byte serve as its unused environment; the idea --- is Codex's, from uni28). A free variable in M is not caught. --- --- The design reads every bit through one reader, get (Codex, 2026-10-12), --- instead of two inline reads with their own refills. A refill moves to the --- next byte, and a byte always has eight bits, so the refilled read can never --- meet nil again: get needs no recursion (Claude). The variable parse is the --- old one: Scott-pair environment, re-entering int8 with the second bit --- pushed back. Verified against the 344 by `blam golf check --io bytes` --- (every closed program to 18 bits, with and without a data byte, plus random --- bytes: 0 differ on every closed program, and on every --- truncated one agrees with the 344 exactly) and by nested --- self-interpretation; see docs/classical/golf.md. --- --- test with --- cat id.Blc id.lam | ./blc run8 uni8.lam +-- BLC8 universal machine for closed programs: 304 bits (38 bytes) +-- a9lim reduced it from 355 bits (344 for the IOCCC uni8.Blc): +-- every bit is read through one reader, get, which refills from the next +-- byte when the current one runs out. A refill always lands on a fresh byte +-- of eight bits, so get never needs to refill twice and is not recursive. +-- The parser branches on a code's first bit before reading the second, and +-- step takes that first bit as an argument: after a variable's tag 11, the +-- second 1 is also the first bit of the rest of its code, so step re-enters +-- with it instead of pushing it back onto the stream. +-- Variables keep the Scott-pair environment. \bytes.bytes ( -let dbl = \x.x x -in - (dbl (\self. - (\get\int8\cont.get (\b.get (\c\tail.b +let + -- get k bits = k bit bits', reading the next byte when bits is nil + get = \k.(\h\bits.bits h (\bytes.bytes (\byte.byte h byte))) + (\b\tail\ignored.k b tail); + -- step cont b bits parses a term whose first bit b is already read + step = + let int8 = \cont.get (step cont) + in \cont\b.get (\c.b (int8 (\exp.c (cont (\args\arg.exp (\z.z arg args))) - (int8 (\exp2.cont (\args.exp args (exp2 args))))) tail) - (c (cont (\args.args c) tail) - (int8 (\var.cont (\args.var (args c))) - (\f.f c tail)))))) - -- get k bits = k bit tail, reading the next byte when bits is nil - (\k. (\h\bits. bits h (\bytes.bytes (\byte. byte h byte))) (\b\tail\ignored.k b tail)) - (self self)) - (\x.x))) + (int8 (\exp2.cont (\args.exp args (exp2 args)))))) + (c (cont (\args.args c)) + (step (\var.cont (\args.var (args c))) c))) +in + -- free variables diverge in the base environment get get get, which + -- has no head normal form: it reduces to ever more leading lambdas and + -- never to a head variable, so like (\x.x x) (\x.x x) it gives every + -- program the same normal form, or none. + -- (\x.x) instead gives a non-strict machine of 283 bits (36 bytes): + -- cont exp bits bytes = exp bits bytes = M bytes for closed M + get (step (\x.x))) + +-- test with +-- cat id.Blc id.lam | ./blc run8 uni8.lam +-- which should output +-- \x.x diff --git a/data/golf/machines/uniK.blc b/data/golf/machines/uniK.blc new file mode 100644 index 00000000..83342a92 --- /dev/null +++ b/data/golf/machines/uniK.blc @@ -0,0 +1 @@ +01000101100000000110000001100001010000010111111001110000001011111100101110000101111101011001011110110001100111110010101010001101000010000010100000000000001011111000010111100001010101011111111111000000101010111111111110110101110111110000010000000010111101001110101101111100101010101111111011111011100000010111010111101011110010111000010101010111111101110111110000001111111001110101011001011111111011001111010011100001110000001110111000011110000111101100110101110110100101111001011000000111000001000100001011110000001011111000000111011110000001111011011111001111111011111101111100001100111011000011010 diff --git a/data/golf/machines/uniK.lam b/data/golf/machines/uniK.lam new file mode 100644 index 00000000..1427d571 --- /dev/null +++ b/data/golf/machines/uniK.lam @@ -0,0 +1,51 @@ +-- 599 bits +let + self = \x.x x; + I = \x.x; + K = \x\y.x; + nil = \x\y.y; + succ = \n\s\z.s n; + B = \x\y\z.x (y z); + R = \x\y\z.y z x; + S = \x\y\z.x z (y z); + fix = \f.(\x.x x) (\x.f (x x)) + + -- Kiselyov LC interpreter with Eager Weakening + -- https://theory.stanford.edu/~blynn/lambda/kiselyov.html + -- intK cont bits = cont depth closedup unparsed_bits + -- (n, d): n is one plus the greatest free index of M, or zero if closed; + -- d =beta \x[n-1]...\x[0]. M, where index i in M denotes x[i]. + -- All n arguments are present, outermost first, including unused ones. + -- Depths are Scott naturals: nil = 0, succ n = n+1. +in self (\recur\outer\list.list (\bit0\list1.list1 (\bit1. + (\intK\cont.bit0 + (intK + (let + -- cmps cont m tm n tn = cont (max m n) closedup + -- add increments the resulting depth; keep preserves a known depth + -- up (n, d) = (n+1, d) + cmps = fix (\cmps\cont. + (\add\keep\m\tm\n\tn.m + (\m1.n +-- (m+1, d1) # (n+1, d2) = up (((0, Com "S") # (m, d1)) # (n, d2)) + (\n1.cmps + (\m1\t.add m1 t n1 tn) + nil S m1 tm) +-- (m+1, d1) # (0, d2) = up ((0, Com "R" :@ d2) # (m, d1)) + (keep m n (R tn) m1 tm)) +-- (0, d1) # (n+1, d2) = up ((0, Com "B" :@ d1) # (n, d2)) + (n (\n1.keep n m (B tm) n1 tn) +-- (0, d1) # (0, d2) = (0, d1 :@ d2) + (cont n (tm tn)))) + (cmps (\l.cont (succ l))) + (\m.cmps (\_.cont m))); + compose = cmps cont + in \m\tm.bit1 + (m (\m1.cont m1 tm) (cont m (K tm))) + (intK (\n\tn.compose m tm n tn)))) + -- A variable is the first projection on its depth many arguments. + -- (1, I); (n, d) becomes (n+1, B K d) for each extra unary 1. + (bit1 (cont (succ nil) I) + (\list2.intK (\n\tm.cont (succ n) (B K tm)) list1))) (recur recur) outer))) + -- closed programs have depth zero; positive depth forces the loop + (\n.n (self self)) diff --git a/data/golf/machines/uniK_lazy.blc b/data/golf/machines/uniK_lazy.blc new file mode 100644 index 00000000..a73db22d --- /dev/null +++ b/data/golf/machines/uniK_lazy.blc @@ -0,0 +1 @@ +0100010110000100000100000110110000001100001011110011111100100000001011111001011100001011000010111111111101011100101011111000001100000101100101111111101100011001111111110000001010101111110111011110101100101111111100001000001010000000000000101111000000101111000010101011110111010010101010111111111111000000101010111111111111000001101011011111110000000010101111111001111010111001011111001110101100000101111111011001010101111111111000001011111110110111110010111001010101011111111011111000000101110101111110111011111101001010101011111111011111011111101011110111001011000010101011111110110010101100000000111100111010001011111011110111001011111111010011111011000011110000111100000010111011110111000011110000111101100110101111001000101110010110000010001000010111111110110111100001111110000001011101111011100110100001100111011000011010 diff --git a/data/golf/machines/uniK_lazy.lam b/data/golf/machines/uniK_lazy.lam new file mode 100644 index 00000000..12dbea5e --- /dev/null +++ b/data/golf/machines/uniK_lazy.lam @@ -0,0 +1,69 @@ +-- 826 bits +let + self = \x.x x; + I = \x.x; + T = \x\y.x; + F = \x\y.y; + nil = F;-- \p\n.n + cons = \x\y\p\n.p x y; + K = T; + B = \x\y\z.x (y z); + R = \x\y\z.y z x; + + -- share self-application between the fixed points and the loop + fix = \f.self (\x.f (x x)); + + -- Kiselyov LC interpreter with Lazy Weakening + -- https://theory.stanford.edu/~blynn/lambda/kiselyov.html + -- intK cont bits = cont unlambdas closedup unparsed_bits + intK = fix (\intK\cont. + let read = \bit0\list1.list1 (\bit1.bit0 + (intK + (let + -- compose cont tm m tn n = cont (max m n) (\...\ tm ...0 (tn ...0)) + -- add b records a flag; keep m preserves a needs-list + cmps = fix (\cmps\cont. + (\add\keep\tm\m\tn\n.m + (\bm\m1.n + (\bn.bm bm bn +-- (True:g1, d1) # (True:g2, d2) = (g1, ([], Com "S") # (g1, d1)) # (g2, d2) +-- (True:g1, d1) # (False:g2, d2) = (g1, ([], Com "C") # (g1, d1)) # (g2, d2) +-- (False:g1, d1) # (True:g2, d2) = (g1, ([], Com "B") # (g1, d1)) # (g2, d2) + (cmps (\m1\t.add T t m1 tn) + (\x\y\z.bm (x z) x (bn (y z) y)) nil tm m1) +-- (False:g1, d1) # (False:g2, d2) = (g1, d1) # (g2, d2) + (add F tm m1 tn)) +-- (True:g1, d1) # ([], d2) = ([], Com "R" :@ d2) # (g1, d1) + (bm (keep m (R tn) n tm m1) +-- (False:g1, d1) # ([], d2) = (g1, d1) # ([], d2) + (keep m tm m1 tn n))) +-- ([], d1) # (True:g2, d2) = ([], Com "B" :@ d1) # (g2, d2) +-- ([], d1) # (False:g2, d2) = ([], d1) # (g2, d2) + (n (\b.keep n (b B I tm) m tn) +-- ([], d1) # ([], d2) = d1 :@ d2 + (cont n (tm tn)))) + (\b.cmps (\l.cont (cons b l))) + (\m.cmps (\_.cont m))); + compose = cmps cont + in \m\tm.bit1 + (m (\b.b (\m1.cont m1 tm) (compose K nil tm)) + (cont m (K tm))) + (intK (\n\tn.compose tm m tn n)))) + (let push = \n.cont (cons bit1 n) + in bit1 (push nil I) (\list2.intK push list1))) + in \list.list read); + + -- loop + omega = self self + +-- binary LC universal machine for closed programs +in intK (\n.n omega) + +-- ([], d1) # (True:[], I) = d1 + -- ([], d1) # (True:g2, d2) = ([], B d1) # ([], I) = B d1 I +-- (True:[], Com "I") # ([], d2) = Com "T" :@ d2 + -- (True:g1, d1) # ([], d2) = R d2 I = T d2 +-- (True:[], Com "I") # (False:g2, d2) = ([], Com "T") # (g2, d2) + -- (True:g1, d1) # (False:g2, d2) = (g1, ([], C) # ([], I)) # (g2, d2) = C I # (g2, d2) +-- (False:g1, d1) # (True:[], Com "I") = d1 + -- (False:g1, d1) # (True:g2, d2) = (g1, ([], B) # (g1, d1)) # ([], I) diff --git a/docs/STATUS.md b/docs/STATUS.md index 5dd516ce..c4431b4b 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -304,14 +304,18 @@ with all features (three opt-in tests ignored) and 328 with default features. ### AIT golf -`classical/golf.md`: certified β-golf shrinks 45 of the 117 tromp/AIT -programs by 470 bits in all (`data/golf/sweep.tsv`; e.g. `tweet` 2230 → 2168, -`uniK` 903 → 854). Hand redesigns take the IOCCC BLC8 machine from 344 bits -(43 bytes) to 321 strict (41 bytes) and 300 non-strict (38 bytes), and -`uni28` from 500 to 399 strict and 382 non-strict. Ports of the 2025-12 parser -shrink `int4` 189 → 175 (with the 165's reader), `ko2kp` 615 → 557, `nf` 600 → 541, and the pairup -programs (771, 651, 1325; the last two on contract-valid inputs only). -Artifacts are in `data/golf/machines/`. +`classical/golf.md`: certified β-golf shrinks 44 of the 117 tromp/AIT +programs by 463 bits in all (`data/golf/sweep.tsv`). The upstream branch, +[tromp/AIT#13](https://github.com/tromp/AIT/pull/13), changes 40 programs by +1,143 bits, every one as a readable source: 36 of the β-golf gains, several +beyond the sweep (`tweet` 2230 → 2134, `loader` 1797 → 1781, +`pairup_Kp` 1402 → 1273), and hand redesigns. The IOCCC BLC8 machine goes from +344 bits (43 bytes) to 304 strict (38 bytes) and 283 non-strict (36 bytes), +`uni28` from 500 to 390 / 370, `uni2` to 332, `blc.lam` 195 → 186, and `uniK` +903 → 826 (599 with eager weakening). The parser ports give `int4` 175, +`ko2kp` 541 (so KP(x) ≤ KO(x) + 541), `nf` 538, and the pairup programs 756, +651 and 1273 (the last two on contract-valid inputs only). Artifacts are in +`data/golf/machines/`. ### Running programs: blc and uni @@ -366,10 +370,12 @@ GHC 9.10.3; `uni.rs` with rustc), all three harnesses in 11 minutes: `lean/Blc/Wire.lean`, then derive machine-checked K upper bounds. 6. **Coding theorem:** rerun the report on the K ≤ 35 cohort; an explicit Kraft–Chaitin decoder would upper-bound c. -7. **AIT golf:** the strict BLC8 machine is one bit over 40 bytes; its whole - β-component at slack 16 (1.5M states) has nothing smaller, so 320 needs a - structural idea. `uniK` and `blc.lam` still carry pre-redesign variable - handling. Upstreaming is a9's call (`contrib/PR_KIT.md`). +7. **AIT golf:** tromp/AIT#13 awaits Tromp's review (end of October). Terms + that Tromp's compiler will not keep as sources: `tree_ordinals` 715 + against its 726 source, and `loader` 1779 / `tweet` 2130 against 1781 / + 2134, which need two names bound side by side. Finishers from + `pairup_Kp` 1273 and `bf` 806 did not complete. The next BLC8 byte + boundaries, 296 strict and 280 non-strict, need another structural step. 8. **Discrete Solomonoff induction:** measure Church bit-list decode coverage and build prefix-tree conditional predictions under `m` and `S`. Infinite streams belong to the separate monotone-machine `ref/AIT` lane. @@ -638,8 +644,8 @@ halt-rounding slack equals the number of inexact divisions (96 units at determinism. The exhaustive qALC Python batteries and Lean proof checks are explicit local commands. - `ref/AIT` is pinned to the additive a9lim/AIT fork at `47b51dd`. The fork's - `uni-rs` and `golf` branches carry the upstream PRs drafted in - `contrib/PR_KIT.md`; both are three commits behind the fork's master. + `golf` branch is tromp/AIT#13, rebased on upstream master; `uni-rs` carries + the drafted `uni.rs` PR (`contrib/PR_KIT.md`), not yet opened. ### Accepted operational risks diff --git a/docs/classical/golf.md b/docs/classical/golf.md index 023eb0da..8b5fee0a 100644 --- a/docs/classical/golf.md +++ b/docs/classical/golf.md @@ -10,13 +10,21 @@ expansion; the self-interpreter and the universal machine have their own records (`self-interpreter/`). This document covers the rest of tromp/AIT: - a sweep of every program in tromp/AIT with expansion-capable optimizers: - 45 programs shrink, 470 bits in all; -- hand redesigns of the BLC8 and BLC2 universal machines: - - IOCCC `uni8` 344 → 321 strict and 300 non-strict; - - `uni28` 500 → 399; + 44 programs shrink, 463 bits in all; +- readable sources for 36 of them, sent upstream as + [tromp/AIT#13](https://github.com/tromp/AIT/pull/13), several smaller than + the sweep's terms; +- redesigns of the universal machines: + - IOCCC `uni8` 344 (43 bytes) → 304 strict (38 bytes) and 283 non-strict + (36 bytes); + - `uni28` 500 → 390 strict and 370 non-strict; + - `uni2` 340 → 332; +- redesigns of two more interpreters: the curried-bit `blc.lam` 195 → 186, + and the Kiselyov machine `uniK` 903 → 826 (same algorithm) and 599 (eager + weakening); - ports of the 2025-12 parser design into the programs that still embed the old one: `int4`, `ko2kp`, `nf` and the `pairup` programs, whose sizes are - constants in Tromp's AIT theorems. + constants in Tromp's AIT theorems (KP(x) ≤ KO(x) + 541). The machines were designed with Codex through independent consults. Who contributed which idea is marked where it appears. @@ -65,30 +73,39 @@ Results are in `data/golf/sweep.tsv`. A long sweep should run a frozen copy of the binary (`BLAM=...`), because rebuilding `target/release/blam` mid-run fails every later step. +A descent's result is a term, not a source. Each of its moves maps to a +source change: a let for a shared subterm, a helper taking an argument for an +anti-unification, a binding moved past a lambda that does not use it, a +reordered parameter list, or a knot written out as `(\x.x x) (\self. ...)` +when the self-application itself is worth sharing. Turning the sweep's terms +into such sources, and descending again from the sources, often goes further +than the sweep did, and Tromp's compiler sometimes η-reduces a source below +the term the η-free descent found. + ## Artifacts `data/golf/machines/` holds each redesigned or ported program. The `.lam` is -the readable source. The `.blc` is the best bits, either the source compiled -or a β-only descent of it, in which case the `.path` file is the move path -that `blam golf check --path` certifies step by step. BLC8 machines also ship -packed `.blc8`. +the readable source, as on the upstream branch, and the `.blc` is its +compiled bits. BLC8 machines also ship packed `.blc8`. | program | tromp/AIT | best strict | best non-strict | |---|---:|---:|---:| -| `uni8` (BLC8 machine) | 344 (IOCCC; 355 compiled) | **321** | **300** | -| `uni28` (BLC2 over bytes) | 500 | **399** | **382** | -| `uni2` (BLC2 machine) | 340 | **333** | **321** (from 324) | +| `uni8` (BLC8 machine) | 344 (IOCCC; 355 compiled) | **304** | **283** | +| `uni28` (BLC2 over bytes) | 500 | **390** | **370** | +| `uni2` (BLC2 machine) | 340 | **332** | **321** (from 324) | +| `blc` (curried-bit interpreter) | 195 | **186** | | +| `uniK` (Kiselyov machine) | 903 | **826**; **599** eager (`uniK_lazy`, `uniK`) | | | `int4` (self-interpreter, 4-primitive code) | 189 | **175** | | -| `ko2kp` (KP ≤ KO + c) | 615 | **557** | | -| `nf` (normal-form printer) | 600 | **541** | | -| `pairupKP` (symmetry of information) | 778 | **771** | | +| `ko2kp` (KP ≤ KO + c) | 615 | **541** | | +| `nf` (normal-form printer) | 600 | **538** | | +| `pairupKP` (symmetry of information) | 778 | **756** | | | `pairupK_p` | 657 | 651 † | | -| `pairup_Kp` | 1402 | 1325 † | | +| `pairup_Kp` | 1402 | 1273 † | | † Verified on contract-valid inputs only. On invalid ones these differ from the originals; see below. -## The BLC8 universal machine: 344 → 321 strict, 300 non-strict +## The BLC8 universal machine: 344 → 304 strict, 283 non-strict `uni8` reads a program from the bits of a byte stream. Each byte is a nil-terminated list of eight bits. The machine discards the rest of the last @@ -103,44 +120,56 @@ Code's Universal Lambda Machine page). It is the same machine as tromp/AIT's | IOCCC `uni8.Blc` | 344 | 43 | published | | β-golfed 344 | 334 | 42 | `letopt`, two cuts: `K` floated over the bit handler's ignored binder (−8), `\x. x x` shared between the knot and Ω (−2) | | shared reader | 325 | 41 | Codex: one reader `get` replaces the two inline reads and their two refill paths | -| non-recursive reader | **321** | **41** | a refill lands on a fresh byte, which always has eight bits, so `get` needs no knot | -| the same, non-strict, base environment `exp` | 308 | 39 | as in tromp/AIT's 178-bit `uni_non_strict` | -| non-strict, identity continuation | **300** | **38** | Codex's trick from `uni28`: `cont exp bits bytes = exp bits bytes`, which is `M bytes` for closed `M` | +| non-recursive reader | 321 | 41 | a refill lands on a fresh byte, which always has eight bits, so `get` needs no knot | +| split read | 319 | 40 | Codex: branch on a code's first bit before reading the second; the abstraction/application path drops a tail binder | +| the parser takes the read bit | 306 | 39 | Codex: `int8 cont = get (step cont)`; after a variable's tag 11 the second 1 is the first bit of the rest of its code, so `step` re-enters with it and the pushback cell goes | +| a reader-made bottom | **304** | **38** | Codex: the base environment `get get get` replaces Ω (below) | +| non-strict, identity continuation | **283** | **36** | Codex's trick from `uni28`: `cont exp bits bytes = exp bits bytes`, which is `M bytes` for closed `M` (300 on the 321) | The sources are `data/golf/machines/uni8.lam` and `uni8_nonstrict.lam`, with -`.blc` (ASCII) and `.blc8` (packed) beside them. The reader is +`.blc` (ASCII) and `.blc8` (packed) beside them. The reader and parser are ```text get k bits = bits h (\bytes. bytes (\byte. byte h byte)) where h = \b \tail \ignored. k b tail +step cont b = get (\c. b + (int8 (\exp. c (cont ABS) (int8 (\exp2. cont APP)))) + (c (cont (\args. args c)) (step (\var. cont (\args. var (args c))) c))) + where int8 cont = get (step cont) ``` -The parser reads its two tag bits through `get`. On the variable path it -pushes the second bit back (`\f. f c tail`) and re-enters itself, as -`uni8.lam` always has. The Scott-pair environment is unchanged. - -Verification: - -- **Differential.** `golf check --io bytes --max-bits 18` against the 344 - covers every closed program through 18 bits, with and without a trailing data - byte, plus random bytes. The 321 gives identical normal forms on all 1,593 - inputs where either halts. On the other 1,979, both machines exceed the - budget; none halts on one machine only. The 300 matches on every closed - program and halts on open ones where the strict 344 does not, as intended. -- **Truncated input.** On 2,801 nil-terminated inputs (every closed program - through 18 bits, cut at every byte, plus random bytes), the 321 agrees with - the 344 exactly. The non-recursive reader changes nothing here, because - running out of bytes gives `nil X = I` either way. Codex measured that the - analogous change in `uni28` does alter two incomplete programs, so it was - not used there. The 300 agrees with the 344 on every closed and every - truncated input; it differs only on open programs, which the 344 refuses. -- **Nested self-interpretation.** Each of 344, 321 and 308 runs each of - them on six programs, including closed variables whose codes cross byte - boundaries. All 54 combinations agree. -- **Tromp's C interpreter.** Under `ref/AIT/uni.c` in byte mode, all three - new binaries print `Ni hao` for the IOCCC smoke test. They also reproduce - `bin/take256.blc8` on 1,000 random bytes byte-identically, directly, and - with the 321 running the 321. +with the Scott-pair environment unchanged, and the machine is +`get (step (\exp\bits. exp (get get get)))`. + +**The bottom.** A strict machine's base environment only has to lack a head +normal form. With `G = get`, `H k x y z = k x y`, `T h x = x h x`, +`R h x = x (T h)`, `A_n = H^n G` and `E_n = G A_n (R A_n)`, `G G G` reduces to +`E_1`, and `E_n` to `L^(3n). E_(n+2)`, where `L^m` stands for `m` leading +lambdas whose arguments are unused. So `get get get` reduces to ever more +unused lambdas and never to a head variable, even under arguments: it is +unsolvable. By the genericity lemma (Barendregt 14.3.24), replacing one +unsolvable term by another leaves every context's normal form, or its absence, +unchanged, so the swap is exact under the normal-form contract. Codex's proof +also checks the recurrence algebraically for `n = 1..12` and β-certifies the +reader against the definitions above. + +Verification, each new machine against its predecessor and so back to the +344: + +- **Differential.** `golf check --io bytes --max-bits 20` covers every closed + program through 20 bits, with and without a trailing data byte, plus single + and random bytes: 6,200 inputs. Strict 304 against 321: 4,222 identical, + 1,978 over budget on both, 0 different, none halting on one side only. + Non-strict 283 against 300: 5,898 identical, 302 over budget on both. +- **Truncated input.** On 1,777 nil-terminated inputs (every closed program + through 18 bits cut at every byte, and nested runs of each machine running + the other on small programs), each new machine agrees with its predecessor + exactly. The non-recursive reader changes nothing here, because running out + of bytes gives `nil X = I` either way. +- **Tromp's C interpreter.** Under `ref/AIT/uni.c` in byte mode, the 304, the + 306 and the 283 reproduce `bin/take256.blc8` on 1,000 random bytes + byte-identically: directly, running themselves, and as 304 running 304 + running 283. ### Why the bit machine's redesign does not port @@ -158,35 +187,92 @@ standard two-component cells the boundary cannot be observed: any marker cell is η-equal to the next cell. Cells that carry the remaining bytes as a third component can observe it. But then every reader must absorb that component, `next` loses its η, `l l l` breaks, and the boundary-tracking flattener -alone costs about 100 bits. Estimated total: about 358 strict, against 321 -(estimate, not built). Codex independently reached the same conclusion and -measured a separate-first-bit handler at 348. +alone costs about 100 bits. Estimated total: about 358 strict (estimate, not +built), well above the Scott-pair machine. Codex independently reached the +same conclusion and measured a separate-first-bit handler at 348. ## The BLC2 machines BLC2 codes de Bruijn indices in Levenshtein code, so the unary pun behind the -bit machine's redesign has no direct analogue. Codex's independent attempt -gives the following. +bit machine's redesign has no direct analogue. Codex's independent attempts +give the following. + +- **`uni28` (500 → 390 / 370).** One bit reader serves the parser, the + Levenshtein delimiter and the digit accumulator (416). A fresh byte always + has a first bit, so the refill applies the byte straight to the + continuation and the reader needs no recursion: + `get = \k\bits. bits (\b\tail\ignored. k b tail) (\bytes. bytes (\byte. byte k))` + (404). On any stream of non-empty bytes it agrees with the recursive reader: + `get k (b:t) bs = k b t bs`, `get k [] ((b:t):bs) = k b t bs`, and both give + `\x.x` at the end of input. One self-application `delta = \x.x x` then + serves both fixpoints and the loop, with the parser's helpers bound inside + it (390). The non-strict version ends in the identity continuation: 370. +- **`uni2` (340 → 332).** Nothing structural survives in the parser: a + Church-numeral decoder, reversed environment fields and a closed `false` for + the known tag all lose, as does reusing the tag bit as the first Levenshtein + bit (the two are independent). One fixpoint combinator + `fix = \f.(\x.x x) (\x.f (x x))` serves `delimit` and `int2` (334), the + abstraction/application parse moves into a helper (333), and Ω becomes + `fix fix` (332): with `F = \x. fix (x x)`, `U = F F` and + `W = (\x. U (x x)) (\x. U (x x))`, `fix fix` reduces to `U`, which + head-reduces to `U W`, so it is unsolvable. The closed-program variant + `int2 (\z. z z)`: 324 → 321. -- **`uni28` (500 → 399 / 382).** One bit reader serves the parser, the - Levenshtein delimiter and the digit accumulator. Its continuation is held - outside the reader's fixpoint: - `get k = let r = \bits. bits (\b\t\_. k b t) (\bytes. bytes r) in r`. - The source compiles to 416, and a certified β-descent takes it to 399. The - non-strict version ends in the identity continuation: 393, then 382. -- **`uni2` (340 → 333).** Nothing structural survives: a Church-numeral - decoder, reversed environment fields and a closed `false` for the known tag - all lose. The 333 is β-golf of Tromp's source, found by the exact let - search. Non-strict: 324 → 321. - -Codex verified the decoders with deeper tests through index 255 and -three-level self-interpretation, as well as the differentials, which were -also re-run independently: - -- `uni2`: every bit stream through 14 bits; -- `uni28`: byte inputs through 18-bit programs. +Verification: -Both: 0 differ, and 0 halting on one side only for the strict machines. +- `uni28`: every closed BLC2 program through 18 bits (594), padded with zeros + and with ones, with and without a trailing data byte: 2,376 inputs, 2,372 + identical, 4 over budget on both (Ω), 0 different, for strict and + non-strict alike; and every such program cut at every byte (818 inputs), + all identical. `golf check --io bytes` (unary-coded programs, mostly + garbage to BLC2) gives 0 different, and its inputs that finish on one side + only (2 strict, 32 non-strict) are budget effects of its call-by-name + evaluator: under call-by-need both machines give `\1` on them. +- `uni2`: every bit stream through 14 bits, 32,767 inputs: 0 different, none + halting on one side only. +- Codex also verified the decoders with deeper tests through index 255 and + three-level self-interpretation. + +## Two more interpreters: `blc.lam` and `uniK` + +- **`blc.lam` (195 → 186).** Tromp's interpreter takes the code's bits as + separate curried arguments. Every code starts with two bits, so Codex's + version takes the second as a parameter instead of binding it in each arm of + the first-bit dispatch (−1), and abstraction and application, which both + begin by parsing a subterm, share that parse before the second-bit choice + (−8). Both steps hold whenever the bits are booleans, so this is held to + exact normal forms: every closed program through 20 bits fed bit by bit and + compared with the program itself, trailing arguments, `2 (3 2)`, and three + levels of self-interpretation: 2,070 inputs, 2,068 identical, 2 over budget + on both, 0 different. A `cons'` environment (200), shared variable recursion + (198) and separate head/tail arguments (203) all lose. +- **`uniK` (903 → 826 → 599).** Tromp's universal machine through Kiselyov's + bracket abstraction with lazy weakening. Codex's 826 is the same algorithm: + one self-application for both fixpoints and the loop, the composition's + continuations factored into two helpers (record a needs flag, keep a + needs-list) passed together so the compiler keeps them shared, and the + variable cases' continuation shared. It is β-convertible to the 903 + (`data/golf/machines/uniK_lazy.lam`). The 599 replaces the boolean + needs-lists with unary depths and eager weakening: a term is a pair + `(n, d)`, with `d` abstracting over all `n` surrounding variables, used or + not; a variable is a projection (`I`, then `B K` for each further 1), + composition aligns depths with `S`, `R` and `B`, and a positive final depth + still forces the loop. Every step is a β identity, but the generated + combinator terms differ, so the 599 is held to the differential: + `golf check --io progs --max-bits 18`, 9,870 inputs, 9,855 identical, 15 + over budget on both, 0 different, none halting on one side only. + +## Cheaper bottoms + +A strict machine needs a base term with no head normal form, not Ω itself. +By the genericity lemma any unsolvable term does the same job exactly, so an +unsolvable built from bindings already in scope can be cheaper than +`(\x.x x) (\x.x x)`. It pays twice: `uni8`'s `get get get` (−2) and `uni2`'s +`fix fix` (−1). Elsewhere Codex's proved alternatives lose: `uni.lam`'s best, +`intL intL intL`, is 192 against 187; strict `int4` 202 against 197; +`uni28`'s `get get get` 396 against 390; `uniK`'s `fix fix` 607 against 599; +`ko2kp`'s clean `Y Y` 566 against 563. `pairup_Kp` has no strict bottom: it +accepts open programs. ## Porting the redesign into programs that embed the old parser @@ -202,14 +288,26 @@ They read plain bit streams, so the redesign drops in. ABS builds stream itself, does the lookup in any environment. The HOAS constructors (`abs`/`app` in `ko2kp`, `L`/`A` in `nf`) are untouched. -| program | original | port | with the 165's reader | after β-descent of the port | +| program | original | port | with the 165's reader | source | |---|---:|---:|---:|---:| -| `ko2kp` | 615 | 569 | 566 | **557** | -| `nf` | 600 | 562 | 559 | **541** | +| `ko2kp` | 615 | 569 | 566 | **541** | +| `nf` | 600 | 562 | 559 | **538** | The 165's reader (`self-interpreter/interpreter.md`) drops in as well: the whole-stream skip `xs xs xs` serves both dispatch arms, 3 bits each. The -β-descents started from the ports before that change. +sources then take certified β-moves of the ports: + +- `ko2kp`: the KP-side definitions (T's case analysis, `nfT`, `appT`, + `boolT`, `consT`, `rest`) are scoped to the argument of `p` that uses them + (−17); `withT = \b. b A appT` hands T's constructors to builders generic in + both, as `uni` is (−5); one `Y` serves `uni`, `nfT` and `go` (−3). Its clean + configuration (`IF_DIRTY = false`, with `omega = Y id`) goes from 598 to + 563. +- `nf`: `cons0`, `cons00` and `cons01` are bound inside `ser`, where their + indices are small (−12); `appT` applies a HOAS value, β-reducing a `Lam` and + building an `App` otherwise (−7); one `Y` serves `parseval` and `ser` (−2). + +Both are certified β-convertible to the ports in every configuration. `int4.lam` is Tromp's self-interpreter for a four-primitive code: `00` λ, `01` application, `10` variable zero, `11` successor. After its tag bit, a @@ -235,6 +333,8 @@ followed by up to three data bits: the remainder by rerunning the program, which exhausts the budget often. - `nf` (through 16 bits): all 3,390 inputs identical. +These were run on the ports; the sources are β-convertible to them. + Open programs fall outside both contracts, and the old and new base environments give them different garbage. @@ -243,18 +343,32 @@ their parser, and `l l l` skips without recording. The port keeps the old bit-by-bit variable loop *only* to record `ps`. It switches the environment to `cons'` cells, and returns as the variable's value the stream captured before the loop, which looks itself up. `pairup_Kp` has a separate -prefix-capture layer and takes the whole `cons'`/skipvar interpreter. Polished -by certified β-descent: +prefix-capture layer and takes the whole `cons'`/skipvar interpreter. -| program | original | β-golf only | port | after descent | +| program | original | β-golf only | port | source | |---|---:|---:|---:|---:| -| `pairupKP` | 778 | 775 | 774 | **771** | +| `pairupKP` | 778 | 775 | 774 | **756** | | `pairupK_p` | 657 | 655 | 653 | **651** | -| `pairup_Kp` | 1402 | 1372 | 1360 | **1325** | - -`pairup_Kp` also takes the 165's reader, 1360 → 1357 before descent; against -the 1360 it differs on 24 of 182 raw pairs, each starting with a first -program β- or η-equal to `λx. x`, which is not a valid description. +| `pairup_Kp` | 1402 | 1372 | 1360, 1357 with the 165's reader | **1273** | + +The sources take certified β-moves of the ports: + +- `pairupKP`: `consBitT` builds `consT (boolT x) xs` with one shared `absT` + (−12); `uni` binds the recursion past a unary 1 outside the two arguments + it ignores (−2); the T datatype moves ahead of `uni` and the input is + applied outside the definitions (−3); the small `appT` is passed into + `uni`'s scope from outside (−1). Clean: 813 → 795. +- `pairupK_p`: the same recursion binding (−2), in all four configurations + (CPS 712, clean 777, clean CPS 791). +- `pairup_Kp`: `uniL1` is defined after `program`, so the compiler keeps one + shared `intL (\x.x x)` (−15); `program` becomes closed over its helpers + (−9); `readc`'s prefix builder becomes `cont01` (−33); `appsym m b` builds + the application of `m` to bit `b`'s term once, outside the node's binders + (−17), with three smaller placements (−10). + +Against the 1360, the 1357 differs on 24 of 182 raw pairs, each starting with +a first program β- or η-equal to `λx. x`, which is not a valid description; +the sources are β-convertible to the 1357 and to the 774 and 653. Verification: @@ -287,8 +401,10 @@ The sweep covers all 117 `.lam` files of tromp/AIT as pinned (`ref/AIT` at - a certificate for every reported term. The reference is `blcc.py`'s size, which is Tromp's toolchain at its default -slack. The note column marks the two results that only tie a size the source -already states, and the programs that were also redesigned by hand. +slack. The source column gives the size of the readable source on the +upstream branch (§Upstream), which may also carry a hand redesign; the note +column marks the two results that only tie a size the source already states, +and the gains kept out of the branch. Every gain was audited against its source. Records whose `in` term is the record itself count: the fast-growing terms, `hydra`, `loader`, `tweet`. A @@ -296,65 +412,74 @@ smaller β-convertible term has the same normal form, so it holds the same record in fewer bits. Smaller numbers stated in comments turned out to be component sizes, except the two ties noted. -| program | tromp/AIT | β-golf | saved | found by | certificate | note | -|---|---:|---:|---:|---|---|---| -| `fast_growing_and_conjectures/tweet.lam` | 2230 | **2168** | 62 | descend | beta | | -| `ait/uniK.lam` | 903 | **854** | 49 | descend | beta | | -| `characteristic_sequences/primes256.lam` | 286 | **252** | 34 | descend | beta | | -| `ait/pairup_Kp.lam` | 1402 | **1372** | 30 | descend | beta | by hand: 1325 (valid inputs) | -| `ait/uni28.lam` | 500 | **474** | 26 | descend | beta | by hand: 399 / 382 | -| `fast_growing_and_conjectures/tree_ordinals.lam` | 752 | **728** | 24 | descend | beta | | -| `lists/sort2.lam` | 435 | **415** | 20 | descend | beta | | -| `ait/mpi.lam` | 473 | **454** | 19 | descend | beta | | -| `ait/nf.lam` | 600 | **581** | 19 | descend | beta | by hand: 541 | -| `ait/bf.lam` | 830 | **812** | 18 | descend | beta | | -| `characteristic_sequences/squares.lam` | 325 | **308** | 17 | descend | beta | | -| `numerals/binary_numerals.lam` | 433 | **416** | 17 | descend | beta | | -| `ait/uni8.lam` | 355 | **341** | 14 | descend | beta | by hand: 321 strict / 300 non-strict (vs the IOCCC 344) | -| `lists/sort.lam` | 300 | **290** | 10 | letopt | beta | | -| `lists/take4k.lam` | 100 | **90** | 10 | descend | beta-path | | -| `ait/pi.lam` | 401 | **392** | 9 | descend | beta | | -| `ait/SKint.lam` | 144 | **136** | 8 | descend | beta-path | | -| `fast_growing_and_conjectures/hydra.lam` | 179 | **171** | 8 | letopt | beta | | -| `ait/uni2.lam` | 340 | **333** | 7 | letopt | beta | | -| `fast_growing_and_conjectures/patcail.lam` | 421 | **414** | 7 | descend | beta | | -| `numerals/scott_numerals.lam` | 482 | **475** | 7 | letopt | beta | | -| `fast_growing_and_conjectures/laver1.lam` | 268 | **262** | 6 | descend | beta | | -| `fast_growing_and_conjectures/loader.lam` | 1797 | **1791** | 6 | descend | beta | | -| `ait/bf2.lam` | 1009 | **1005** | 4 | letopt | beta | | -| `ait/delimito.lam` | 216 | **212** | 4 | letopt | beta | | -| `fast_growing_and_conjectures/laver2.lam` | 212 | **208** | 4 | descend | beta | | -| `ait/pairupKP.lam` | 778 | **775** | 3 | descend | beta | by hand: 771 | -| `ait/triage.lam` | 269 | **266** | 3 | descend | beta | | -| `numerals/min.lam` | 52 | **49** | 3 | descend | beta | | -| `ait/ko2kp.lam` | 615 | **613** | 2 | descend | beta | by hand: 557 | -| `ait/pairupK_p.lam` | 657 | **655** | 2 | letopt | beta | by hand: 651 (valid inputs) | -| `fast_growing_and_conjectures/erdos.lam` | 289 | **287** | 2 | descend | beta | | -| `fast_growing_and_conjectures/laver.lam` | 203 | **201** | 2 | letopt | beta | ties the stated 201 with slack 6 | -| `numerals/church_minimal.lam` | 39 | **37** | 2 | descend | beta | ties the stated 37 with blc -O6 | -| `numerals/sqrt.lam` | 118 | **116** | 2 | descend | beta | | -| `ait/delimit.lam` | 326 | **325** | 1 | letopt | beta | | -| `ait/pairlen.lam` | 285 | **284** | 1 | letopt | beta | | -| `ait/tree.lam` | 223 | **222** | 1 | descend | beta | | -| `characteristic_sequences/primes2.lam` | 217 | **216** | 1 | descend | beta | | -| `lists/cycle.lam` | 83 | **82** | 1 | descend | beta | | -| `lists/take16k.lam` | 110 | **109** | 1 | descend | beta-path | | -| `lists/take1k.lam` | 105 | **104** | 1 | descend | beta | | -| `lists/take256.lam` | 81 | **80** | 1 | descend | beta | | -| `lists/take64k.lam` | 81 | **80** | 1 | descend | beta-path | | -| `numerals/church.lam` | 30 | **29** | 1 | letopt | beta | | - -45 programs shrink under β-golf alone, by 470 bits in all; 43 of them below every size their source states. 64 do not shrink; 8 demos are excluded. +| program | tromp/AIT | β-golf | saved | found by | certificate | source | note | +|---|---:|---:|---:|---|---|---:|---| +| `fast_growing_and_conjectures/tweet.lam` | 2230 | **2168** | 62 | descend | beta | 2134 | | +| `ait/uniK.lam` | 903 | **854** | 49 | descend | beta | 826; 599 with eager weakening | | +| `characteristic_sequences/primes256.lam` | 286 | **252** | 34 | descend | beta | 252 | | +| `ait/pairup_Kp.lam` | 1402 | **1372** | 30 | descend | beta | 1273 (valid inputs) | | +| `ait/uni28.lam` | 500 | **474** | 26 | descend | beta | 390 / 370 | | +| `fast_growing_and_conjectures/tree_ordinals.lam` | 752 | **728** | 24 | descend | beta | 726 | | +| `lists/sort2.lam` | 435 | **415** | 20 | descend | beta | 415 | | +| `ait/mpi.lam` | 473 | **454** | 19 | descend | beta | 454 | | +| `ait/nf.lam` | 600 | **581** | 19 | descend | beta | 538 | | +| `ait/bf.lam` | 830 | **812** | 18 | descend | beta | 806 | | +| `characteristic_sequences/squares.lam` | 325 | **308** | 17 | descend | beta | 301 | | +| `numerals/binary_numerals.lam` | 433 | **416** | 17 | descend | beta | | kept out: the 416 inlines the library into fac | +| `ait/uni8.lam` | 355 | **341** | 14 | descend | beta | 304 strict / 283 non-strict | | +| `lists/sort.lam` | 300 | **290** | 10 | letopt | beta | 290 | | +| `lists/take4k.lam` | 100 | **90** | 10 | descend | beta-path | | kept out: bin/ holds its compiled golden | +| `ait/pi.lam` | 401 | **392** | 9 | descend | beta | 392 | | +| `ait/SKint.lam` | 144 | **136** | 8 | descend | beta-path | 136 | | +| `fast_growing_and_conjectures/hydra.lam` | 179 | **171** | 8 | letopt | beta | 171 | | +| `ait/uni2.lam` | 340 | **333** | 7 | letopt | beta | 332 / 321 | | +| `fast_growing_and_conjectures/patcail.lam` | 421 | **414** | 7 | descend | beta | 414 | | +| `fast_growing_and_conjectures/laver1.lam` | 268 | **262** | 6 | descend | beta | 262 | | +| `fast_growing_and_conjectures/loader.lam` | 1797 | **1791** | 6 | descend | beta | 1781 | | +| `ait/bf2.lam` | 1009 | **1005** | 4 | letopt | beta | 999 | | +| `ait/delimito.lam` | 216 | **212** | 4 | letopt | beta | 212 | | +| `fast_growing_and_conjectures/laver2.lam` | 212 | **208** | 4 | descend | beta | 208 | | +| `ait/pairupKP.lam` | 778 | **775** | 3 | descend | beta | 756 | | +| `ait/triage.lam` | 269 | **266** | 3 | descend | beta | 259 | | +| `numerals/min.lam` | 52 | **49** | 3 | descend | beta | 49 | | +| `ait/ko2kp.lam` | 615 | **613** | 2 | descend | beta | 541 | | +| `ait/pairupK_p.lam` | 657 | **655** | 2 | letopt | beta | 651 (valid inputs) | | +| `fast_growing_and_conjectures/erdos.lam` | 289 | **287** | 2 | descend | beta | 287 | | +| `fast_growing_and_conjectures/laver.lam` | 203 | **201** | 2 | letopt | beta | | ties the stated 201 with slack 6 | +| `numerals/church_minimal.lam` | 39 | **37** | 2 | descend | beta | | ties the stated 37 with blc -O6 | +| `numerals/sqrt.lam` | 118 | **116** | 2 | descend | beta | 116 | | +| `ait/delimit.lam` | 326 | **325** | 1 | letopt | beta | 325 | | +| `ait/pairlen.lam` | 285 | **284** | 1 | letopt | beta | 284 | | +| `ait/tree.lam` | 223 | **222** | 1 | descend | beta | 222 | | +| `characteristic_sequences/primes2.lam` | 217 | **216** | 1 | descend | beta | 216 | | +| `lists/cycle.lam` | 83 | **82** | 1 | descend | beta | 82 | | +| `lists/take16k.lam` | 110 | **109** | 1 | descend | beta-path | | kept out: bin/ holds its compiled golden | +| `lists/take1k.lam` | 105 | **104** | 1 | descend | beta | | kept out: bin/ holds its compiled golden | +| `lists/take256.lam` | 81 | **80** | 1 | descend | beta | | kept out: bin/ holds its compiled golden | +| `lists/take64k.lam` | 81 | **80** | 1 | descend | beta-path | | kept out: bin/ holds its compiled golden | +| `numerals/church.lam` | 30 | **29** | 1 | letopt | beta | 29 | | + +44 programs shrink under β-golf alone, by 463 bits in all; 42 of them below every size their source states. 64 do not shrink; 9 demos are excluded. Demos (excluded): - `ait/binary_better.lam` (862 → 192): an example term for the BLC2 size comparison - `ait/minbase.lam` (92 → 23): computes S from a smaller base - `numerals/SK_numerals.lam` (110 → 31): applies the artifact to sample data +- `numerals/scott_numerals.lam` (482 → 475): applies the artifact to sample data - `numerals/tuple_numerals.lam` (7 → 7): applies the artifact to sample data - `rosetta/exp00.lam` (31 → 31): applies the artifact to sample data - `rosetta/facY.lam` (160 → 160): applies the artifact to sample data - `rosetta/forloops.lam` (139 → 129): applies the artifact to sample data - `rosetta/variadicY.lam` (256 → 249): applies the artifact to sample data -No gain from β-golf: `BB/BB40.lam`, `BB/BB_Xi.lam`, `Sample.lam`, `ait/Aint.lam`, `ait/Y.lam`, `ait/allA.lam`, `ait/bcl.lam`, `ait/beavers.lam`, `ait/blc.lam`, `ait/decoders.lam`, `ait/delimit2.lam`, `ait/int.lam` (by hand: 165), `ait/int4.lam` (by hand: 175), `ait/mlatu.lam`, `ait/quine.lam`, `ait/readlen.lam`, `ait/uni.lam` (by hand: 187 strict / 175 non-strict), `ait/vararg.lam`, `ait/wtf.lam`, `ait/zot.lam`, `characteristic_sequences/all.lam`, `characteristic_sequences/even.lam`, `characteristic_sequences/none.lam`, `characteristic_sequences/odd.lam`, `characteristic_sequences/primes.lam`, `characteristic_sequences/thue-morse.lam`, `fast_growing_and_conjectures/BBE0.lam`, `fast_growing_and_conjectures/BO.lam`, `fast_growing_and_conjectures/E0.lam`, `fast_growing_and_conjectures/ackermann.lam`, `fast_growing_and_conjectures/bms.lam`, `fast_growing_and_conjectures/collatz.lam`, `fast_growing_and_conjectures/gAckerman.lam`, `fast_growing_and_conjectures/goldbach.lam`, `fast_growing_and_conjectures/goodstein.lam`, `fast_growing_and_conjectures/graham.lam`, `fast_growing_and_conjectures/laver0.lam`, `fast_growing_and_conjectures/melo.lam`, `fast_growing_and_conjectures/oddperfect.lam`, `fast_growing_and_conjectures/perfect.lam`, `fast_growing_and_conjectures/w1CK.lam`, `fast_growing_and_conjectures/w218.lam`, `fast_growing_and_conjectures/wCubed.lam`, `lists/cat.lam`, `lists/fold.lam`, `lists/length.lam`, `lists/map.lam`, `lists/reverse.lam`, `misc/id.lam`, `misc/truth.lam`, `numerals/div.lam`, `numerals/divides.lam`, `numerals/eq.lam`, `numerals/fac.lam`, `numerals/fib.lam`, `numerals/gcd.lam`, `numerals/half.lam`, `numerals/leq.lam`, `numerals/lt.lam`, `numerals/mod.lam`, `numerals/tri.lam`, `rosetta/catstrings.lam`, `rosetta/mutrec.lam`, `rosetta/swap.lam`. +No gain from β-golf: `BB/BB40.lam`, `BB/BB_Xi.lam`, `Sample.lam`, `ait/Aint.lam`, `ait/Y.lam`, `ait/allA.lam`, `ait/bcl.lam`, `ait/beavers.lam`, `ait/blc.lam` (source: 186), `ait/decoders.lam`, `ait/delimit2.lam`, `ait/int.lam` (source: 165), `ait/int4.lam` (source: 175), `ait/mlatu.lam`, `ait/quine.lam`, `ait/readlen.lam`, `ait/uni.lam` (source: 187 strict / 175 non-strict), `ait/vararg.lam`, `ait/wtf.lam`, `ait/zot.lam`, `characteristic_sequences/all.lam`, `characteristic_sequences/even.lam`, `characteristic_sequences/none.lam`, `characteristic_sequences/odd.lam`, `characteristic_sequences/primes.lam`, `characteristic_sequences/thue-morse.lam`, `fast_growing_and_conjectures/BBE0.lam`, `fast_growing_and_conjectures/BO.lam`, `fast_growing_and_conjectures/E0.lam`, `fast_growing_and_conjectures/ackermann.lam`, `fast_growing_and_conjectures/bms.lam`, `fast_growing_and_conjectures/collatz.lam`, `fast_growing_and_conjectures/gAckerman.lam`, `fast_growing_and_conjectures/goldbach.lam`, `fast_growing_and_conjectures/goodstein.lam`, `fast_growing_and_conjectures/graham.lam`, `fast_growing_and_conjectures/laver0.lam`, `fast_growing_and_conjectures/melo.lam`, `fast_growing_and_conjectures/oddperfect.lam`, `fast_growing_and_conjectures/perfect.lam`, `fast_growing_and_conjectures/w1CK.lam`, `fast_growing_and_conjectures/w218.lam`, `fast_growing_and_conjectures/wCubed.lam`, `lists/cat.lam`, `lists/fold.lam`, `lists/length.lam`, `lists/map.lam`, `lists/reverse.lam`, `misc/id.lam`, `misc/truth.lam`, `numerals/div.lam`, `numerals/divides.lam`, `numerals/eq.lam`, `numerals/fac.lam`, `numerals/fib.lam`, `numerals/gcd.lam`, `numerals/half.lam`, `numerals/leq.lam`, `numerals/lt.lam`, `numerals/mod.lam`, `numerals/tri.lam`, `rosetta/catstrings.lam`, `rosetta/mutrec.lam`, `rosetta/swap.lam`. + +## Upstream + +The sources go to Tromp as [tromp/AIT#13](https://github.com/tromp/AIT/pull/13), +from the `golf` branch of the a9lim/AIT fork: one commit per program and +change, each with its design note and verification, so any subset can be +taken. Against upstream the branch changes 40 programs and saves 1,143 bits +in all. `ref/AIT` here stays pinned to the fork's additive `master`; the +`golf` branch modifies upstream files and never lands there. diff --git a/tools/golf/sweep.py b/tools/golf/sweep.py index 1c3ccdac..ea835c35 100644 --- a/tools/golf/sweep.py +++ b/tools/golf/sweep.py @@ -41,6 +41,7 @@ DEMOS = { "numerals/SK_numerals.lam": "applies the artifact to sample data", "numerals/tuple_numerals.lam": "applies the artifact to sample data", + "numerals/scott_numerals.lam": "applies the artifact to sample data", "rosetta/exp00.lam": "applies the artifact to sample data", "rosetta/facY.lam": "applies the artifact to sample data", "rosetta/forloops.lam": "applies the artifact to sample data", diff --git a/tools/golf/table.py b/tools/golf/table.py index 8616b188..ed98f06f 100644 --- a/tools/golf/table.py +++ b/tools/golf/table.py @@ -18,18 +18,59 @@ "numerals/church_minimal.lam": "37 with blc -O6", "fast_growing_and_conjectures/laver.lam": "201 with slack 6", } -# Programs redesigned or ported by hand: the sweep row is β-golf only. -MACHINES = { - "ait/uni8.lam": "321 strict / 300 non-strict (vs the IOCCC 344)", - "ait/uni28.lam": "399 / 382", +# The size of each program's readable source on the a9lim/AIT `golf` branch +# (tromp/AIT PR 13), as Tromp's compiler gives it. The sweep row is β-golf of +# the pinned original; a source may also carry a hand redesign. +SOURCES = { + "ait/uni8.lam": "304 strict / 283 non-strict", + "ait/uni28.lam": "390 / 370", + "ait/uni2.lam": "332 / 321", "ait/int.lam": "165", "ait/uni.lam": "187 strict / 175 non-strict", "ait/int4.lam": "175", - "ait/ko2kp.lam": "557", - "ait/nf.lam": "541", - "ait/pairupKP.lam": "771", + "ait/ko2kp.lam": "541", + "ait/nf.lam": "538", + "ait/pairupKP.lam": "756", "ait/pairupK_p.lam": "651 (valid inputs)", - "ait/pairup_Kp.lam": "1325 (valid inputs)", + "ait/pairup_Kp.lam": "1273 (valid inputs)", + "ait/blc.lam": "186", + "ait/uniK.lam": "826; 599 with eager weakening", + "ait/mpi.lam": "454", + "ait/pi.lam": "392", + "ait/SKint.lam": "136", + "ait/bf.lam": "806", + "ait/bf2.lam": "999", + "ait/delimito.lam": "212", + "ait/triage.lam": "259", + "ait/delimit.lam": "325", + "ait/pairlen.lam": "284", + "ait/tree.lam": "222", + "fast_growing_and_conjectures/loader.lam": "1781", + "fast_growing_and_conjectures/tweet.lam": "2134", + "fast_growing_and_conjectures/tree_ordinals.lam": "726", + "fast_growing_and_conjectures/hydra.lam": "171", + "fast_growing_and_conjectures/erdos.lam": "287", + "fast_growing_and_conjectures/laver1.lam": "262", + "fast_growing_and_conjectures/laver2.lam": "208", + "fast_growing_and_conjectures/patcail.lam": "414", + "characteristic_sequences/primes256.lam": "252", + "characteristic_sequences/squares.lam": "301", + "characteristic_sequences/primes2.lam": "216", + "lists/sort2.lam": "415", + "lists/sort.lam": "290", + "lists/cycle.lam": "82", + "numerals/min.lam": "49", + "numerals/sqrt.lam": "116", + "numerals/church.lam": "29", +} +# Gains deliberately left out of the upstream branch, and why. +KEPT_OUT = { + "numerals/binary_numerals.lam": "kept out: the 416 inlines the library into fac", + "lists/take4k.lam": "kept out: bin/ holds its compiled golden", + "lists/take16k.lam": "kept out: bin/ holds its compiled golden", + "lists/take1k.lam": "kept out: bin/ holds its compiled golden", + "lists/take256.lam": "kept out: bin/ holds its compiled golden", + "lists/take64k.lam": "kept out: bin/ holds its compiled golden", } @@ -46,15 +87,13 @@ def main(): else: same.append(prog) gains.sort(key=lambda g: (-g[3], g[0])) - print("| program | tromp/AIT | β-golf | saved | found by | certificate | note |") - print("|---|---:|---:|---:|---|---|---|") + print("| program | tromp/AIT | β-golf | saved | found by | certificate | source | note |") + print("|---|---:|---:|---:|---|---|---:|---|") for prog, ref, best, saved, how, cert, claims in gains: - note = "" + note = KEPT_OUT.get(prog, "") if prog in STATED: note = f"ties the stated {STATED[prog]}" - elif prog in MACHINES: - note = f"by hand: {MACHINES[prog]}" - print(f"| `{prog}` | {ref} | **{best}** | {saved} | {how} | {cert} | {note} |") + print(f"| `{prog}` | {ref} | **{best}** | {saved} | {how} | {cert} | {SOURCES.get(prog, '')} | {note} |") print() new = [g for g in gains if g[0] not in STATED] print(f"{len(gains)} programs shrink under β-golf alone, by {sum(g[3] for g in gains)} bits in all; " @@ -67,7 +106,7 @@ def main(): print(f"- `{prog}` ({ref} → {best}): {why}") print() print("No gain from β-golf: " + ", ".join( - f"`{p}`" + (f" (by hand: {MACHINES[p]})" if p in MACHINES else "") for p in sorted(same)) + ".") + f"`{p}`" + (f" (source: {SOURCES[p]})" if p in SOURCES else "") for p in sorted(same)) + ".") if __name__ == "__main__": From 071fa6fc06a2dc1b09cf841d994a07330e3aa0d3 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 18:38:53 -0400 Subject: [PATCH 19/41] PR kit: note the #13 summary comment is posted --- contrib/PR_KIT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/PR_KIT.md b/contrib/PR_KIT.md index 4e98fcc6..d9768502 100644 --- a/contrib/PR_KIT.md +++ b/contrib/PR_KIT.md @@ -97,9 +97,9 @@ instrumental, so they can be written out in full when the PRs go up. a9 opened it with the title "165 bit self-interpreter" and a two-line body. The commit messages carry each change's design note and verification, so the body can stay short; the comment below summarizes the whole branch for -the review. Posting it is a9's call. +the review. a9 posted an edited version on 2026-10-20. -**Draft comment for #13:** +**Draft comment for #13 (as drafted):** > While you're away I've added forty more commits on the same terms: one > program per commit, each with its design note and how it was checked, so From 917e4bfffbdf19a70e9da69351ab58434c4b06a9 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 19:32:11 -0400 Subject: [PATCH 20/41] Prove remainder nonlinearity and close self-applied skip bound --- docs/STATUS.md | 34 +- .../self-interpreter/cheap-tail-bound.md | 282 +++++++-- .../self-interpreter/head-decomposition.md | 51 +- .../classical/self-interpreter/interpreter.md | 23 +- docs/classical/self-interpreter/remainder.md | 117 ++-- lean/Blc.lean | 2 + lean/Blc/SelfintProjections.lean | 284 +++++++++ lean/Blc/SelfintZero.lean | 550 ++++++++++++++++++ 8 files changed, 1230 insertions(+), 113 deletions(-) create mode 100644 lean/Blc/SelfintProjections.lean create mode 100644 lean/Blc/SelfintZero.lean diff --git a/docs/STATUS.md b/docs/STATUS.md index c4431b4b..192e6553 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -180,11 +180,14 @@ with all features (three opt-in tests ignored) and 328 with default features. budget. For `T=s s`, affine reductions preserve the 30-bit budget; the reviewed nonlinear-redex classification now also excludes the five-application compressed cases, including proper argument contexts. - Any 30-bit improvement therefore has a beta-normal minimum - representative with at least three lambdas and exactly four - applications. The remaining normal forms and complete numerical - thresholds remain open; the further affine and four-application - arguments in the proof record are explicitly provisional + Every remaining beta-normal four-application shape is also excluded, + completing the handwritten `T=s s` threshold: every successful + handler costs at least 31 bits, and its reader at least 43. This + includes the full ambient frame, whole-stream access, and arbitrary + source redexes. The proof extends the safe-data argument to affine + callbacks, then separates affine input-edge accounting from the + case that can copy vacuous closures. The improving `T=s`, `|H|≤34` + budget remains open (`classical/self-interpreter/cheap-tail-bound.md`, `classical/self-interpreter/protocol-obstructions.md`). The zero arm ≥ 14, APP lift ≥ 19, reader/handler knot-tree and cell/APP @@ -217,7 +220,13 @@ with all features (three opt-in tests ignored) and 328 with default features. lambdas, headed by either the continuation or the stream. In the former case, continuation occurrences inside the two payloads can be replaced by the stream, preserving the full contract and saving one bit each. - These are handwritten results. Head normalization is not size-monotone + These are handwritten results. `SelfintProjections` kernel-checks + rigid-spine projection of the contract, including divergent decoded + values. Each payload of a literal continuation-headed interpreter + needs at least two nonlinear binders and a stream occurrence. Such a + head form therefore has at least five nonlinear binders in total and + costs at least 55 bits. This prices the displayed form only; + head normalization is not size-monotone even for fully affine terms. The literal 165 expands to a 755-bit head form in four contractions; its two lambdas, stream head, and two arguments are checked by `tools/self-interpreter/theory/head_decomposition.py` @@ -238,9 +247,16 @@ with all features (three opt-in tests ignored) and 328 with default features. sources, and every suffix. The fixed source/wire and symbolic-clause check takes 0.007 seconds (`data/self-interpreter/theory/remainder.json`). This is an unrestricted upper bound for a parser projection, not a - self-interpreter or a beta-normal remainder bound. The same note - records an unproved infinite-zero-prefix route to a nonlinear-binder - lower bound, with its missing obligations explicit. + self-interpreter or a beta-normal remainder bound. `SelfintZero` + proves that every exact remainder extractor needs two nonlinear + binders, including two inside the body of an explicit stream lambda. + Only closed-source, closed-suffix beta-join correctness is needed. + The proof normalizes source terms with at most one nonlinear binder + over a labelled infinite zero stream, then simulates the finite trace + on a closed source `λⁿ.I` followed by `Ω` to contradict exact extraction. + Integrated `lake build Blc` passes all 33 jobs; an eleven-theorem + audit across `SelfintZero` and `SelfintProjections` uses only + `propext` and `Quot.sound`. - **Normal and typed witnesses** (`classical/self-interpreter/normal.md`, `typed-normal.md`): the β-normal interpreter is 204 bits (`int204_normal`, L 21, A 29, X 44). Lean proves its exact wire, diff --git a/docs/classical/self-interpreter/cheap-tail-bound.md b/docs/classical/self-interpreter/cheap-tail-bound.md index faf0b473..569b25a0 100644 --- a/docs/classical/self-interpreter/cheap-tail-bound.md +++ b/docs/classical/self-interpreter/cheap-tail-bound.md @@ -1,13 +1,15 @@ -# Constraints on the cheap reader operands +# Cheap-reader lambda floors and the self-application bound This is Codex's handwritten proof record. It concerns the reader `s H T` in the ambient frame `[s,j,c,p,x]`, with `j,c,p,x` independent rigid variables. The handler may use every ambient variable and arbitrary beta redexes. The two operands considered here are `T=s` and `T=s s`. -The sections explicitly marked **Provisional argument** have not completed -independent review. They are retained as proposed extensions and are not -used by the established boundary stated at the end. +For `T=s s`, the argument excludes every handler of at most 30 bits +that satisfies both reader laws. It allows arbitrary source beta +redexes, whole-stream access through `s`, and every variable in the +ambient frame. The proof is handwritten, not a Lean formalization. +The corresponding 34-bit threshold for `T=s` remains open. Write @@ -31,9 +33,10 @@ Correctness on all variable streams alone forces **at least two explicit lambdas in H**, and **at least three when H is beta-normal**. The zero-stream law is not needed for these floors. -This does not settle either joint size threshold. A reader improvement -requires `|H|≤34` with `T=s`, or `|H|≤30` with `T=s s`; two lambdas -alone do not exclude those budgets. +A reader improvement requires `|H|≤34` with `T=s`, or `|H|≤30` +with `T=s s`. The lambda floors alone do not exclude those budgets; +the compression and shape arguments below complete the exclusion for +`T=s s`. ## The application-only data algebra @@ -269,10 +272,6 @@ size budget. ## Affine source lambdas and pending arguments -**Provisional argument.** The generalization below still needs review of -the macro-application bound and the treatment of nested opaque closures. -The preceding three-lambda floor does not depend on this generalization. - A source term is affine here when every source binder has at most one bound occurrence. This condition is preserved by beta reduction: an affine source binder cannot copy its argument, and every data binder @@ -281,9 +280,10 @@ lambda moved inside another closure remains a single occurrence. The preceding opaque-marker argument extends to any affine source term. Suppose it contains `k` source lambdas and has `n≥k+1` -safe external arguments still pending, with final argument `T` equal -to the original `Pₘ` or `Q`. For a sufficiently long variable -prefix, it cannot yield `c Pₘ₋₁ N`. +external data atoms still pending, chosen from `F,I,Q,Pₘ,Pₘ₋₁`, +with final argument `T` equal to the original `Pₘ` or `Q`. +For a sufficiently long variable prefix, it cannot yield +`c Pₘ₋₁ N`. To make the long-prefix choice explicit, let `A` count the initial macro applications, including those inside source lambda bodies, @@ -297,8 +297,11 @@ m > 2^(k+1) (A+2). Normalize the outer application context while treating its outermost source-lambda blocks as distinct rigid markers. The data-algebra table applies with these additional markers. In one normalization -phase the macro application count at most doubles: each table row -adds at most two applications for an original application. A source +phase the macro application count at most doubles. Normalize both +children first and inspect the table: a Scott value applied to a +marker-headed neutral is the largest case, replacing its one +application by two; the other rows add no more. Untouched lambda +bodies retain their original application nodes. A source lambda contraction cannot increase the macro application count, since its argument is used at most once. Across at most `k` source activations, the successive counts are therefore bounded by @@ -314,7 +317,10 @@ inside an ordinary rigid neutral, but they remain trapped there and cannot become functional values or standalone arguments of a source callback. Consequently no source activation receives bare terminal `K`. Its first argument is safe data, a marker-bearing expression, -or an ordinary rigid neutral. +or an ordinary rigid neutral. Restore every source block when +contracting one of them. The term may no longer be beta-normal; +the induction permits arbitrary affine terms and counts all +remaining source lambdas, including those moved into a closure. Now induct on `k`. A functional data result has no `c`; an ordinary rigid result retains the pending arguments and therefore retains final @@ -769,8 +775,9 @@ Thus five-application nonlinear compression is also impossible. Since `A≥6` would cost at least `2·2+4·6+2+3=33` bits, these results prove that **if a successful `T=s s` handler of size -at most 30 exists, one of minimum size is beta-normal**. This does -not assert that all such normal forms have been excluded. +at most 30 exists, one of minimum size is beta-normal**. The +remaining sections exclude every possible shape of that normal +minimum. ## Normal handlers with at most three applications @@ -918,14 +925,27 @@ after consuming the Scott `K,R`. In either case at least five source lambdas have been consumed, with both `j,c` beneath them. Thus `L≥5`, `X≥6+7=13`, and the size is at least 37. -These cases exhaust the three-application normal shapes. Every -possible 30-bit improvement therefore has exactly four applications. +These cases exhaust the three-application normal shapes. Five or +more applications would cost at least `2·3+4·5+2+3=31` bits, +using the three-lambda floor and mandatory `j,c`. Every possible +30-bit improvement therefore has exactly four applications. -## One bound leaf in a nonleading four-application handler +For these remaining candidates, let `k` again count the leading +lambdas. The size identity and mandatory rigid leaves give + +``` +2L+X≤12, X≥2k+3, hence L+k≤4. +``` + +Together with `L≥3`, this leaves only `L=3,k=0`, `L=4,k=0`, +and `L=3,k=1`. A nonleading normal candidate must have free `s` +as its body head; every other available head is rigid. Among its +five leaves, `s,j,c` are mandatory, leaving zero, one, or two +bound occurrences. Zero was excluded by the all-vacuous argument. +The next two sections handle one and two, and the final section +handles the single leading lambda. -**Provisional argument.** This proposed exclusion depends on the affine -pending-argument generalization above and its remaining shape analysis. -It is not counted as an established exclusion. +## One bound leaf in a nonleading four-application handler Consider a beta-normal, application-headed handler with `A=4` and exactly one bound-variable leaf `v`. Its other four leaves @@ -990,11 +1010,6 @@ having exactly one bound-variable leaf. ## Two bound leaves in a nonleading four-application handler -**Provisional argument.** The proposed ordered-spine proof below still -needs independent review, particularly its bound on useful `K` -contractions and its treatment of duplicated vacuous closures. -It is not counted as an established exclusion. - Consider the other nonleading case: the five leaves are exactly `s,j,c,v,w`, where `v,w` are bound occurrences, possibly of the same binder. There is only one free `s`. The size constraint gives either @@ -1043,16 +1058,47 @@ a live bound occurrence. The final useful live occurrence on a successful zero path must therefore expose an input `R`, or expose `Q` and apply it to fixed source arguments to obtain `R j`. -There are at most two such live source occurrences on the path. -For distinct affine binders, neither source nor data reduction copies -them. If a binder is nonlinear, its two occurrences already use both -bound leaves. An argument copied by its contraction cannot contain -another live source binder: that would require a third bound leaf. -Nor can that argument contain the contracting binder itself: the -normal source has only its single occurrence as a lambda subterm, -and the Scott inputs and external inputs contain no source code. -Copied source closures are therefore vacuous. They do not create -additional live source occurrences. +### Repeated occurrences of one binder + +First suppose both bound leaves belong to the same binder `v`. +Before that binder is activated, only vacuous source lambdas can +consume the ordered input list: there is no other live binder that +could expose a supplied `K` or forward a supplied source closure. +Since `n≥5` and `L≤4`, `v` cannot receive the final `Q`. +Its argument is therefore `K`, `R`, or a common source argument +containing only rigid `j/c` leaves and vacuous lambdas. + +An argument of the last kind eventually exposes a `j/c` head or +leaves a lambda; copying it cannot introduce an `R` head. Giving +`v` the rigid `R` exposes that head before the final input edge +has been consumed. The remaining source lambdas are vacuous, and +there are fewer of them than remaining input edges, so that rigid +head retains a nonempty suffix ending in `Q`. + +If `v` receives `K`, all subsequent reductions select or erase +subtrees: the only live functional binders are those of copies of +`K`, and every remaining source lambda is vacuous. These reductions +preserve the order of surviving rigid leaves. If `j` lies inside +`D`, it precedes every still-available `R`, so the result cannot +be `R j`. + +If `j` lies in a common argument `A_i`, every original input edge +must still disappear by the ordered-suffix invariant. A fixed source +application inside `D` contains no `j`, while a fixed application +inside `A_i` contains no `R`. Selector and eraser reductions cannot +insert a received input into either fixed application: `K` returns +its selected argument whole, and a vacuous lambda discards its +argument. Thus joining a pending input `R` to that common `j` +would have to retain an original input edge, which is impossible. +This excludes the repeated-binder case without counting how many +vacuous lambdas its contraction might copy. + +### Distinct affine binders + +Now suppose the two bound leaves belong to distinct binders. All +source binders are affine, so neither source nor data reduction +copies any source lambda. There are at most `L` source-lambda +contractions and two live source occurrences on the head path. Before the final useful occurrence, the other occurrence can expose at most one useful `K` head. Forwarding a common argument containing @@ -1067,9 +1113,6 @@ capture of `R`. If selection reaches the pending inputs, selecting the earlier cell `R` retains a suffix ending in `Q`; selecting the last external `K` gives `K R Q→R`, with no source `j` after it. Vacuous wrappers only discard inputs and do not change this order. -This also excludes the two `K` residuals of a duplicated input `K`: -the second residual is precisely this unsuccessful final-`K` case. - Thus at most one useful `K` contraction precedes a successful `R j`. A source lambda consumes at most one original input edge, and that `K` consumes at most two. The ordered-spine invariant gives @@ -1116,17 +1159,148 @@ more. This contradicts `X≤4`. Hence the two-bound-leaf case also cannot meet the 30-bit budget. -## Remaining boundary - -The general results here are lambda-count obstructions for two specified -operands, together with the scoped three-leading-lambda exclusion for -`T=s`. For `T=s s`, the compression lemmas and the beta-normal -lambda floor reduce every possible 30-bit improvement to a beta-normal -minimum candidate with `L≥3` and `A=4`. The proposed four-application -exclusions above remain provisional, and the remaining beta-normal -shapes have not all been excluded. Neither improving -budget is fully excluded, and these results are not a global -optimality theorem. +## One leading lambda in a four-application handler + +The only remaining normal shape has `A=4,L=3` and exactly one +leading lambda: + +``` +H = λb.B, X≤6. +``` + +Mandatory occurrences of `j,c` contribute `2+3=5` index units, +leaving at most one extra unit. Each occurs exactly once; an +additional occurrence would itself exceed that allowance. Higher +ambient variables are also excluded. Let `V=Pₘ₋₁(N)` and `Q=K N` +on a sufficiently long variable stream. The variable law becomes + +``` +B[F/b] V Q =β c V N. +``` + +### A free stream occurrence + +If free `s` occurs, its index one spends the entire remaining unit. +Thus `j,c,s` have no inner lambda above them, every bound-variable +leaf has index zero, and there is only one `s`. The two inner +lambdas contain only their own bound leaves. The five-leaf budget +leaves exactly these possibilities: + +* two separate identities `I,I`; +* `F=λa d.d`, with the other bound leaf an exterior occurrence of `b`; +* `J=λa.a I`; +* `G=λa d.d d`. + +These exhaust the closed normal blocks with two lambdas and at most +two variable leaves whose indices are all zero. The remaining +syntax is application-only over those blocks, the stream, the +possible exterior `b`, and rigid `j,c`. + +After substituting `b=F`, the first two possibilities belong to the +safe data algebra. Functional results contain no `c`, while a +rigid result retains both pending arguments and ends in `Q`. +Neither can produce `c V N`. + +Each of `J,G` uses both remaining bound leaves, so there is no +exterior `b` in these cases. Before any source activation, the +application context has only `S=Pₘ`, rigid `j,c`, and its unique +opaque source block. The earlier literal-`s D` argument applies: +if an activation occurs, a first one can be chosen at a literal +source subterm `s J` or `s G`. If none occurs, the data or rigid +result already fails with both external arguments pending. The +two possible local activations give + +``` +S J →* F I V → V, +S G →* (λd.d d) V → V V →* Q. +``` + +Both eliminate all inner source lambdas and leave only safe data +before the pending `V,Q`. The data-algebra obstruction completes +the free-`s` case using the variable law alone. + +### No free stream occurrence + +Without `s`, all three leaves besides `j,c` are bound occurrences. +First-input dependence and beta-normality force the body head `b`: + +``` +B = b A₁ ... A_q, 1≤q≤4. +``` + +For `q=1`, the variable input `F` erases the only argument and +therefore erases the sole source of `c`. For `q=4`, every argument +is a lambda chain over one leaf. The zero branch uses only +projections, constant chains, and supplied copies of `K`. These +select or erase subtrees while preserving the order of surviving +rigid leaves. Every source `j` precedes every external `R`, so +they cannot give `R j`. + +For `q=2`, zero selects `A₁ R (K R)` and the variable branch +selects `A₂ V Q`. The unique `j` must lie in `A₁`, and the +unique `c` in `A₂`. Each branch also needs a bound-variable +leaf: without one the first is a vacuous `j` chain, and the +second is a vacuous `c` chain whose nonempty final argument +suffix ends in `Q`. Thus each branch has exactly two leaves and +one internal application. + +The single spare index unit permits at most one inner lambda +above `j`. The only useful normal forms for the first branch, +up to placement of lambdas elsewhere, are + +``` +b j, b (λu.j), λu.u j. +``` + +On the zero input their results after `R,K R` are respectively +`j (K R)`, `j`, and `R j (K R)`, all wrong. Every other +placement has rigid head `j`, puts `j` beneath two inner +lambdas, contains a source beta redex, or captures outer `b` +beneath a lambda also containing `j`. That last placement costs +two spare index units, one for `b` and one for `j`, exceeding +the available one. + +For `q=3`, exactly one application lies inside the arguments. +If it lies in `A₂`, the zero branch `A₁ A₃ R (K R)` uses +only projection and constant chains. The same rigid-leaf order +obstruction excludes it. + +Otherwise `A₂` is a lambda chain over one leaf. If it is bare, +that leaf is `j`, `c`, or outer `b`. The first two give a wrong +rigid head or retain the wrong final argument. The last becomes +`F`, and `F A₃ V Q→*V Q` has no `c`. If `A₂` begins with +a lambda, contract `A₂ A₃` internally on the variable branch. +Its one-leaf body is affine, so at most one source lambda remains, +with both `V,Q` still pending. The affine pending-argument lemma +then excludes the required result. + +The only way that this residual could instead be nonlinear is +for `A₃` to contain both remaining bound leaves under its sole +lambda. In that case the other two leaves `j,c` lie separately +in `A₁,A₂`; zero correctness puts `j` in `A₁`. That first +branch is a vacuous rigid-`j` chain and already fails the zero +law. Thus the affine argument covers every remaining case. + +This excludes the one-leading-lambda shape at the 30-bit budget. + +## Established bound and remaining scope + +Combining the compression lemmas, the beta-normal three-lambda floor, +and the exhaustive shape arguments proves: + +> In the ambient frame `[s,j,c,p,x]`, with `j,c,p,x` independent +> and rigid, no handler `H` of BLC size at most 30 satisfies both +> `T=s s` reader laws. This includes handlers with arbitrary source +> beta redexes and arbitrary whole-stream use of `s`. + +Thus the self-application operand cannot improve the reader within +this joint-handler interface. The whole-stream operand `T=s` at +`|H|≤34` remains open; only the stated lambda floors and the +three-leading-lambda special case have been excluded there. +Neither the independence assumptions on the ambient continuations +nor the specified reader interface have been removed. This is not +a global optimality theorem for the 165-bit interpreter. + The standard-skip handler bounds, including whole-stream access, live in `handler-bound.md`; neutral-operand domination is in `protocol-obstructions.md`. diff --git a/docs/classical/self-interpreter/head-decomposition.md b/docs/classical/self-interpreter/head-decomposition.md index af32320f..aa148302 100644 --- a/docs/classical/self-interpreter/head-decomposition.md +++ b/docs/classical/self-interpreter/head-decomposition.md @@ -143,9 +143,54 @@ only at the displayed root. Variable-for-variable replacement also preserves beta normality, so the same conclusion holds within the beta-normal fragment. -These are two semantic projections, not a lower bound obtained by adding -two independent implementation costs. They can contain copies descended -from shared code in the original `E`. +The two semantic projections can contain copies descended from shared code +in the original `E`. The following bound prices their syntax only when +the interpreter is already in the displayed form. + +## A continuation-headed interpreter needs five nonlinear binders + +`Blc.SelfintProjections` kernel-checks the rigid projections above without +assuming that either payload normalizes. It then proves, for any exact +interpreter literally of the form `H=λc s.c A B`, + +``` +nonlinear(A) ≥ 2, nonlinear(B) ≥ 2, +occ_s(A) ≥ 1, occ_s(B) ≥ 1, +nonlinear(H) ≥ 5, |H|_BLC ≥ 55. +``` + +The two interior bounds have different witnesses. For the value payload, +use the closed source `Ω` and a rigid suffix. Its Scott quotation is +binder-affine. Substituting that quotation cannot increase the payload's +nonlinear-binder count. A payload with at most one nonlinear binder would +therefore normalize, by `one_nonlinear_normalizes`, whereas its required +value `λz.Ω` has no normal form. + +For the remainder payload, first fix the continuation to the closed +affine identity. This leaves its nonlinear count unchanged and gives a +body whose only possible free variable is the stream. The theorem +`SelfintZero.remainder_body_two_nonlinear` then applies. Its infinite-zero +argument uses only closed sources `λⁿ.I` and a closed suffix `Ω`; +`remainder.md` gives the proof and its finite-prefix simulation. + +Each payload must use the stream variable. Otherwise its instantiated +term is independent of the supplied stream: the value projection could +not distinguish sources `I,K`, or the remainder projection could not +distinguish two rigid suffixes. Both occurrences belong to the same +displayed stream binder, making it a fifth nonlinear binder beyond the +four inside the payloads. Hence an exact interpreter with at most four +nonlinear binders that is itself in head normal form must be stream-headed. + +Finally, the established wire inequality for an arbitrary open term `T` +is `10 nonlinear(T) + 4 freeLeaves(T) ≤ |T|+2`. Each payload has at +least two nonlinear binders and one free stream occurrence, so each costs +at least 22 bits. The two interface lambdas, two root applications, and +the continuation variable cost 11 bits, giving `22+22+11=55`. + +These bounds allow arbitrary internal redexes, continuation uses, and +whole-stream access in `A,B`. They do not apply to the syntax of an +arbitrary source `E` that reduces to `H`: shared nonlinear code can be +copied into both payloads during that reduction. ## Stream-headed forms retain unrestricted control diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index a713ecca..f5033b4e 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -314,8 +314,14 @@ and every linear source redex must save enough index bits to offset the contraction's removed syntax. `remainder.md` gives a separate exact syntactic remainder extractor, with its all-source contract proved in `Blc/SelfintRemainder.lean`. -It calibrates that projection without supplying an additive lower bound -or reconstructing the source value; STATUS records its size and checks. +`Blc/SelfintZero.lean` proves that an exact remainder body needs two +nonlinear binders, excluding its stream binder. Together with the +value projection's independent two-binder requirement, +`Blc/SelfintProjections.lean` proves that a literal continuation-headed +interpreter has four nonlinear binders inside its payloads and a fifth +at its public stream binder. The corresponding wire floor is 55 bits. +This prices that displayed head form, not the source that expands into it; +STATUS records the construction's size and current checks. **Duplication.** At least two syntactic binders of `E` occur at least twice. Lean proves that every term with at most one such binder weakly normalizes; @@ -390,7 +396,8 @@ These are Codex's handwritten proofs, with targeted reduction checks in successful readers with `T=s next` or `T=s cont` also work with `T=s`, saving 5 or 6 bits. The proof in `protocol-obstructions.md` tracks an inert marked operand that every successful reduction must erase. It does - not exclude the cheaper `T=s` family or the productive thunk `T=s s`. + does not by itself exclude the cheaper `T=s` family or the productive + thunk `T=s s`. `cheap-tail-bound.md` proves that both families require at least two explicit lambdas in `H`, even with arbitrary whole-stream use and beta redexes. Every beta-normal handler needs at least three lambdas, @@ -399,9 +406,11 @@ These are Codex's handwritten proofs, with targeted reduction checks in improving `T=s` budget. For `T=s s`, every possible 30-bit improvement has a beta-normal minimum representative: affine contractions preserve its budget, and - the remaining nonlinear source-redex cases are excluded. It must - have at least three lambdas and exactly four applications. - It does not yet exclude their complete numerical handler budgets. + the remaining nonlinear source-redex cases are excluded. Its last + possible normal shapes, with at least three lambdas and exactly four + applications, are also excluded. Thus every successful `T=s s` + handler costs at least 31 bits, keeping the reader at least 43. + The `T=s`, `|H|≤34` threshold remains open. - **The zero arm costs at least 14 bits**, even with `bit0 := K` and the whole zero cell available to borrow. With `R` absent and the neighbours rigid, `Z R R = R next` forces the normal form `λu v. u next` (15) or @@ -619,5 +628,5 @@ Open: | `tools/self-interpreter/search_fix.py` | the knot search | | `tools/self-interpreter/beta_search.py` | the Python βη component reference | | `tools/self-interpreter/theory/` | bounded checks for explicit structural witnesses and protocol equations; no candidate search | -| `lake build` in `lean/` | the 165/168, normal, simply typed and two-nonlinear witnesses; unconditional normalization, capture and origin theorems | +| `lake build` in `lean/` | interpreter and remainder witnesses; normalization, capture, origin, beta-cost, zero-stream and head-projection theorems | | `data/self-interpreter/searches_165.json` | commands and totals of the joint searches of §3 | diff --git a/docs/classical/self-interpreter/remainder.md b/docs/classical/self-interpreter/remainder.md index c9ba991d..d2ee8961 100644 --- a/docs/classical/self-interpreter/remainder.md +++ b/docs/classical/self-interpreter/remainder.md @@ -94,43 +94,80 @@ A source that is itself continuation-headed has disjoint value and remainder payloads; a smaller term may instead share code before reaching that head form, or fuse both tasks in a stream-headed handler. -## Open lower-bound route: an infinite zero prefix - -The following is a proposed argument, not an established theorem or a -Lean result. Introduce a formal infinite zero-stream constant `Z` with -the rewrite rule - -``` -Z A → A K Z. -``` - -Application-only expressions over `K,Z` and opaque source closures appear -to admit a terminating data-normalization phase. The candidate normal -forms are iterated partial applications of `K` around `K`, `Z`, or an -opaque-headed expression. The useful equations include - -``` -Z K →* K, Z Z →* K Z, -Z (K A) →* A Z, Z (K (K A)) →* A. -``` - -If that phase and its interaction with source closures can be proved, -an affine closed source should weak-head normalize on `Z`: every source -contraction consumes a source lambda. The same argument may extend to a -source with at most one nonlinear binder, because its first nonlinear -weak-head contraction would leave affine source code. Weak-head reduction -is essential here; reducing under lambdas can move nonlinearity to an -enclosing binder. - -A finite reduction on `Z` inspects only a bounded zero prefix. A rigorous -simulation by sufficiently long finite encodings of `λⁿ.I` would then -give a lambda-headed result, contradicting exact extraction of a rigid -suffix. This would force at least two nonlinear binders in a remainder -extractor, and two inside the body of an explicit `λs.B` interface. - -The missing obligations are termination of the extended data algebra, -preservation of the source-binder accounting, and finite-prefix -simulation. No nonlinear-binder lower bound for remainder extraction is -claimed here. In particular, absence of a strict increase in the number -of source lambdas is insufficient: copying can recycle code with zero -net growth. +## Two nonlinear binders are necessary + +`Blc.SelfintZero.remainder_two_nonlinear` proves that every closed exact +remainder extractor contains at least two nonlinear binders. The stronger +`remainder_body_two_nonlinear` counts only the interior of an explicit +`λs.B` interface: if `B` has no free variables except `s` and + +``` +B[s := stream(M,N)] =β N +``` + +for every closed source `M` and every closed suffix `N`, then `B` itself +contains at least two nonlinear binders. The outer stream binder does not +count toward this bound. Beta-join correctness suffices; directed reduction +to the suffix is not assumed. The proof uses only closed beta-normal sources +of the form `λⁿ.I` and the single divergent suffix `Ω`. + +The mechanism is a labelled infinite zero stream. The extended syntax keeps +program lambdas explicit and introduces two affine data constants with rules + +``` +K A B → A, +Zᵢ A → A K Zᵢ₊₁. +``` + +The label records how many zero cells have been exposed along that stream +occurrence. It has no control effect. Treat each program lambda and variable +as an opaque head during a data phase. Canonical data values are `K`, `Zᵢ`, +`K V`, and opaque-headed spines with canonical arguments. Application of two +canonical values has a finite closed table: + +| Function and argument | Canonical result | +| --- | --- | +| `K V` | `K V` | +| `(K U) V` | `U` | +| `(h A⃗) V` | `h A⃗ V` | +| `Zᵢ K` | `K` | +| `Zᵢ Zⱼ` | `K Zᵢ₊₁` | +| `Zᵢ (K K)` | `K Zᵢ₊₁` | +| `Zᵢ (K Zⱼ)` | `K Zⱼ₊₁` | +| `Zᵢ (K (K A))` | `A` | +| `Zᵢ (K (h A⃗))` | `h A⃗ Zᵢ₊₁` | +| `Zᵢ (h A⃗)` | `h A⃗ K Zᵢ₊₁` | + +Here `h` is opaque. The first row records formation of a partial application, +not a reduction. Each other row is justified by a fixed finite reduction. +Bottom-up evaluation of the finite application tree therefore completes a +data phase. It neither copies program lambdas nor increases the number of +nonlinear program binders. + +For a closed extended term, the canonical result either denotes a lambda +(`K`, `Zᵢ`, `K V`, or an unapplied program lambda), or exposes a program +beta redex on the global function spine. An affine program contraction +strictly decreases the number of program lambdas. If there is at most one +nonlinear program binder, contracting it leaves entirely affine program +code. Alternating data phases and these head contractions must therefore +terminate at a lambda-like result. No reduction is performed underneath a +program lambda: allowing that would invalidate the nonlinear-binder +accounting by moving nonlinearity to an enclosing binder. + +The simulation is finite and uniform in the suffix. For any finite extended +trace, choose `m` larger than every stream label it demands and interpret +`Zᵢ` as `m−i` zero cells followed by an arbitrary closed tail `T`. Each +extended step becomes an ordinary finite beta reduction. The terminal +lambda-like result becomes an actual lambda. Choose an even `m=2n` and +`T=stream(I,Ω)`. The initial input is exactly `stream(λⁿ.I,Ω)`, so a putative +extractor with at most one nonlinear program binder reduces to a lambda. +Correctness also makes it beta-join `Ω`. Confluence makes this impossible: +every beta reduct of `Ω` is `Ω`, whereas every reduct of a lambda remains +a lambda. + +`Blc/SelfintZero.lean` mechanizes the application table, both binder-count +invariants, termination, labelled simulation, and the contradiction. +Its two public lower-bound theorems use only `propext` and `Quot.sound`, +with no custom axioms or admitted proofs. This establishes a structural +obstruction, not a sharp bit-length lower bound for remainder extraction +or an additive lower bound for arbitrary self-interpreters. diff --git a/lean/Blc.lean b/lean/Blc.lean index df887ea3..9fa115c1 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -25,3 +25,5 @@ import Blc.SelfintControl import Blc.SelfintTyped import Blc.SelfintWireCost import Blc.SelfintRemainder +import Blc.SelfintZero +import Blc.SelfintProjections diff --git a/lean/Blc/SelfintProjections.lean b/lean/Blc/SelfintProjections.lean new file mode 100644 index 00000000..8accdc2e --- /dev/null +++ b/lean/Blc/SelfintProjections.lean @@ -0,0 +1,284 @@ +/- +Independent semantic projections of a continuation-headed interpreter. +The payloads are arbitrary terms: no normality or parser architecture is +assumed. Any resulting source-size statement applies to this displayed +head form, not to an interpreter that reduces to it. +-/ +import Blc.SelfintControl +import Blc.SelfintWireCost +import Blc.SelfintZero + +namespace Blc.SelfintProjections +open Term SelfintControl SelfintLowerBound SelfintWireCost + +def headForm (A B : Term) : Term := + .lam (.lam (.app (.app (.var 1) A) B)) + +theorem rigid_app_betas {t u : Term} (h : Betas t u) : + ∀ {f a : Term}, t = .app f a → Rigid f → + ∃ g b, u = .app g b ∧ Betas f g ∧ Betas a b := by + induction h with + | refl t => + intro f a ht hf + exact ⟨f, a, ht, .refl _, .refl _⟩ + | head hb hs ih => + intro f a ht hf + subst ht + cases hb with + | beta b a => cases hf + | appL a hb => + obtain ⟨g, b, hu, hg, hba⟩ := ih rfl (rigid_beta hf hb) + exact ⟨g, b, hu, .head hb hg, hba⟩ + | appR f hb => + obtain ⟨g, b, hu, hg, hba⟩ := ih rfl hf + exact ⟨g, b, hu, hg, .head hb hba⟩ + +theorem rigid_app_join {f a g b : Term} (hf : Rigid f) (hg : Rigid g) + (h : BetaJoin (.app f a) (.app g b)) : + BetaJoin f g ∧ BetaJoin a b := by + obtain ⟨w, hfw, hgw⟩ := h + obtain ⟨f', a', hf', hff, haa⟩ := rigid_app_betas hfw rfl hf + obtain ⟨g', b', hg', hgg, hbb⟩ := rigid_app_betas hgw rfl hg + have he := hf'.symm.trans hg' + cases he + exact ⟨⟨f', hff, hgg⟩, ⟨a', haa, hbb⟩⟩ + +theorem subst_self (t : Term) (j : Nat) (ht : FreeUnder (j + 1) t) : + substDec j (.var j) t = t := by + induction t generalizing j with + | var n => + simp only [substDec] + split + · rename_i h; subst n; rfl + · have hng : ¬ n > j := by change n < j + 1 at ht; omega + simp only [hng, if_false] + | lam b ih => + simp only [substDec, shift, Nat.zero_le, if_true] + rw [ih (j + 1) ht] + | app f a ihf iha => + simp only [substDec, ihf j ht.1, iha j ht.2] + +theorem head_apply {A B : Term} (hA : FreeUnder 2 A) (hB : FreeUnder 2 B) + (S : Term) : + Betas (.app (.app (headForm A B) (.var 0)) S) + (.app (.app (.var 0) (contract A S)) (contract B S)) := by + apply Betas.head (.appL S (.beta _ _)) + simp only [contract, substDec, shift, Nat.zero_le, if_true] + rw [subst_self A 1 hA, subst_self B 1 hB] + exact .head (.beta _ _) (.refl _) + +/-- Rigid projection works even when the decoded source diverges. -/ +theorem projection_contract {A B : Term} (h : IsSelfInterpreter (headForm A B)) + {M : Term} (hM : Closed M) (N : Term) : + BetaJoin (contract A (streamOf (blcCode M) N)) (.lam M) ∧ + BetaJoin (contract B (streamOf (blcCode M) N)) N := by + have hA : FreeUnder 2 A := h.1.1.2 + have hB : FreeUnder 2 B := h.1.2 + have hc := contract_join h hM (.var 0) N + have hh := head_apply hA hB (streamOf (blcCode M) N) + have hj := join_trans (join_symm (join_of_betas hh)) hc + obtain ⟨hv, hn⟩ := rigid_app_join (.app _ (.var 0)) (.app _ (.var 0)) hj + exact ⟨(rigid_app_join (.var 0) (.var 0) hv).2, hn⟩ + +/-- Fix the unused public continuation to I, leaving only the stream slot. -/ +def payload (B : Term) : Term := substDec 1 identity B + +theorem payload_free {B : Term} (hB : FreeUnder 2 B) : + FreeUnder 1 (payload B) := by + have h : FreeUnder 0 (.app (.lam (.lam B)) identity) := + ⟨hB, by decide⟩ + have h' := beta_freeUnder (.beta (.lam B) identity) 0 h + simpa only [contract, substDec, shift_closed 1 0 (by decide : Closed identity), + FreeUnder, payload] using h' + +theorem payload_nonlinear (B : Term) : nonlinear (payload B) = nonlinear B := by + simp only [payload, nonlinear_subst] + have h : nonlinear identity = 0 := by decide + simp only [h, Nat.mul_zero, Nat.add_zero] + +theorem payload_contract {A B : Term} (h : IsSelfInterpreter (headForm A B)) + {M N : Term} (hM : Closed M) (hN : Closed N) : + BetaJoin (contract (payload A) (streamOf (blcCode M) N)) (.lam M) ∧ + BetaJoin (contract (payload B) (streamOf (blcCode M) N)) N := by + have hS : Closed (streamOf (blcCode M) N) := streamOf_closed _ hN + have hLM : Closed (.lam M) := closed_freeUnder hM 1 + obtain ⟨ha, hb⟩ := projection_contract h hM N + have lift : ∀ P T, Closed T → + BetaJoin (contract P (streamOf (blcCode M) N)) T → + BetaJoin (contract (payload P) (streamOf (blcCode M) N)) T := by + intro P T hT hj + have hj' := join_inst [identity] 0 hj + simp only [instN, shift_zero, substDec_contract, + shift_closed 1 0 (by decide : Closed identity), substDec_closed _ _ hS, + substDec_closed _ _ hT] at hj' + exact hj' + exact ⟨lift A (.lam M) hLM ha, lift B N hN hb⟩ + +private def omegaTerm : Term := + .app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.var 0))) + +private theorem omega_beta_eq {u : Term} (h : Beta omegaTerm u) : u = omegaTerm := by + have hs := headStep_complete (spine_beta_head (Spine.redex (by decide) (by decide)) h) + exact Option.some.inj hs.symm + +private theorem omega_betas_eq {u : Term} (h : Betas omegaTerm u) : u = omegaTerm := by + have aux : ∀ t v, Betas t v → t = omegaTerm → v = omegaTerm := by + intro t v hs + induction hs with + | refl => exact id + | head hb _ ih => + intro ht + apply ih + subst ht + exact omega_beta_eq hb + exact aux _ _ h rfl + +private theorem omega_no_nf : ¬ HasNormalForm omegaTerm := by + rintro ⟨n, hr, hnf⟩ + have he := omega_betas_eq hr + subst n + exact hnf _ (.beta _ _) + +/-- The value payload itself needs two nonlinear binders, excluding +both public interface binders. Its stream input is binder-affine. -/ +theorem value_two_nonlinear {A B : Term} (h : IsSelfInterpreter (headForm A B)) : + 2 ≤ nonlinear A := by + apply Nat.le_of_not_lt + intro hn + let S := streamOf (blcCode omegaTerm) (.var 0) + have hs : nonlinear (contract A S) ≤ 1 := by + simp only [contract, nonlinear_subst, S, nonlinear_stream, nonlinear, + Nat.mul_zero, Nat.add_zero] + omega + obtain ⟨nf, hr, hnft⟩ := one_nonlinear_normalizes (contract A S) hs + have hnf : NormalForm nf := fun _ hb => nft_no_beta hnft hb + obtain ⟨w, hw, ho⟩ := (projection_contract h (by decide : Closed omegaTerm) (.var 0)).1 + obtain ⟨v, hv, hnv⟩ := betas_preserve_hasNormalForm hw ⟨nf, hr, hnf⟩ + exact omega_no_nf (lam_betas_nf (betas_trans ho hv) hnv rfl) + +/-- The remainder payload independently needs two nonlinear binders. +This invokes finite-prefix simulation of the infinite zero stream. -/ +theorem remainder_two_nonlinear {A B : Term} (h : IsSelfInterpreter (headForm A B)) : + 2 ≤ nonlinear B := by + have hp := SelfintZero.remainder_body_two_nonlinear (payload B) + (payload_free h.1.2) + (fun M hM N hN => (payload_contract h hM hN).2) + simpa only [payload_nonlinear] using hp + +theorem four_interior_nonlinear {A B : Term} (h : IsSelfInterpreter (headForm A B)) : + 4 ≤ nonlinear A + nonlinear B := by + have ha := value_two_nonlinear h + have hb := remainder_two_nonlinear h + omega + +theorem freeLeaves_zero_closed (t : Term) (c : Nat) (h : freeLeaves c t = 0) : + FreeUnder c t := by + induction t generalizing c with + | var n => + simp only [freeLeaves] at h + split at h + · contradiction + · rename_i hn; exact Nat.lt_of_not_ge hn + | lam b ih => exact ih (c + 1) h + | app f a ihf iha => + simp only [freeLeaves] at h + exact ⟨ihf c (by omega), iha c (by omega)⟩ + +private theorem normal_join_eq {t u : Term} + (ht : NFt t) (hu : NFt u) (h : BetaJoin t u) : t = u := by + obtain ⟨w, hw, hw'⟩ := h + have hnt : NormalForm t := fun _ hb => nft_no_beta ht hb + have hnu : NormalForm u := fun _ hb => nft_no_beta hu hb + exact (normalForm_betas_eq hnt hw).symm.trans (normalForm_betas_eq hnu hw') + +theorem subst_absent (t : Term) (j : Nat) (s u : Term) (h : occ j t = 0) : + substDec j s t = substDec j u t := by + induction t generalizing j s u with + | var n => + have hn : n ≠ j := by intro he; simp [occ, he] at h + simp only [substDec, hn, if_false] + | lam b ih => exact congrArg Term.lam (ih (j + 1) _ _ h) + | app f a ihf iha => + simp only [occ] at h + simp only [substDec, ihf j s u (by omega), iha j s u (by omega)] + +theorem value_stream_occ {A B : Term} (h : IsSelfInterpreter (headForm A B)) : + 1 ≤ occ 0 A := by + apply Nat.le_of_not_lt + intro hn + have hi := (projection_contract h (by decide : Closed identity) (.var 0)).1 + have hk := (projection_contract h (by decide : Closed churchTrue) (.var 0)).1 + have he := subst_absent A 0 (streamOf (blcCode identity) (.var 0)) + (streamOf (blcCode churchTrue) (.var 0)) (by omega) + change contract A _ = contract A _ at he + rw [he] at hi + have heq := normal_join_eq (by decide : NFt (.lam identity)) + (by decide : NFt (.lam churchTrue)) (join_trans (join_symm hi) hk) + cases heq + +theorem remainder_stream_occ {A B : Term} (h : IsSelfInterpreter (headForm A B)) : + 1 ≤ occ 0 B := by + apply Nat.le_of_not_lt + intro hn + have hi := (projection_contract h (by decide : Closed identity) (.var 0)).2 + have hk := (projection_contract h (by decide : Closed identity) (.var 1)).2 + have he := subst_absent B 0 (streamOf (blcCode identity) (.var 0)) + (streamOf (blcCode identity) (.var 1)) (by omega) + change contract B _ = contract B _ at he + rw [he] at hi + have heq := normal_join_eq (by decide : NFt (.var 0)) + (by decide : NFt (.var 1)) (join_trans (join_symm hi) hk) + cases heq + +/-- The public stream binder is nonlinear as well as four interior +binders. This counts syntax in the displayed head form only. -/ +theorem headForm_five_nonlinear {A B : Term} (h : IsSelfInterpreter (headForm A B)) : + 5 ≤ nonlinear (headForm A B) := by + have hna := value_two_nonlinear h + have hnb := remainder_two_nonlinear h + have hoa := value_stream_occ h + have hob := remainder_stream_occ h + have hs : 1 < occ 0 A + occ 0 B := by omega + simp only [headForm, nonlinear, occ, + show ¬ (1 : Nat) = 0 by decide, if_false, Nat.zero_add, hs, if_pos] + omega + +theorem value_free_leaf {A B : Term} (h : IsSelfInterpreter (headForm A B)) : + 1 ≤ freeLeaves 0 A := by + apply Nat.le_of_not_lt + intro hn + have hc : Closed A := freeLeaves_zero_closed A 0 (by omega) + have hi := (projection_contract h (by decide : Closed identity) (.var 0)).1 + have hk := (projection_contract h (by decide : Closed churchTrue) (.var 0)).1 + simp only [contract, substDec_closed _ _ hc] at hi hk + have he := normal_join_eq (by decide : NFt (.lam identity)) + (by decide : NFt (.lam churchTrue)) (join_trans (join_symm hi) hk) + cases he + +theorem remainder_free_leaf {A B : Term} (h : IsSelfInterpreter (headForm A B)) : + 1 ≤ freeLeaves 0 B := by + apply Nat.le_of_not_lt + intro hn + have hc : Closed B := freeLeaves_zero_closed B 0 (by omega) + have hi := (projection_contract h (by decide : Closed identity) identity).2 + have hk := (projection_contract h (by decide : Closed identity) churchTrue).2 + simp only [contract, substDec_closed _ _ hc] at hi hk + have he := normal_join_eq (by decide : NFt identity) + (by decide : NFt churchTrue) (join_trans (join_symm hi) hk) + cases he + +/-- This prices only an interpreter already in the displayed head form. +Beta expansion of that form can be shorter, so this is not a global bound. -/ +theorem headForm_fifty_five {A B : Term} (h : IsSelfInterpreter (headForm A B)) : + 55 ≤ (blcCode (headForm A B)).length := by + have hna := value_two_nonlinear h + have hnb := remainder_two_nonlinear h + have hfa := value_free_leaf h + have hfb := remainder_free_leaf h + have hwa := nonlinear_wire_bound A + have hwb := nonlinear_wire_bound B + simp only [headForm, blcCode, List.length_cons, List.length_append, + List.length_replicate, List.length_nil] + omega + +end Blc.SelfintProjections diff --git a/lean/Blc/SelfintZero.lean b/lean/Blc/SelfintZero.lean new file mode 100644 index 00000000..f498d963 --- /dev/null +++ b/lean/Blc/SelfintZero.lean @@ -0,0 +1,550 @@ +/- +Labelled infinite zero streams. Program lambdas are explicit; K and Z_i +are affine data constants with rules K a b -> a and Z_i a -> a K Z_(i+1). +The labels record finite prefix demand and do not affect normalization. +-/ +import Blc.SelfintLowerBound +import Blc.SelfintWireCost +import Blc.NormalOrder + +namespace Blc +namespace SelfintZero +open Term SelfintLowerBound + +inductive Q where + | var (n : Nat) | lam (b : Q) | app (f a : Q) | k | z (i : Nat) +deriving Repr, DecidableEq + +def shiftQ (c : Nat) : Q → Q + | .var n => if n ≥ c then .var (n + 1) else .var n + | .lam b => .lam (shiftQ (c + 1) b) + | .app f a => .app (shiftQ c f) (shiftQ c a) + | .k => .k + | .z i => .z i + +def substQ (j : Nat) (s : Q) : Q → Q + | .var n => if n = j then s else if n > j then .var (n - 1) else .var n + | .lam b => .lam (substQ (j + 1) (shiftQ 0 s) b) + | .app f a => .app (substQ j s f) (substQ j s a) + | .k => .k + | .z i => .z i + +/-- Erasure is only for binder accounting, not a model of the Z rule. -/ +def erase : Q → Term + | .var n => .var n + | .lam b => .lam (erase b) + | .app f a => .app (erase f) (erase a) + | .k | .z _ => .lam (.var 0) + +theorem erase_shift (t : Q) (c : Nat) : + erase (shiftQ c t) = shift 1 c (erase t) := by + induction t generalizing c with + | var n => simp only [shiftQ, erase, shift]; split <;> rfl + | lam b ih => simp [shiftQ, erase, shift, ih] + | app f a ihf iha => simp [shiftQ, erase, shift, ihf, iha] + | k => simp [shiftQ, erase, shift] + | z i => simp [shiftQ, erase, shift] + +theorem erase_subst (t s : Q) (j : Nat) : + erase (substQ j s t) = substDec j (erase s) (erase t) := by + induction t generalizing s j with + | var n => simp only [substQ, substDec, erase]; split <;> (try rfl); split <;> rfl + | lam b ih => simp [substQ, substDec, erase, ih, erase_shift] + | app f a ihf iha => simp [substQ, substDec, erase, ihf, iha] + | k => exact (substDec_closed j (erase s) (by decide : Closed (.lam (.var 0)))).symm + | z i => exact (substDec_closed j (erase s) (by decide : Closed (.lam (.var 0)))).symm + +def nl (t : Q) : Nat := nonlinear (erase t) +def oc (j : Nat) (t : Q) : Nat := occ j (erase t) +def ClosedQ (t : Q) : Prop := Closed (erase t) + +@[simp] theorem nl_var (n : Nat) : nl (.var n) = 0 := rfl +@[simp] theorem nl_lam (b : Q) : nl (.lam b) = nl b + if 1 < oc 0 b then 1 else 0 := rfl +@[simp] theorem nl_app (f a : Q) : nl (.app f a) = nl f + nl a := rfl +@[simp] theorem nl_k : nl .k = 0 := by decide +@[simp] theorem nl_z (i : Nat) : nl (.z i) = 0 := rfl +@[simp] theorem oc_var (j n : Nat) : oc j (.var n) = if n = j then 1 else 0 := rfl +@[simp] theorem oc_lam (j : Nat) (b : Q) : oc j (.lam b) = oc (j + 1) b := rfl +@[simp] theorem oc_app (j : Nat) (f a : Q) : oc j (.app f a) = oc j f + oc j a := rfl +@[simp] theorem oc_k (j : Nat) : oc j .k = 0 := by + change (if 0 = j + 1 then 1 else 0) = 0 + exact if_neg (Nat.zero_ne_add_one j) +@[simp] theorem oc_z (j i : Nat) : oc j (.z i) = 0 := by + change (if 0 = j + 1 then 1 else 0) = 0 + exact if_neg (Nat.zero_ne_add_one j) + +theorem nl_subst (t s : Q) (j : Nat) : + nl (substQ j s t) = nl t + oc j t * nl s := by + simpa [nl, oc, erase_subst] using nonlinear_subst (erase t) (erase s) j + +/-- Only source-program lambdas are counted. -/ +def red : Q → Nat + | .var _ | .k | .z _ => 0 + | .lam b => red b + 1 + | .app f a => red f + red a + +theorem red_shift (t : Q) (c : Nat) : red (shiftQ c t) = red t := by + induction t generalizing c with + | var n => simp only [shiftQ]; split <;> rfl + | lam b ih => simp [shiftQ, red, ih] + | app f a ihf iha => simp [shiftQ, red, ihf, iha] + | k => rfl + | z i => rfl + +theorem red_subst (t s : Q) (j : Nat) : + red (substQ j s t) = red t + oc j t * red s := by + induction t generalizing s j with + | var n => + simp only [substQ, oc_var, red] + split + · simp + · split <;> simp [red] + | lam b ih => simp only [substQ, red, oc_lam, ih, red_shift]; omega + | app f a ihf iha => simp only [substQ, red, oc_app, ihf, iha, Nat.add_mul]; omega + | k => simp [substQ, red] + | z i => simp [substQ, red] + +/-- Weak compatible closure: no step is performed inside a program lambda. -/ +inductive Step : Q → Q → Prop where + | beta (b a : Q) : Step (.app (.lam b) a) (substQ 0 a b) + | k (a b : Q) : Step (.app (.app .k a) b) a + | z (i : Nat) (a : Q) : Step (.app (.z i) a) (.app (.app a .k) (.z (i + 1))) + | left {f g : Q} (a : Q) : Step f g → Step (.app f a) (.app g a) + | right (f : Q) {a b : Q} : Step a b → Step (.app f a) (.app f b) + +inductive Steps : Q → Q → Prop where + | refl (t : Q) : Steps t t + | head {t u v : Q} : Step t u → Steps u v → Steps t v + +theorem trans {t u v : Q} (h : Steps t u) (g : Steps u v) : Steps t v := by + induction h with + | refl => exact g + | head h _ ih => exact .head h (ih g) + +theorem one {t u : Q} (h : Step t u) : Steps t u := .head h (.refl _) + +theorem left {f g : Q} (a : Q) (h : Steps f g) : Steps (.app f a) (.app g a) := by + induction h with + | refl => exact .refl _ + | head h _ ih => exact .head (.left _ h) ih + +theorem right (f : Q) {a b : Q} (h : Steps a b) : Steps (.app f a) (.app f b) := by + induction h with + | refl => exact .refl _ + | head h _ ih => exact .head (.right _ h) ih + +inductive Atom where + | var (n : Nat) | lam (b : Q) +deriving Repr + +def atomTerm : Atom → Q + | .var n => .var n + | .lam b => .lam b + +mutual +inductive V where + | k | z (i : Nat) | const (v : V) | neu (n : Neu) +inductive Neu where + | atom (a : Atom) | app (n : Neu) (v : V) +end + +mutual +def val : V → Q + | .k => .k + | .z i => .z i + | .const v => .app .k (val v) + | .neu n => neutral n +def neutral : Neu → Q + | .atom a => atomTerm a + | .app n v => .app (neutral n) (val v) +end + +/-- Closed finite application table for the two affine data constants. -/ +def ap : V → V → V + | .k, v => .const v + | .const u, _ => u + | .neu n, v => .neu (.app n v) + | .z _, .k => .k + | .z i, .z _ => .const (.z (i + 1)) + | .z i, .const .k => .const (.z (i + 1)) + | .z _, .const (.z j) => .const (.z (j + 1)) + | .z _, .const (.const a) => a + | .z i, .const (.neu n) => .neu (.app n (.z (i + 1))) + | .z i, .neu n => .neu (.app (.app n .k) (.z (i + 1))) + +theorem ap_sound (u v : V) : Steps (.app (val u) (val v)) (val (ap u v)) := by + cases u with + | k => exact .refl _ + | const u => exact one (.k _ _) + | neu n => exact .refl _ + | z i => + cases v with + | k => exact .head (.z _ _) (one (.k _ _)) + | z j => + exact .head (.z _ _) (.head (.left _ (.z _ _)) + (.head (.left _ (.k _ _)) (.refl _))) + | neu n => exact one (.z _ _) + | const v => + refine .head (.z _ _) (.head (.left _ (.k _ _)) ?_) + cases v with + | k => exact .refl _ + | z j => + exact .head (.z _ _) (.head (.left _ (.z _ _)) + (.head (.left _ (.k _ _)) (.refl _))) + | const a => exact one (.k _ _) + | neu n => exact .refl _ + +theorem ap_red (u v : V) : red (val (ap u v)) ≤ red (val u) + red (val v) := by + cases u <;> cases v <;> simp only [ap, val, neutral, red] <;> try omega + case z.const i v => cases v <;> simp only [val, neutral, red] <;> omega + +theorem ap_nl (u v : V) : nl (val (ap u v)) ≤ nl (val u) + nl (val v) := by + cases u <;> cases v <;> simp only [ap, val, neutral, nl_app, nl_k, nl_z] <;> try omega + case z.const i v => cases v <;> simp only [val, neutral, nl_app, nl_k, nl_z] <;> omega + +def blue : Q → V + | .var n => .neu (.atom (.var n)) + | .lam b => .neu (.atom (.lam b)) + | .app f a => ap (blue f) (blue a) + | .k => .k + | .z i => .z i + +theorem blue_sound (t : Q) : Steps t (val (blue t)) := by + induction t with + | var n => exact .refl _ + | lam b ih => exact .refl _ + | app f a ihf iha => exact trans (left _ ihf) (trans (right _ iha) (ap_sound _ _)) + | k => exact .refl _ + | z i => exact .refl _ + +theorem blue_red (t : Q) : red (val (blue t)) ≤ red t := by + induction t with + | app f a ihf iha => have h := ap_red (blue f) (blue a); simp only [blue, red]; omega + | var | lam | k | z => exact Nat.le_refl _ + +theorem blue_nl (t : Q) : nl (val (blue t)) ≤ nl t := by + induction t with + | app f a ihf iha => have h := ap_nl (blue f) (blue a); simp only [blue, nl_app]; omega + | var | lam | k | z => exact Nat.le_refl _ + +theorem step_closed {t u : Q} (h : Step t u) (ht : ClosedQ t) : ClosedQ u := by + induction h with + | beta b a => + unfold ClosedQ at ht ⊢ + rw [erase_subst] + exact SelfintWireCost.beta_freeUnder (.beta _ _) 0 ht + | k a b => exact ht.1.2 + | z i a => exact ⟨⟨ht.2, by decide⟩, by simp [erase, FreeUnder]⟩ + | left a h ih => exact ⟨ih ht.1, ht.2⟩ + | right f h ih => exact ⟨ht.1, ih ht.2⟩ + +theorem steps_closed {t u : Q} (h : Steps t u) (ht : ClosedQ t) : ClosedQ u := by + induction h with + | refl => exact ht + | head h _ ih => exact ih (step_closed h ht) + +/-- Red beta contraction on the global function spine. -/ +inductive RStep : Q → Q → Prop where + | beta (b a : Q) : RStep (.app (.lam b) a) (substQ 0 a b) + | left {f g : Q} (a : Q) : RStep f g → RStep (.app f a) (.app g a) + +theorem RStep.step {t u : Q} (h : RStep t u) : Step t u := by + induction h with + | beta b a => exact .beta b a + | left a h ih => exact .left a ih + +theorem red_progress {t u : Q} (h : RStep t u) (ht : nl t ≤ 1) : + (red u < red t ∧ nl u ≤ nl t) ∨ (nl t = 1 ∧ nl u = 0) := by + induction h with + | beta b a => + by_cases hb : oc 0 b ≤ 1 + · left + have hn : ¬1 < oc 0 b := by omega + simp only [red_subst, red, nl_subst, nl_app, nl_lam, if_neg hn, Nat.add_zero] + rcases Nat.le_one_iff_eq_zero_or_eq_one.mp hb with h | h + · simp only [h, Nat.zero_mul, Nat.add_zero]; constructor <;> omega + · simp only [h, Nat.one_mul]; constructor <;> omega + · right + have hn : 1 < oc 0 b := by omega + simp only [nl_app, nl_lam, if_pos hn] at ht ⊢ + have hnb : nl b = 0 := by omega + have hna : nl a = 0 := by omega + rw [nl_subst, hnb, hna] + constructor <;> omega + | @left f g a h ih => + have hf : nl f ≤ 1 := by simp only [nl_app] at ht; omega + rcases ih hf with ⟨hr, hn⟩ | ⟨hn, hz⟩ + · left; simp only [red, nl_app] at *; constructor <;> omega + · right; simp only [nl_app] at *; constructor <;> omega + +/-- The four kinds of lambda-like weak-head answer. -/ +inductive Done : Q → Prop where + | k : Done .k + | z (i : Nat) : Done (.z i) + | const (t : Q) : Done (.app .k t) + | lam (b : Q) : Done (.lam b) + +theorem neutral_progress (n : Neu) (hc : ClosedQ (neutral n)) : + (∃ b, neutral n = .lam b) ∨ ∃ u, RStep (neutral n) u := by + cases n with + | atom a => + cases a with + | var i => exact (Nat.not_lt_zero i hc).elim + | lam b => exact Or.inl ⟨b, rfl⟩ + | app n v => + rcases neutral_progress n hc.1 with ⟨b, hb⟩ | ⟨u, hu⟩ + · right; simp only [neutral, hb]; exact ⟨_, .beta _ _⟩ + · right; exact ⟨_, .left _ hu⟩ +termination_by sizeOf n + +theorem val_progress (v : V) (hc : ClosedQ (val v)) : + Done (val v) ∨ ∃ u, RStep (val v) u := by + cases v with + | k => exact Or.inl .k + | z i => exact Or.inl (.z i) + | const a => exact Or.inl (.const _) + | neu n => + rcases neutral_progress n hc with ⟨b, hb⟩ | hr + · left; rw [val, hb]; exact .lam b + · exact Or.inr hr + +theorem affine_terminates (t : Q) (hc : ClosedQ t) (hn : nl t = 0) : + ∃ u, Steps t u ∧ Done u := by + generalize hm : red t = m + induction m using Nat.strongRecOn generalizing t with + | ind m ih => + have hb := blue_sound t + have hbr := blue_red t + have hbn : nl (val (blue t)) = 0 := Nat.eq_zero_of_le_zero (hn ▸ blue_nl t) + rcases val_progress (blue t) (steps_closed hb hc) with hd | ⟨u, hu⟩ + · exact ⟨_, hb, hd⟩ + · rcases red_progress hu (by omega) with ⟨hr, hn'⟩ | ⟨hn', _⟩ + · obtain ⟨v, hv, hd⟩ := ih (red u) (by omega) u + (step_closed hu.step (steps_closed hb hc)) (by omega) rfl + exact ⟨v, trans hb (.head hu.step hv), hd⟩ + · exact (Nat.zero_ne_one (hbn.symm.trans hn')).elim + +/-- At most one nonlinear program binder cannot diverge while scanning +the infinite all-zero Scott stream. The proof alternates finite blue +normalization with global red head contraction. -/ +theorem one_nonlinear_terminates (t : Q) (hc : ClosedQ t) (hn : nl t ≤ 1) : + ∃ u, Steps t u ∧ Done u := by + generalize hm : red t = m + induction m using Nat.strongRecOn generalizing t with + | ind m ih => + have hb := blue_sound t + have hbr := blue_red t + have hbn : nl (val (blue t)) ≤ 1 := Nat.le_trans (blue_nl t) hn + rcases val_progress (blue t) (steps_closed hb hc) with hd | ⟨u, hu⟩ + · exact ⟨_, hb, hd⟩ + · rcases red_progress hu hbn with ⟨hr, hn'⟩ | ⟨_, hn'⟩ + · obtain ⟨v, hv, hd⟩ := ih (red u) (by omega) u + (step_closed hu.step (steps_closed hb hc)) (by omega) rfl + exact ⟨v, trans hb (.head hu.step hv), hd⟩ + · obtain ⟨v, hv, hd⟩ := affine_terminates u + (step_closed hu.step (steps_closed hb hc)) hn' + exact ⟨v, trans hb (.head hu.step hv), hd⟩ + +/-- Interpretation of the data constants by closed ordinary terms. -/ +def interp (ρ : Nat → Term) : Q → Term + | .var n => .var n + | .lam b => .lam (interp ρ b) + | .app f a => .app (interp ρ f) (interp ρ a) + | .k => churchTrue + | .z i => ρ i + +theorem interp_shift (ρ : Nat → Term) (hρ : ∀ i, Closed (ρ i)) + (t : Q) (c : Nat) : interp ρ (shiftQ c t) = shift 1 c (interp ρ t) := by + induction t generalizing c with + | var n => simp only [shiftQ, interp, shift]; split <;> rfl + | lam b ih => simp [shiftQ, interp, shift, ih] + | app f a ihf iha => simp [shiftQ, interp, shift, ihf, iha] + | k => exact (shift_churchTrue _ _).symm + | z i => exact (shift_closed _ _ (hρ i)).symm + +theorem interp_subst (ρ : Nat → Term) (hρ : ∀ i, Closed (ρ i)) + (t s : Q) (j : Nat) : + interp ρ (substQ j s t) = substDec j (interp ρ s) (interp ρ t) := by + induction t generalizing s j with + | var n => simp only [substQ, interp, substDec]; split <;> (try rfl); split <;> rfl + | lam b ih => simp [substQ, interp, substDec, ih, interp_shift ρ hρ] + | app f a ihf iha => simp [substQ, interp, substDec, ihf, iha] + | k => exact (substDec_churchTrue _ _).symm + | z i => exact (substDec_closed _ _ (hρ i)).symm + +def zeros : Nat → Term → Term + | 0, T => T + | n + 1, T => pairT churchTrue (zeros n T) + +theorem pair_closed {a b : Term} (ha : Closed a) (hb : Closed b) : Closed (pairT a b) := by + unfold pairT + rw [shift_closed _ _ ha, shift_closed _ _ hb] + exact ⟨⟨by decide, closed_freeUnder ha 1⟩, closed_freeUnder hb 1⟩ + +theorem zeros_closed (n : Nat) {T : Term} (hT : Closed T) : Closed (zeros n T) := by + induction n with + | zero => exact hT + | succ n ih => exact pair_closed (by decide) ih + +def realize (m : Nat) (T : Term) : Q → Term := interp (fun i => zeros (m - i) T) + +/-- One above the largest demanded zero-cell label. -/ +def demand : Q → Nat + | .var _ | .k => 0 + | .lam b => demand b + | .app f a => max (demand f) (demand a) + | .z i => i + 1 + +theorem step_sim {t u : Q} (h : Step t u) (m : Nat) (T : Term) + (hT : Closed T) (hm : demand t ≤ m) : Betas (realize m T t) (realize m T u) := by + induction h with + | beta b a => + unfold realize + rw [interp_subst _ (fun i => zeros_closed _ hT)] + exact .head (.beta _ _) (.refl _) + | k a b => exact betas_of_spineReds (spine_true2 _ _) + | z i a => + have he : m - i = (m - (i + 1)) + 1 := by simp only [demand] at hm; omega + simp only [realize, interp, he, zeros] + exact betas_of_spineReds (spine_pairT _ _ _) + | left a h ih => + exact betas_appL _ (ih (Nat.le_trans (Nat.le_max_left _ _) hm)) + | right f h ih => + exact betas_appR _ (ih (Nat.le_trans (Nat.le_max_right _ _) hm)) + +/-- Every finite labelled trace has a finite prefix that simulates it. -/ +theorem steps_sim {t u : Q} (h : Steps t u) : + ∃ b, ∀ m, b ≤ m → ∀ T, Closed T → Betas (realize m T t) (realize m T u) := by + induction h with + | refl t => exact ⟨0, fun _ _ _ _ => .refl _⟩ + | @head t u v h hs ih => + obtain ⟨b, hb⟩ := ih + refine ⟨max (demand t) b, fun m hm T hT => ?_⟩ + exact betas_trans (step_sim h m T hT (Nat.le_trans (Nat.le_max_left _ _) hm)) + (hb m (Nat.le_trans (Nat.le_max_right _ _) hm) T hT) + +theorem done_sim {t : Q} (h : Done t) : + ∃ b, ∀ m, b ≤ m → ∀ T, ∃ B, Betas (realize m T t) (.lam B) := by + cases h with + | k => exact ⟨0, fun _ _ _ => ⟨_, .refl _⟩⟩ + | z i => + refine ⟨i + 1, fun m hm T => ?_⟩ + have he : m - i = (m - (i + 1)) + 1 := by omega + simp only [realize, interp, he, zeros, pairT] + exact ⟨_, .refl _⟩ + | const t => + refine ⟨0, fun m _ T => ⟨_, .head (.beta _ _) (.refl _)⟩⟩ + | lam b => exact ⟨0, fun _ _ _ => ⟨_, .refl _⟩⟩ + +/-- The infinite-zero proof produces a uniform finite cutoff, independent +of the closed suffix eventually placed after the zero prefix. -/ +theorem finite_prefix_answer (t : Q) (hc : ClosedQ t) (hn : nl t ≤ 1) : + ∃ b, ∀ m, b ≤ m → ∀ T, Closed T → ∃ B, Betas (realize m T t) (.lam B) := by + obtain ⟨u, hu, hd⟩ := one_nonlinear_terminates t hc hn + obtain ⟨a, ha⟩ := steps_sim hu + obtain ⟨b, hb⟩ := done_sim hd + refine ⟨max a b, fun m hm T hT => ?_⟩ + obtain ⟨B, hB⟩ := hb m (Nat.le_trans (Nat.le_max_right _ _) hm) T + exact ⟨B, betas_trans (ha m (Nat.le_trans (Nat.le_max_left _ _) hm) T hT) hB⟩ + +def embed : Term → Q + | .var n => .var n + | .lam b => .lam (embed b) + | .app f a => .app (embed f) (embed a) + +@[simp] theorem erase_embed (t : Term) : erase (embed t) = t := by + induction t <;> simp_all [embed, erase] + +@[simp] theorem interp_embed (ρ : Nat → Term) (t : Term) : interp ρ (embed t) = t := by + induction t <;> simp_all [embed, interp] + +private def omegaTerm : Term := + .app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.var 0))) + +private theorem omega_beta_eq {u : Term} (h : Beta omegaTerm u) : u = omegaTerm := by + have hs := headStep_complete (spine_beta_head (Spine.redex (by decide) (by decide)) h) + exact Option.some.inj hs.symm + +private theorem omega_betas_eq {u : Term} (h : Betas omegaTerm u) : u = omegaTerm := by + have aux : ∀ t v, Betas t v → t = omegaTerm → v = omegaTerm := by + intro t v hs + induction hs with + | refl => exact id + | head hb _ ih => + intro ht + apply ih + subst ht + exact omega_beta_eq hb + exact aux _ _ h rfl + +private theorem omega_not_lam {B : Term} : ¬ BetaJoin (.lam B) omegaTerm := by + rintro ⟨u, hu, ho⟩ + have he := omega_betas_eq ho + subst u + obtain ⟨v, hv, _⟩ := lam_betas_shape hu + cases hv + +def tower : Nat → Term + | 0 => .lam (.var 0) + | n + 1 => .lam (tower n) + +theorem tower_closed (n : Nat) : Closed (tower n) := by + induction n with + | zero => decide + | succ n ih => exact closed_freeUnder ih 1 + +theorem tower_stream (n : Nat) (N : Term) : + streamOf (blcCode (tower n)) N = zeros (2 * n) (streamOf (blcCode (.lam (.var 0))) N) := by + induction n with + | zero => rfl + | succ n ih => + have he : 2 * (n + 1) = (2 * n + 1) + 1 := by omega + change pairT churchTrue (pairT churchTrue (streamOf (blcCode (tower n)) N)) = _ + rw [he] + simp only [zeros, ih] + +/-- Any body which returns the exact suffix after every closed BLC term +contains at least two nonlinear binders, excluding its outer stream binder. +Only closed suffixes and beta-join correctness are required. -/ +theorem remainder_body_two_nonlinear (B : Term) (hB : FreeUnder 1 B) + (hR : ∀ M, Closed M → ∀ N, Closed N → + BetaJoin (contract B (streamOf (blcCode M) N)) N) : + 2 ≤ nonlinear B := by + by_cases hn : 2 ≤ nonlinear B + · exact hn + exfalso + have hsmall : nonlinear B ≤ 1 := by omega + let t : Q := substQ 0 (.z 0) (embed B) + have hc : ClosedQ t := by + unfold ClosedQ t + rw [erase_subst, erase_embed] + exact SelfintWireCost.beta_freeUnder (.beta B (.lam (.var 0))) 0 ⟨hB, by decide⟩ + have hnl : nl t ≤ 1 := by + change nl (substQ 0 (.z 0) (embed B)) ≤ 1 + rw [nl_subst, nl_z, Nat.mul_zero, Nat.add_zero] + simpa only [nl, erase_embed] using hsmall + obtain ⟨b, hb⟩ := finite_prefix_answer t hc hnl + let T := streamOf (blcCode (.lam (.var 0))) omegaTerm + have hT : Closed T := by decide + obtain ⟨D, hD⟩ := hb (2 * b) (by omega) T hT + have he : realize (2 * b) T t = contract B (streamOf (blcCode (tower b)) omegaTerm) := by + simp only [t, realize, interp_subst _ (fun i => zeros_closed _ hT), + interp, interp_embed, Nat.sub_zero, contract, tower_stream, T] + rw [he] at hD + obtain ⟨u, hu, ho⟩ := hR (tower b) (tower_closed b) omegaTerm (by decide) + obtain ⟨v, hv, hv'⟩ := betas_confluent hD hu + exact omega_not_lam ⟨v, hv, betas_trans ho hv'⟩ + +/-- The corresponding whole-program bound. -/ +theorem remainder_two_nonlinear (R : Term) (hR : Closed R) + (hcorrect : ∀ M, Closed M → ∀ N, Closed N → + BetaJoin (.app R (streamOf (blcCode M) N)) N) : + 2 ≤ nonlinear R := by + have hbody := remainder_body_two_nonlinear (.app (shift 1 0 R) (.var 0)) + (by rw [shift_closed _ _ hR]; exact ⟨closed_freeUnder hR 1, by decide⟩) + (by + intro M hM N hN + simpa only [contract, substDec, substDec_shift, ↓reduceIte] using hcorrect M hM N hN) + simpa only [nonlinear, nonlinear_shift, Nat.add_zero] using hbody +end SelfintZero +end Blc From 28fe2bd86ae8e2660ce0762c07043c8f7e8bb55b Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 19:54:57 -0400 Subject: [PATCH 21/41] Prove inert operand replacement and narrow whole-stream handlers --- .../theory/head_decomposition.json | 14 +- docs/STATUS.md | 28 +- .../self-interpreter/cheap-tail-bound.md | 447 +++++++++++++++++- .../self-interpreter/handler-bound.md | 5 +- .../self-interpreter/head-decomposition.md | 23 + .../classical/self-interpreter/interpreter.md | 12 +- .../self-interpreter/protocol-obstructions.md | 119 ++++- lean/Blc.lean | 1 + lean/Blc/SelfintInert.lean | 138 ++++++ .../theory/head_decomposition.py | 38 +- 10 files changed, 804 insertions(+), 21 deletions(-) create mode 100644 lean/Blc/SelfintInert.lean diff --git a/data/self-interpreter/theory/head_decomposition.json b/data/self-interpreter/theory/head_decomposition.json index 23302726..d2204b10 100644 --- a/data/self-interpreter/theory/head_decomposition.json +++ b/data/self-interpreter/theory/head_decomposition.json @@ -13,6 +13,18 @@ "affine": true } ], + "sharing_counterexample": { + "source_bits": 43, + "head_form_bits": 125, + "head_contractions": 2, + "source_nonlinear": 2, + "head_form_nonlinear": 6, + "payload_nonlinear": [ + 2, + 2 + ], + "is_interpreter": false + }, "int165": { "source_bits": 165, "head_form_bits": 755, @@ -50,5 +62,5 @@ } ] }, - "seconds": 0.0073 + "seconds": 0.0023 } diff --git a/docs/STATUS.md b/docs/STATUS.md index 192e6553..34895f2b 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -169,7 +169,14 @@ with all features (three opt-in tests ignored) and 328 with default features. correlated handler with only one explicit lambda shows why the proof must price applications rather than transfer every independent-case lemma. For arbitrary correlated handlers, neutral operands `s next` and `s cont` - are dominated by `s`, saving 5 and 6 bits. A separate handwritten + are dominated by `s`, saving 5 and 6 bits. The right-associated + operand `s (s s)` is also dominated, saving eight bits. An algebraic + classification of all application-only operands through ten bits + leaves only `s,j,c,s s,(s s) s`; bare `j,c` have explicit handlers + showing why same-handler replacement by `s` fails. The common + inert-operand replacement principle is kernel-checked in `SelfintInert`; + the per-operand equation and absence checks are handwritten. + A separate handwritten theorem proves that handlers for `T=s` and `T=s s` need at least two explicit lambdas, even with whole-stream access and beta redexes. The strengthened theorem rules out every beta-normal handler with at @@ -186,8 +193,12 @@ with all features (three opt-in tests ignored) and 328 with default features. includes the full ambient frame, whole-stream access, and arbitrary source redexes. The proof extends the safe-data argument to affine callbacks, then separates affine input-edge accounting from the - case that can copy vacuous closures. The improving `T=s`, `|H|≤34` - budget remains open + case that can copy vacuous closures. At the improving `T=s`, `|H|≤34` + budget, every successful handler has at least three source lambdas, + including before beta-normalization. A minimum successful handler has + no affine source redex and exactly four or five applications: the + three-application normal cases and nonlinear compression at that + application count are excluded. The remaining `T=s` cases stay open (`classical/self-interpreter/cheap-tail-bound.md`, `classical/self-interpreter/protocol-obstructions.md`). The zero arm ≥ 14, APP lift ≥ 19, reader/handler knot-tree and cell/APP @@ -230,8 +241,13 @@ with all features (three opt-in tests ignored) and 328 with default features. even for fully affine terms. The literal 165 expands to a 755-bit head form in four contractions; its two lambdas, stream head, and two arguments are checked by `tools/self-interpreter/theory/head_decomposition.py` - with two fixed affine examples, in 0.007 seconds + with two fixed affine examples and a sharing counterexample, in 0.002 seconds (`data/self-interpreter/theory/head_decomposition.json`). + The latter is a 43-bit non-interpreter with two nonlinear binders; + two head contractions create a 125-bit continuation-headed form with + two nonlinear binders in each payload and six overall. Its value + projection has the wrong rigid head. This demonstrates why the + payload counts alone do not price independent source modules. Lean's `SelfintWireCost` proves the exact local beta size balance, including copied code and index movement, and applies it to every redex of a globally minimum interpreter. Such a minimum has no @@ -254,8 +270,8 @@ with all features (three opt-in tests ignored) and 328 with default features. The proof normalizes source terms with at most one nonlinear binder over a labelled infinite zero stream, then simulates the finite trace on a closed source `λⁿ.I` followed by `Ω` to contradict exact extraction. - Integrated `lake build Blc` passes all 33 jobs; an eleven-theorem - audit across `SelfintZero` and `SelfintProjections` uses only + Integrated `lake build Blc` passes all 34 jobs; a seventeen-theorem + audit across `SelfintZero`, `SelfintProjections`, and `SelfintInert` uses only `propext` and `Quot.sound`. - **Normal and typed witnesses** (`classical/self-interpreter/normal.md`, `typed-normal.md`): the β-normal interpreter is 204 bits diff --git a/docs/classical/self-interpreter/cheap-tail-bound.md b/docs/classical/self-interpreter/cheap-tail-bound.md index 569b25a0..2447603d 100644 --- a/docs/classical/self-interpreter/cheap-tail-bound.md +++ b/docs/classical/self-interpreter/cheap-tail-bound.md @@ -1283,6 +1283,446 @@ law. Thus the affine argument covers every remaining case. This excludes the one-leading-lambda shape at the 30-bit budget. +## Compression constraints for the whole-stream operand + +The following results concern `T=s` at its improving budget `|H|≤34`. +They do not assume that the first input is used: unlike `K R`, the +third input `s` itself still carries the branch bit. + +### All-vacuous handlers still fail + +The earlier head relation between `P=cons K R` and +`W=cons F (cons K N)` applies without change to source expressions +made from application, rigid ambient variables, and vacuous lambdas. +Only the external-argument calculation changes. An exposed `P` with +three, two, or one of the inputs `K,R,P` still pending gives + +``` +P K R P →* R, P R P →* R K R P, P P →* K R. +``` + +None is `R j`. A rigid head exposed while inputs remain retains the +last `P`, which is not beta-equal to `j`. Thus the zero law again +requires three successive constant-function heads, discarding the +three inputs, followed by rigid head `R`. The related variable +evaluation discards `F,cons K N,W` through the corresponding +constant functions and ends with rigid head `N`, rather than `c`. +This excludes all-vacuous handlers for `T=s` without a size bound. + +### A growing affine contraction cannot belong to a successful handler + +The exact affine size change remains + +``` +Δ = d(f−1) − 6 − r, +``` + +where `d` is the depth of the sole bound occurrence in the redex +body, `f` counts free leaves of its argument, and `r≥0` counts the +other body references whose indices decrease. Unlike at 30 bits, +this quantity can be positive at 34 bits. However, the same source +budget gives + +``` +3d+4f+7 ≤ 34. +``` + +Together with `d(f−1)>6+r`, this leaves only + +| `d` | `f` | Lower bound `3d+4f+7` | +|---:|---:|---:| +| 4 | 3 | 31 | +| 5 | 3 | 34 | +| 3 | 4 | 32 | +| 2 | 5 | 33 | + +Every row forces `A=f`: an additional application would add four +bits to a lower bound already at least 31. The `A+1=f+1` source +leaves are therefore exactly the sole bound occurrence `u` and +the argument's `f` free leaves. The redex body is `λ^d.u`, and +every lambda inside its argument `D` is vacuous. Both mandatory +rigid leaves `j,c` lie in `D`. + +There is no surrounding application, since the redex and `D` +already use all `f` applications. There is no surrounding lambda +either: one would add two lambda bits and at least two index bits +for `j,c`, raising the lower bound to at least 35. Thus the whole +handler is the redex, and its contraction leaves only vacuous +source lambdas. The preceding obstruction excludes that reduct +and hence the original handler. + +Consequently every affine contraction in a successful handler of +size at most 34 is nonincreasing in wire size. An affine contraction +also strictly decreases AST node count. Choosing a successful +handler minimal in `(wire size, AST node count)` therefore removes +every affine source redex, despite the failure of unrestricted +34-bit affine size monotonicity. + +### Two source lambdas cannot fit the 34-bit budget + +This exclusion does not require minimality. A normal handler with +two source lambdas already fails the variable law. In a nonnormal +one, an affine source contraction leaves at most one source lambda, +which also fails. Any source redex must therefore copy an argument +containing the other source lambda. Write the whole handler as + +``` +E[(λu.B) C[D]], D=λv.W, +``` + +where `B,C,E,W` are application-only and `C` has one hole. Set +`k=#u in B≥2` and `r=#v in W`. The argument `C[D]` is +source-beta-normal: contracting a redex headed by `D` there would +leave at most the outer source lambda, because that redex's argument +contains no lambda. + +The wire budget gives `A≤6`, hence at most seven variable leaves. +The two source lambdas are disjoint, so their bound occurrences +have index zero. If `r=0`, contracting the outer redex leaves only +vacuous source lambdas and is impossible. If `r=1,k=2`, that +contraction leaves affine source code with at most two lambdas. +Its ordinary beta-normalization cannot increase the lambda count, +so the normal three-lambda floor excludes it, irrespective of the +normal form's wire size. + +First suppose no free `s` occurs. If `D=I`, the remaining source +reduces through the application algebra of `I` and rigid variables. +Otherwise `W` either has a rigid head or has head `v` with at least +one argument. In an application tree over copies of `D` and rigid +variables, a head contraction of an applied `D` then either exposes +a rigid head or produces another applied `D`. It cannot expose a +bare lambda: substituting the argument at the head occurrence of +`v` retains at least one body argument. Thus a nontrivial such tree +has a rigid head or no head normal form. A proper normal `C[D]` +is already rigid-headed; a bare `C[D]=D` yields a nontrivial tree +because `k≥2`. The surrounding application-only context cannot +repair either outcome. A rigid head retains all three external +arguments, while an exposed divergent head cannot yield the required +normal output. This handles the no-`s` cases. + +Now suppose `s` occurs. The mandatory `j,c,s` leaves give +`k+r≤4`. After the preceding cases, only `(k,r)=(3,1)` and +`(2,2)` remain. Both use all seven leaves, so + +``` +A=6, X≤4. +``` + +There is exactly one occurrence of each ambient variable `j,c,s`. +Since their base index contribution is three, at most one ambient +leaf lies beneath either source lambda. + +For `(k,r)=(3,1)`, if `D=I`, substitution reduces to the safe +application-only data algebra. Otherwise the sole ambient leaf +beneath a lambda lies in `D`, which is one of + +``` +R_a=λv.v a, L_a=λv.a v, a∈{s,j,c}. +``` + +Then `B` is a pure three-leaf tree of `u`. The extended data +algebra for `R_a,L_a` proved above reduces `C[D]` to base data, +to a rigid neutral, or to `D` itself. Only the last case needs an +additional check. For `a=s`, `D D→*Q=K N`, and either three-copy +tree is `N`-headed. For rigid `a`, `D D` and either three-copy +tree have head `a`. All outcomes therefore return to the base +data or rigid-head obstruction. + +For `(k,r)=(2,2)`, choose an arbitrarily large **odd** prefix +length `m≥3` and write + +``` +S=Pₘ, V=Pₘ₋₁, U=Pₘ₋₂, Q=K N. +``` + +The adjacent-pair identities on this subsequence are + +``` +S V →* N P₀, U V →* N P₀. +``` + +They follow by applying the recursive pair/pair row twice, reducing +both indices by two, until `P₁ P₀→N P₀`. Parity is essential: +the corresponding adjacent products at even `m` are `I`. + +If `s` is inside `B`, then `D=Δ=λv.v v`. For a bare argument +`C[D]=D`, the six possible three-leaf bodies give + +| Body `B` | Result after `u:=Δ,s:=S` | +|---|---| +| `u (u s)` | `N` | +| `u (s u)` | `Q` | +| `s (u u)` | no head normal form | +| `(u u) s` | no head normal form | +| `(u s) u` | `N` | +| `(s u) u` | `U` | + +A proper `C[D]` has only rigid ambient heads in this case and +already fails by the same data argument. Thus this placement cannot +satisfy the variable law. + +If `s` is inside `D`, then `B=u u`; a proper `C[D]` is again +rigid-headed. For the bare argument, the six bodies of `D` give + +| Body `W` | Head behavior of `D D` at odd `m≥3` | +|---|---| +| `v (v s)` | `N`-headed | +| `v (s v)` | `N`-headed | +| `s (v v)` | no head normal form | +| `(v v) s` | no head normal form | +| `(v s) v` | `N`-headed | +| `(s v) v` | `N`-headed | + +For the second row, `S D→*V`, so `D D→*V (S V)`. +For the last row, `S D→*U V`, so the adjacent-pair identity +gives its rigid `N` head. The two divergent rows respectively +return to `D D` with two or one further arguments. These are head +loops, independent of reductions inside their arguments. + +Finally suppose `s` lies outside both lambdas. Then `D` is `Δ` +or has one rigid leaf `a∈{j,c}` in addition to its two `v` +leaves. The alternative placement of that rigid leaf in `B` leaves +`D=Δ`. With `D` opaque, any first source activation inside +`C[D]` must occur at a literal `s D`, by the earlier first-activation +argument. For `Δ`, this gives `S Δ→*V`. For the six bodies +`v(v a),v(a v),a(v v),(v v)a,(v a)v,(a v)v`, respectively, +the results of `S D` are + +``` +V, V, a-headed, a-headed, I, a-headed. +``` + +Thus a proper `C[D]` reduces to safe data or a rigid neutral. +Substitution into `B` preserves the base algebra. If `C[D]` is +bare `D`, the nontrivial tree `B[D/u]` uses only `D` and rigid +variables, and the applied-`D` invariant above gives a rigid head +or head divergence. The remaining application context may erase +such a term, but doing so leaves base data or an ordinary rigid +head; retaining it as the head preserves divergence. None produces +the required two-argument `c` spine after all three external inputs. + +These cases exhaust the two-lambda source shapes. Therefore every +successful `T=s` handler of size at most 34 has **at least three +source lambdas, even before beta-normalization**. Its size identity +then forces **at most five applications**. This does not yet remove +nonlinear redexes from handlers with three or more source lambdas. + +## Normal whole-stream handlers with at most three applications + +Write `P=cons K R` on the zero input and `S=Pₘ(N)`, +`V=Pₘ₋₁(N)` on a variable input. The laws are + +``` +H[P/s] K R P =β R j, +H[S/s] F V S =β c V N. +``` + +The handler in this section is beta-normal. Let `k` count its +leading lambdas. Zero correctness gives `k≤3`. A rigid body head +cannot work. The established normal floor gives `L≥3`, and the +earlier whole-stream theorem already excludes `L=k=3` at this +budget. These facts will be used throughout the case split. + +### No stream access and at most one live binder + +First suppose `s` is absent and only one source binder is live, +possibly at more than one occurrence. Its body head must be a +variable bound by that binder, and the binder must be leading. +Otherwise the normal head is rigid. Every other source lambda is +vacuous. + +If the live binder receives the first input `K`, only selectors +and vacuous erasers remain. Distinguish the remaining ordered input +edges carrying `R,P` from fixed applications in source bodies. +Selectors return an argument whole, and vacuous binders discard an +argument; neither inserts a received input inside a fixed source +application. The direct `R` cannot acquire the earlier source `j` +after the final `P` edge has been consumed. Before that edge is +consumed, an exposed rigid `R` retains `P`, so is not `R j`. +The final `P` can only be selected as a whole after the earlier +input edges have disappeared; there is then no later input or fixed +source argument to activate it. It remains a lambda. These cases +exclude the zero law. + +If the live binder receives the second input `R`, two leading +lambdas leave final `P` attached to the rigid head. With three +leading lambdas, substituting rigid `R` creates no redex: all other +binders are vacuous and the source was normal. The normal result +still contains mandatory `c`, so cannot be `R j`. + +If it receives the third input, all three leading lambdas have +been consumed. The remaining source expression uses only its +stream argument, rigid ambient variables, applications, and +vacuous lambdas. The all-vacuous head relation pairs the zero +stream `P` with a variable stream. A zero head `R` consequently +becomes head `N`, contradicting the variable head `c`. + +Thus a normal no-`s` handler with at most one live source binder +fails, regardless of the number of that binder's occurrences. + +### Zero, one, or two applications + +With `A≤1`, the mandatory rigid leaves `j,c` leave no live +binder or stream occurrence, so all source lambdas are vacuous. +With `A=2`, the third leaf is either an ambient variable, again +giving only vacuous binders, or the sole occurrence of one live +binder with no `s`. Both cases have just been excluded. + +### Three applications without free s + +There are four leaves. The preceding one-live-binder argument +handles repetitions of the same bound variable and extra rigid +ambient leaves. The only case left has exactly + +``` +j,c,v,w, +``` + +with `v,w` bound by distinct live binders. Every source binder +is affine. The normal body head is one of the leading inputs. + +If its head is the first input `b`, write the body as +`b A₁ ... A_q`, where `1≤q≤3`. For `q=1`, the variable +branch erases the source of `c`. For `q=2`, zero needs `j` +in `A₁` and variable output needs `c` in `A₂`. Only one +further bound leaf remains. If it lies in `A₂`, the first branch +is a vacuous `j` chain and cannot give head `R`. If it lies in +`A₁`, the second branch is a vacuous `c` chain. Its nonempty +argument suffix ends in `S`, and therefore cannot end in `N`. + +For `q=3`, each argument is a lambda chain over one leaf. The +zero branch must contain the other bound leaf, with `j` in the +shared third argument and `c` in the second branch. The variable +branch is consequently a vacuous `c` chain applied to that +`j` chain and any pending external inputs. Its last argument is +either the `j` chain or `S`, never `N`; erasing them all gives +bare `c`. Thus a first-input head fails. + +If the head is the second input `r`, `k=2` retains final `P`, +so `k=3`. To give `R j`, its body must have exactly one +argument that reduces to bare `j`. + +* If the other live leaf is outer `b`, the base index sum is + `2+1+4+5=12`. Three lambdas already cost 32 bits, and every + additional vacuous lambda adds at least three. Only `L=k=3` + fits, which was excluded earlier. +* If the other live leaf is outer `t`, the base size is 30 bits; + at most one additional vacuous lambda fits. The sole argument + is a normal term with one occurrence each of `t,j,c` and two + applications. A rigid head cannot erase `c`. If its head is + `t=P`, its callback has either one rigid leaf, or the rigid + application of `j,c`. With at most one vacuous lambda, the + callback cannot erase both Scott arguments and the remaining + rigid leaf. It cannot reduce to bare `j`. +* If the other binder is inside that argument, the argument is + already beta-normal over `j,c` and its own bound variable. + The substitution at the outer head `r` does not change it. + It still contains `c` and is not bare `j`. + +Finally suppose the head is the third input `t`, so `k=3`. +The mandatory `j,c` contribute nine index units, giving `L≤5`. +Write the body `t A₁ ... A_q`. + +For `q=1`, the callback contains both rigid leaves and the sole +other bound leaf. Its only possible useful head is that bound +leaf. It can receive `K` or `R`, either from the Scott cell or +from an outer leading binder. A `K` head selects a fixed rigid +block and cannot put the later `R` before its `j`; an `R` head +cannot erase the other rigid leaf `c`. Hence zero fails. + +For `q=2`, if the sole inner application is in `A₂`, that +argument contains `j,c` and can never become bare `j`. +Otherwise `A₁` has the form of a lambda chain over `w J`, +where `J` is a chain over one rigid leaf and `A₂` contains +the other. The only possible zero output is obtained when +`w=R` and `J=j`. Before exposing that rigid head, the callback +must consume the cell's `K,R` and the common argument `A₂`. +This needs three callback lambdas in addition to the leading +three, contradicting `L≤5`. + +For `q=3`, all three arguments are one-leaf chains. To obtain +`R j`, the last must be bare `j` and the other rigid chain +must contain `c`. At most two inner lambdas fit. If the live +leaf is bound inside the first callback, the possibilities are +`I`, `K`, and `F`. Only `I` gives `R j`; `K` gives the +second rigid chain, while `F` leaves two arguments on `R`. +The other zero-compatible possibility is `λa.b`, returning +the outer first input after consuming the Scott bit. A bare +outer `b`, or a chain returning outer `r`, does not give +`R j`. In the two compatible cases, the variable branch is +the `c` chain applied only to `j`. It gives `c j`, bare `c`, +or a remaining lambda, never `c V N`. + +This exhausts the no-`s` four-leaf cases. + +### Three applications with free s + +The only nonvacuous leaf pattern is now exactly `j,c,s,v`, +with one occurrence of a live bound variable `v`. If the normal +body head is a leading input and `k=3`, its base size is at +least 32 bits. Any additional lambda lies above an ambient leaf +and adds at least three bits. Only `L=k=3` can fit, already +excluded. A second-input head with `k=2` retains final `P`. +Thus the remaining bound-head cases have first-input head `b` +and `k=1,2`. + +One Boolean argument erases `c` on the variable branch. With +two arguments, the zero branch must contain `s,j`, leaving a +vacuous `c` chain for the variable branch. With three arguments, +the zero branch must be the `s` chain, `j` must be shared, and +the variable branch is again a vacuous `c` chain. In each case +its nonempty final argument suffix ends in `S`, not `N`. + +It remains to consider free `s` as the normal body head: + +``` +H = λ^k.s A₁ ... A_q. +``` + +For `q=1`, the callback contains `v,j,c` with two applications. +Its useful head must be `v`. The value supplied to `v` can be +`K`, `R`, or `P`. A `K` selects a fixed rigid block; an `R` +cannot erase `c`; and a `P` applied to a rigid or vacuous +rigid callback has that callback's `j/c` head. None gives +`R j`. + +For `q=2`, placing the one inner application in `A₂` traps +`j,c` in the same rigid block, which cannot become bare `j`. +Otherwise the first callback is a chain over `v J` and the +other argument contains the other rigid leaf. Only `v=R` and +`J=j` can give `R j`. The callback must then consume all +`6−k` arguments supplied by the Scott cell, the common argument, +and the pending external inputs. Thus `L≥6`; the deeply bound +`j` contributes at least seven index units and `c` at least +two. The wire size is at least `12+12+2+9=35`, beyond the +budget. + +For `q=3`, every argument is a one-leaf chain. If `k<3`, the +last ordered input is `P`. Retaining a common `j` application +edge would also retain that final input edge. Consuming all input +edges leaves no fixed source application from which to construct +`R j`: projections and constants return a selected argument +whole. Selecting the final `P` leaves it unapplied. Thus `k=3`. +The case `L=k=3` has already been excluded. For a remaining +candidate the mandatory ambient index sum is twelve, so the +34-bit budget forces `L=4,X=12`. The sole callback is therefore +`I`, with all other arguments bare. The unique zero-compatible +arrangement is + +``` +λb r t.s I c j. +``` + +Its variable result is `S I c j→*c j`, not `c V N`. +This excludes the last four-leaf shape. + +Consequently no beta-normal `T=s` handler of size at most 34 +can have at most three applications. Combined with the compression +results, the same holds for a minimum successful handler: at +`A≤3`, a nonlinear source redex uses both leaves remaining after +`j,c`, so contracting it leaves only vacuous source binders. +Affine redexes are already absent in such a minimum. + ## Established bound and remaining scope Combining the compression lemmas, the beta-normal three-lambda floor, @@ -1295,8 +1735,11 @@ and the exhaustive shape arguments proves: Thus the self-application operand cannot improve the reader within this joint-handler interface. The whole-stream operand `T=s` at -`|H|≤34` remains open; only the stated lambda floors and the -three-leading-lambda special case have been excluded there. +`|H|≤34` remains open. At that budget a minimum successful handler +would have no affine source redex, at least three source lambdas, +and exactly four or five applications. The three-leading-lambda +special case is also excluded, but nonlinear compression at three +or more source lambdas and the other normal shapes remain open. Neither the independence assumptions on the ambient continuations nor the specified reader interface have been removed. This is not a global optimality theorem for the 165-bit interpreter. diff --git a/docs/classical/self-interpreter/handler-bound.md b/docs/classical/self-interpreter/handler-bound.md index 1d09f9a8..1bc61945 100644 --- a/docs/classical/self-interpreter/handler-bound.md +++ b/docs/classical/self-interpreter/handler-bound.md @@ -728,8 +728,9 @@ rigid parameters and fixes the skip to `s s s`. Exploiting the actual behaviour of NEXT or the recursive parser is outside its hypotheses. Other reader heads, arbitrary skip operands, and arbitrary sub-165 programs remain open without further decomposition or a different global invariant. -`cheap-tail-bound.md` proves a separate two-lambda floor for `T=s` and -`T=s s`, but not their numerical handler thresholds. +`cheap-tail-bound.md` proves separate lambda floors for `T=s` and +`T=s s`, and excludes every `T=s s` handler below 31 bits, keeping +that reader at least 43 bits. The improving `T=s` threshold remains open. The five explicit witnesses and the arithmetic are checked by `tools/self-interpreter/theory/handler_bound.py`, including the 40-bit diff --git a/docs/classical/self-interpreter/head-decomposition.md b/docs/classical/self-interpreter/head-decomposition.md index aa148302..7e21b10b 100644 --- a/docs/classical/self-interpreter/head-decomposition.md +++ b/docs/classical/self-interpreter/head-decomposition.md @@ -243,6 +243,29 @@ literal source expands substantially when reduced only to head normal form. The fixed symbolic check and measured sizes are recorded in `docs/STATUS.md`. +Even the four-interior-binder requirement can arise from very little +shared syntax. Define, in the frame containing `c,s`, + +``` +A = λy.c (y s) (y I), +E = λc s.(λx.x (x x)) A. +``` + +There are only two nonlinear source binders, the ternary `x` and binary +`y`. Two head contractions give + +``` +λc s.c ((A A) s) ((A A) I), +``` + +with two nonlinear binders in each payload and six overall. The fixed +checker measures the source and its expansion in STATUS. This term is +**not an interpreter**: its value payload exposes the rigid head `c`, +so it cannot equal the required abstraction. It shows why counting the +four residual nonlinear binders cannot itself price four independent +pieces of source code. A useful stronger bound must also constrain how +the shared code satisfies both semantic projections. + ## Exact beta wire costs `Blc.SelfintWireCost` formalizes the local accounting needed to distinguish diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index f5033b4e..e10fd2b8 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -395,9 +395,14 @@ These are Codex's handwritten proofs, with targeted reduction checks in - **Neutral skip operands are dominated.** For arbitrary correlated `H`, successful readers with `T=s next` or `T=s cont` also work with `T=s`, saving 5 or 6 bits. The proof in `protocol-obstructions.md` tracks an - inert marked operand that every successful reduction must erase. It does + inert marked operand that every successful reduction must erase. It does not by itself exclude the cheaper `T=s` family or the productive thunk `T=s s`. + The same argument dominates `s (s s)` and the cheap rigid-headed + operands. Through ten bits, application-only operands reduce to + `s,j,c,s s,(s s) s`; bare `j,c` remain substantive separate cases. + `Blc/SelfintInert.lean` kernel-checks the common replacement principle; + the specific operand equations and absence checks are handwritten. `cheap-tail-bound.md` proves that both families require at least two explicit lambdas in `H`, even with arbitrary whole-stream use and beta redexes. Every beta-normal handler needs at least three lambdas, @@ -410,7 +415,10 @@ These are Codex's handwritten proofs, with targeted reduction checks in possible normal shapes, with at least three lambdas and exactly four applications, are also excluded. Thus every successful `T=s s` handler costs at least 31 bits, keeping the reader at least 43. - The `T=s`, `|H|≤34` threshold remains open. + At `T=s`, `|H|≤34`, every successful handler has at least three + source lambdas even before normalization. A minimum successful handler + has no affine source redex and exactly four or five applications. + The remaining shapes and nonlinear compression cases stay open. - **The zero arm costs at least 14 bits**, even with `bit0 := K` and the whole zero cell available to borrow. With `R` absent and the neighbours rigid, `Z R R = R next` forces the normal form `λu v. u next` (15) or diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index f74b2289..fa5ccaca 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -63,7 +63,7 @@ These are complete interpreter constructions, all larger than 165. The reset ide 168-bit variant follows by finitely unfolding its existing knot once; the script additionally checks the reset followed by parsing `I`. -## Neutral operands in a joint handler/skip reader are dominated +## Cheap application-only third operands Consider the ambient frame `[s,j,c,p,x]`, innermost first, with `j` the rigid NEXT continuation and `c` the rigid result continuation. Let `H` @@ -127,12 +127,117 @@ stability of beta reduction under capture-avoiding substitution replaces the fresh rigid `R,N` by arbitrary suffixes, so this is a symbolic result for every unary length and suffix. -This is a handwritten domination proof, independently checked by two -Codex instances. It neither identifies the operands as beta-equal nor proves -a minimum reader size. It rules out these more expensive neutral operands -as a source of a new record relative to the still-open `T = s` family. -The productive thunk `T = s s` also remains open. No conclusion about -arbitrary sub-165 interpreters follows. +### Kernel-checked replacement principle + +`Blc.SelfintInert` proves the shared mechanism independently of the +reader architecture. Substitution by a rigid beta-normal term cannot +create a beta redex: every step after substitution reflects to a step +before it. The module lifts this reflection to finite reductions. + +Its predicate `Avoid a n` means that `n` contains no copy of `a`, +with the appropriate free-variable shift beneath each enclosing lambda. +If substituting `a` for a marked variable reaches such an output, the +reflected reduction ends with zero occurrences of that variable. The +same source reduction therefore works with any replacement. + +In the final-argument form, if `a` is rigid and beta-normal, `n` is +normal, `Avoid a n`, and `f a =β n`, then + +``` +∀ b, f b →* n. +``` + +Only the selected argument is replaced; `f` may contain other copies +of `a` or the stream. The directed version does not require a normal +target. Normality in the beta-join version supplies a directed reduction +to that target. The specific operand equations and absence checks in +this section remain handwritten applications of this kernel-checked +principle. + +### Right-associated self-application is also dominated + +The other 10-bit all-`s` application tree is `s (s s)`. Its exact equations +are + +```text +s = cons K R: s (s s) →* R R, +s = 1^n 0 ++ N, n >= 1: s (s s) →* N (tail s). +``` + +For the first equation, `s s →* K R`, followed by +`s (K R) →* (K R) K R →* R R`. For the second, write `X=tail s`; +then `s s →* K N` and `s (K N) →* (K N) F X →* N X`. + +For fresh rigid `R,N`, both results are beta-normal rigid boxes. The box +`R R` cannot occur in the required `R j`, since `R,j` are independent. +The box `N X` cannot occur in `c X N`: throughout the finite Scott term +`X`, and in the outer result, every occurrence of `N` is a bare leaf. +The preceding residual-box argument therefore applies unchanged. Any +correct reader using `T=s (s s)` stays correct after replacing only that +operand by `s`, saving eight bits. The handler may retain other occurrences +of the whole stream and arbitrary beta redexes. + +### Classification through ten bits + +An application-only operand in the fixed frame has leaf costs +`|s|=2`, `|j|=3`, `|c|=4`, `|p|=5`, and `|x|=6`, with two bits per +application. At ten bits it has at most two applications. If it has two, +all three leaves must be `s`, so the only shapes are `(s s) s` and +`s (s s)`. With one application it is `a b` for ambient variables +`a,b` whose costs sum to at most eight. + +Every such one-application operand with a rigid head is dominated by `s`: + +* A `j`-headed application cannot survive in either target: the only + target occurrence of `j` is a bare zero-branch leaf. +* The only allowed `c`-headed applications are `c s`, `c j`, and `c c`. + The zero target contains no `c`. On a variable stream, the one-argument + `c` prefix in the target is `c X`. None of `s,j,c` equals `X`: `s` + has one more Scott cell, and the other two are independent rigid + variables. Hence the marked application cannot occur in that target. +* A `p`- or `x`-headed application cannot survive, because those rigid + variables are absent from both targets. + +The same absence argument dominates the bare operands `p` and `x`. +All boxes here are already normal after replacing `s` by the normal +Scott stream; the same copy-or-erase proof and substitution lifting apply. +Together with the `s a` and right-associated arguments above, this leaves +exactly the following representatives that these domination results do +not remove: + +| Operand | Bits | +|---|---:| +| `s` | 2 | +| `j` | 3 | +| `c` | 4 | +| `s s` | 6 | +| `(s s) s` | 10 | + +The bare `j,c` exceptions are substantive. Same-handler replacement by +`s` is not valid in general. For example, + +```text +H_j = λb r. b r (λt. c r (r r t)), T = j, +H_c = λb r t. b (r j) (t r (r r t)), T = c +``` + +both satisfy the two reader laws. On the variable branch, the unary tail +`r` obeys `r r t →* N` for either supplied operand. Replacing `j` by `s` +in the first reader instead gives `R s` on the zero branch. Replacing `c` +by `s` in the second instead gives `s X N` on the variable branch, which +has no free `c` and cannot yield `c X N`. Thus those two operand families +need their own handler analysis; a handler may obtain the corresponding +required output leaf from the operand itself. + +The per-operand domination proofs and the complete classification were +independently reviewed. They neither identify the +operands as beta-equal nor prove a minimum reader size. They reduce the +application-only operand classification through +ten bits to the five displayed families. The `T=s`, `T=j`, and `T=c` +families remain open at the budgets needed for a reader improvement. +The separate proof in `cheap-tail-bound.md` excludes every productive-thunk +`T = s s` handler below 31 bits, keeping that reader at least 43 bits. +No conclusion about arbitrary sub-165 interpreters follows. ## The raw NEXT diagonal still fails for every skip function diff --git a/lean/Blc.lean b/lean/Blc.lean index 9fa115c1..243723bd 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -27,3 +27,4 @@ import Blc.SelfintWireCost import Blc.SelfintRemainder import Blc.SelfintZero import Blc.SelfintProjections +import Blc.SelfintInert diff --git a/lean/Blc/SelfintInert.lean b/lean/Blc/SelfintInert.lean new file mode 100644 index 00000000..9c7ebab2 --- /dev/null +++ b/lean/Blc/SelfintInert.lean @@ -0,0 +1,138 @@ +/- +Replacing a selected inert operand. Substitution by a rigid normal term +cannot create a beta redex. If the required output contains no shifted +copy of that operand, every marked occurrence was erased, so another +operand can be substituted in the same reduction. +-/ +import Blc.SelfintProjections +import Blc.SelfintOrigins + +namespace Blc.SelfintInert +open Term SelfintControl SelfintProjections + +theorem rigid_shift {t : Term} (h : Rigid t) (c : Nat) : Rigid (shift 1 c t) := by + induction h with + | var n => simp only [shift]; split <;> exact .var _ + | app a h ih => exact .app _ ih + +theorem subst_lam_shape {t s b : Term} (hr : Rigid s) (j : Nat) + (he : substDec j s t = .lam b) : + ∃ a, t = .lam a ∧ b = substDec (j + 1) (shift 1 0 s) a := by + cases t with + | var n => + simp only [substDec] at he + split at he + · exact (rigid_not_lam hr _ he).elim + · split at he <;> cases he + | lam a => exact ⟨a, rfl, (Term.lam.inj he).symm⟩ + | app f a => cases he + +theorem beta_reflect (t : Term) (j : Nat) (s : Term) + (hr : Rigid s) (hn : NFt s) {u : Term} + (h : Beta (substDec j s t) u) : + ∃ v, Beta t v ∧ substDec j s v = u := by + induction t generalizing j s u with + | var n => + simp only [substDec] at h + split at h + · exact (nft_no_beta hn h).elim + · split at h <;> cases h + | lam b ih => + cases h with + | lam hb => + obtain ⟨v, hv, he⟩ := ih (j + 1) (shift 1 0 s) (rigid_shift hr 0) + (QuoteOrigins.Marked.nft_shift hn 0) hb + exact ⟨.lam v, .lam hv, congrArg Term.lam he⟩ + | app f a ihf iha => + generalize he : substDec j s (.app f a) = w at h + cases h with + | beta b a' => + obtain ⟨hf, ha⟩ := Term.app.inj he + obtain ⟨b', rfl, hb⟩ := subst_lam_shape hr j hf + refine ⟨contract b' a, .beta _ _, ?_⟩ + rw [substDec_contract, ← hb, ha] + | appL a' hb => + obtain ⟨hf, ha⟩ := Term.app.inj he + rw [← hf] at hb + obtain ⟨v, hv, he'⟩ := ihf j s hr hn hb + exact ⟨.app v a, .appL a hv, by simp only [substDec, he', ha]⟩ + | appR f' hb => + obtain ⟨hf, ha⟩ := Term.app.inj he + rw [← ha] at hb + obtain ⟨v, hv, he'⟩ := iha j s hr hn hb + exact ⟨.app f v, .appR f hv, by simp only [substDec, he', hf]⟩ + | lam hb => cases he + +theorem betas_reflect {t u : Term} (h : Betas t u) : + ∀ (v : Term) (j : Nat) (s : Term), Rigid s → NFt s → + t = substDec j s v → ∃ w, Betas v w ∧ substDec j s w = u := by + induction h with + | refl t => + intro v j s hr hn he + exact ⟨v, .refl _, he.symm⟩ + | head hb hs ih => + intro v j s hr hn he + rw [he] at hb + obtain ⟨v', hv, he'⟩ := beta_reflect v j s hr hn hb + obtain ⟨w, hw, hew⟩ := ih v' j s hr hn he'.symm + exact ⟨w, .head hv hw, hew⟩ + +/-- No subterm is a copy of `needle`, shifted at each enclosing binder. -/ +def Avoid (needle : Term) : Term → Prop + | .var n => .var n ≠ needle + | .lam b => .lam b ≠ needle ∧ Avoid (shift 1 0 needle) b + | .app f a => .app f a ≠ needle ∧ Avoid needle f ∧ Avoid needle a + +theorem avoid_not_self (t : Term) : ¬ Avoid t t := by + cases t with + | var n => exact fun h => h rfl + | lam b => exact fun h => h.1 rfl + | app f a => exact fun h => h.1 rfl + +theorem avoid_subst_occ (t : Term) (j : Nat) (s : Term) + (h : Avoid s (substDec j s t)) : occ j t = 0 := by + induction t generalizing j s with + | var n => + by_cases he : n = j + · simp only [substDec, he, if_true] at h + exact (avoid_not_self s h).elim + · simp only [occ, he, if_false] + | lam b ih => exact ih (j + 1) (shift 1 0 s) h.2 + | app f a ihf iha => + simp only [occ, ihf j s h.2.1, iha j s h.2.2, Nat.zero_add] + +/-- A reduction to an output avoiding an inert selected operand erases +that operand, and the very same source trace works for any replacement. -/ +theorem replace_inert {t n a : Term} (j : Nat) (hr : Rigid a) (hn : NFt a) + (ha : Avoid a n) (h : Betas (substDec j a t) n) (b : Term) : + Betas (substDec j b t) n := by + obtain ⟨w, hw, he⟩ := betas_reflect h t j a hr hn rfl + have ho := avoid_subst_occ w j a (he ▸ ha) + have he' := subst_absent w j a b ho + rw [← he, he'] + exact betas_subst hw j b + +/-- Beta-join correctness has the same replacement property when the +required output is normal. No directed-correctness hypothesis is needed. -/ +theorem replace_inert_join {t n a : Term} (j : Nat) (hr : Rigid a) (hn : NFt a) + (ha : Avoid a n) (hN : NormalForm n) + (h : BetaJoin (substDec j a t) n) (b : Term) : + Betas (substDec j b t) n := by + obtain ⟨w, ht, hnw⟩ := h + have he := normalForm_betas_eq hN hnw + subst w + exact replace_inert j hr hn ha ht b + +/-- The common reader use: replace only the final argument, while the +function may contain other copies of that argument or of the stream. -/ +theorem replace_final_argument {f n a : Term} (hr : Rigid a) (hn : NFt a) + (ha : Avoid a n) (hN : NormalForm n) (h : BetaJoin (.app f a) n) + (b : Term) : Betas (.app f b) n := by + let t : Term := .app (shift 1 0 f) (.var 0) + have hs (v : Term) : substDec 0 v t = .app f v := by + simp only [t, substDec, substDec_shift, ↓reduceIte] + have ht : BetaJoin (substDec 0 a t) n := by rw [hs]; exact h + have hb := replace_inert_join 0 hr hn ha hN ht b + simpa only [hs] using hb + +end Blc.SelfintInert diff --git a/tools/self-interpreter/theory/head_decomposition.py b/tools/self-interpreter/theory/head_decomposition.py index 6760ed72..f4854b40 100644 --- a/tools/self-interpreter/theory/head_decomposition.py +++ b/tools/self-interpreter/theory/head_decomposition.py @@ -2,7 +2,7 @@ """Fixed head-reduction accounting checks; no candidate enumeration. The universal head-decomposition argument is handwritten. These checks only -verify its two explicit affine examples and the existing 165's head form. +verify explicit compression examples and the existing 165's head form. """ from pathlib import Path import json @@ -45,6 +45,14 @@ def affine(term): return affine(term[1]) and affine(term[2]) +def nonlinear(term): + if term[0] == "V": + return 0 + if term[0] == "L": + return int(occurrences(term[1]) > 1) + nonlinear(term[1]) + return nonlinear(term[1]) + nonlinear(term[2]) + + def free_leaves(term, cutoff=0): if term[0] == "V": return int(term[1] >= cutoff) @@ -98,6 +106,30 @@ def main(): examples.append(dict(n=n, source_bits=lc.size(source), head_form_bits=lc.size(result), affine=True)) + # A syntax counterexample to pricing residual nonlinear binders as + # independent source code. This term is explicitly NOT an interpreter. + shared = "\\y.c (y s) (y (\\z.z))" + sharing_source = battery.compile_lam( + "\\c\\s.(\\x.x (x x)) (" + shared + ")") + sharing_head = head_step(head_step(sharing_source)) + expected = battery.compile_lam( + "\\c\\s.c (((" + shared + ") (" + shared + ")) s) " + "(((" + shared + ") (" + shared + ")) (\\z.z))") + assert sharing_head == expected and head_step(sharing_head) is None + assert lc.size(sharing_source) == 43 and lc.size(sharing_head) == 125 + assert nonlinear(sharing_source) == 2 and nonlinear(sharing_head) == 6 + sharing_body = sharing_head[1][1] + left, right = sharing_body[1][2], sharing_body[2] + assert nonlinear(left) == nonlinear(right) == 2 + # The value payload retains a rigid continuation head after one more + # head step, whereas a decoded value must be an abstraction. + value_head = head_step(left) + assert value_head is not None and head_step(value_head) is None + spine = value_head + while spine[0] == "A": + spine = spine[1] + assert spine == ("V", 1) + source = battery.compile_lam( (ROOT / "data/self-interpreter/machines/int165.lam").read_text()) assert lc.enc(source) == ( @@ -128,6 +160,10 @@ def main(): assert (leading, body, arguments) == (2, ("V", 0), 2) report = dict( affine_examples=examples, + sharing_counterexample=dict( + source_bits=43, head_form_bits=125, head_contractions=2, + source_nonlinear=2, head_form_nonlinear=6, + payload_nonlinear=[2, 2], is_interpreter=False), int165=dict(source_bits=165, head_form_bits=755, head_contractions=contractions, leading_lambdas=leading, head="stream", head_arguments=arguments, From 11df0c7b8681d746faaa1a83d8bdca90aa1e455a Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 20:09:33 -0400 Subject: [PATCH 22/41] Prove head-clock monotonicity and remainder code growth --- docs/STATUS.md | 23 +- .../self-interpreter/cheap-tail-bound.md | 132 +++++++- .../classical/self-interpreter/interpreter.md | 12 +- docs/classical/self-interpreter/remainder.md | 296 ++++++++++++++++++ lean/Blc.lean | 1 + lean/Blc/WeakHeadClock.lean | 152 +++++++++ 6 files changed, 606 insertions(+), 10 deletions(-) create mode 100644 lean/Blc/WeakHeadClock.lean diff --git a/docs/STATUS.md b/docs/STATUS.md index 34895f2b..ec235b78 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -197,8 +197,11 @@ with all features (three opt-in tests ignored) and 328 with default features. budget, every successful handler has at least three source lambdas, including before beta-normalization. A minimum successful handler has no affine source redex and exactly four or five applications: the - three-application normal cases and nonlinear compression at that - application count are excluded. The remaining `T=s` cases stay open + three-application normal cases and all nonlinear compression through + four applications are excluded. A four-application minimum must be + beta-normal; the normal `(A,L,k)=(4,4,2)` shape is also excluded, + where `k` counts leading lambdas. Other normal shapes and nonlinear + five-application compression remain open (`classical/self-interpreter/cheap-tail-bound.md`, `classical/self-interpreter/protocol-obstructions.md`). The zero arm ≥ 14, APP lift ≥ 19, reader/handler knot-tree and cell/APP @@ -270,9 +273,21 @@ with all features (three opt-in tests ignored) and 328 with default features. The proof normalizes source terms with at most one nonlinear binder over a labelled infinite zero stream, then simulates the finite trace on a closed source `λⁿ.I` followed by `Ω` to contradict exact extraction. - Integrated `lake build Blc` passes all 34 jobs; a seventeen-theorem + A separately reviewed handwritten theorem proves that every exact + remainder extractor has some valid source `λⁿ.I`, with suffix `I`, + whose ordinary weak-head trace strictly increases interpreter-origin + lambda count. The proof shows that a constant-count infinite-zero + execution eventually recycles one flat code template without carrying + an advancing tail; a uniform label bound then contradicts finite-prefix + correctness. It gives neither an explicit `n` nor a bit-size bound, + and does not quantify over every successful trace. + `WeakHeadClock` kernel-checks the supporting bound on head contractions + interspersed with arbitrary beta reductions; the full growth theorem + remains handwritten. + Integrated `lake build Blc` passes all 35 jobs; a seventeen-theorem audit across `SelfintZero`, `SelfintProjections`, and `SelfintInert` uses only - `propext` and `Quot.sound`. + `propext` and `Quot.sound`, as does a separate four-theorem + `WeakHeadClock` audit. - **Normal and typed witnesses** (`classical/self-interpreter/normal.md`, `typed-normal.md`): the β-normal interpreter is 204 bits (`int204_normal`, L 21, A 29, X 44). Lean proves its exact wire, diff --git a/docs/classical/self-interpreter/cheap-tail-bound.md b/docs/classical/self-interpreter/cheap-tail-bound.md index 2447603d..9f40d64c 100644 --- a/docs/classical/self-interpreter/cheap-tail-bound.md +++ b/docs/classical/self-interpreter/cheap-tail-bound.md @@ -1504,8 +1504,78 @@ the required two-argument `c` spine after all three external inputs. These cases exhaust the two-lambda source shapes. Therefore every successful `T=s` handler of size at most 34 has **at least three source lambdas, even before beta-normalization**. Its size identity -then forces **at most five applications**. This does not yet remove -nonlinear redexes from handlers with three or more source lambdas. +then forces **at most five applications**. + +### Four-application nonlinear compression + +Choose a successful handler minimal in `(wire size, AST node count)`. +It has no affine source redex by the preceding size argument. Suppose +it has a nonlinear source redex and at most four applications. +At three applications the mandatory `j,c` and two occurrences of the +redex binder exhaust the four leaves. Contracting that binder leaves +only vacuous source lambdas, which cannot satisfy both laws. Fewer +applications cannot contain all four mandatory leaves. + +At four applications there is only one further leaf. Unless it is +the occurrence of another live source binder, contraction again +leaves only vacuous binders. The only case to consider therefore +has exactly the leaves + +``` +u, u, j, c, v, +``` + +where `u` is bound by the chosen nonlinear redex and `v` is the +sole occurrence of a distinct live binder. In particular `s` is +absent. If the redex argument does not contain both the binder of +`v` and its occurrence, contraction leaves at most one live source +binder. All other source binders are vacuous. Such source code has +a beta-normal form: a contraction of its only live binder leaves +all-vacuous code, while vacuous contractions strictly remove syntax. +Its normal form still has at most one live binder. The no-`s`, +one-live-binder obstruction proved in the following normal-handler +section excludes this normal form, regardless of its wire size. + +Otherwise let `D` be the entire copied argument. It has one live +binder, used once, and every other binder inside it is vacuous. +Its only possible free variables are `j,c`. Since every binder +inside `D` is affine and the minimum handler has no affine source +redex, `D` is source-beta-normal. + +Contract the `u` redex. There are now exactly two copies of `D`, +and all remaining source binders are affine. Normalize this source +term before supplying any reader inputs. Affine beta reduction +terminates and cannot increase the number of live binders. If one +of the two live binders contracts, loses its sole occurrence, or is +erased with a surrounding subtree, the resulting normal form has +at most one live binder and is excluded as above. + +Suppose both live binders survive. No live contraction occurred; +every source contraction was vacuous. Mark each surviving live +binder together with its body as an island. Initially the two +islands are disjoint copies inside the two occurrences of `D`. +Vacuous contractions only remove an argument and expose an already +present body: they cannot insert either island inside the other. +The source-normality of `D` also prevents an internal redex from +altering an island. Removing a vacuous prefix of a copy does not +change the island rooted at its live binder. The two surviving +islands therefore remain disjoint in the full source normal form. + +A beta-normal term without `s` has a rigid head or a head variable +bound by one of its leading lambdas. A rigid head cannot give the +zero output `R j`. A bound head would make its binder live, so +that binder must be one of the two surviving islands. Being on the +leading lambda chain, its body contains the rest of the normal +term, including the other surviving live binder, unless that +other binder is earlier on the leading chain. In the latter case +the reverse containment holds. Either case nests the two islands, +contradicting their disjointness. If `D` was originally headed by +rigid `j/c` instead, that rigid head already guards its live binder +and cannot provide a leading bound head. + +Thus the normal form fails in every case. A minimum successful +whole-stream handler with four applications must be beta-normal; +only five-application nonlinear compression remains at this budget. ## Normal whole-stream handlers with at most three applications @@ -1723,6 +1793,57 @@ results, the same holds for a minimum successful handler: at `j,c`, so contracting it leaves only vacuous source binders. Affine redexes are already absent in such a minimum. +## Four applications with four lambdas and two leading lambdas + +One further normal `T=s` shape is excluded at 34 bits: + +``` +A=4, L=4, H=λb r.B. +``` + +The budget gives `X≤8`. Mandatory `j,c` beneath the leading +pair contribute seven index units. A free `s` would contribute +two more and cannot occur. A body headed by `r` would retain +the final zero input `P`, so its head must be `b`. That head's +index one spends the remaining unit. + +Consequently `j,c` lie outside both inner lambdas, every inner +bound occurrence has index zero, and every occurrence of outer +`r` lies outside the inner lambdas. Of the five source leaves, +three are already `b,j,c`. The two inner lambdas therefore have +exactly the same closed-block possibilities as in the earlier +one-leading-lambda classification: + +``` +I,I; F plus one exterior r; J=λa.a I; G=λa d.d d. +``` + +Substitute the variable inputs `b=F,r=V=Pₘ₋₁`, leaving only +the final `S=Pₘ` pending. The `I/F` cases belong to the base +safe algebra. A functional result contains no `c`, and a rigid +result retains final `S`, so both fail. + +The `J/G` cases use both remaining leaves and have no exterior +`r`. For `J`, the internal algebra contains only `F,I,J` and +rigid neutrals. The rules `J U→U I`, `J J→I`, `J F→I`, +`J I→I`, `F J→I`, and `I J→J` close it. Again, its +functional values contain no `c`, and its rigid values retain +final `S`. + +For unique `G`, first normalize its context with `G` opaque. +The `F/I` data cannot copy it. If `G` has an internal argument, +its vacuous outer lambda discards that argument and exposes the +unique `Δ=λd.d d`. An internal argument of `Δ` can contain +neither `G` nor another source lambda: it normalizes to `F`, +`I`, or a rigid neutral. The first two give `Δ F→I` and +`Δ I→I`; the last preserves its rigid head and final `S`. +If `Δ` is returned bare, the final input gives `S S→*K N`, +which contains no `c`. If `G` is returned bare instead, its +single final input leaves `Δ`, also without `c`. These cases +exhaust the remaining block. + +Thus `(A,L,k)=(4,4,2)` cannot satisfy the whole-stream reader laws. + ## Established bound and remaining scope Combining the compression lemmas, the beta-normal three-lambda floor, @@ -1737,9 +1858,10 @@ Thus the self-application operand cannot improve the reader within this joint-handler interface. The whole-stream operand `T=s` at `|H|≤34` remains open. At that budget a minimum successful handler would have no affine source redex, at least three source lambdas, -and exactly four or five applications. The three-leading-lambda -special case is also excluded, but nonlinear compression at three -or more source lambdas and the other normal shapes remain open. +and exactly four or five applications. At four applications it +must be beta-normal. The three-leading-lambda special case and +the normal shape `(A,L,k)=(4,4,2)` are also excluded. The remaining +normal shapes and five-application nonlinear compression are open. Neither the independence assumptions on the ambient continuations nor the specified reader interface have been removed. This is not a global optimality theorem for the 165-bit interpreter. diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index e10fd2b8..a08b69ad 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -323,6 +323,14 @@ at its public stream binder. The corresponding wire floor is 55 bits. This prices that displayed head form, not the source that expands into it; STATUS records the construction's size and current checks. +The independently reviewed handwritten theorem in `remainder.md` also +forces strict interpreter-code growth on some ordinary weak-head trace +of every exact remainder extractor, using a valid source `λⁿ.I` and +suffix `I`. The proof bounds the labels accessible to a constant-count +infinite-zero execution. `Blc/WeakHeadClock.lean` mechanizes its supporting +head-clock argument; the growth theorem itself remains handwritten and +gives no numerical size bound. + **Duplication.** At least two syntactic binders of `E` occur at least twice. Lean proves that every term with at most one such binder weakly normalizes; the interpreter contract on Ω contradicts that conclusion. If `E = λc s.B`, @@ -418,7 +426,9 @@ These are Codex's handwritten proofs, with targeted reduction checks in At `T=s`, `|H|≤34`, every successful handler has at least three source lambdas even before normalization. A minimum successful handler has no affine source redex and exactly four or five applications. - The remaining shapes and nonlinear compression cases stay open. + At four applications it must be beta-normal; the `(A,L,k)=(4,4,2)` + normal shape is also excluded, with `k` the number of leading lambdas. + Other normal shapes and five-application nonlinear compression stay open. - **The zero arm costs at least 14 bits**, even with `bit0 := K` and the whole zero cell available to borrow. With `R` absent and the neighbours rigid, `Z R R = R next` forces the normal form `λu v. u next` (15) or diff --git a/docs/classical/self-interpreter/remainder.md b/docs/classical/self-interpreter/remainder.md index d2ee8961..5fb959f3 100644 --- a/docs/classical/self-interpreter/remainder.md +++ b/docs/classical/self-interpreter/remainder.md @@ -171,3 +171,299 @@ Its two public lower-bound theorems use only `propext` and `Quot.sound`, with no custom axioms or admitted proofs. This establishes a structural obstruction, not a sharp bit-length lower bound for remainder extraction or an additive lower bound for arbitrary self-interpreters. + + +## Source code must grow on a head trace + +**Handwritten theorem.** Let `R` be closed and suppose + +``` +R (stream(M,N)) =β N +``` + +for every closed source `M` and every closed suffix `N`. Mark precisely the +lambdas originally belonging to `R`, and propagate those marks through beta +reduction. For some `n`, ordinary deterministic weak-head evaluation of + +``` +R (stream(λⁿ.I,I)) +``` + +contains a contraction that strictly increases the number of marked +lambdas. Weak-head evaluation here follows the global function spine and +stops at an outer lambda or a rigid variable head. The theorem concerns this +specific evaluation strategy; it does not assert growth on every successful +beta trace. + +Codex's argument below has independent written review. The growth theorem +is not mechanized. In particular, it is stronger than the preceding +kernel-checked two-nonlinear-binder theorem: a nonlinear contraction can +recycle code without increasing its count, as `Δ Δ → Δ Δ` demonstrates. +There is no numerical bound on `n`, on the time of the growth step, or on +an extractor's wire length. + +### Head contractions cannot continue after normalization + +Use the following head-clock fact. If the deterministic weak-head trace of +`t` terminates after `h` contractions, every beta reduct `u` of `t` has +weak-head length at most `h`. A global weak-head contraction decreases +that length by exactly one. + +To prove the first assertion, write a nonterminal term as + +``` +(λx.B) A A₂ … Aₖ. +``` + +A beta contraction other than the displayed head contraction lies inside +`B`, `A`, or one of the later arguments. Taking it first leaves the same +head lambda and application. After one head contraction, the result is +reachable from the original head reduct by contracting the finitely many +residuals of that other contraction. Strong induction on `h`, with an inner +induction on the length of an arbitrary beta trace, proves the assertion. +The base case holds because beta reduction preserves an outer lambda or a +rigid variable head. Consequently a weak-head-normalizing term cannot +admit infinitely many global head contractions, even with arbitrary beta +contractions between them. + +`Blc/WeakHeadClock.lean` mechanizes this supporting fact. Its +`count_reduct` theorem proves monotonicity under arbitrary beta reduction, +and `interleaved_bound` bounds any selected head contractions interspersed +with unrestricted beta steps by the initial finite head clock. This does +not mechanize the growth theorem's data-flow and finite-transient arguments. + +We will use both suffixes `Ω` and `I`. The former prevents the infinite-zero +execution from terminating. The latter makes a finite-prefix execution +weak-head normalizing and supplies the eventual contradiction. + +### Comparing the head trace with data normalization + +Use the extended constants `K,Zᵢ` and their data rules from the preceding +proof, with every explicit lambda representing a marked program lambda. +Start the extended weak-head execution at `R Z₀`. + +This execution cannot terminate. A closed extended weak-head answer is a +program lambda, `K`, `K V`, or `Zᵢ`. Any finite computation to such an answer +can be simulated on sufficiently long finite zero prefixes, where the +answer becomes an actual outer lambda. Choose an even prefix length `2n` +and tail `stream(I,Ω)`. The input is `stream(λⁿ.I,Ω)`. Correctness makes its +result beta-join `Ω`, but a lambda cannot beta-join `Ω`: the latter's only +beta reduct is itself, and beta reduction preserves an outer lambda. + +The data rules admit a finite full normalizer. Recursively normalize the +bodies of program lambdas, treat those lambdas and free variables as opaque +heads, and evaluate each application with the displayed finite table. Write +`B(t)` for this full data normal form. These are only data contractions +under a program lambda; no program contraction is performed there. The +data rewrite system is orthogonal, so its normal form is unique and data +reduction commutes with substitution up to this normal form. Data reduction +never duplicates a program lambda or a variable occurrence. + +An infinite weak-head execution cannot consist eventually of data steps +alone. The finite data normalizer supplies a trace to data normal form. +Each data head rule is affine, so commuting an earlier non-head data step +past it leaves at most one residual step. A finite trace to a head-normal +form must eventually contract the persistent head redex. Move that +contraction to the front and induct on the shortened finite trace. This +proves termination of the deterministic data head strategy, without +asserting that mere weak normalization would terminate an arbitrary +reduction strategy. + +Now suppose, for contradiction, that the infinite-zero head execution +never increases the program-lambda count. Its infinitely many program +head contractions induce an auxiliary execution on full data normal forms. +If an actual program step contracts a binder with `k` occurrences and an +argument with `a` program lambdas, the count changes by + +``` +(k−1)a − 1. +``` + +In the data normal form, the corresponding binder and argument have +`k′≤k` occurrences and `a′≤a` program lambdas. The corresponding global +program head contraction still exists. Data normalization of its result +is `B(u)`, where `u` is the actual reduct: normalize the body and argument, +use stability of data reduction under substitution, then use uniqueness +of the data normal form. If `(k−1)a≤1`, then `(k′−1)a′≤1` as well; when +`k′=0` the new contraction is strictly decreasing. Subsequent data +normalization can only decrease the count further. Actual data steps do +not change `B(t)`. + +Thus the auxiliary execution has infinitely many global program head +contractions and a nonincreasing program-lambda count. After a finite +prefix that natural-number count is constant. Every subsequent program +contraction has exactly + +``` +k=2, a=1. +``` + +Every individual data step in this phase also preserves the count. In +particular, no `K` or Scott projection can erase a program-bearing argument. + +### The finite transient in a constant-count phase + +Mark all program lambdas present at the start of this phase as old. A copy +created by a subsequent program contraction is new. Every copied argument +contains exactly one program lambda and is closed, because the contraction +is on the global head of a closed term. Its sole lambda `D` is therefore +closed when considered in isolation and has an application-only body. Call +such a lambda flat. Its body is already in full data normal form. + +Every new lambda is consequently a closed flat template. While it survives, +its body cannot change: an outside substitution does not affect a closed +term, its body has no program lambda or data redex, and contracting its own +binder consumes it. Only old lambdas can be nonflat or refer to an enclosing +program binder. Each old head contractor is consumed once. Copying an old +lambda produces new copies, so it does not replenish the old population. +After finitely many further steps, no old lambda is ever a head contractor. + +Every closed data-normal value with exactly one program lambda has one of +the forms + +``` +Kⁿ D, +Kⁿ(D A₁ … Aₖ), k≥1, +``` + +where `D` is closed and flat and all `Aᵢ` are closed and program-free. +Here `Kⁿ V` means `n` nested constant-function wrappers around `V`. + +In the second form, mark the occurrence of `D` as blocked. More precisely, +a block is a closed connected subterm `D A₁` with `A₁` program-free. Do not +mark an application to an open outer-bound variable under an old lambda; +that variable could later acquire a program-bearing argument. + +A blocked occurrence cannot lose its first argument without contracting +`D` or erasing the whole occurrence. Outside substitution preserves the +closed connected subterm. Data rules can move it, wrap it, or append +arguments, but cannot remove that first argument. Contracting `D` with its +program-free first argument strictly decreases the program-lambda count; +erasing it does so as well. Neither is possible in this phase. The mark is +therefore permanent, including when the blocked subterm is copied. + +Count blocked lambda occurrences. This count is nondecreasing and bounded +by the constant total program-lambda count. Copying a blocked one-lambda +operand consumes an unblocked head lambda and creates two blocked copies +in place of the previous one, increasing the blocked count by one. Marking +a new closed block also increases it. After finitely many further steps, +there are no blocked-operand copies and no new blocks. + +At the end of this finite transient every head contractor is a closed flat +template, and every copied argument has form `Kⁿ D`. Old or blocked +lambdas may remain farther down the pending spine, but cannot become the +active contractor or copied operand. + +### The stable transition does not carry an advancing tail + +Consider a stable contraction whose flat contractor is `C=λx.A` and whose +argument is `Kⁿ D`. The application-only body `A` contains exactly two +occurrences of `x`. Its substitution instance therefore contains exactly +two copies of `D`, fixed data syntax from `A`, and `n` wrappers around each +copy. It contains no other program lambda. + +Data normalization preserves both copies. Every closed program-bearing +data-normal value is a wrapper chain around a program-headed spine, so +the normalized substituted body has form + +``` +Kᵐ(D V₁ … Vᵣ). +``` + +The head `D` itself has no program lambda in its body, so the other copy +must occur in one of the `Vᵢ`; in particular `r≥1`. The first argument +`V₁` cannot be program-free, since that would create a new closed block. +Thus `V₁` contains the other copy of `D`. It cannot be a blocked one-lambda +value, since the next head contraction would copy that blocked operand. +Therefore `V₁=Kᑫ D`, and every later `Vᵢ` is program-free. + +Applying the normalized body to the previous pending spine erases exactly +the arguments consumed by its `m` wrappers. Those arguments must be +program-free. If there were too few arguments, the execution would stop at +a partial constant function, contrary to its infinitude. Once the head is +exposed, the state is + +``` +D (Kᑫ D) (new program-free arguments) (unconsumed old spine). +``` + +After this single transition the active template is `D` forever. Its +wrapper counter may grow without bound. The old pending arguments can +only be erased by wrappers or remain after the internally supplied +recursive argument; they never become the argument substituted into a new +`D` body. + +The direct interaction with an advancing zero cell makes this restriction +explicit: + +``` +Zᵢ D →* D K Zᵢ₊₁, a new block; +Zᵢ (K D) →* D Zᵢ₊₁, a new block; +Zᵢ (Kⁿ D) →* Kⁿ⁻² D, n≥2, the advancing tail is discarded. +``` + +A zero cell can instead act on a two-code value such as `D(KᑫD)…`, +appending `K,Zᵢ₊₁` after its recursive argument. This only pushes +program-free values onto the pending spine. It does not transfer a new +tail into either template. + +### A uniform label bound, independent of the wrappers + +Write the stabilized template as `D=λx.A`. Evaluate its fixed finite body +`A`, treating the canonical value `Kᑫ D` substituted for `x` as one leaf. +The data application table increases the largest label by at most two per +table call, including its intermediate reductions. The factor two matters: +`Zᵢ(K Zⱼ)` passes through `Zⱼ Zᵢ₊₁` and creates a discarded `Zᵢ₊₂` before +reaching `K Zⱼ₊₁`. + +The recursive evaluation follows the fixed syntax of `A`. Its variable +leaf may have any number of `K` wrappers, but those wrappers carry no +labels and normalizing their applications creates no new label. The copies +of `D` also have their fixed, already-normalized bodies. Hence a bound +consisting of the largest fixed label plus twice the number of application +nodes in `A`, enlarged by a fixed table margin, covers every intermediate +label in every stable body evaluation. It is independent of the wrapper +counter. + +Every newly pushed program-free value satisfies that bound. The old +pending spine is finite at the start of the stable phase and already data +normal. Its values are only retained or erased; they are never evaluated +as a new state or substituted into `D`. Enlarge the bound to cover those +values and every label in the finite transient. There is therefore one +finite `L` bounding all labels used in the entire infinite auxiliary +execution, despite its possibly unbounded wrappers and pending spine. + +### Returning to a finite valid source + +Choose even `2n>L` and interpret `Zᵢ` as the corresponding tail of + +``` +zeros₂ₙ (stream(I,I)) = stream(λⁿ.I,I). +``` + +Every data and program step of the entire infinite auxiliary execution +is reproduced by ordinary beta reduction. Every program head contraction +remains a global ordinary head contraction. We obtain infinitely many head +contractions interspersed with finite data reductions from a reduct of +`R(stream(λⁿ.I,I))`. + +Exact remainder correctness makes this term beta-join normal `I`, hence +normalize to `I` and have a finite weak-head clock. The head-clock fact +rules out the displayed infinite execution. This contradicts the assumed +absence of growth in the infinite-zero head trace. + +The infinite-zero ordinary head trace must therefore contain a strict +program-lambda growth step. That step occurs in a finite trace prefix. +Simulate that prefix on a sufficiently long even finite zero prefix with +tail `stream(I,I)`. The actual ordinary weak-head trace follows the same +steps, and the program-lambda counts agree, giving the claimed valid-source +witness. + +At a growth step, either a binary binder copies an argument containing at +least two program lambdas, or a binder with at least three occurrences +copies an argument containing program code. Remainder extraction therefore +needs an actual increase of code during some head computation even though +its required output contributes no new program lambda. This is a +qualitative computational obstruction; it supplies neither a sharp bit +bound for remainder extraction nor an additive price for the two +self-interpreter projections. diff --git a/lean/Blc.lean b/lean/Blc.lean index 243723bd..f08fee34 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -28,3 +28,4 @@ import Blc.SelfintRemainder import Blc.SelfintZero import Blc.SelfintProjections import Blc.SelfintInert +import Blc.WeakHeadClock diff --git a/lean/Blc/WeakHeadClock.lean b/lean/Blc/WeakHeadClock.lean new file mode 100644 index 00000000..0bb83576 --- /dev/null +++ b/lean/Blc/WeakHeadClock.lean @@ -0,0 +1,152 @@ +/- +The number of deterministic weak-head contractions cannot increase under +arbitrary beta reduction. It strictly decreases at a weak-head contraction. +This also bounds head contractions interleaved with unrestricted reductions. +-/ +import Blc.SelfintLowerBound +import Blc.SelfintControl + +namespace Blc.WeakHeadClock +open Term SelfintLowerBound SelfintControl + +inductive Count : Term → Nat → Prop where + | stop {t : Term} : weakStep t = none → Count t 0 + | step {t u : Term} {n : Nat} : + weakStep t = some u → Count u n → Count t (n + 1) + +theorem weak_app {f g : Term} (h : weakStep f = some g) (a : Term) : + weakStep (.app f a) = some (.app g a) := by + cases f with + | var n => simp [weakStep] at h + | lam b => simp [weakStep] at h + | app p q => simp only [weakStep, h, Option.map_some] + +theorem rigid_stop {t : Term} (h : Rigid t) : weakStep t = none := by + induction h with + | var n => rfl + | app a h ih => + rename_i f + cases f with + | var n => rfl + | lam b => cases h + | app p q => simp only [weakStep, ih, Option.map_none] + +theorem stop_beta {t u : Term} (hs : weakStep t = none) (hb : Beta t u) : + weakStep u = none := by + cases t with + | lam b => cases hb with | lam h => rfl + | var n => cases hb + | app f a => + exact rigid_stop (rigid_beta (weakStep_none_rigid hs (fun h => h)) hb) + +theorem subst_arg {a b : Term} (h : Beta a b) (t : Term) : + Betas (contract t a) (contract t b) := by + obtain ⟨n, hn⟩ := beta_par h + exact parN_betas (parN_substDec (parN_refl t) hn 0) + +/-- A different contraction commutes past the head contraction, with +finitely many residual contractions after it. -/ +theorem commute {t p u : Term} (hs : weakStep t = some p) (hb : Beta t u) : + u = p ∨ ∃ q, weakStep u = some q ∧ Betas p q := by + induction t generalizing p u with + | var n => simp [weakStep] at hs + | lam b ih => simp [weakStep] at hs + | app f a ihf iha => + cases f with + | var n => simp [weakStep] at hs + | lam b => + simp only [weakStep, Option.some.injEq] at hs + subst p + cases hb with + | beta b a => exact .inl rfl + | appL a h => + cases h with + | lam h => + exact .inr ⟨_, rfl, betas_subst (.head h (.refl _)) 0 a⟩ + | appR f h => exact .inr ⟨_, rfl, subst_arg h b⟩ + | app g b => + simp only [weakStep, Option.map_eq_some_iff] at hs + obtain ⟨f', hf, rfl⟩ := hs + cases hb with + | appL a h => + rcases ihf hf h with he | ⟨q, hq, hp⟩ + · exact .inl (congrArg (Term.app · a) he) + · exact .inr ⟨.app q a, weak_app hq a, betas_appL a hp⟩ + | appR f h => + exact .inr ⟨_, weak_app hf _, .head (.appR f' h) (.refl _)⟩ + +theorem count_reduct : ∀ n, ∀ {t u : Term}, Count t n → Betas t u → + ∃ m, m ≤ n ∧ Count u m := by + intro n + induction n using Nat.strongRecOn with + | ind n ih => + have single : ∀ k, k ≤ n → ∀ {t u : Term}, Count t k → Beta t u → + ∃ m, m ≤ k ∧ Count u m := by + intro k hk t u hc hb + by_cases he : k = n + · subst k + cases hc with + | stop hs => exact ⟨0, Nat.le_refl _, .stop (stop_beta hs hb)⟩ + | @step t p k hs hc => + rcases commute hs hb with he | ⟨q, hq, hpq⟩ + · subst u + exact ⟨k, Nat.le_succ _, hc⟩ + · obtain ⟨m, hm, hcm⟩ := ih k (Nat.lt_succ_self _) hc hpq + exact ⟨m + 1, Nat.succ_le_succ hm, .step hq hcm⟩ + · exact ih k (by omega) hc (.head hb (.refl _)) + have many : ∀ {t u : Term}, Betas t u → + ∀ k, k ≤ n → Count t k → ∃ m, m ≤ k ∧ Count u m := by + intro t u h + induction h with + | refl t => intro k hk hc; exact ⟨k, Nat.le_refl _, hc⟩ + | head hb hs iht => + intro k hk hc + obtain ⟨q, hq, hcq⟩ := single k hk hc hb + obtain ⟨m, hm, hcm⟩ := iht q (Nat.le_trans hq hk) hcq + exact ⟨m, Nat.le_trans hm hq, hcm⟩ + intro t u hc h + exact many h n (Nat.le_refl _) hc + +theorem count_unique {t : Term} {m n : Nat} (hm : Count t m) (hn : Count t n) : + m = n := by + induction hm generalizing n with + | stop hs => cases hn with + | stop => rfl + | step ht hc => simp [hs] at ht + | step hs hc ih => cases hn with + | stop ht => simp [ht] at hs + | step ht hd => + have he := Option.some.inj (hs.symm.trans ht) + subst he + exact congrArg (· + 1) (ih hd) + +theorem head_decreases {t u : Term} {n : Nat} (hc : Count t n) + (hs : weakStep t = some u) : ∃ m, m < n ∧ Count u m := by + cases hc with + | stop ht => simp [ht] at hs + | step ht hd => + have he := Option.some.inj (ht.symm.trans hs) + subst he + exact ⟨_, Nat.lt_succ_self _, hd⟩ + +/-- Selected head contractions, interspersed with arbitrary beta steps. -/ +inductive Interleaved : Nat → Term → Term → Prop where + | refl (t : Term) : Interleaved 0 t t + | beta {t u v : Term} {n : Nat} : + Beta t u → Interleaved n u v → Interleaved n t v + | head {t u v : Term} {n : Nat} : + weakStep t = some u → Interleaved n u v → Interleaved (n + 1) t v + +theorem interleaved_bound {t u : Term} {n h : Nat} (ht : Count t h) + (hr : Interleaved n t u) : n ≤ h := by + induction hr generalizing h with + | refl t => exact Nat.zero_le _ + | beta hb hr ih => + obtain ⟨m, hm, hcm⟩ := count_reduct h ht (.head hb (.refl _)) + exact Nat.le_trans (ih hcm) hm + | head hs hr ih => + obtain ⟨m, hm, hcm⟩ := head_decreases ht hs + have hn := ih hcm + omega + +end Blc.WeakHeadClock From 9755d09cf208dfff67ac765244e5f5b57c46da8f Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 20:35:17 -0400 Subject: [PATCH 23/41] Mechanize remainder growth components and narrow compressed readers --- docs/STATUS.md | 25 +- .../self-interpreter/cheap-tail-bound.md | 289 +++++++++- .../classical/self-interpreter/interpreter.md | 14 +- docs/classical/self-interpreter/remainder.md | 108 ++-- lean/Blc.lean | 7 + lean/Blc/SelfintGrowthBlocks.lean | 345 +++++++++++ lean/Blc/SelfintGrowthBlue.lean | 315 ++++++++++ lean/Blc/SelfintGrowthHead.lean | 439 ++++++++++++++ lean/Blc/SelfintGrowthLabels.lean | 219 +++++++ lean/Blc/SelfintGrowthOrigins.lean | 209 +++++++ lean/Blc/SelfintGrowthSimulation.lean | 133 +++++ lean/Blc/SelfintGrowthStable.lean | 543 ++++++++++++++++++ lean/Blc/WeakHeadClock.lean | 33 ++ 13 files changed, 2625 insertions(+), 54 deletions(-) create mode 100644 lean/Blc/SelfintGrowthBlocks.lean create mode 100644 lean/Blc/SelfintGrowthBlue.lean create mode 100644 lean/Blc/SelfintGrowthHead.lean create mode 100644 lean/Blc/SelfintGrowthLabels.lean create mode 100644 lean/Blc/SelfintGrowthOrigins.lean create mode 100644 lean/Blc/SelfintGrowthSimulation.lean create mode 100644 lean/Blc/SelfintGrowthStable.lean diff --git a/docs/STATUS.md b/docs/STATUS.md index ec235b78..f4dceb57 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -200,8 +200,13 @@ with all features (three opt-in tests ignored) and 328 with default features. three-application normal cases and all nonlinear compression through four applications are excluded. A four-application minimum must be beta-normal; the normal `(A,L,k)=(4,4,2)` shape is also excluded, - where `k` counts leading lambdas. Other normal shapes and nonlinear - five-application compression remain open + where `k` counts leading lambdas. Without free stream access, every + affine handler fails the variable law once `m>A(H)+2L(H)+5`; a + separate live-binder-antichain obstruction also allows nonaffine redexes. + These exclude all five-application nonlinear compression without free + `s`. The only remaining compressed leaf allocation is `u,u,j,c,s,v`, + where `u` is the contracted nonlinear binder and `v` belongs to one + affine source binder. Other normal shapes remain open (`classical/self-interpreter/cheap-tail-bound.md`, `classical/self-interpreter/protocol-obstructions.md`). The zero arm ≥ 14, APP lift ≥ 19, reader/handler knot-tree and cell/APP @@ -282,12 +287,20 @@ with all features (three opt-in tests ignored) and 328 with default features. correctness. It gives neither an explicit `n` nor a bit-size bound, and does not quantify over every successful trace. `WeakHeadClock` kernel-checks the supporting bound on head contractions - interspersed with arbitrary beta reductions; the full growth theorem - remains handwritten. - Integrated `lake build Blc` passes all 35 jobs; a seventeen-theorem + interspersed with arbitrary beta reductions. The seven `SelfintGrowth` + modules additionally check data normalization and nongrowth transport, + bounded blocked-copy and nonflat-head events, the stable two-copy + value classification, uniform fixed-body label bounds, and finite-prefix + simulation with a head-clock bound. An exact data-normalizer cost proves + strong normalization of every data-reduction order; the extended head + machine and exact-remainder nontermination are also checked. The complete + infinite-execution synthesis remains handwritten. + Integrated `lake build Blc` passes all 42 jobs; a seventeen-theorem audit across `SelfintZero`, `SelfintProjections`, and `SelfintInert` uses only `propext` and `Quot.sound`, as does a separate four-theorem - `WeakHeadClock` audit. + `WeakHeadClock` audit. Of twenty-two audited growth-support theorems, + twenty-one use at most those axioms; the infinite-execution event + extraction additionally uses `Classical.choice`. - **Normal and typed witnesses** (`classical/self-interpreter/normal.md`, `typed-normal.md`): the β-normal interpreter is 204 bits (`int204_normal`, L 21, A 29, X 44). Lean proves its exact wire, diff --git a/docs/classical/self-interpreter/cheap-tail-bound.md b/docs/classical/self-interpreter/cheap-tail-bound.md index 9f40d64c..0a2f8c1b 100644 --- a/docs/classical/self-interpreter/cheap-tail-bound.md +++ b/docs/classical/self-interpreter/cheap-tail-bound.md @@ -1283,6 +1283,153 @@ law. Thus the affine argument covers every remaining case. This excludes the one-leading-lambda shape at the 30-bit budget. +## Affine handlers without whole-stream access + +The following handwritten theorem has been independently reviewed; it is not a +Lean theorem. It uses the `T=s` variable law alone and allows arbitrary affine +source beta redexes, but requires the handler to have no free `s`. + +Let + + F = λa b.b, + P₀(N) = λh.h K N, + Pᵢ₊₁(N) = λh.h F (Pᵢ(N)). + +A term is affine when every lambda binder has at most one occurrence. Count +every lambda and application in H, including any source redexes, as L and A +respectively. The free variables of H are fixed rigid ambient variables, +including c if used; H contains neither the stream variable s nor the fresh +suffix variable N. + +**Theorem.** If H is affine, then for every integer m>A+2L+5, + + H F (Pₘ₋₁(N)) (Pₘ(N)) ≠β c (Pₘ₋₁(N)) N. + +Consequently no affine handler without free s satisfies the whole-stream +variable law for every unary length. No zero-branch law, normal-form +assumption on H, or wire-size bound is needed. + +### One-stream application-edge lemma + +Let C[-] be an affine one-hole context with N absent, and place one P_b(N) in +its hole. Suppose a beta-reduction reaches a normal term containing N as a +bare leaf outside every residual original Scott cell. Then + + b+1 ≤ A(C), + +where applications inside the inserted P_b(N) are excluded from A(C). + +Give the initial applications of C persistent marks, and give the applications +initially inside P_b(N) no marks. Affine beta reduction never copies any +application node or N occurrence. Since the final term contains N, its sole +origin is never erased. + +Every original Scott cell whose tail contains N must have its own lambda +contracted before N becomes bare. An uncontracted original cell is a +beta-normal subterm closed except for rigid N; no outside substitution can +change its body or extract its tail. Erasing it would erase the sole N. + +We claim every such contraction consumes a marked application node. An +unmarked application belongs to a cell body + + (h bit) tail, + +where bit is F or K. Before this cell's lambda contracts, its whole body is +normal. When that lambda contracts with callback a, the two application nodes +become + + (a bit) tail. + +The unique N remains in tail, so a and bit contain no N. While the outer node +survives, that N stays in its argument subtree: reductions inside the argument +keep it there or erase it, reductions outside move the whole node, and a +substitution into the function cannot supply a second N. To move the argument +into a callback body, the outer node itself must contract and disappear. Thus +this outer node cannot ever have an N-containing residual stream as its +function. + +The paired inner node a bit also cannot acquire N in its function. As long as +the paired outer node survives, N is confined to the other side. Before the +outer node can contract, its function a bit must become a lambda; this +requires the inner application node to contract or disappear first. It +therefore cannot survive that transfer and subsequently become an application +of an N-containing stream. Erasing the N-bearing tail instead would lose N +permanently. + +There are no application nodes inside the Boolean bodies. These are all +unmarked origins. Consequently every original Scott-cell contraction consumes +a distinct initially marked node, proving the bound. This argument tracks +syntactic residual nodes, not the numerical size of an intermediate reduct. + +### A long output spine retains an original cell + +Assume the claimed reader equality. The whole application is affine, so it +beta-normalizes, and by confluence its normal form is the displayed normal +target. + +Distinguish the two initial suffix occurrences as fresh rigid N₁ and N₂. +Replay the same reduction with those labels. Affinity prevents duplication, +and the target has two suffix occurrences, so neither origin was erased. The +labeled target is therefore + + c (Pₘ₋₁(Nα)) Nβ, {α,β}={1,2}. + +Every Scott binder on the outer spine of Pₘ₋₁(Nα) has body headed by its own +variable with exactly two arguments. At most L such binders can originate in +H. None can originate in an input Boolean: + +* a surviving vacuous Boolean binder stays vacuous under capture-avoiding + substitution; +* the live binder of F has body consisting of that variable alone, even after + its vacuous outer binder disappears; +* the outer live binder of K, while it survives, retains its normal body λb.a; + its inner binder is vacuous. + +These are syntactic facts about surviving binders. No eta conversion is used, +and a Boolean merely being extensionally related to some term does not +suffice. + +The output spine has m Scott binders. Since m>L, it contains an original +input-cell binder. Choose the first one from the outside, after d output +cells. All d preceding binders must originate in H, so d≤L. This original cell +is the intact subterm + + Pᵢ(Nα), i=m−1−d ≥ m−1−L. + +It is intact because the original cell was beta-normal and closed except for +Nα. Outside substitution cannot change it, and contracting its own binder +would destroy that binder's origin. The original input containing this cell is +either Pₘ₋₁(Nα) or Pₘ(Nα), so there are at most d+1≤L+1 cells above it there. + +### Replace the retained island and apply the edge bound + +Replace this original surviving cell by a fresh rigid variable z in the +initial term. Replay all the previous contractions outside its unique +residual. None contracted inside the cell, and none erased it; treating it as +opaque therefore preserves every contraction. Capture-avoiding shifts of z +follow the same surrounding binders as the replaced cell. The final target is +the same c-headed term with its retained cell replaced by z, and with Nβ still +a bare final argument. + +The reserved input now has at most L+1 Scott cells, ending in z. The other +input is still P_b(Nβ), with b=m−1 or b=m, and has at least m cells. All of Nα +was inside the replaced cell and has disappeared. The remaining context around +P_b(Nβ) is affine, contains no Nβ, and has at most + + A + 3 + 2(L+1) = A+2L+5 + +applications: A in H, the three external reader applications, and two for each +cell of the truncated other input. Boolean bodies add no applications. + +The one-stream lemma now requires + + m ≤ b+1 ≤ A+2L+5, + +contrary to the chosen m. This proves the theorem. It excludes every affine +no-`s` handler for `T=s`, including affine reducts of non-affine source +handlers. It does not exclude handlers that retain a nonlinear binder or use +the whole stream freely. + ## Compression constraints for the whole-stream operand The following results concern `T=s` at its improving budget `|H|≤34`. @@ -1577,6 +1724,95 @@ Thus the normal form fails in every case. A minimum successful whole-stream handler with four applications must be beta-normal; only five-application nonlinear compression remains at this budget. +### The remaining five-application compression shapes + +At `A=5`, the improving budget and the source-lambda floor give + +``` +L=3, X≤6, or L=4, X≤4. +``` + +Choose a nonlinear redex with binder `u`. Its two mandatory bound +occurrences and the rigid `j,c` use four of the six variable leaves. +If every other source binder is vacuous, contracting `u` leaves +all-vacuous code and fails. + +When `s` is absent and there is at most one other live binder, +the live-binder-antichain theorem below excludes the reduct. If +that binder lies inside the copied argument, its copies are +disjoint live islands and every other binder is vacuous. Otherwise +only that one live binder remains, possibly with more occurrences. +This includes a third occurrence of `u`, a repeated occurrence of +the other binder, and an additional rigid ambient leaf. + +If `s` is present, the only remaining leaf allocation is + +``` +u,u,j,c,s,v, +``` + +where `v` is the sole occurrence of a distinct live binder. The +post-contraction code has stream access, so the no-stream theorems +do not settle this allocation. + +If `s` is absent, the only remaining allocation is + +``` +u,u,j,c,v,w, +``` + +with `v,w` bound by distinct affine binders. After contracting `u`, +the affine no-stream theorem excludes the reduct whenever it is +still affine. It can become nonaffine only if the copied argument +contains a free occurrence of `v` or `w` whose binding lambda lies +outside that argument. The following argument excludes these last +enclosing-binder placements as well. + +For `L=4`, the bound `X≤4` permits no initial leading lambda: +the mandatory `j,c` below one would already contribute five. +Follow the source's left application spine. A rigid head fails the +zero law. A lambda at its head must bind `u`, since every other +source binder is affine and the minimum has no affine source +redex. Thus the `u` redex lies on this application spine, with no +enclosing lambda. Its argument cannot contain a free occurrence +bound by another source lambda: such a binder would have to enclose +the redex. The reduct is therefore affine and already excluded. + +For `L=3`, call the copied argument `D`. If it contains no lambda, +contracting `u` leaves at most two source lambdas. The unrestricted +no-`s` two-source-lambda corollary below excludes that reduct. +Otherwise `D` contains one of the other two binders, say `b`, and +the copied free occurrence is bound by the remaining binder `a` +outside `D`. Thus `a` encloses the `u` redex and also encloses +`b`: all three source lambdas lie in this one `a` block. + +The `a` block must be the whole handler. If it is applied in +function position, it gives an affine source redex, forbidden by +minimality. If it is in argument position, all source lambdas are +inside that argument and the outside head is rigid `j/c`, which +cannot satisfy the zero law. Consequently `H=λa.T`. + +On the variable branch, first substitute the closed affine Boolean +`F` for `a`, then contract the source `u` redex. Call the resulting +term `T_F`. The binder `b` is inside `D`, so its copies remain affine; +the only formerly free bound occurrence in `D` has become `F`. +Every lambda in `T_F` is therefore affine, and `T_F` has no free `s`. +The affine handler + +``` +H′ = λignored.T_F +``` + +has exactly the same variable behavior as `H`: +`H′ F Pₘ₋₁ Pₘ =β H F Pₘ₋₁ Pₘ`. The affine no-stream theorem +excludes this equality for all sufficiently large `m`. No zero law +for `H′` is needed. This closes the final no-`s` placement without +requiring a special shape for `D`. + +Thus all no-`s` five-application nonlinear compression is excluded. +The only remaining compressed allocation at the improving budget +is `u,u,j,c,s,v`, with `v` bound by one affine source lambda. + ## Normal whole-stream handlers with at most three applications Write `P=cons K R` on the zero input and `S=Pₘ(N)`, @@ -1630,6 +1866,54 @@ becomes head `N`, contradicting the variable head `c`. Thus a normal no-`s` handler with at most one live source binder fails, regardless of the number of that binder's occurrences. +### A live-binder antichain also fails + +This consequence does not assume normality, affinity, or a size +bound. Call a binder live when it has at least one bound occurrence. +Suppose `H` contains no free `s`, and no live binder lies in the +body of another live binder. The condition refers to binding +identities and their residuals under capture-avoiding substitution, +not merely to variable names. It restricts all live binders, +including affine ones. + +Beta reduction preserves this antichain condition. A vacuous +contraction only discards its argument and exposes an existing +body. At a live redex `(λu.B) D`, the body `B` contains no other +live binder, and every enclosing binder is vacuous. Substitution +therefore inserts any copies of the live islands in `D` only +beneath vacuous binders. It neither nests them inside a surviving +live binder nor nests them inside each other. Capture avoidance +prevents a vacuous binder from acquiring a new bound occurrence. +Erasing a binder's last occurrence can only remove it from the +live set. + +Successful application to `K,R,P` would imply that `H` has a head +normal form. A rigid head cannot produce the required zero head +`R`. A head variable bound by a leading lambda makes that binder +live. Every other surviving live binder would then be inside its +body or, if earlier on the leading lambda chain, would contain it. +Both possibilities violate the preserved antichain. Thus this +head normal form has at most one live binder in its entire syntax. + +Every internal redex is consequently vacuous: the only live +binder is on the unapplied leading chain. These internal reductions +terminate by strictly deleting syntax, giving a full beta-normal +form with at most one live binder. The preceding no-`s` obstruction +excludes it. Hence no handler with a live-binder antichain and no +free `s` can satisfy both whole-stream reader laws. + +### Two source lambdas without s + +An arbitrary no-`s` handler with at most two source lambdas also +fails, with no size or normal-form assumption. The antichain theorem +handles every case except exactly two nested live binders. In that +case, the argument of a source redex cannot contain the other +lambda: the other binder is either an ancestor of the redex or is +inside its body. Contracting any source redex therefore leaves at +most one source lambda, which satisfies the antichain condition and +is excluded. If no source redex exists, the earlier arbitrary-size +floor for beta-normal handlers with at most two lambdas applies. + ### Zero, one, or two applications With `A≤1`, the mandatory rigid leaves `j,c` leave no live @@ -1861,7 +2145,10 @@ would have no affine source redex, at least three source lambdas, and exactly four or five applications. At four applications it must be beta-normal. The three-leading-lambda special case and the normal shape `(A,L,k)=(4,4,2)` are also excluded. The remaining -normal shapes and five-application nonlinear compression are open. +normal shapes must either use `s` or have nonaffine, nested live +binders. Five-application nonlinear compression remains only with +the leaf allocation `u,u,j,c,s,v`, where `u` binds the nonlinear +redex and `v` is the sole occurrence of one other live binder. Neither the independence assumptions on the ambient continuations nor the specified reader interface have been removed. This is not a global optimality theorem for the 165-bit interpreter. diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index a08b69ad..3c7f7893 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -327,9 +327,11 @@ The independently reviewed handwritten theorem in `remainder.md` also forces strict interpreter-code growth on some ordinary weak-head trace of every exact remainder extractor, using a valid source `λⁿ.I` and suffix `I`. The proof bounds the labels accessible to a constant-count -infinite-zero execution. `Blc/WeakHeadClock.lean` mechanizes its supporting -head-clock argument; the growth theorem itself remains handwritten and -gives no numerical size bound. +infinite-zero execution. `Blc/WeakHeadClock.lean` and the `SelfintGrowth` +modules mechanize the head clock, data normalization, both finite-event +counters, stable value forms, fixed-body label bounds, and finite-prefix +simulation. Their synthesis into the full growth theorem remains +handwritten and gives no numerical size bound. **Duplication.** At least two syntactic binders of `E` occur at least twice. Lean proves that every term with at most one such binder weakly normalizes; @@ -428,7 +430,11 @@ These are Codex's handwritten proofs, with targeted reduction checks in has no affine source redex and exactly four or five applications. At four applications it must be beta-normal; the `(A,L,k)=(4,4,2)` normal shape is also excluded, with `k` the number of leading lambdas. - Other normal shapes and five-application nonlinear compression stay open. + Without free `s`, every affine handler fails its variable law, and a + live-binder-antichain theorem also excludes nonaffine handlers. These + close every five-application compressed case without free `s`; only + the leaf allocation `u,u,j,c,s,v` remains in the compressed case. + Other normal shapes stay open. - **The zero arm costs at least 14 bits**, even with `bit0 := K` and the whole zero cell available to borrow. With `R` absent and the neighbours rigid, `Z R R = R next` forces the normal form `λu v. u next` (15) or diff --git a/docs/classical/self-interpreter/remainder.md b/docs/classical/self-interpreter/remainder.md index 5fb959f3..2e7bc2eb 100644 --- a/docs/classical/self-interpreter/remainder.md +++ b/docs/classical/self-interpreter/remainder.md @@ -195,8 +195,9 @@ stops at an outer lambda or a rigid variable head. The theorem concerns this specific evaluation strategy; it does not assert growth on every successful beta trace. -Codex's argument below has independent written review. The growth theorem -is not mechanized. In particular, it is stronger than the preceding +Codex's argument below has independent written review. The complete growth +theorem is not mechanized; the kernel-checked components are listed below. +In particular, it is stronger than the preceding kernel-checked two-nonlinear-binder theorem: a nonlinear contraction can recycle code without increasing its count, as `Δ Δ → Δ Δ` demonstrates. There is no numerical bound on `n`, on the time of the growth step, or on @@ -255,19 +256,21 @@ bodies of program lambdas, treat those lambdas and free variables as opaque heads, and evaluate each application with the displayed finite table. Write `B(t)` for this full data normal form. These are only data contractions under a program lambda; no program contraction is performed there. The -data rewrite system is orthogonal, so its normal form is unique and data -reduction commutes with substitution up to this normal form. Data reduction -never duplicates a program lambda or a variable occurrence. - -An infinite weak-head execution cannot consist eventually of data steps -alone. The finite data normalizer supplies a trace to data normal form. -Each data head rule is affine, so commuting an earlier non-head data step -past it leaves at most one residual step. A finite trace to a head-normal -form must eventually contract the persistent head redex. Move that -contraction to the front and induct on the shortened finite trace. This -proves termination of the deterministic data head strategy, without -asserting that mere weak normalization would terminate an arbitrary -reduction strategy. +normalizer is invariant under every data step, and data reduction commutes +with substitution up to this normal form. These statements follow directly +from the application table and its reduction traces. Data reduction never +duplicates a program lambda or a variable occurrence. + +In fact every data-reduction order terminates. Assign each application-table +case its exact contraction count, from zero through five, and let `cost(t)` +be the total cost of the recursive full normalizer. A K contraction removes +the erased operand's cost plus one. A Z contraction removes exactly one: +the table cost equals one plus the costs of its two new applications. +Under a context, the normal values supplied to the surrounding table calls +are invariant, so the same strict decrease remains. Every data step +therefore decreases the natural number `cost(t)`, even under program +lambdas. In particular, an infinite weak-head execution cannot consist +eventually of data steps alone. `SelfintGrowthHead` checks this cost argument. Now suppose, for contradiction, that the infinite-zero head execution never increases the program-lambda count. Its infinitely many program @@ -303,20 +306,22 @@ particular, no `K` or Scott projection can erase a program-bearing argument. ### The finite transient in a constant-count phase -Mark all program lambdas present at the start of this phase as old. A copy -created by a subsequent program contraction is new. Every copied argument -contains exactly one program lambda and is closed, because the contraction -is on the global head of a closed term. Its sole lambda `D` is therefore -closed when considered in isolation and has an application-only body. Call -such a lambda flat. Its body is already in full data normal form. - -Every new lambda is consequently a closed flat template. While it survives, -its body cannot change: an outside substitution does not affect a closed -term, its body has no program lambda or data redex, and contracting its own -binder consumes it. Only old lambdas can be nonflat or refer to an enclosing -program binder. Each old head contractor is consumed once. Copying an old -lambda produces new copies, so it does not replenish the old population. -After finitely many further steps, no old lambda is ever a head contractor. +Call a program lambda flat when it is closed in isolation and its body +contains no program lambda. Every copied argument contains exactly one +program lambda and is closed, because the contraction is on the global +head of a closed term. Its sole lambda is therefore flat. + +Count all nonflat program lambdas. Substitution preserves every existing +closed flat lambda and copies no nonflat lambda from a closed one-lambda +operand. Data reduction also preserves flatness. This count is thus +nonincreasing, and strictly decreases whenever the head contractor is +nonflat. After finitely many further steps, every head contractor is flat. + +The surviving flat templates have bodies already in full data normal form. +Their bodies cannot change: outside substitution fixes a closed term, +there is no internal program lambda or data redex, and contracting a +template's own binder consumes it. The finite-transient assertion needs +neither a label on every original binder nor an inventory of templates. Every closed data-normal value with exactly one program lambda has one of the forms @@ -350,7 +355,7 @@ a new closed block also increases it. After finitely many further steps, there are no blocked-operand copies and no new blocks. At the end of this finite transient every head contractor is a closed flat -template, and every copied argument has form `Kⁿ D`. Old or blocked +template, and every copied argument has form `Kⁿ D`. Nonflat or blocked lambdas may remain farther down the pending spine, but cannot become the active contractor or copied operand. @@ -411,19 +416,16 @@ tail into either template. Write the stabilized template as `D=λx.A`. Evaluate its fixed finite body `A`, treating the canonical value `Kᑫ D` substituted for `x` as one leaf. -The data application table increases the largest label by at most two per -table call, including its intermediate reductions. The factor two matters: -`Zᵢ(K Zⱼ)` passes through `Zⱼ Zᵢ₊₁` and creates a discarded `Zᵢ₊₂` before -reaching `K Zⱼ₊₁`. - -The recursive evaluation follows the fixed syntax of `A`. Its variable -leaf may have any number of `K` wrappers, but those wrappers carry no -labels and normalizing their applications creates no new label. The copies -of `D` also have their fixed, already-normalized bodies. Hence a bound -consisting of the largest fixed label plus twice the number of application -nodes in `A`, enlarged by a fixed table margin, covers every intermediate -label in every stable body evaluation. It is independent of the wrapper -counter. +Every data application-table call takes at most five K/Z contractions, +and every contraction increases the largest label by at most one. + +The recursive evaluation follows the fixed syntax of `A`. The substituted +leaf may have arbitrarily many `K` wrappers, but it is already canonical +and needs no normalization step. The copies of `D` also have their fixed, +already-normalized bodies. If `L₀` bounds the labels in `A,D`, every +intermediate label in this chosen body-normalization trace is at most +`L₀ + 5 apps(A)`. The bound is independent of the wrapper counter and +includes labels subsequently erased by a data contraction. Every newly pushed program-free value satisfies that bound. The old pending spine is finite at the start of the stable phase and already data @@ -467,3 +469,23 @@ its required output contributes no new program lambda. This is a qualitative computational obstruction; it supplies neither a sharp bit bound for remainder extraction nor an additive price for the two self-interpreter projections. + +### Kernel-checked components and remaining synthesis + +The `SelfintGrowth` modules check the following components against the same +labelled syntax used by `SelfintZero`: + +| Module | Checked result | +| --- | --- | +| `SelfintGrowthBlue` | Full data normalization, substitution compatibility, and preservation of an exposed non-growing program head contraction. | +| `SelfintGrowthBlocks` | Permanent closed blocks survive substitutions; in a constant-count phase, selected blocked-operand copies are bounded by the initial program-lambda count. | +| `SelfintGrowthOrigins` | The nonflat-lambda counter decreases at each nonflat head contraction, bounding those events in a closed constant-count phase. | +| `SelfintGrowthLabels` | A fixed application-only body's data evaluation takes at most five steps per application, uniformly in the size of its canonical operand, with every intermediate label bounded. | +| `SelfintGrowthStable` | Closed one-code operands and block-free two-copy values have the stated wrapper/spine forms; flat-body transitions and their label bounds follow. | +| `SelfintGrowthSimulation` | A uniformly bounded-label trace realizes on a finite zero prefix, and its selected program head steps are bounded by that realization's weak-head clock. | +| `SelfintGrowthHead` | Strict data-cost descent, deterministic extended head execution, finite realization by actual weak-head steps, and infinite-zero nontermination from the exact suffix contract. | + +These are supporting theorems, not a packaged proof of remainder growth. +The synthesis from an arbitrary nongrowing infinite head execution to a +uniformly bounded stable execution remains to be mechanized. Current build +and axiom-audit results are recorded in `docs/STATUS.md`. diff --git a/lean/Blc.lean b/lean/Blc.lean index f08fee34..5e799213 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -29,3 +29,10 @@ import Blc.SelfintZero import Blc.SelfintProjections import Blc.SelfintInert import Blc.WeakHeadClock +import Blc.SelfintGrowthBlue +import Blc.SelfintGrowthBlocks +import Blc.SelfintGrowthOrigins +import Blc.SelfintGrowthLabels +import Blc.SelfintGrowthStable +import Blc.SelfintGrowthSimulation +import Blc.SelfintGrowthHead diff --git a/lean/Blc/SelfintGrowthBlocks.lean b/lean/Blc/SelfintGrowthBlocks.lean new file mode 100644 index 00000000..5d6a443d --- /dev/null +++ b/lean/Blc/SelfintGrowthBlocks.lean @@ -0,0 +1,345 @@ +/- +Permanent closed blocks in a source-code-count-preserving computation. +A block is a closed flat program lambda already applied to a closed +program-free first argument. The counter records its lambda once. +-/ +import Blc.SelfintGrowthBlue + +namespace Blc.SelfintGrowthBlocks +open Term SelfintZero SelfintGrowthBlue + +theorem shift_free_iff (t : Q) (c d : Nat) (h : d ≤ c) : + FreeUnder d (erase (shiftQ c t)) ↔ FreeUnder d (erase t) := by + induction t generalizing c d with + | var n => + simp only [shiftQ] + split + · rename_i hn + have hd : d ≤ n := Nat.le_trans h hn + exact ⟨fun hl => (Nat.not_lt.mpr (Nat.le_trans hd (Nat.le_succ n)) hl).elim, + fun hl => (Nat.not_lt.mpr hd hl).elim⟩ + · rfl + | lam b ih => exact ih (c + 1) (d + 1) (Nat.succ_le_succ h) + | app f a ihf iha => + exact and_congr (ihf c d h) (iha c d h) + | k => rfl + | z i => rfl + +theorem closed_shift_iff (t : Q) (c : Nat) : + ClosedQ (shiftQ c t) ↔ ClosedQ t := + shift_free_iff t c 0 (Nat.zero_le c) + +theorem subst_free (t : Q) (j : Nat) (s : Q) + (h : FreeUnder j (erase t)) : substQ j s t = t := by + induction t generalizing j s with + | var n => + have hn : n < j := h + simp only [substQ, if_neg (Nat.ne_of_lt hn), if_neg (Nat.not_lt.mpr (Nat.le_of_lt hn))] + | lam b ih => exact congrArg Q.lam (ih (j + 1) _ h) + | app f a ihf iha => simp only [substQ, ihf j s h.1, iha j s h.2] + | k => rfl + | z i => rfl + +theorem subst_closed (t : Q) (j : Nat) (s : Q) (h : ClosedQ t) : + substQ j s t = t := + subst_free t j s (Term.closed_freeUnder h j) + +def Block (f a : Q) : Prop := + match f with + | .lam b => red b = 0 ∧ ClosedQ (.lam b) ∧ red a = 0 ∧ ClosedQ a + | _ => False + +instance (t : Q) : Decidable (ClosedQ t) := + inferInstanceAs (Decidable (Closed (erase t))) + +instance (f a : Q) : Decidable (Block f a) := by + cases f <;> dsimp [Block] <;> infer_instance + +def root (f a : Q) : Nat := if Block f a then 1 else 0 + +def blocks : Q → Nat + | .var _ | .k | .z _ => 0 + | .lam b => blocks b + | .app f a => blocks f + blocks a + root f a + +theorem root_shift (f a : Q) (c : Nat) : + root (shiftQ c f) (shiftQ c a) = root f a := by + cases f with + | var n => simp only [shiftQ]; split <;> rfl + | lam b => + change (if red (shiftQ (c + 1) b) = 0 ∧ ClosedQ (shiftQ c (.lam b)) ∧ + red (shiftQ c a) = 0 ∧ ClosedQ (shiftQ c a) then 1 else 0) = _ + simp only [red_shift, closed_shift_iff, root, Block] + rfl + | app f a => rfl + | k => rfl + | z i => rfl + +theorem blocks_shift (t : Q) (c : Nat) : blocks (shiftQ c t) = blocks t := by + induction t generalizing c with + | var n => simp only [shiftQ]; split <;> rfl + | lam b ih => exact ih (c + 1) + | app f a ihf iha => simp only [shiftQ, blocks, ihf, iha, root_shift] + | k => rfl + | z i => rfl + +theorem root_subst_le (f a : Q) (j : Nat) (s : Q) : + root f a ≤ root (substQ j s f) (substQ j s a) := by + by_cases h : Block f a + · have hf : ClosedQ f := by + cases f with + | lam b => exact h.2.1 + | var | app | k | z => exact h.elim + have ha : ClosedQ a := by + cases f with + | lam b => exact h.2.2.2 + | var | app | k | z => exact h.elim + rw [subst_closed f j s hf, subst_closed a j s ha] + exact Nat.le_refl _ + · simp only [root, if_neg h] + exact Nat.zero_le _ + +/-- Closed blocks survive substitution; copies of the argument bring +their own blocks. New blocks may also be formed. -/ +theorem blocks_subst_le (t s : Q) (j : Nat) : + blocks t + oc j t * blocks s ≤ blocks (substQ j s t) := by + induction t generalizing s j with + | var n => + simp only [substQ, blocks, oc_var] + split + · simp only [Nat.one_mul, Nat.zero_add, Nat.le_refl] + · split <;> simp_all only [blocks, Nat.zero_mul, Nat.zero_add, Nat.le_refl] + | lam b ih => + simpa only [substQ, blocks, oc_lam, blocks_shift] using ih (shiftQ 0 s) (j + 1) + | app f a ihf iha => + have hf := ihf s j + have ha := iha s j + have hr := root_subst_le f a j s + simp only [substQ, blocks, oc_app, Nat.add_mul] + omega + | k => simp only [blocks, oc_k, substQ, Nat.zero_mul, Nat.zero_add, Nat.le_refl] + | z i => simp only [blocks, oc_z, substQ, Nat.zero_mul, Nat.zero_add, Nat.le_refl] + +theorem blocks_zero (t : Q) (h : red t = 0) : blocks t = 0 := by + induction t with + | var n => rfl + | lam b ih => simp only [red] at h; omega + | app f a ihf iha => + have hf : red f = 0 := by simp only [red] at h; omega + have ha : red a = 0 := by simp only [red] at h; omega + have hr : root f a = 0 := by + cases f <;> try rfl + case lam b => + simp only [red] at hf + omega + simp only [blocks, ihf hf, iha ha, hr, Nat.zero_add] + | k => rfl + | z i => rfl + +theorem blocks_le_red (t : Q) : blocks t ≤ red t := by + induction t with + | var n => exact Nat.le_refl _ + | lam b ih => simp only [blocks, red]; omega + | app f a ihf iha => + by_cases h : Block f a + · cases f with + | lam b => + have hb := blocks_zero b h.1 + have ha := blocks_zero a h.2.2.1 + simp only [blocks, root, if_pos h, hb, ha, red, h.1, h.2.2.1] + omega + | var | app | k | z => exact h.elim + · simp only [blocks, root, if_neg h, Nat.add_zero, red] + omega + | k => exact Nat.le_refl _ + | z i => exact Nat.le_refl _ + +theorem root_program_arg (b a : Q) (h : 0 < red a) : root (.lam b) a = 0 := by + have hn : ¬ Block (.lam b) a := fun hb => (Nat.ne_of_gt h) hb.2.2.1 + exact if_neg hn + +/-- Copying a blocked one-lambda operand consumes an unblocked head and +strictly increases a counter bounded by the total program-lambda count. -/ +theorem blocked_copy_strict (b a : Q) (hk : oc 0 b = 2) (ha : red a = 1) + (hb : 0 < blocks a) : + blocks (.app (.lam b) a) < blocks (substQ 0 a b) := by + have h := blocks_subst_le b a 0 + have hr := root_program_arg b a (by omega) + simp only [blocks, hr, Nat.add_zero] + rw [hk] at h + omega + +theorem root_data_left {f g : Q} (h : DataStep f g) (a : Q) : + root f a ≤ root g a := by + by_cases hf : Block f a + · cases f with + | lam b => + cases h with + | @lam b c h => + have hc : red c = 0 := Nat.eq_zero_of_le_zero (hf.1 ▸ h.red_le) + have hclosed : ClosedQ (.lam c) := h.freeUnder 1 hf.2.1 + have hg : Block (.lam c) a := ⟨hc, hclosed, hf.2.2⟩ + simp only [root, if_pos hf, if_pos hg, Nat.le_refl] + | var | app | k | z => exact hf.elim + · simp only [root, if_neg hf] + exact Nat.zero_le _ + +theorem root_data_right (f : Q) {a b : Q} (h : DataStep a b) : + root f a ≤ root f b := by + by_cases ha : Block f a + · cases f with + | lam c => + have hb : red b = 0 := Nat.eq_zero_of_le_zero (ha.2.2.1 ▸ h.red_le) + have hclosed : ClosedQ b := h.freeUnder 0 ha.2.2.2 + have hg : Block (.lam c) b := ⟨ha.1, ha.2.1, hb, hclosed⟩ + simp only [root, if_pos ha, if_pos hg, Nat.le_refl] + | var | app | k | z => exact ha.elim + · simp only [root, if_neg ha] + exact Nat.zero_le _ + +/-- A data step preserving the source-lambda count cannot erase a block. +This includes data reductions underneath program lambdas. -/ +theorem data_blocks_le {t u : Q} (h : DataStep t u) (hr : red u = red t) : + blocks t ≤ blocks u := by + induction h with + | k a b => + have hb : red b = 0 := by simp only [red] at hr; omega + have hbb := blocks_zero b hb + simp only [blocks, root, Block, if_false, hbb, Nat.zero_add, Nat.add_zero, Nat.le_refl] + | z i a => + simp only [blocks, root, Block, if_false, Nat.zero_add, Nat.add_zero] + exact Nat.le_add_right _ _ + | @left f g a h ih => + have hf : red g = red f := by simp only [red] at hr; omega + have hb := ih hf + have hx := root_data_left h a + simp only [blocks] + omega + | @right f a b h ih => + have ha : red b = red a := by simp only [red] at hr; omega + have hb := ih ha + have hx := root_data_right f h + simp only [blocks] + omega + | @lam b c h ih => + exact ih (by simp only [red] at hr; omega) + +theorem data_steps_blocks_le {t u : Q} (h : DataSteps t u) (hr : red u = red t) : + blocks t ≤ blocks u := by + induction h with + | refl => exact Nat.le_refl _ + | @head t v u h hs ih => + have htv : red v = red t := by have h₁ := h.red_le; have h₂ := hs.red_le; omega + have hvu : red u = red v := by omega + exact Nat.le_trans (data_blocks_le h htv) (ih hvu) + +theorem constant_parameters (k a : Nat) (h : k * a = a + 1) : k = 2 ∧ a = 1 := by + have ha : 0 < a := by + by_cases hz : a = 0 + · simp only [hz, Nat.mul_zero] at h + omega + · omega + have hk : 2 ≤ k := by + by_cases hz : k = 0 + · simp only [hz, Nat.zero_mul] at h + omega + · by_cases ho : k = 1 + · simp only [ho, Nat.one_mul] at h + omega + · omega + have hm := Nat.mul_le_mul_right a hk + have he : a = 1 := by omega + rw [he] at h + simp only [Nat.mul_one] at h + exact ⟨h, he⟩ + +theorem constant_beta_parameters (b a : Q) + (h : red (substQ 0 a b) = red (.app (.lam b) a)) : + oc 0 b = 2 ∧ red a = 1 := by + have he : oc 0 b * red a = red a + 1 := by + simp only [red_subst, red] at h + omega + exact constant_parameters _ _ he + +theorem head_root_zero {t u : Q} (h : RedHead t u) (a : Q) : root t a = 0 := by + cases h <;> rfl + +/-- The block counter is monotone at every program head contraction in +a constant-source-lambda-count phase. -/ +theorem head_blocks_le {t u : Q} (h : RedHead t u) (hr : red u = red t) : + blocks t ≤ blocks u := by + induction h with + | beta b a => + obtain ⟨hk, ha⟩ := constant_beta_parameters b a hr + have hs := blocks_subst_le b a 0 + have hz := root_program_arg b a (by omega) + simp only [blocks, hz, Nat.add_zero] + rw [hk] at hs + omega + | @left f g a h ih => + have hf : red g = red f := by simp only [red] at hr; omega + have hb := ih hf + have hz := head_root_zero h a + simp only [blocks, hz, Nat.add_zero] + omega + +/-- A selected blocked operand is exposed at a red head contraction. -/ +inductive CopiesBlock : Q → Q → Prop where + | beta (b a : Q) : 0 < blocks a → + CopiesBlock (.app (.lam b) a) (substQ 0 a b) + | left {f g : Q} (a : Q) : CopiesBlock f g → CopiesBlock (.app f a) (.app g a) + +theorem CopiesBlock.head {t u : Q} (h : CopiesBlock t u) : RedHead t u := by + induction h with + | beta b a h => exact .beta _ _ + | left a h ih => exact .left _ ih + +/-- Thus only finitely many selected blocked-operand copies fit in a +constant-count phase; its natural-number counter rises at each one. -/ +theorem CopiesBlock.strict {t u : Q} (h : CopiesBlock t u) (hr : red u = red t) : + blocks t < blocks u := by + induction h with + | beta b a hb => + obtain ⟨hk, ha⟩ := constant_beta_parameters b a hr + exact blocked_copy_strict b a hk ha hb + | @left f g a h ih => + have hf : red g = red f := by simp only [red] at hr; omega + have hb := ih hf + have hz := head_root_zero h.head a + simp only [blocks, hz, Nat.add_zero] + omega + +/-- A finite part of a constant-count phase, counting selected blocked +operand copies. Other head contractions may be left uncounted. -/ +inductive Phase : Nat → Q → Q → Prop where + | refl (t : Q) : Phase 0 t t + | data {t u v : Q} {n : Nat} : DataStep t u → red u = red t → + Phase n u v → Phase n t v + | head {t u v : Q} {n : Nat} : RedHead t u → red u = red t → + Phase n u v → Phase n t v + | copy {t u v : Q} {n : Nat} : CopiesBlock t u → red u = red t → + Phase n u v → Phase (n + 1) t v + +theorem Phase.red_eq {n : Nat} {t u : Q} (h : Phase n t u) : red u = red t := by + induction h with + | refl => rfl + | data _ h _ ih | head _ h _ ih | copy _ h _ ih => exact ih.trans h + +theorem Phase.blocks_add {n : Nat} {t u : Q} (h : Phase n t u) : + blocks t + n ≤ blocks u := by + induction h with + | refl => exact Nat.le_refl _ + | data h he _ ih => have hm := data_blocks_le h he; omega + | head h he _ ih => have hm := head_blocks_le h he; omega + | copy h he _ ih => have hm := h.strict he; omega + +/-- No constant-count computation can keep copying blocked operands: +there are at most as many selected copies as initially unblocked lambdas. -/ +theorem Phase.copies_bound {n : Nat} {t u : Q} (h : Phase n t u) : + blocks t + n ≤ red t := by + have hb := h.blocks_add + have hr := blocks_le_red u + have he := h.red_eq + omega + +end Blc.SelfintGrowthBlocks diff --git a/lean/Blc/SelfintGrowthBlue.lean b/lean/Blc/SelfintGrowthBlue.lean new file mode 100644 index 00000000..6e6b39a3 --- /dev/null +++ b/lean/Blc/SelfintGrowthBlue.lean @@ -0,0 +1,315 @@ +/- +Full normalization of the affine K/Z data rules, including under program +lambdas. No program beta contraction is included in DataStep. This is a +supporting interface for the remainder code-growth argument, not a proof +of that argument's finite-transient or bounded-label assertions. +-/ +import Blc.SelfintZero + +namespace Blc +namespace SelfintGrowthBlue +open Term SelfintZero + +inductive DataStep : Q → Q → Prop where + | k (a b : Q) : DataStep (.app (.app .k a) b) a + | z (i : Nat) (a : Q) : + DataStep (.app (.z i) a) (.app (.app a .k) (.z (i + 1))) + | left {f g : Q} (a : Q) : DataStep f g → DataStep (.app f a) (.app g a) + | right (f : Q) {a b : Q} : DataStep a b → DataStep (.app f a) (.app f b) + | lam {b c : Q} : DataStep b c → DataStep (.lam b) (.lam c) + +inductive DataSteps : Q → Q → Prop where + | refl (t : Q) : DataSteps t t + | head {t u v : Q} : DataStep t u → DataSteps u v → DataSteps t v + +theorem DataSteps.trans {t u v : Q} (h : DataSteps t u) (g : DataSteps u v) : + DataSteps t v := by + induction h with + | refl => exact g + | head h _ ih => exact .head h (ih g) + +theorem DataSteps.one {t u : Q} (h : DataStep t u) : DataSteps t u := + .head h (.refl _) + +theorem DataSteps.left {f g : Q} (a : Q) (h : DataSteps f g) : + DataSteps (.app f a) (.app g a) := by + induction h with + | refl => exact .refl _ + | head h _ ih => exact .head (.left _ h) ih + +theorem DataSteps.right (f : Q) {a b : Q} (h : DataSteps a b) : + DataSteps (.app f a) (.app f b) := by + induction h with + | refl => exact .refl _ + | head h _ ih => exact .head (.right _ h) ih + +theorem DataSteps.lam {b c : Q} (h : DataSteps b c) : + DataSteps (.lam b) (.lam c) := by + induction h with + | refl => exact .refl _ + | head h _ ih => exact .head (.lam h) ih + +theorem DataStep.red_le {t u : Q} (h : DataStep t u) : red u ≤ red t := by + induction h with + | k a b => simp only [red]; omega + | z i a => simp only [red]; omega + | left a h ih => simp only [red]; omega + | right f h ih => simp only [red]; omega + | lam h ih => simp only [red]; omega + +theorem DataStep.occ_le {t u : Q} (h : DataStep t u) (j : Nat) : + oc j u ≤ oc j t := by + induction h generalizing j with + | k a b => simp only [oc_app, oc_k]; omega + | z i a => simp only [oc_app, oc_k, oc_z]; omega + | left a h ih => simp only [oc_app]; exact Nat.add_le_add_right (ih j) _ + | right f h ih => simp only [oc_app]; exact Nat.add_le_add_left (ih j) _ + | lam h ih => exact ih (j + 1) + +theorem DataStep.freeUnder {t u : Q} (h : DataStep t u) (d : Nat) + (ht : FreeUnder d (erase t)) : FreeUnder d (erase u) := by + induction h generalizing d with + | k a b => exact ht.1.2 + | z i a => exact ⟨⟨ht.2, by simp [erase, FreeUnder]⟩, by simp [erase, FreeUnder]⟩ + | left a h ih => exact ⟨ih d ht.1, ht.2⟩ + | right f h ih => exact ⟨ht.1, ih d ht.2⟩ + | lam h ih => exact ih (d + 1) ht + +theorem DataSteps.red_le {t u : Q} (h : DataSteps t u) : red u ≤ red t := by + induction h with + | refl => exact Nat.le_refl _ + | head h _ ih => exact Nat.le_trans ih h.red_le + +theorem DataSteps.occ_le {t u : Q} (h : DataSteps t u) (j : Nat) : + oc j u ≤ oc j t := by + induction h with + | refl => exact Nat.le_refl _ + | head h _ ih => exact Nat.le_trans ih (h.occ_le j) + +theorem DataSteps.freeUnder {t u : Q} (h : DataSteps t u) (d : Nat) + (ht : FreeUnder d (erase t)) : FreeUnder d (erase u) := by + induction h with + | refl => exact ht + | head h _ ih => exact ih (h.freeUnder d ht) + +theorem ap_data (u v : V) : DataSteps (.app (val u) (val v)) (val (ap u v)) := by + cases u with + | k => exact .refl _ + | const u => exact .one (.k _ _) + | neu n => exact .refl _ + | z i => + cases v with + | k => exact .head (.z _ _) (.one (.k _ _)) + | z j => + exact .head (.z _ _) (.head (.left _ (.z _ _)) + (.head (.left _ (.k _ _)) (.refl _))) + | neu n => exact .one (.z _ _) + | const v => + refine .head (.z _ _) (.head (.left _ (.k _ _)) ?_) + cases v with + | k => exact .refl _ + | z j => + exact .head (.z _ _) (.head (.left _ (.z _ _)) + (.head (.left _ (.k _ _)) (.refl _))) + | const a => exact .one (.k _ _) + | neu n => exact .refl _ + +/-- Unlike `SelfintZero.blue`, this also normalizes data inside lambdas. -/ +def deep : Q → V + | .var n => .neu (.atom (.var n)) + | .lam b => .neu (.atom (.lam (val (deep b)))) + | .app f a => ap (deep f) (deep a) + | .k => .k + | .z i => .z i + +def norm (t : Q) : Q := val (deep t) + +theorem norm_sound (t : Q) : DataSteps t (norm t) := by + induction t with + | var n => exact .refl _ + | lam b ih => exact ih.lam + | app f a ihf iha => + exact (ihf.left _).trans ((iha.right _).trans (ap_data _ _)) + | k => exact .refl _ + | z i => exact .refl _ + +theorem norm_red (t : Q) : red (norm t) ≤ red t := (norm_sound t).red_le +theorem norm_occ (t : Q) (j : Nat) : oc j (norm t) ≤ oc j t := + (norm_sound t).occ_le j +theorem norm_freeUnder (t : Q) (d : Nat) (ht : FreeUnder d (erase t)) : + FreeUnder d (erase (norm t)) := (norm_sound t).freeUnder d ht + +theorem ap_z (i : Nat) (v : V) : + ap (ap v .k) (.z (i + 1)) = ap (.z i) v := by + cases v with + | k => rfl + | z j => rfl + | neu n => rfl + | const v => cases v <;> rfl + +theorem DataStep.deep_eq {t u : Q} (h : DataStep t u) : deep t = deep u := by + induction h with + | k a b => rfl + | z i a => exact (ap_z i (deep a)).symm + | left a h ih => simp only [deep, ih] + | right f h ih => simp only [deep, ih] + | lam h ih => simp only [deep, ih] + +theorem DataSteps.deep_eq {t u : Q} (h : DataSteps t u) : deep t = deep u := by + induction h with + | refl => rfl + | head h _ ih => exact h.deep_eq.trans ih + +theorem DataSteps.norm_eq {t u : Q} (h : DataSteps t u) : norm t = norm u := + congrArg val h.deep_eq + +theorem norm_idempotent (t : Q) : norm (norm t) = norm t := + (norm_sound t).norm_eq.symm + +theorem deep_norm (t : Q) : deep (norm t) = deep t := + (norm_sound t).deep_eq.symm + +/-- Every two data reducts have the same explicit common data reduct. -/ +theorem data_confluent {t u v : Q} (hu : DataSteps t u) (hv : DataSteps t v) : + ∃ w, DataSteps u w ∧ DataSteps v w := by + refine ⟨norm t, ?_, ?_⟩ + · rw [hu.norm_eq] + exact norm_sound u + · rw [hv.norm_eq] + exact norm_sound v + +theorem DataStep.shift {t u : Q} (h : DataStep t u) (c : Nat) : + DataStep (shiftQ c t) (shiftQ c u) := by + induction h generalizing c with + | k a b => exact .k _ _ + | z i a => exact .z _ _ + | left a h ih => exact .left _ (ih c) + | right f h ih => exact .right _ (ih c) + | lam h ih => exact .lam (ih (c + 1)) + +theorem DataSteps.shift {t u : Q} (h : DataSteps t u) (c : Nat) : + DataSteps (shiftQ c t) (shiftQ c u) := by + induction h with + | refl => exact .refl _ + | head h _ ih => exact .head (h.shift c) ih + +theorem DataStep.subst {t u : Q} (h : DataStep t u) (s : Q) (j : Nat) : + DataStep (substQ j s t) (substQ j s u) := by + induction h generalizing s j with + | k a b => exact .k _ _ + | z i a => exact .z _ _ + | left a h ih => exact .left _ (ih s j) + | right f h ih => exact .right _ (ih s j) + | lam h ih => exact .lam (ih (shiftQ 0 s) (j + 1)) + +theorem DataSteps.subst {t u : Q} (h : DataSteps t u) (s : Q) (j : Nat) : + DataSteps (substQ j s t) (substQ j s u) := by + induction h with + | refl => exact .refl _ + | head h _ ih => exact .head (h.subst s j) ih + +theorem DataSteps.subst_arg {s s' : Q} (h : DataSteps s s') (t : Q) (j : Nat) : + DataSteps (substQ j s t) (substQ j s' t) := by + induction t generalizing j s s' with + | var n => + simp only [substQ] + split + · exact h + · split <;> exact .refl _ + | lam b ih => exact (ih (h.shift 0) (j + 1)).lam + | app f a ihf iha => exact ((ihf h j).left _).trans ((iha h j).right _) + | k => exact .refl _ + | z i => exact .refl _ + +/-- Normalizing the body and operand before substitution gives the same +data normal form as normalizing their substitution instance afterward. -/ +theorem norm_subst (t s : Q) (j : Nat) : + norm (substQ j s t) = norm (substQ j (norm s) (norm t)) := by + exact ((norm_sound t).subst s j |>.trans + ((norm_sound s).subst_arg (norm t) j)).norm_eq + +/-- A program beta contraction on the global function spine. -/ +inductive RedHead : Q → Q → Prop where + | beta (b a : Q) : RedHead (.app (.lam b) a) (substQ 0 a b) + | left {f g : Q} (a : Q) : RedHead f g → RedHead (.app f a) (.app g a) + +theorem RedHead.neutral {t u : Q} (h : RedHead t u) : ∃ n, deep t = .neu n := by + induction h with + | beta b a => exact ⟨_, rfl⟩ + | left a h ih => + obtain ⟨n, hn⟩ := ih + exact ⟨.app n (deep a), by simp only [deep, hn, ap]⟩ + +/-- Full data normalization preserves an exposed program head redex. +The normalized reduct agrees after one further finite data phase. -/ +theorem RedHead.norm_sim {t u : Q} (h : RedHead t u) : + ∃ v, RedHead (norm t) v ∧ norm v = norm u := by + induction h with + | beta b a => + exact ⟨_, .beta (norm b) (norm a), (norm_subst b a 0).symm⟩ + | @left f g a h ih => + obtain ⟨v, hv, he⟩ := ih + obtain ⟨n, hn⟩ := h.neutral + have ht : norm (.app f a) = .app (norm f) (norm a) := by + simp only [norm, deep, hn, ap, val, SelfintZero.neutral] + refine ⟨.app v (norm a), ht ▸ .left _ hv, ?_⟩ + have hd : deep v = deep g := by + have hh := congrArg deep he + simpa only [deep_norm] using hh + change val (ap (deep v) (deep (norm a))) = val (ap (deep g) (deep a)) + rw [deep_norm, hd] + +theorem RedHead.norm_steps {t u : Q} (h : RedHead t u) : + ∃ v, RedHead (norm t) v ∧ DataSteps v (norm u) := by + obtain ⟨v, hv, he⟩ := h.norm_sim + exact ⟨v, hv, he ▸ norm_sound v⟩ + +private theorem noGrowth_mono (k a l b : Nat) (h : k * a ≤ a + 1) + (hl : l ≤ k) (hb : b ≤ a) : l * b ≤ b + 1 := by + cases l with + | zero => simp + | succ l => + have hm := Nat.mul_le_mul_right a hl + have ha : l * a ≤ 1 := by + simp only [Nat.succ_mul] at hm + omega + have hb' := Nat.mul_le_mul_left l hb + simp only [Nat.succ_mul] + omega + +/-- Removing data redexes cannot turn a nongrowing program contraction +into a growing one: both its bound-occurrence and operand counts decrease. -/ +theorem beta_norm_noGrowth (b a : Q) + (h : red (substQ 0 a b) ≤ red (.app (.lam b) a)) : + red (substQ 0 (norm a) (norm b)) ≤ red (.app (.lam (norm b)) (norm a)) := by + rw [red_subst] at h ⊢ + simp only [red] at h ⊢ + have hp : oc 0 b * red a ≤ red a + 1 := by omega + have hm := noGrowth_mono (oc 0 b) (red a) (oc 0 (norm b)) (red (norm a)) + hp (norm_occ b 0) (norm_red a) + omega + +theorem RedHead.norm_noGrowth {t u : Q} (h : RedHead t u) + (hr : red u ≤ red t) : + ∃ v, RedHead (norm t) v ∧ norm v = norm u ∧ red v ≤ red (norm t) := by + induction h with + | beta b a => + exact ⟨_, .beta (norm b) (norm a), (norm_subst b a 0).symm, + beta_norm_noGrowth b a hr⟩ + | @left f g a h ih => + have hf : red g ≤ red f := by simpa only [red, Nat.add_le_add_iff_right] using hr + obtain ⟨v, hv, he, hvred⟩ := ih hf + obtain ⟨n, hn⟩ := h.neutral + have ht : norm (.app f a) = .app (norm f) (norm a) := by + simp only [norm, deep, hn, ap, val, SelfintZero.neutral] + have hd : deep v = deep g := by + have hh := congrArg deep he + simpa only [deep_norm] using hh + refine ⟨.app v (norm a), ht ▸ .left _ hv, ?_, ?_⟩ + · change val (ap (deep v) (deep (norm a))) = val (ap (deep g) (deep a)) + rw [deep_norm, hd] + · rw [ht] + exact Nat.add_le_add_right hvred _ + +end SelfintGrowthBlue +end Blc diff --git a/lean/Blc/SelfintGrowthHead.lean b/lean/Blc/SelfintGrowthHead.lean new file mode 100644 index 00000000..ac712b23 --- /dev/null +++ b/lean/Blc/SelfintGrowthHead.lean @@ -0,0 +1,439 @@ +/- +Deterministic weak-head execution for labelled zero streams. Data rules +strictly decrease an explicit normalization cost, so an infinite execution +must expose infinitely many program head contractions. +-/ +import Blc.SelfintGrowthOrigins +import Blc.SelfintGrowthSimulation + +namespace Blc.SelfintGrowthHead +open Term SelfintZero SelfintGrowthBlue SelfintGrowthLabels SelfintGrowthSimulation + SelfintLowerBound WeakHeadClock + +/-- Exact number of data contractions in one canonical application table call. -/ +def apCost : V → V → Nat + | .k, _ | .neu _, _ => 0 + | .const _, _ => 1 + | .z _, .k => 2 + | .z _, .z _ => 3 + | .z _, .neu _ => 1 + | .z _, .const .k => 2 + | .z _, .const (.z _) => 5 + | .z _, .const (.const _) => 3 + | .z _, .const (.neu _) => 2 + +theorem apCost_z (i : Nat) (v : V) : + apCost (.z i) v = 1 + apCost v .k + apCost (ap v .k) (.z (i + 1)) := by + cases v with + | k | z | neu => rfl + | const v => cases v <;> rfl + +/-- Work of the fixed full-data normalizer. Its value decreases even for +other data-reduction orders, since all table arguments have invariant values. -/ +def cost : Q → Nat + | .var _ | .k | .z _ => 0 + | .lam b => cost b + | .app f a => cost f + cost a + apCost (deep f) (deep a) + +theorem data_cost_lt {t u : Q} (h : DataStep t u) : cost u < cost t := by + induction h with + | k a b => simp only [cost, deep, ap, apCost]; omega + | z i a => simp only [cost, deep, apCost_z]; omega + | left a h ih => simp only [cost, h.deep_eq]; omega + | right f h ih => simp only [cost, h.deep_eq]; omega + | lam h ih => exact ih + +theorem data_count_le {n : Nat} {t u : Q} (h : CountData n t u) : + cost u + n ≤ cost t := by + induction h with + | refl => exact Nat.le_refl _ + | head h hs ih => have hh := data_cost_lt h; omega + +/-- The full data relation is strongly normalizing, including reductions +under program lambdas. This uses strict cost descent, not confluence. -/ +theorem data_acc (t : Q) : Acc (fun u t => DataStep t u) t := by + have h : ∀ n, ∀ t, cost t = n → Acc (fun u t => DataStep t u) t := by + intro n + induction n using Nat.strongRecOn with + | ind n ih => + intro t ht + refine Acc.intro t ?_ + intro u hu + exact ih (cost u) (ht ▸ data_cost_lt hu) u rfl + exact h (cost t) t rfl + +theorem no_infinite_data (f : Nat → Q) (h : ∀ n, DataStep (f n) (f (n + 1))) : False := by + have hb : ∀ n, cost (f n) + n ≤ cost (f 0) := by + intro n + induction n with + | zero => exact Nat.le_refl _ + | succ n ih => have hh := data_cost_lt (h n); omega + have hh := hb (cost (f 0) + 1) + omega + +/-- Data steps on the global function spine only. -/ +inductive DataHead : Q → Q → Prop where + | k (a b : Q) : DataHead (.app (.app .k a) b) a + | z (i : Nat) (a : Q) : + DataHead (.app (.z i) a) (.app (.app a .k) (.z (i + 1))) + | left {f g : Q} (a : Q) : DataHead f g → DataHead (.app f a) (.app g a) + +theorem DataHead.data {t u : Q} (h : DataHead t u) : DataStep t u := by + induction h with + | k a b => exact .k _ _ + | z i a => exact .z _ _ + | left a h ih => exact .left _ ih + +/-- Exactly the two kinds of ordinary extended head contraction. -/ +inductive Head : Q → Q → Prop where + | red {t u : Q} : RedHead t u → Head t u + | data {t u : Q} : DataHead t u → Head t u + +def next : Q → Option Q + | .app (.lam b) a => some (substQ 0 a b) + | .app (.z i) a => some (.app (.app a .k) (.z (i + 1))) + | .app (.app .k a) _ => some a + | .app f a => (next f).map (Q.app · a) + | _ => none + +theorem next_left {f g : Q} (h : next f = some g) (a : Q) : + next (.app f a) = some (.app g a) := by + cases f with + | var | lam | k | z => simp [next] at h + | app p q => + cases p <;> simp_all [next] + +theorem red_next {t u : Q} (h : RedHead t u) : next t = some u := by + induction h with + | beta => rfl + | left a h ih => exact next_left ih a + +theorem DataHead.next {t u : Q} (h : DataHead t u) : next t = some u := by + induction h with + | k | z => rfl + | left a h ih => exact next_left ih a + +theorem Head.next {t u : Q} (h : Head t u) : next t = some u := by + cases h with + | red h => exact red_next h + | data h => exact h.next + +theorem next_head {t u : Q} (h : next t = some u) : Head t u := by + induction t generalizing u with + | var | lam | k | z => simp [next] at h + | app f a ihf iha => + cases f with + | lam b => simp only [next, Option.some.injEq] at h; subst u; exact .red (.beta _ _) + | z i => simp only [next, Option.some.injEq] at h; subst u; exact .data (.z _ _) + | app p q => + cases p with + | k => simp only [next, Option.some.injEq] at h; subst u; exact .data (.k _ _) + | var => simp [next] at h + | lam b => + simp only [next, Option.map_some, Option.some.injEq] at h + subst u + exact .red (.left _ (.beta _ _)) + | z i => + simp only [next, Option.map_some, Option.some.injEq] at h + subst u + exact .data (.left _ (.z _ _)) + | app p r => + change (next (.app (.app p r) q)).map (Q.app · a) = some u at h + rw [Option.map_eq_some_iff] at h + obtain ⟨g, hg, rfl⟩ := h + cases ihf hg with + | red hr => exact .red (.left _ hr) + | data hd => exact .data (.left _ hd) + | var | k => simp [next] at h + +theorem head_deterministic {t u v : Q} (hu : Head t u) (hv : Head t v) : u = v := + Option.some.inj (hu.next.symm.trans hv.next) + +theorem Head.closed {t u : Q} (h : Head t u) (hc : ClosedQ t) : ClosedQ u := by + cases h with + | red h => exact SelfintGrowthOrigins.head_closed h hc + | data h => exact h.data.freeUnder 0 hc + +theorem done_next {t : Q} (h : Done t) : next t = none := by cases h <;> rfl + +/-- Closed extended weak-head normal forms have precisely the four Done shapes. -/ +theorem closed_terminal {t : Q} (hc : ClosedQ t) (hn : next t = none) : Done t := by + induction t with + | var n => exact (Nat.not_lt_zero n hc).elim + | lam b => exact .lam _ + | k => exact .k + | z i => exact .z _ + | app f a ihf iha => + cases f with + | var n => exact (Nat.not_lt_zero n hc.1).elim + | lam b | z i => simp [next] at hn + | k => exact .const _ + | app p q => + have hf : next (.app p q) = none := by + cases p <;> simp_all [next] + cases ihf hc.1 hf with + | const q => simp [next] at hn + +/-- Every infinite extended head execution has a program contraction +after each position: data steps alone cannot form an infinite suffix. -/ +theorem infinite_red (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) (n : Nat) : + ∃ k, n ≤ k ∧ RedHead (f k) (f (k + 1)) := by + classical + apply Classical.byContradiction + intro hn + have hd : ∀ k, DataStep (f (n + k)) (f (n + k + 1)) := by + intro k + cases h (n + k) with + | red hr => exact (hn ⟨n + k, by omega, hr⟩).elim + | data hd => exact hd.data + exact no_infinite_data (fun k => f (n + k)) (by + intro k + simpa only [Nat.add_assoc] using hd k) + +/-- Full data normalization stutters at data heads and preserves every +nongrowing program head as one nongrowing program head followed by data. -/ +theorem head_norm_noGrowth {t u : Q} (h : Head t u) (hr : red u ≤ red t) : + norm t = norm u ∨ + ∃ v, RedHead (norm t) v ∧ norm v = norm u ∧ red v ≤ red (norm t) := by + cases h with + | data h => exact .inl (congrArg val h.data.deep_eq) + | red h => exact .inr (h.norm_noGrowth hr) + +/-- An actual infinite nongrowing head execution exposes arbitrarily late +program heads on its canonical data normal forms. -/ +theorem infinite_red_norm (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) + (hr : ∀ n, red (f (n + 1)) ≤ red (f n)) (n : Nat) : + ∃ k v, n ≤ k ∧ RedHead (norm (f k)) v ∧ + norm v = norm (f (k + 1)) ∧ red v ≤ red (norm (f k)) := by + obtain ⟨k, hk, hh⟩ := infinite_red f h n + obtain ⟨v, hv, he, hvred⟩ := hh.norm_noGrowth (hr k) + exact ⟨k, v, hk, hv, he, hvred⟩ + +/-- Exact ordinary weak-head traces, with every contraction counted. -/ +inductive WeakTrace : Nat → Term → Term → Prop where + | refl (t : Term) : WeakTrace 0 t t + | step {n : Nat} {t u v : Term} : weakStep t = some u → + WeakTrace n u v → WeakTrace (n + 1) t v + +theorem WeakTrace.trans {n m : Nat} {t u v : Term} (h : WeakTrace n t u) + (g : WeakTrace m u v) : WeakTrace (n + m) t v := by + induction h with + | refl => simpa only [Nat.zero_add] using g + | step h hs ih => + simpa only [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using WeakTrace.step h (ih g) + +theorem WeakTrace.left {n : Nat} {t u : Term} (h : WeakTrace n t u) (a : Term) : + WeakTrace n (.app t a) (.app u a) := by + induction h with + | refl => exact .refl _ + | step h hs ih => exact .step (WeakHeadClock.weak_app h a) ih + +theorem WeakTrace.betas {n : Nat} {t u : Term} (h : WeakTrace n t u) : Betas t u := by + induction h with + | refl => exact .refl _ + | step h hs ih => exact .head (weakStep_beta h) ih + +theorem weak_true2 (a b : Term) : WeakTrace 2 (.app (.app churchTrue a) b) a := by + refine .step (WeakHeadClock.weak_app (show weakStep (.app churchTrue a) = + some (.lam (shift 1 0 a)) from rfl) b) ?_ + refine .step ?_ (.refl a) + simp only [weakStep, contract, substDec_shift] + +theorem weak_pair (a b x : Term) : + weakStep (.app (pairT a b) x) = some (.app (.app x a) b) := by + simp only [pairT, weakStep, contract, substDec, if_true, substDec_shift] + +/-- A data head is realized by one or two actual ordinary head steps. -/ +theorem data_head_realize {t u : Q} (h : DataHead t u) (m : Nat) (T : Term) + (hm : demand t ≤ m) : + ∃ n, 1 ≤ n ∧ n ≤ 2 ∧ WeakTrace n (realize m T t) (realize m T u) := by + induction h with + | k a b => exact ⟨2, by omega, by omega, weak_true2 _ _⟩ + | z i a => + have he : m - i = (m - (i + 1)) + 1 := by simp only [demand] at hm; omega + refine ⟨1, by omega, by omega, .step ?_ (.refl _)⟩ + simpa only [realize, interp, he, zeros] using + weak_pair churchTrue (zeros (m - (i + 1)) T) (realize m T a) + | @left f g a h ih => + obtain ⟨n, hn, hb, ht⟩ := ih (Nat.le_trans (Nat.le_max_left _ _) hm) + exact ⟨n, hn, hb, ht.left _⟩ + +theorem head_realize {t u : Q} (h : Head t u) (m : Nat) (T : Term) + (hT : Closed T) (hm : demand t ≤ m) : + ∃ n, 1 ≤ n ∧ n ≤ 2 ∧ WeakTrace n (realize m T t) (realize m T u) := by + cases h with + | red h => exact ⟨1, by omega, by omega, .step (red_head_sim h m T hT) (.refl _)⟩ + | data h => exact data_head_realize h m T hm + +/-- Actual extended head traces, counting the program contractions. -/ +inductive Trace : Nat → Q → Q → Prop where + | refl (t : Q) : Trace 0 t t + | red {n : Nat} {t u v : Q} : RedHead t u → Trace n u v → Trace (n + 1) t v + | data {n : Nat} {t u v : Q} : DataHead t u → Trace n u v → Trace n t v + +theorem Trace.trans {n m : Nat} {t u v : Q} (h : Trace n t u) (g : Trace m u v) : + Trace (n + m) t v := by + induction h with + | refl => simpa only [Nat.zero_add] using g + | red h hs ih => + simpa only [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using Trace.red h (ih g) + | data h hs ih => exact .data h (ih g) + +theorem Trace.closed {n : Nat} {t u : Q} (h : Trace n t u) (hc : ClosedQ t) : ClosedQ u := by + induction h with + | refl => exact hc + | red h hs ih => exact ih (Head.closed (.red h) hc) + | data h hs ih => exact ih (Head.closed (.data h) hc) + +theorem Head.trace {t u : Q} (h : Head t u) : ∃ n, Trace n t u := by + cases h with + | red h => exact ⟨1, .red h (.refl _)⟩ + | data h => exact ⟨0, .data h (.refl _)⟩ + +theorem Trace.finite_realize {n : Nat} {t u : Q} (h : Trace n t u) : + ∃ b, ∀ m, b ≤ m → ∀ T, Closed T → + ∃ k, n ≤ k ∧ WeakTrace k (realize m T t) (realize m T u) := by + induction h with + | refl t => exact ⟨0, fun _ _ _ _ => ⟨0, by omega, .refl _⟩⟩ + | red h hs ih => + obtain ⟨b, hb⟩ := ih + refine ⟨b, fun m hm T hT => ?_⟩ + obtain ⟨k, hk, ht⟩ := hb m hm T hT + exact ⟨k + 1, by omega, .step (red_head_sim h m T hT) ht⟩ + | @data n t v u h hs ih => + obtain ⟨b, hb⟩ := ih + refine ⟨max (demand t) b, fun m hm T hT => ?_⟩ + obtain ⟨k, hk, ht⟩ := hb m (Nat.le_trans (Nat.le_max_right _ _) hm) T hT + obtain ⟨j, _, _, hj⟩ := data_head_realize h m T (Nat.le_trans (Nat.le_max_left _ _) hm) + exact ⟨j + k, by omega, hj.trans ht⟩ + +/-- The selected program-contraction count is preserved separately, without +counting administrative data contractions as additional program steps. +This theorem concerns selected events, not colored lambda occurrences. -/ +theorem Trace.finite_selected {n : Nat} {t u : Q} (h : Trace n t u) : + ∃ b, ∀ m, b ≤ m → ∀ T, Closed T → + Interleaved n (realize m T t) (realize m T u) := by + induction h with + | refl t => exact ⟨0, fun _ _ _ _ => .refl _⟩ + | red h hs ih => + obtain ⟨b, hb⟩ := ih + exact ⟨b, fun m hm T hT => .head (red_head_sim h m T hT) (hb m hm T hT)⟩ + | @data n t v u h hs ih => + obtain ⟨b, hb⟩ := ih + refine ⟨max (demand t) b, fun m hm T hT => ?_⟩ + exact interleaved_prepend (data_sim h.data m T hT (Nat.le_trans (Nat.le_max_left _ _) hm)) + (hb m (Nat.le_trans (Nat.le_max_right _ _) hm) T hT) + +/-- Realized extended terminal states need at most one administrative +ordinary head step to expose their lambda. -/ +theorem done_weak_realize {t : Q} (h : Done t) : + ∃ b, ∀ m, b ≤ m → ∀ T, ∃ n B, n ≤ 1 ∧ + WeakTrace n (realize m T t) (.lam B) := by + cases h with + | k => exact ⟨0, fun _ _ _ => ⟨0, _, by omega, .refl _⟩⟩ + | z i => + refine ⟨i + 1, fun m hm T => ?_⟩ + have he : m - i = (m - (i + 1)) + 1 := by omega + simp only [realize, interp, he, zeros, pairT] + exact ⟨0, _, by omega, .refl _⟩ + | const t => exact ⟨0, fun _ _ _ => ⟨1, _, by omega, .step rfl (.refl _)⟩⟩ + | lam b => exact ⟨0, fun _ _ _ => ⟨0, _, by omega, .refl _⟩⟩ + +theorem Trace.done_prefix {n : Nat} {t u : Q} (h : Trace n t u) (hd : Done u) : + ∃ b, ∀ m, b ≤ m → ∀ T, Closed T → + ∃ k B, WeakTrace k (realize m T t) (.lam B) := by + obtain ⟨b, hb⟩ := h.finite_realize + obtain ⟨c, hc⟩ := done_weak_realize hd + refine ⟨max b c, fun m hm T hT => ?_⟩ + obtain ⟨k, _, hk⟩ := hb m (Nat.le_trans (Nat.le_max_left _ _) hm) T hT + obtain ⟨j, B, _, hj⟩ := hc m (Nat.le_trans (Nat.le_max_right _ _) hm) T + exact ⟨k + j, B, hk.trans hj⟩ + +/-- The deterministic execution is stationary only after reaching Done. -/ +def execute (t : Q) : Nat → Q + | 0 => t + | n + 1 => (next (execute t n)).getD (execute t n) + +theorem execute_trace (t : Q) (n : Nat) : ∃ k, Trace k t (execute t n) := by + induction n with + | zero => exact ⟨0, .refl _⟩ + | succ n ih => + obtain ⟨k, hk⟩ := ih + cases hn : next (execute t n) with + | none => simpa only [execute, hn, Option.getD_none] using ⟨k, hk⟩ + | some u => + obtain ⟨j, hj⟩ := (next_head hn).trace + exact ⟨k + j, by simpa only [execute, hn, Option.getD_some] using hk.trans hj⟩ + +/-- Excluding all finite closed terminal executions supplies an actual +infinite deterministic head execution, rather than merely an arbitrary +infinite compatible reduction. -/ +theorem nonterminal_infinite (t : Q) (hc : ClosedQ t) + (hn : ¬ ∃ n u, Trace n t u ∧ Done u) : + ∃ f : Nat → Q, f 0 = t ∧ ∀ n, Head (f n) (f (n + 1)) := by + refine ⟨execute t, rfl, ?_⟩ + intro n + obtain ⟨k, hk⟩ := execute_trace t n + cases hs : next (execute t n) with + | none => exact (hn ⟨k, execute t n, hk, closed_terminal (hk.closed hc) hs⟩).elim + | some u => simpa only [execute, hs, Option.getD_some] using next_head hs + +private def omega : Term := + .app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.var 0))) + +private theorem omega_beta_eq {u : Term} (h : Beta omega u) : u = omega := by + have hs := headStep_complete (spine_beta_head (Spine.redex (by decide) (by decide)) h) + exact Option.some.inj hs.symm + +private theorem omega_betas_eq {u : Term} (h : Betas omega u) : u = omega := by + have aux : ∀ t v, Betas t v → t = omega → v = omega := by + intro t v hs + induction hs with + | refl => exact id + | head hb hs ih => + intro ht + apply ih + subst ht + exact omega_beta_eq hb + exact aux _ _ h rfl + +private theorem omega_not_lam {B : Term} : ¬ BetaJoin (.lam B) omega := by + rintro ⟨u, hu, ho⟩ + have he := omega_betas_eq ho + subst u + obtain ⟨v, hv, _⟩ := lam_betas_shape hu + cases hv + +/-- Exact closed-source remainder extraction cannot reach an extended +terminal state on the infinite zero stream. A finite terminal trace would +give a lambda even for a sufficiently long valid lambda-prefix and suffix Ω. -/ +theorem remainder_nonterminal (R : Term) + (hR : ∀ M, Closed M → ∀ N, Closed N → + BetaJoin (.app R (streamOf (blcCode M) N)) N) : + ¬ ∃ n u, Trace n (.app (embed R) (.z 0)) u ∧ Done u := by + rintro ⟨n, u, ht, hd⟩ + obtain ⟨b, hb⟩ := ht.done_prefix hd + let T := streamOf (blcCode (.lam (.var 0))) omega + have hT : Closed T := by decide + obtain ⟨k, B, hk⟩ := hb (2 * b) (by omega) T hT + have he : realize (2 * b) T (.app (embed R) (.z 0)) = + .app R (streamOf (blcCode (SelfintZero.tower b)) omega) := by + simp only [realize, interp, interp_embed, Nat.sub_zero, SelfintZero.tower_stream, T] + rw [he] at hk + obtain ⟨v, hv, ho⟩ := hR (SelfintZero.tower b) (SelfintZero.tower_closed b) omega (by decide) + obtain ⟨w, hw, hw'⟩ := betas_confluent hk.betas hv + exact omega_not_lam ⟨w, hw, betas_trans ho hw'⟩ + +/-- The suffix contract supplies an actual infinite deterministic execution +on the labelled zero stream, without assuming its existence as a premise. -/ +theorem remainder_infinite (R : Term) (hc : Closed R) + (hR : ∀ M, Closed M → ∀ N, Closed N → + BetaJoin (.app R (streamOf (blcCode M) N)) N) : + ∃ f : Nat → Q, f 0 = .app (embed R) (.z 0) ∧ + ∀ n, Head (f n) (f (n + 1)) := by + have ht : ClosedQ (.app (embed R) (.z 0)) := by + change Closed (erase (.app (embed R) (.z 0))) + simpa only [erase, erase_embed, Closed, FreeUnder] using And.intro hc (by decide : Closed (.lam (.var 0))) + exact nonterminal_infinite _ ht (remainder_nonterminal R hR) + +end Blc.SelfintGrowthHead diff --git a/lean/Blc/SelfintGrowthLabels.lean b/lean/Blc/SelfintGrowthLabels.lean new file mode 100644 index 00000000..97438bc9 --- /dev/null +++ b/lean/Blc/SelfintGrowthLabels.lean @@ -0,0 +1,219 @@ +/- +Uniform finite label demand for evaluating a fixed application-only body. +The substituted operand may have arbitrarily many K wrappers: if it is +already in data normal form, those wrappers cost no normalization steps. +-/ +import Blc.SelfintGrowthBlue + +namespace Blc.SelfintGrowthLabels +open Term SelfintZero SelfintGrowthBlue + +def Bounded (l : Nat) : Q → Prop + | .var _ | .k => True + | .z i => i ≤ l + | .lam b => Bounded l b + | .app f a => Bounded l f ∧ Bounded l a + +theorem bounded_mono (t : Q) {l m : Nat} (h : l ≤ m) (ht : Bounded l t) : + Bounded m t := by + induction t with + | var | k => trivial + | z i => exact Nat.le_trans ht h + | lam b ih => exact ih ht + | app f a ihf iha => exact ⟨ihf ht.1, iha ht.2⟩ + +theorem bounded_shift (t : Q) (c l : Nat) : + Bounded l (shiftQ c t) ↔ Bounded l t := by + induction t generalizing c with + | var n => simp only [shiftQ]; split <;> rfl + | lam b ih => exact ih (c + 1) + | app f a ihf iha => exact and_congr (ihf c) (iha c) + | k | z => rfl + +theorem bounded_subst (t s : Q) (j l : Nat) (ht : Bounded l t) + (hs : Bounded l s) : Bounded l (substQ j s t) := by + induction t generalizing s j with + | var n => + simp only [substQ] + split + · exact hs + · split <;> trivial + | lam b ih => exact ih (shiftQ 0 s) (j + 1) ht ((bounded_shift s 0 l).mpr hs) + | app f a ihf iha => exact ⟨ihf s j ht.1 hs, iha s j ht.2 hs⟩ + | k => trivial + | z i => exact ht + +theorem step_bounded {t u : Q} (h : DataStep t u) (l : Nat) + (ht : Bounded l t) : Bounded (l + 1) u := by + induction h generalizing l with + | k a b => exact bounded_mono a (by omega) ht.1.2 + | z i a => + exact ⟨⟨bounded_mono a (by omega) ht.2, trivial⟩, + by change i + 1 ≤ l + 1; have hi : i ≤ l := ht.1; omega⟩ + | left a h ih => exact ⟨ih l ht.1, bounded_mono a (by omega) ht.2⟩ + | right f h ih => exact ⟨bounded_mono f (by omega) ht.1, ih l ht.2⟩ + | lam h ih => exact ih l ht + +inductive CountData : Nat → Q → Q → Prop where + | refl (t : Q) : CountData 0 t t + | head {n : Nat} {t u v : Q} : DataStep t u → CountData n u v → CountData (n + 1) t v + +theorem CountData.steps {n : Nat} {t u : Q} (h : CountData n t u) : DataSteps t u := by + induction h with + | refl => exact .refl _ + | head h _ ih => exact .head h ih + +theorem CountData.trans {n m : Nat} {t u v : Q} (h : CountData n t u) + (g : CountData m u v) : CountData (n + m) t v := by + induction h with + | refl => simpa only [Nat.zero_add] using g + | @head n t u w h hs ih => + simpa only [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using CountData.head h (ih g) + +theorem CountData.one {t u : Q} (h : DataStep t u) : CountData 1 t u := + .head h (.refl _) + +theorem CountData.left {n : Nat} {f g : Q} (a : Q) (h : CountData n f g) : + CountData n (.app f a) (.app g a) := by + induction h with + | refl => exact .refl _ + | head h _ ih => exact .head (.left _ h) ih + +theorem CountData.right (f : Q) {n : Nat} {a b : Q} (h : CountData n a b) : + CountData n (.app f a) (.app f b) := by + induction h with + | refl => exact .refl _ + | head h _ ih => exact .head (.right _ h) ih + +theorem CountData.bounded {n : Nat} {t u : Q} (h : CountData n t u) (l : Nat) + (ht : Bounded l t) : Bounded (l + n) u := by + induction h generalizing l with + | refl => simpa only [Nat.add_zero] using ht + | @head n t v u h hs ih => + have hu := ih (l + 1) (step_bounded h l ht) + simpa only [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using hu + +/-- A bound on every intermediate state of a finite data trace. -/ +inductive BoundTrace (l : Nat) : Q → Q → Prop where + | refl (t : Q) : Bounded l t → BoundTrace l t t + | head {t u v : Q} : Bounded l t → DataStep t u → BoundTrace l u v → BoundTrace l t v + +theorem BoundTrace.start {l : Nat} {t u : Q} (h : BoundTrace l t u) : Bounded l t := by + cases h with + | refl t ht => exact ht + | head ht _ _ => exact ht + +theorem BoundTrace.finish {l : Nat} {t u : Q} (h : BoundTrace l t u) : Bounded l u := by + induction h with + | refl t ht => exact ht + | head _ _ _ ih => exact ih + +theorem BoundTrace.steps {l : Nat} {t u : Q} (h : BoundTrace l t u) : DataSteps t u := by + induction h with + | refl => exact .refl _ + | head _ h _ ih => exact .head h ih + +theorem BoundTrace.mono {l m : Nat} {t u : Q} (h : BoundTrace l t u) (hl : l ≤ m) : + BoundTrace m t u := by + induction h with + | refl t ht => exact .refl _ (bounded_mono _ hl ht) + | head ht h _ ih => exact .head (bounded_mono _ hl ht) h ih + +theorem BoundTrace.trans {l : Nat} {t u v : Q} (h : BoundTrace l t u) + (g : BoundTrace l u v) : BoundTrace l t v := by + induction h with + | refl => exact g + | head ht h _ ih => exact .head ht h (ih g) + +theorem BoundTrace.left {l : Nat} {f g : Q} (h : BoundTrace l f g) + (a : Q) (ha : Bounded l a) : BoundTrace l (.app f a) (.app g a) := by + induction h with + | refl f hf => exact .refl _ ⟨hf, ha⟩ + | head hf h _ ih => exact .head ⟨hf, ha⟩ (.left _ h) ih + +theorem BoundTrace.right {l : Nat} {a b : Q} (h : BoundTrace l a b) + (f : Q) (hf : Bounded l f) : BoundTrace l (.app f a) (.app f b) := by + induction h with + | refl a ha => exact .refl _ ⟨hf, ha⟩ + | head ha h _ ih => exact .head ⟨hf, ha⟩ (.right _ h) ih + +theorem BoundTrace.lam {l : Nat} {b c : Q} (h : BoundTrace l b c) : + BoundTrace l (.lam b) (.lam c) := by + induction h with + | refl b hb => exact .refl _ hb + | head hb h _ ih => exact .head hb (.lam h) ih + +theorem CountData.boundTrace {n : Nat} {t u : Q} (h : CountData n t u) (l : Nat) + (ht : Bounded l t) : BoundTrace (l + n) t u := by + induction h generalizing l with + | refl => exact .refl _ (by simpa only [Nat.add_zero] using ht) + | @head n t v u h hs ih => + have hv := ih (l + 1) (step_bounded h l ht) + have he : l + 1 + n = l + (n + 1) := by omega + exact .head (bounded_mono _ (by omega) ht) h (he ▸ hv) + +/-- Each table call has at most five actual K/Z contractions. -/ +theorem ap_count (u v : V) : + ∃ n, n ≤ 5 ∧ CountData n (.app (val u) (val v)) (val (ap u v)) := by + cases u with + | k => exact ⟨0, by omega, .refl _⟩ + | const u => exact ⟨1, by omega, .one (.k _ _)⟩ + | neu n => exact ⟨0, by omega, .refl _⟩ + | z i => + cases v with + | k => exact ⟨2, by omega, .head (.z _ _) (.one (.k _ _))⟩ + | z j => + exact ⟨3, by omega, .head (.z _ _) (.head (.left _ (.z _ _)) + (.head (.left _ (.k _ _)) (.refl _)))⟩ + | neu n => exact ⟨1, by omega, .one (.z _ _)⟩ + | const v => + cases v with + | k => exact ⟨2, by omega, .head (.z _ _) (.head (.left _ (.k _ _)) (.refl _))⟩ + | z j => + exact ⟨5, by omega, .head (.z _ _) (.head (.left _ (.k _ _)) + (.head (.z _ _) (.head (.left _ (.z _ _)) + (.head (.left _ (.k _ _)) (.refl _)))))⟩ + | const a => + exact ⟨3, by omega, .head (.z _ _) (.head (.left _ (.k _ _)) (.one (.k _ _)))⟩ + | neu n => + exact ⟨2, by omega, .head (.z _ _) (.head (.left _ (.k _ _)) (.refl _))⟩ + +def apps : Q → Nat + | .var _ | .k | .z _ => 0 + | .lam b => apps b + | .app f a => apps f + apps a + 1 + +/-- Evaluating a fixed program-lambda-free body uses at most five data +steps per original application, independent of the operand's size. -/ +theorem flat_subst_count (t s : Q) (j : Nat) (ht : red t = 0) + (hs : norm s = s) : + ∃ n, n ≤ 5 * apps t ∧ CountData n (substQ j s t) (norm (substQ j s t)) := by + induction t generalizing j with + | var k => + simp only [substQ] + split + · exact ⟨0, by simp [apps], by rw [hs]; exact .refl s⟩ + · split <;> exact ⟨0, by simp [apps], .refl _⟩ + | lam b ih => exact (Nat.succ_ne_zero (red b) ht).elim + | app f a ihf iha => + have hf : red f = 0 := by simp only [red] at ht; omega + have ha : red a = 0 := by simp only [red] at ht; omega + obtain ⟨nf, hnf, htf⟩ := ihf j hf + obtain ⟨na, hna, hta⟩ := iha j ha + obtain ⟨np, hnp, htp⟩ := ap_count (deep (substQ j s f)) (deep (substQ j s a)) + refine ⟨nf + na + np, ?_, ?_⟩ + · simp only [apps, Nat.mul_add, Nat.mul_one] + omega + · exact ((htf.left _).trans (hta.right _)).trans htp + | k => exact ⟨0, by simp [apps], .refl _⟩ + | z i => exact ⟨0, by simp [apps], .refl _⟩ + +/-- Every demanded label in this chosen normalization trace has a +uniform bound from the fixed body, even for arbitrarily large operands. -/ +theorem flat_subst_bound (t s : Q) (j l : Nat) (ht : red t = 0) + (hs : norm s = s) (hlt : Bounded l t) (hls : Bounded l s) : + ∃ n, n ≤ 5 * apps t ∧ BoundTrace (l + n) (substQ j s t) (norm (substQ j s t)) := by + obtain ⟨n, hn, h⟩ := flat_subst_count t s j ht hs + exact ⟨n, hn, h.boundTrace l (bounded_subst t s j l hlt hls)⟩ + +end Blc.SelfintGrowthLabels diff --git a/lean/Blc/SelfintGrowthOrigins.lean b/lean/Blc/SelfintGrowthOrigins.lean new file mode 100644 index 00000000..eb85fc1f --- /dev/null +++ b/lean/Blc/SelfintGrowthOrigins.lean @@ -0,0 +1,209 @@ +/- +A direct provenance invariant for the source-lambda growth argument. +A closed one-lambda operand contributes only closed flat lambdas when copied. +Counting all other lambdas bounds the number of nonflat head contractors, +without adding a second labelled syntax. This is a finite-trace lemma, not +the full remainder growth theorem. +-/ +import Blc.SelfintGrowthBlocks + +namespace Blc.SelfintGrowthOrigins +open Term SelfintZero SelfintGrowthBlue SelfintGrowthBlocks + +def Flat : Q → Prop + | .lam b => red b = 0 ∧ ClosedQ (.lam b) + | _ => False + +instance (t : Q) : Decidable (Flat t) := by + cases t <;> dsimp [Flat] <;> infer_instance + +def badRoot (b : Q) : Nat := if Flat (.lam b) then 0 else 1 + +def bad : Q → Nat + | .var _ | .k | .z _ => 0 + | .lam b => bad b + badRoot b + | .app f a => bad f + bad a + +theorem flat_iff (t : Q) : + Flat t ↔ ∃ b, t = .lam b ∧ red b = 0 ∧ ClosedQ t := by + cases t <;> simp [Flat] + +theorem badRoot_le_one (b : Q) : badRoot b ≤ 1 := by + unfold badRoot + split <;> omega + +theorem bad_le_red (t : Q) : bad t ≤ red t := by + induction t with + | var | k | z => exact Nat.le_refl _ + | app f a ihf iha => exact Nat.add_le_add ihf iha + | lam b ih => exact Nat.add_le_add ih (badRoot_le_one b) + +theorem bad_zero (t : Q) (h : red t = 0) : bad t = 0 := by + have hle := bad_le_red t + omega + +theorem badRoot_shift (b : Q) (c : Nat) : + badRoot (shiftQ (c + 1) b) = badRoot b := by + change (if red (shiftQ (c + 1) b) = 0 ∧ ClosedQ (shiftQ c (.lam b)) + then 0 else 1) = _ + simp only [red_shift, closed_shift_iff, badRoot, Flat] + rfl + +theorem bad_shift (t : Q) (c : Nat) : bad (shiftQ c t) = bad t := by + induction t generalizing c with + | var n => simp only [shiftQ]; split <;> rfl + | lam b ih => simp only [shiftQ, bad, ih, badRoot_shift] + | app f a ihf iha => simp only [shiftQ, bad, ihf, iha] + | k | z => rfl + +theorem badRoot_subst_le (b s : Q) (j : Nat) : + badRoot (substQ (j + 1) (shiftQ 0 s) b) ≤ badRoot b := by + by_cases h : Flat (.lam b) + · have he := subst_closed (.lam b) j s h.2 + have hb := Q.lam.inj he + rw [hb] + exact Nat.le_refl _ + · simpa only [badRoot, if_neg h] using + badRoot_le_one (substQ (j + 1) (shiftQ 0 s) b) + +/-- Existing closed-flat lambdas are fixed by outside substitution. +Only the copied operand can contribute additional bad lambdas. -/ +theorem bad_subst_le (t s : Q) (j : Nat) : + bad (substQ j s t) ≤ bad t + oc j t * bad s := by + induction t generalizing s j with + | var n => + simp only [substQ, bad, oc_var] + split + · simp only [Nat.one_mul, Nat.zero_add, Nat.le_refl] + · split <;> simp_all only [bad, Nat.zero_mul, Nat.zero_add, Nat.le_refl] + | lam b ih => + have hb := ih (shiftQ 0 s) (j + 1) + have hr := badRoot_subst_le b s j + simp only [substQ, bad, oc_lam, bad_shift] at * + omega + | app f a ihf iha => + have hf := ihf s j + have ha := iha s j + simp only [substQ, bad, oc_app, Nat.add_mul] + omega + | k => simp only [substQ, bad, oc_k, Nat.zero_mul, Nat.zero_add, Nat.le_refl] + | z i => simp only [substQ, bad, oc_z, Nat.zero_mul, Nat.zero_add, Nat.le_refl] + +/-- A closed operand with at most one program lambda has no bad lambda. +In particular every newly copied lambda is closed and flat. -/ +theorem closed_one_bad_zero (t : Q) (hc : ClosedQ t) (hr : red t ≤ 1) : + bad t = 0 := by + induction t with + | var n => rfl + | k | z => rfl + | lam b ih => + have hb : red b = 0 := by simp only [red] at hr; omega + have hf : Flat (.lam b) := ⟨hb, hc⟩ + simp only [bad, bad_zero b hb, badRoot, if_pos hf, Nat.zero_add] + | app f a ihf iha => + have hf : red f ≤ 1 := by simp only [red] at hr; omega + have ha : red a ≤ 1 := by simp only [red] at hr; omega + simp only [bad, ihf hc.1 hf, iha hc.2 ha, Nat.add_zero] + +theorem badRoot_data_le {b c : Q} (h : DataStep b c) : badRoot c ≤ badRoot b := by + by_cases hb : Flat (.lam b) + · have hc : Flat (.lam c) := ⟨Nat.eq_zero_of_le_zero (hb.1 ▸ h.red_le), + h.freeUnder 1 hb.2⟩ + simp only [badRoot, if_pos hb, if_pos hc, Nat.le_refl] + · simpa only [badRoot, if_neg hb] using badRoot_le_one c + +/-- Data reduction cannot make a closed-flat lambda bad. -/ +theorem data_bad_le {t u : Q} (h : DataStep t u) : bad u ≤ bad t := by + induction h with + | k a b => simp only [bad]; omega + | z i a => simp only [bad]; omega + | left a h ih => exact Nat.add_le_add_right ih _ + | right f h ih => exact Nat.add_le_add_left ih _ + | lam h ih => exact Nat.add_le_add ih (badRoot_data_le h) + +theorem data_steps_bad_le {t u : Q} (h : DataSteps t u) : bad u ≤ bad t := by + induction h with + | refl => exact Nat.le_refl _ + | head h _ ih => exact Nat.le_trans ih (data_bad_le h) + +theorem head_closed {t u : Q} (h : RedHead t u) (hc : ClosedQ t) : ClosedQ u := by + induction h with + | beta b a => + unfold ClosedQ at hc ⊢ + rw [erase_subst] + exact SelfintWireCost.beta_freeUnder (.beta _ _) 0 hc + | left a h ih => exact ⟨ih hc.1, hc.2⟩ + +theorem head_bad_le {t u : Q} (h : RedHead t u) (hc : ClosedQ t) + (hr : red u = red t) : bad u ≤ bad t := by + induction h with + | beta b a => + obtain ⟨_, ha⟩ := constant_beta_parameters b a hr + have hz := closed_one_bad_zero a hc.2 (by omega) + have hs := bad_subst_le b a 0 + simp only [bad, hz, Nat.add_zero, Nat.mul_zero] at * + omega + | @left f g a h ih => + have he : red g = red f := by simp only [red] at hr; omega + exact Nat.add_le_add_right (ih hc.1 he) _ + +/-- A selected head contraction whose contractor is not closed and flat. -/ +inductive BadHead : Q → Q → Prop where + | beta (b a : Q) : ¬ Flat (.lam b) → + BadHead (.app (.lam b) a) (substQ 0 a b) + | left {f g : Q} (a : Q) : BadHead f g → BadHead (.app f a) (.app g a) + +theorem BadHead.head {t u : Q} (h : BadHead t u) : RedHead t u := by + induction h with + | beta b a _ => exact .beta _ _ + | left a _ ih => exact .left _ ih + +theorem BadHead.strict {t u : Q} (h : BadHead t u) (hc : ClosedQ t) + (hr : red u = red t) : bad u < bad t := by + induction h with + | beta b a hn => + obtain ⟨_, ha⟩ := constant_beta_parameters b a hr + have hz := closed_one_bad_zero a hc.2 (by omega) + have hs := bad_subst_le b a 0 + simp only [bad, badRoot, if_neg hn, hz, Nat.add_zero, Nat.mul_zero] at * + omega + | @left f g a h ih => + have he : red g = red f := by simp only [red] at hr; omega + exact Nat.add_lt_add_right (ih hc.1 he) _ + +/-- A finite constant-count phase, with selected bad-head events counted. -/ +inductive Phase : Nat → Q → Q → Prop where + | refl (t : Q) : Phase 0 t t + | data {t u v : Q} {n : Nat} : DataStep t u → red u = red t → + Phase n u v → Phase n t v + | head {t u v : Q} {n : Nat} : RedHead t u → red u = red t → + Phase n u v → Phase n t v + | nonflat {t u v : Q} {n : Nat} : BadHead t u → red u = red t → + Phase n u v → Phase (n + 1) t v + +theorem Phase.bad_add {n : Nat} {t u : Q} (h : Phase n t u) (hc : ClosedQ t) : + bad u + n ≤ bad t := by + induction h with + | refl => exact Nat.le_refl _ + | data h _ _ ih => + have hi := ih (h.freeUnder 0 hc) + have hm := data_bad_le h + omega + | head h he _ ih => + have hi := ih (head_closed h hc) + have hm := head_bad_le h hc he + omega + | nonflat h he _ ih => + have hi := ih (head_closed h.head hc) + have hm := h.strict hc he + omega + +/-- There can be only finitely many nonflat head contractors in a closed +constant-count computation: at most its initial source-lambda count. -/ +theorem Phase.bad_bound {n : Nat} {t u : Q} (h : Phase n t u) (hc : ClosedQ t) : + n ≤ red t := by + have hm := h.bad_add hc + have hr := bad_le_red t + omega + +end Blc.SelfintGrowthOrigins diff --git a/lean/Blc/SelfintGrowthSimulation.lean b/lean/Blc/SelfintGrowthSimulation.lean new file mode 100644 index 00000000..b437b4b9 --- /dev/null +++ b/lean/Blc/SelfintGrowthSimulation.lean @@ -0,0 +1,133 @@ +/- +Finite realization of data/program traces whose zero labels have one +uniform bound. A finite ordinary weak-head clock bounds every selected +program head contraction, even with unrestricted data reductions between. +-/ +import Blc.SelfintGrowthLabels +import Blc.WeakHeadClock + +namespace Blc.SelfintGrowthSimulation +open Term SelfintZero SelfintGrowthBlue SelfintGrowthLabels SelfintLowerBound WeakHeadClock + +theorem bounded_demand (t : Q) (l : Nat) (h : Bounded l t) : demand t ≤ l + 1 := by + induction t with + | var | k => exact Nat.zero_le _ + | z i => exact Nat.succ_le_succ h + | lam b ih => exact ih h + | app f a ihf iha => exact Nat.max_le.mpr ⟨ihf h.1, iha h.2⟩ + +theorem data_sim {t u : Q} (h : DataStep t u) (m : Nat) (T : Term) + (hT : Closed T) (hm : demand t ≤ m) : + Betas (realize m T t) (realize m T u) := by + induction h with + | k a b => exact step_sim (.k a b) m T hT hm + | z i a => exact step_sim (.z i a) m T hT hm + | left a h ih => + exact betas_appL _ (ih (Nat.le_trans (Nat.le_max_left _ _) hm)) + | right f h ih => + exact betas_appR _ (ih (Nat.le_trans (Nat.le_max_right _ _) hm)) + | lam h ih => exact betas_lam (ih hm) + +theorem data_steps_sim {t u : Q} (h : DataSteps t u) : + ∃ b, ∀ m, b ≤ m → ∀ T, Closed T → + Betas (realize m T t) (realize m T u) := by + induction h with + | refl t => exact ⟨0, fun _ _ _ _ => .refl _⟩ + | @head t v u h hs ih => + obtain ⟨b, hb⟩ := ih + refine ⟨max (demand t) b, fun m hm T hT => ?_⟩ + exact betas_trans (data_sim h m T hT (Nat.le_trans (Nat.le_max_left _ _) hm)) + (hb m (Nat.le_trans (Nat.le_max_right _ _) hm) T hT) + +/-- A program head contraction remains exactly one ordinary head step, +regardless of the number of zero cells used to realize data constants. -/ +theorem red_head_sim {t u : Q} (h : RedHead t u) (m : Nat) (T : Term) + (hT : Closed T) : weakStep (realize m T t) = some (realize m T u) := by + induction h with + | beta b a => + unfold realize + rw [interp_subst _ (fun i => zeros_closed _ hT)] + rfl + | left a h ih => exact WeakHeadClock.weak_app ih _ + +theorem interleaved_prepend {t u v : Term} {n : Nat} (h : Betas t u) + (g : Interleaved n u v) : Interleaved n t v := by + induction h with + | refl => exact g + | head h _ ih => exact .beta h (ih g) + +/-- Data labels are bounded at every data step; program head steps are +counted. No constant-code-count or normal-form assumption is imposed. -/ +inductive Run (l : Nat) : Nat → Q → Q → Prop where + | refl (t : Q) : Run l 0 t t + | data {n : Nat} {t u v : Q} : Bounded l t → DataStep t u → + Run l n u v → Run l n t v + | head {n : Nat} {t u v : Q} : RedHead t u → + Run l n u v → Run l (n + 1) t v + +theorem Run.realize {l n : Nat} {t u : Q} (h : Run l n t u) + (m : Nat) (hm : l < m) (T : Term) (hT : Closed T) : + Interleaved n (SelfintZero.realize m T t) (SelfintZero.realize m T u) := by + induction h with + | refl t => exact .refl _ + | @data n t v u hb hd hs ih => + have hdemand : demand t ≤ m := Nat.le_trans (bounded_demand t l hb) hm + exact interleaved_prepend (data_sim hd m T hT hdemand) ih + | head h hs ih => exact .head (red_head_sim h m T hT) ih + +/-- A uniformly bounded-label execution cannot contain arbitrarily many +program head contractions when its finite realization head-normalizes. -/ +theorem Run.head_bound {l n h : Nat} {t u : Q} (hr : Run l n t u) + (m : Nat) (hm : l < m) (T : Term) (hT : Closed T) + (hc : Count (SelfintZero.realize m T t) h) : n ≤ h := + interleaved_bound hc (hr.realize m hm T hT) + +theorem no_unbounded_run {l h : Nat} {t : Q} (m : Nat) (hm : l < m) + (T : Term) (hT : Closed T) (hc : Count (realize m T t) h) : + ¬ (∀ n, ∃ u, Run l n t u) := by + intro hr + obtain ⟨u, hu⟩ := hr (h + 1) + have hn := hu.head_bound m hm T hT hc + omega + +/-- A finite initial data phase is harmless: a uniform later demand bound +still contradicts normalization of every sufficiently long even prefix. -/ +theorem normal_prefixes_no_run {l : Nat} {t u : Q} (hd : DataSteps t u) + (T : Term) (hT : Closed T) + (hn : ∀ n, HasNormalForm (realize (2 * n) T t)) : + ¬ (∀ n, ∃ v, Run l n u v) := by + obtain ⟨b, hb⟩ := data_steps_sim hd + let n := max b (l + 1) + have hb' : b ≤ 2 * n := by have := Nat.le_max_left b (l + 1); omega + have hl : l < 2 * n := by have := Nat.le_max_right b (l + 1); omega + have hred := hb (2 * n) hb' T hT + obtain ⟨h, hc⟩ := hasNormalForm_count (betas_preserve_hasNormalForm hred (hn n)) + exact no_unbounded_run (2 * n) hl T hT hc + +private def identity : Term := .lam (.var 0) + +private theorem identity_normal : NormalForm identity := by + intro u h + cases h with + | lam h => cases h + +/-- Exact remainder extraction rules out an unbounded selected-head trace +with one finite label bound after any finite initial data phase. This +specialization uses only the valid sources lambda^n.I and the suffix I. -/ +theorem remainder_no_bounded_run (R : Term) + (hR : ∀ M, Closed M → ∀ N, Closed N → + BetaJoin (.app R (streamOf (blcCode M) N)) N) + {l : Nat} {u : Q} (hd : DataSteps (.app (embed R) (.z 0)) u) : + ¬ (∀ n, ∃ v, Run l n u v) := by + let T := streamOf (blcCode identity) identity + have hT : Closed T := by decide + apply normal_prefixes_no_run hd T hT + intro n + obtain ⟨w, hw, hi⟩ := hR (SelfintZero.tower n) (SelfintZero.tower_closed n) identity (by decide) + have he : w = identity := normalForm_betas_eq identity_normal hi + subst w + rw [SelfintZero.tower_stream n identity] at hw + refine ⟨identity, ?_, identity_normal⟩ + simpa only [realize, interp, interp_embed, Nat.sub_zero, tower_stream, T, identity] using hw + +end Blc.SelfintGrowthSimulation diff --git a/lean/Blc/SelfintGrowthStable.lean b/lean/Blc/SelfintGrowthStable.lean new file mode 100644 index 00000000..1f9f6d50 --- /dev/null +++ b/lean/Blc/SelfintGrowthStable.lean @@ -0,0 +1,543 @@ +/- +Canonical one-code operands and the stable two-copy state. This module +uses the permanent-block counter, not a bound on constant-function wrappers. +-/ +import Blc.SelfintGrowthBlocks +import Blc.SelfintGrowthLabels + +namespace Blc.SelfintGrowthStable +open Term SelfintZero SelfintGrowthBlue SelfintGrowthBlocks + +def wraps : Nat → Q → Q + | 0, t => t + | n + 1, t => .app .k (wraps n t) + +@[simp] theorem wraps_red (n : Nat) (t : Q) : red (wraps n t) = red t := by + induction n with + | zero => rfl + | succ n ih => simp only [wraps, red, Nat.zero_add, ih] + +@[simp] theorem wraps_blocks (n : Nat) (t : Q) : blocks (wraps n t) = blocks t := by + induction n with + | zero => rfl + | succ n ih => simp only [wraps, blocks, root, Block, if_false, Nat.zero_add, Nat.add_zero, ih] + +theorem wraps_norm (n : Nat) (t : Q) : norm (wraps n t) = wraps n (norm t) := by + induction n with + | zero => rfl + | succ n ih => + change Q.app .k (norm (wraps n t)) = Q.app .k (wraps n (norm t)) + exact congrArg (Q.app .k) ih + +theorem wraps_bounded (n : Nat) (t : Q) (l : Nat) : + SelfintGrowthLabels.Bounded l (wraps n t) ↔ SelfintGrowthLabels.Bounded l t := by + induction n with + | zero => rfl + | succ n ih => exact (and_iff_right True.intro).trans ih + +theorem neutral_red_pos (n : Neu) (h : ClosedQ (neutral n)) : 0 < red (neutral n) := by + cases n with + | atom a => + cases a with + | var i => exact (Nat.not_lt_zero i h).elim + | lam b => exact Nat.zero_lt_succ _ + | app n v => + have hn := neutral_red_pos n h.1 + simp only [neutral, red] + omega +termination_by sizeOf n + +theorem one_red_neutral (n : Neu) (hc : ClosedQ (neutral n)) (hr : red (neutral n) = 1) : + (∃ b, neutral n = .lam b ∧ red b = 0 ∧ ClosedQ (.lam b)) ∨ + blocks (neutral n) = 1 := by + cases n with + | atom a => + cases a with + | var i => exact (Nat.not_lt_zero i hc).elim + | lam b => exact .inl ⟨b, rfl, by simp only [neutral, atomTerm, red] at hr; omega, hc⟩ + | app n v => + have hp := neutral_red_pos n hc.1 + have hn : red (neutral n) = 1 := by simp only [neutral, red] at hr; omega + have hv : red (val v) = 0 := by simp only [neutral, red] at hr; omega + have hbv := blocks_zero (val v) hv + right + rcases one_red_neutral n hc.1 hn with ⟨b, he, hb, hbc⟩ | hbn + · have hroot : Block (neutral n) (val v) := by + rw [he] + exact ⟨hb, hbc, hv, hc.2⟩ + have hbb := blocks_zero b hb + rw [he] at hroot + simp only [neutral, blocks, root, he, if_pos hroot, hbb, hbv, Nat.zero_add] + · have hle := blocks_le_red (neutral (.app n v)) + simp only [neutral, blocks, hbn, hbv, Nat.add_zero] at hle ⊢ + simp only [red, hn, hv, Nat.add_zero] at hle + omega +termination_by sizeOf n + +/-- A closed canonical one-program-lambda value is either a constant +wrapper chain around a flat closed lambda or contains a permanent block. -/ +theorem one_red_value (v : V) (hc : ClosedQ (val v)) (hr : red (val v) = 1) : + (∃ n b, val v = wraps n (.lam b) ∧ red b = 0 ∧ ClosedQ (.lam b)) ∨ + blocks (val v) = 1 := by + cases v with + | k => cases hr + | z i => cases hr + | const v => + have hv : red (val v) = 1 := by simpa only [val, red, Nat.zero_add] using hr + rcases one_red_value v hc.2 hv with ⟨n, b, he, hb, hbc⟩ | hblock + · exact .inl ⟨n + 1, b, congrArg (Q.app .k) he, hb, hbc⟩ + · right + simpa only [val, blocks, root, Block, if_false, Nat.zero_add, Nat.add_zero] using hblock + | neu n => + rcases one_red_neutral n hc hr with ⟨b, he, hb, hbc⟩ | hblock + · exact .inl ⟨0, b, he, hb, hbc⟩ + · exact .inr hblock +termination_by sizeOf v + +theorem one_red_unblocked (v : V) (hc : ClosedQ (val v)) (hr : red (val v) = 1) + (hb : blocks (val v) = 0) : + ∃ n b, val v = wraps n (.lam b) ∧ red b = 0 ∧ ClosedQ (.lam b) := by + rcases one_red_value v hc hr with h | h + · exact h + · exact (Nat.zero_ne_one (hb.symm.trans h)).elim + +/-- Every opaque program-lambda node is the same closed template. In the +stable application this template itself has no program lambda in its body. -/ +def Only (d : Q) : Q → Prop + | .var _ | .k | .z _ => True + | .lam b => .lam b = d + | .app f a => Only d f ∧ Only d a + +theorem only_zero (d t : Q) (h : red t = 0) : Only d t := by + induction t with + | var | k | z => trivial + | lam b ih => exact (Nat.succ_ne_zero (red b) h).elim + | app f a ihf iha => + exact ⟨ihf (by simp only [red] at h; omega), + iha (by simp only [red] at h; omega)⟩ + +theorem Only.ap (d : Q) (u v : V) (hu : Only d (val u)) (hv : Only d (val v)) : + Only d (val (ap u v)) := by + cases u with + | k => exact ⟨trivial, hv⟩ + | const u => exact hu.2 + | neu n => exact ⟨hu, hv⟩ + | z i => + cases v with + | k => trivial + | z j => exact ⟨trivial, trivial⟩ + | neu n => exact ⟨⟨hv, trivial⟩, trivial⟩ + | const v => + cases v with + | k | z => exact ⟨trivial, trivial⟩ + | const v => exact hv.2.2 + | neu n => exact ⟨hv.2, trivial⟩ + +theorem Only.norm {d t : Q} (hd : norm d = d) (h : Only d t) : Only d (norm t) := by + induction t with + | var | k | z => trivial + | lam b ih => + change .lam b = d at h + subst d + rw [hd] + exact rfl + | app f a ihf iha => exact Only.ap d (deep f) (deep a) (ihf h.1) (iha h.2) + +theorem Only.subst {d t s : Q} (hd : ClosedQ d) (ht : Only d t) (hs : Only d s) + (j : Nat) : Only d (substQ j s t) := by + induction t generalizing j with + | var n => + simp only [substQ] + split + · exact hs + · split <;> trivial + | lam b ih => + change .lam b = d at ht + have hc : ClosedQ (.lam b) := ht ▸ hd + rw [subst_closed (.lam b) j s hc] + exact ht + | app f a ihf iha => exact ⟨ihf ht.1 j, iha ht.2 j⟩ + | k | z => trivial + +theorem wraps_only_iff (d t : Q) (n : Nat) : Only d (wraps n t) ↔ Only d t := by + induction n with + | zero => rfl + | succ n ih => exact (and_iff_right True.intro).trans ih + +def apps (f : Q) : List V → Q + | [] => f + | v :: vs => apps (.app f (val v)) vs + +theorem apps_snoc (f : Q) (vs : List V) (v : V) : + apps f (vs ++ [v]) = .app (apps f vs) (val v) := by + induction vs generalizing f with + | nil => rfl + | cons v vs ih => exact ih (.app f (val v)) + +def redWeight : List V → Nat + | [] => 0 + | v :: vs => red (val v) + redWeight vs + +def blockWeight : List V → Nat + | [] => 0 + | v :: vs => blocks (val v) + blockWeight vs + +theorem apps_red (f : Q) (vs : List V) : + red (apps f vs) = red f + redWeight vs := by + induction vs generalizing f with + | nil => exact (Nat.add_zero _).symm + | cons v vs ih => simp only [apps, ih, red, redWeight, Nat.add_assoc] + +theorem apps_blocks_lower (f : Q) (vs : List V) : + blocks f + blockWeight vs ≤ blocks (apps f vs) := by + induction vs generalizing f with + | nil => exact Nat.le_refl _ + | cons v vs ih => + have hh := ih (.app f (val v)) + simp only [apps, blockWeight, blocks] at * + omega + +theorem apps_blocks_app (f a : Q) (vs : List V) : + blocks (apps (.app f a) vs) = blocks (.app f a) + blockWeight vs := by + induction vs generalizing f a with + | nil => exact (Nat.add_zero _).symm + | cons v vs ih => + simp only [apps, ih, blockWeight, blocks, root, Block, if_false, + Nat.add_zero, Nat.add_assoc] + +theorem apps_data {f g : Q} (h : DataSteps f g) (vs : List V) : + DataSteps (apps f vs) (apps g vs) := by + induction vs generalizing f g with + | nil => exact h + | cons v vs ih => exact ih (h.left (val v)) + +theorem apps_head {f g : Q} (h : RedHead f g) (vs : List V) : + RedHead (apps f vs) (apps g vs) := by + induction vs generalizing f g with + | nil => exact h + | cons v vs ih => exact ih (.left (val v) h) + +theorem apps_append (f : Q) (us vs : List V) : + apps f (us ++ vs) = apps (apps f us) vs := by + induction us generalizing f with + | nil => rfl + | cons u us ih => exact ih (.app f (val u)) + +theorem apps_bounded (f : Q) (vs : List V) (l : Nat) : + SelfintGrowthLabels.Bounded l (apps f vs) ↔ + SelfintGrowthLabels.Bounded l f ∧ + ∀ v ∈ vs, SelfintGrowthLabels.Bounded l (val v) := by + induction vs generalizing f with + | nil => exact ⟨fun h => ⟨h, by simp⟩, fun h => h.1⟩ + | cons v vs ih => + rw [apps, ih] + constructor + · intro h + exact ⟨h.1.1, fun w hw => by + rcases List.mem_cons.mp hw with he | hh + · exact he ▸ h.1.2 + · exact h.2 w hh⟩ + · intro h + exact ⟨⟨h.1, h.2 v (by simp)⟩, fun w hw => h.2 w (List.mem_cons_of_mem v hw)⟩ + +def normArgs (vs : List V) : List V := vs.map (fun v => deep (val v)) + +theorem norm_app_neutral (f a : Q) (hf : ∃ n, deep f = .neu n) : + norm (.app f a) = .app (norm f) (norm a) := by + obtain ⟨n, hn⟩ := hf + simp only [norm, deep, hn, ap, val, neutral] + +theorem apps_deep_neutral (f : Q) (vs : List V) (hf : ∃ n, deep f = .neu n) : + ∃ n, deep (apps f vs) = .neu n := by + induction vs generalizing f with + | nil => exact hf + | cons v vs ih => + obtain ⟨n, hn⟩ := hf + exact ih (.app f (val v)) ⟨.app n (deep (val v)), by simp only [deep, hn, ap]⟩ + +theorem norm_apps (f : Q) (vs : List V) (hf : ∃ n, deep f = .neu n) : + norm (apps f vs) = apps (norm f) (normArgs vs) := by + induction vs generalizing f with + | nil => rfl + | cons v vs ih => + obtain ⟨n, hn⟩ := hf + have ha : ∃ n, deep (.app f (val v)) = .neu n := + ⟨.app n (deep (val v)), by simp only [deep, hn, ap]⟩ + rw [apps, ih _ ha, norm_app_neutral f (val v) ⟨n, hn⟩] + rfl + +theorem apps_normArgs (f : Q) (vs : List V) + (hv : ∀ v ∈ vs, norm (val v) = val v) : apps f (normArgs vs) = apps f vs := by + induction vs generalizing f with + | nil => rfl + | cons v vs ih => + change apps (.app f (norm (val v))) (normArgs vs) = apps (.app f (val v)) vs + rw [hv v (by simp)] + exact ih _ (fun w hw => hv w (List.mem_cons_of_mem v hw)) + +theorem norm_apps_fixed (f : Q) (vs : List V) (hf : ∃ n, deep f = .neu n) + (hn : norm f = f) (hv : ∀ v ∈ vs, norm (val v) = val v) : + norm (apps f vs) = apps f vs := by + rw [norm_apps f vs hf, hn] + exact apps_normArgs f vs hv + +/-- A nonterminal result has consumed every leading constant wrapper. +Exactly an initial segment of the old pending spine was discarded. -/ +theorem peel_wrappers (m : Nat) (f : Q) (pending : List V) + (hn : ¬ Done (norm (apps (wraps m f) pending))) : + ∃ pre post, pending = pre ++ post ∧ pre.length = m ∧ + norm (apps (wraps m f) pending) = norm (apps f post) := by + induction m generalizing pending with + | zero => exact ⟨[], pending, rfl, rfl, rfl⟩ + | succ m ih => + cases pending with + | nil => + have hd : Done (norm (apps (wraps (m + 1) f) [])) := by + change Done (.app .k (norm (wraps m f))) + exact .const _ + exact (hn hd).elim + | cons v vs => + have hh : norm (apps (wraps (m + 1) f) (v :: vs)) = + norm (apps (wraps m f) vs) := + (apps_data (.one (.k (wraps m f) (val v))) vs).norm_eq + obtain ⟨pre, post, hp, hl, he⟩ := ih vs (hh ▸ hn) + exact ⟨v :: pre, post, congrArg (List.cons v) hp, congrArg Nat.succ hl, hh.trans he⟩ + +/-- Global conservation across the pending spine forces conservation +inside the fixed flat body. Any local block would persist to the endpoint. -/ +theorem flat_spine_local_counts (b a : Q) (vs : List V) + (hb : red b = 0) (hk : oc 0 b = 2) (ha : red a = 1) (hab : blocks a = 0) + (hr : red (norm (apps (substQ 0 a b) vs)) = + red (apps (.app (.lam b) a) vs)) + (hz : blocks (norm (apps (substQ 0 a b) vs)) = + blocks (apps (.app (.lam b) a) vs)) : + red (norm (substQ 0 a b)) = red (substQ 0 a b) ∧ + blocks (norm (substQ 0 a b)) = 0 := by + have hraw : red (substQ 0 a b) = 2 := by + rw [red_subst, hb, hk, ha] + have hstart : red (.app (.lam b) a) = 2 := by simp only [red, hb, ha] + have hp := apps_data (norm_sound (substQ 0 a b)) vs + have hs : DataSteps (apps (norm (substQ 0 a b)) vs) + (norm (apps (substQ 0 a b) vs)) := by + rw [hp.norm_eq] + exact norm_sound _ + have hrp := hp.red_le + have hrs := hs.red_le + have he : red (apps (norm (substQ 0 a b)) vs) = + red (norm (apps (substQ 0 a b) vs)) := by + rw [hr, apps_red, apps_red, hstart] + simp only [apps_red, hraw] at hrp + simp only [hr, apps_red, hstart] at hrs + omega + have hbmid := data_steps_blocks_le hs he.symm + have hblower := apps_blocks_lower (norm (substQ 0 a b)) vs + have hroot := root_program_arg b a (by omega) + have hbb := blocks_zero b hb + have hzstart : blocks (apps (.app (.lam b) a) vs) = blockWeight vs := by + simp only [apps_blocks_app, blocks, hbb, hab, hroot, Nat.zero_add] + constructor + · simp only [apps_red, hr, hstart] at he + omega + · rw [hz, hzstart] at hbmid + omega + +theorem two_red_neutral (d : Q) (hd : red d = 1) (n : Neu) + (hc : ClosedQ (neutral n)) (ho : Only d (neutral n)) + (hr : red (neutral n) = 2) (hb : blocks (neutral n) = 0) : + ∃ q vs, neutral n = apps (.app d (wraps q d)) vs ∧ + ∀ v ∈ vs, red (val v) = 0 := by + cases n with + | atom a => + cases a with + | var i => exact (Nat.not_lt_zero i hc).elim + | lam b => + change .lam b = d at ho + simp only [neutral, atomTerm, ho, hd] at hr + exact (Nat.succ_ne_self 1 hr.symm).elim + | app n v => + have hp := neutral_red_pos n hc.1 + have hbn : blocks (neutral n) = 0 := by simp only [neutral, blocks] at hb; omega + have hbv : blocks (val v) = 0 := by simp only [neutral, blocks] at hb; omega + have hn : red (neutral n) = 1 ∨ red (neutral n) = 2 := by + simp only [neutral, red] at hr + omega + rcases hn with hn | hn + · have hv : red (val v) = 1 := by simp only [neutral, red] at hr; omega + have he : neutral n = d := by + rcases one_red_neutral n hc.1 hn with ⟨b, he, _, _⟩ | hh + · have hh := ho.1 + rw [he] at hh + exact he.trans hh + · exact (Nat.zero_ne_one (hbn.symm.trans hh)).elim + obtain ⟨q, b, hvb, _, _⟩ := one_red_unblocked v hc.2 hv hbv + have hbd : .lam b = d := by + have hh := ho.2 + rw [hvb] at hh + exact (wraps_only_iff d (.lam b) q).mp hh + exact ⟨q, [], by simp only [neutral, he, hvb, hbd, apps], by simp⟩ + · have hv : red (val v) = 0 := by simp only [neutral, red] at hr; omega + obtain ⟨q, vs, he, hs⟩ := two_red_neutral d hd n hc.1 ho.1 hn hbn + refine ⟨q, vs ++ [v], ?_, ?_⟩ + · simp only [neutral, apps_snoc, he] + · intro w hw + rcases List.mem_append.mp hw with hw | hw + · exact hs w hw + · have hew : w = v := by simpa only [List.mem_singleton] using hw + exact hew ▸ hv +termination_by sizeOf n + +/-- The two surviving copies already supply the next recursive operand. +All other body arguments are program-free, regardless of wrapper depth. -/ +theorem two_red_value (d : Q) (hd : red d = 1) (v : V) + (hc : ClosedQ (val v)) (ho : Only d (val v)) + (hr : red (val v) = 2) (hb : blocks (val v) = 0) : + ∃ m q vs, val v = wraps m (apps (.app d (wraps q d)) vs) ∧ + ∀ w ∈ vs, red (val w) = 0 := by + cases v with + | k | z => cases hr + | const v => + have hr' : red (val v) = 2 := by simpa only [val, red, Nat.zero_add] using hr + have hb' : blocks (val v) = 0 := by + simpa only [val, blocks, root, Block, if_false, Nat.zero_add, Nat.add_zero] using hb + obtain ⟨m, q, vs, he, hs⟩ := two_red_value d hd v hc.2 ho.2 hr' hb' + exact ⟨m + 1, q, vs, congrArg (Q.app .k) he, hs⟩ + | neu n => + obtain ⟨q, vs, he, hs⟩ := two_red_neutral d hd n hc ho hr hb + exact ⟨0, q, vs, he, hs⟩ +termination_by sizeOf v + +theorem wraps_closed (n : Nat) (t : Q) (h : ClosedQ t) : ClosedQ (wraps n t) := by + induction n with + | zero => exact h + | succ n ih => exact ⟨by decide, ih⟩ + +/-- A flat binary body, supplied one wrapped flat template, has exactly +the stable two-copy shape after any count-preserving, block-free data phase. +The next head template is the operand template, not the old contractor. -/ +theorem flat_body_transition (b d : Q) (n : Nat) + (hb : red b = 0) (hk : oc 0 b = 2) (hbc : FreeUnder 1 (erase b)) + (hd : red d = 0) (hdc : ClosedQ (.lam d)) (hdn : norm (.lam d) = .lam d) + (hr : red (norm (substQ 0 (wraps n (.lam d)) b)) = + red (substQ 0 (wraps n (.lam d)) b)) + (hz : blocks (norm (substQ 0 (wraps n (.lam d)) b)) = 0) : + ∃ m q vs, + norm (substQ 0 (wraps n (.lam d)) b) = + wraps m (apps (.app (.lam d) (wraps q (.lam d))) vs) ∧ + ∀ v ∈ vs, red (val v) = 0 := by + have ha := wraps_closed n (.lam d) hdc + have hc := SelfintZero.step_closed (.beta b (wraps n (.lam d))) ⟨hbc, ha⟩ + have ho : Only (.lam d) (wraps n (.lam d)) := + (wraps_only_iff (.lam d) (.lam d) n).mpr rfl + have hs := (only_zero (.lam d) b hb).subst hdc ho 0 + have hn := hs.norm hdn + have htwo : red (norm (substQ 0 (wraps n (.lam d)) b)) = 2 := by + rw [hr, red_subst, wraps_red] + simp only [hb, hk, red, hd, Nat.zero_add, Nat.mul_one] + exact two_red_value (.lam d) (by simp only [red, hd]) _ + (norm_freeUnder _ 0 hc) hn htwo hz + +/-- The local two-copy transition follows from conservation of the +whole canonical state, with an arbitrary pending application spine. -/ +theorem flat_spine_transition (b d : Q) (n : Nat) (pending : List V) + (hb : red b = 0) (hk : oc 0 b = 2) (hbc : FreeUnder 1 (erase b)) + (hd : red d = 0) (hdc : ClosedQ (.lam d)) (hdn : norm (.lam d) = .lam d) + (hr : red (norm (apps (substQ 0 (wraps n (.lam d)) b) pending)) = + red (apps (.app (.lam b) (wraps n (.lam d))) pending)) + (hz : blocks (norm (apps (substQ 0 (wraps n (.lam d)) b) pending)) = + blocks (apps (.app (.lam b) (wraps n (.lam d))) pending)) : + ∃ m q vs, + norm (substQ 0 (wraps n (.lam d)) b) = + wraps m (apps (.app (.lam d) (wraps q (.lam d))) vs) ∧ + ∀ v ∈ vs, red (val v) = 0 := by + have ha : red (wraps n (.lam d)) = 1 := by simp only [wraps_red, red, hd] + have hab : blocks (wraps n (.lam d)) = 0 := by + simp only [wraps_blocks, blocks, blocks_zero d hd] + obtain ⟨he, hz'⟩ := flat_spine_local_counts b (wraps n (.lam d)) pending hb hk ha hab hr hz + exact flat_body_transition b d n hb hk hbc hd hdc hdn he hz' + +/-- After the stable head contraction, the next template is the copied +template. New arguments are program-free and uniformly label-bounded; +the old pending spine contributes only an untouched suffix. -/ +theorem stable_spine_next (b d : Q) (n l : Nat) (pending : List V) + (hb : red b = 0) (hk : oc 0 b = 2) (hbc : FreeUnder 1 (erase b)) + (hd : red d = 0) (hdc : ClosedQ (.lam d)) (hdn : norm (.lam d) = .lam d) + (hp : ∀ v ∈ pending, norm (val v) = val v) + (hbl : SelfintGrowthLabels.Bounded l b) + (hdl : SelfintGrowthLabels.Bounded l (.lam d)) + (hr : red (norm (apps (substQ 0 (wraps n (.lam d)) b) pending)) = + red (apps (.app (.lam b) (wraps n (.lam d))) pending)) + (hz : blocks (norm (apps (substQ 0 (wraps n (.lam d)) b) pending)) = + blocks (apps (.app (.lam b) (wraps n (.lam d))) pending)) + (hn : ¬ Done (norm (apps (substQ 0 (wraps n (.lam d)) b) pending))) : + ∃ q pre post fresh, pending = pre ++ post ∧ + norm (apps (substQ 0 (wraps n (.lam d)) b) pending) = + apps (.app (.lam d) (wraps q (.lam d))) (fresh ++ post) ∧ + ∀ v ∈ fresh, red (val v) = 0 ∧ norm (val v) = val v ∧ + SelfintGrowthLabels.Bounded (l + 5 * SelfintGrowthLabels.apps b) (val v) := by + obtain ⟨m, q, vs, he, hs⟩ := flat_spine_transition b d n pending hb hk hbc hd hdc hdn hr hz + let f := Q.app (.lam d) (wraps q (.lam d)) + have hfd : ∃ a, deep f = .neu a := ⟨_, rfl⟩ + have hfn : norm f = f := by + rw [norm_app_neutral (.lam d) (wraps q (.lam d)) ⟨_, rfl⟩, + hdn, wraps_norm, hdn] + have hfresh : ∀ v ∈ normArgs vs, red (val v) = 0 ∧ norm (val v) = val v := by + intro v hv + obtain ⟨w, hw, hew⟩ := List.mem_map.mp hv + subst v + exact ⟨Nat.eq_zero_of_le_zero (hs w hw ▸ norm_red (val w)), norm_idempotent (val w)⟩ + have he' : norm (substQ 0 (wraps n (.lam d)) b) = + wraps m (apps f (normArgs vs)) := by + calc + _ = norm (norm (substQ 0 (wraps n (.lam d)) b)) := (norm_idempotent _).symm + _ = norm (wraps m (apps f vs)) := congrArg norm he + _ = wraps m (apps f (normArgs vs)) := by rw [wraps_norm, norm_apps f vs hfd, hfn] + have ha : norm (wraps n (.lam d)) = wraps n (.lam d) := by rw [wraps_norm, hdn] + obtain ⟨k, hk', htrace⟩ := SelfintGrowthLabels.flat_subst_count b (wraps n (.lam d)) 0 hb ha + have hbound : SelfintGrowthLabels.Bounded (l + 5 * SelfintGrowthLabels.apps b) + (norm (substQ 0 (wraps n (.lam d)) b)) := by + have hi := SelfintGrowthLabels.bounded_subst b (wraps n (.lam d)) 0 l hbl + ((wraps_bounded n (.lam d) l).mpr hdl) + exact SelfintGrowthLabels.bounded_mono _ (Nat.add_le_add_left hk' l) (htrace.bounded l hi) + have hfreshbound : ∀ v ∈ normArgs vs, + SelfintGrowthLabels.Bounded (l + 5 * SelfintGrowthLabels.apps b) (val v) := by + rw [he'] at hbound + exact ((apps_bounded f (normArgs vs) _).mp + ((wraps_bounded m _ _).mp hbound)).2 + have hglobal : norm (apps (substQ 0 (wraps n (.lam d)) b) pending) = + norm (apps (wraps m (apps f (normArgs vs))) pending) := by + rw [(apps_data (norm_sound (substQ 0 (wraps n (.lam d)) b)) pending).norm_eq, he'] + obtain ⟨pre, post, hpend, _, hpeel⟩ := + peel_wrappers m (apps f (normArgs vs)) pending (hglobal ▸ hn) + have hpost : ∀ v ∈ post, norm (val v) = val v := by + intro v hv + apply hp v + rw [hpend] + exact List.mem_append_right pre hv + have hargs : ∀ v ∈ normArgs vs ++ post, norm (val v) = val v := by + intro v hv + rcases List.mem_append.mp hv with hv | hv + · exact (hfresh v hv).2 + · exact hpost v hv + refine ⟨q, pre, post, normArgs vs, hpend, ?_, ?_⟩ + · calc + _ = norm (apps (wraps m (apps f (normArgs vs))) pending) := hglobal + _ = norm (apps (apps f (normArgs vs)) post) := hpeel + _ = norm (apps f (normArgs vs ++ post)) := congrArg norm (apps_append f _ _).symm + _ = apps f (normArgs vs ++ post) := norm_apps_fixed f _ hfd hfn hargs + · intro v hv + exact ⟨(hfresh v hv).1, (hfresh v hv).2, hfreshbound v hv⟩ + +/-- The selected data phase has a demand bound independent of the +number of constant-function wrappers around the copied template. -/ +theorem flat_body_bound (b d : Q) (n l : Nat) + (hb : red b = 0) (hd : norm d = d) + (hbl : SelfintGrowthLabels.Bounded l b) + (hdl : SelfintGrowthLabels.Bounded l d) : + ∃ k, k ≤ 5 * SelfintGrowthLabels.apps b ∧ + SelfintGrowthLabels.BoundTrace (l + k) + (substQ 0 (wraps n d) b) (norm (substQ 0 (wraps n d) b)) := by + have hn : norm (wraps n d) = wraps n d := by rw [wraps_norm, hd] + exact SelfintGrowthLabels.flat_subst_bound b (wraps n d) 0 l hb hn hbl + ((wraps_bounded n d l).mpr hdl) + +end Blc.SelfintGrowthStable diff --git a/lean/Blc/WeakHeadClock.lean b/lean/Blc/WeakHeadClock.lean index 0bb83576..ebabdb1b 100644 --- a/lean/Blc/WeakHeadClock.lean +++ b/lean/Blc/WeakHeadClock.lean @@ -129,6 +129,39 @@ theorem head_decreases {t u : Term} {n : Nat} (hc : Count t n) subst he exact ⟨_, Nat.lt_succ_self _, hd⟩ +theorem head_nonlam_weak {t u : Term} (h : HeadStep t u) + (hn : ∀ b, t ≠ .lam b) : weakStep t = some u := by + induction h with + | beta b a => rfl + | appL a hnl h ih => exact weak_app (ih hnl) a + | under h ih => exact (hn _ rfl).elim + +theorem head_stop_weak {t : Term} (h : headStep t = none) : weakStep t = none := by + induction t with + | var | lam => rfl + | app f a ihf iha => + cases f with + | var => rfl + | lam b => simp only [headStep] at h; cases h + | app g b => + simp only [headStep, Option.map_eq_none_iff] at h + simp only [weakStep, ihf h, Option.map_none] + +/-- Ordinary beta normalization supplies a finite weak-head clock. -/ +theorem hasNormalForm_count {t : Term} (h : HasNormalForm t) : ∃ n, Count t n := by + obtain ⟨k, p, hk, hp⟩ := hasNormalForm_headTerminates h + have hr := headReds_of_headSteps k hk + clear h hk + induction hr with + | refl t => exact ⟨0, .stop (head_stop_weak hp)⟩ + | @head t u v n hs ht ih => + cases t with + | lam b => exact ⟨0, .stop rfl⟩ + | var i => cases hs + | app f a => + obtain ⟨n, hn⟩ := ih hp + exact ⟨n + 1, .step (head_nonlam_weak hs (by intro b h; cases h)) hn⟩ + /-- Selected head contractions, interspersed with arbitrary beta steps. -/ inductive Interleaved : Nat → Term → Term → Prop where | refl (t : Term) : Interleaved 0 t t From 67af7cfa271227a7c10f09a3a37b21d9f89041b5 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 20:45:37 -0400 Subject: [PATCH 24/41] Prove unavoidable remainder code growth with source origins --- docs/STATUS.md | 36 +- .../classical/self-interpreter/interpreter.md | 19 +- docs/classical/self-interpreter/remainder.md | 68 ++-- lean/Blc.lean | 6 + lean/Blc/SelfintGrowth.lean | 217 +++++++++++ lean/Blc/SelfintGrowthColored.lean | 366 ++++++++++++++++++ lean/Blc/SelfintGrowthCounters.lean | 240 ++++++++++++ lean/Blc/SelfintGrowthHead.lean | 24 +- lean/Blc/SelfintGrowthSequence.lean | 125 ++++++ lean/Blc/SelfintGrowthSpine.lean | 107 +++++ lean/Blc/SelfintGrowthTrace.lean | 193 +++++++++ 11 files changed, 1342 insertions(+), 59 deletions(-) create mode 100644 lean/Blc/SelfintGrowth.lean create mode 100644 lean/Blc/SelfintGrowthColored.lean create mode 100644 lean/Blc/SelfintGrowthCounters.lean create mode 100644 lean/Blc/SelfintGrowthSequence.lean create mode 100644 lean/Blc/SelfintGrowthSpine.lean create mode 100644 lean/Blc/SelfintGrowthTrace.lean diff --git a/docs/STATUS.md b/docs/STATUS.md index f4dceb57..9a2ccee5 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -278,29 +278,35 @@ with all features (three opt-in tests ignored) and 328 with default features. The proof normalizes source terms with at most one nonlinear binder over a labelled infinite zero stream, then simulates the finite trace on a closed source `λⁿ.I` followed by `Ω` to contradict exact extraction. - A separately reviewed handwritten theorem proves that every exact - remainder extractor has some valid source `λⁿ.I`, with suffix `I`, - whose ordinary weak-head trace strictly increases interpreter-origin - lambda count. The proof shows that a constant-count infinite-zero - execution eventually recycles one flat code template without carrying - an advancing tail; a uniform label bound then contradicts finite-prefix - correctness. It gives neither an explicit `n` nor a bit-size bound, - and does not quantify over every successful trace. + A separately reviewed, fully kernel-checked theorem proves that every + exact remainder extractor strictly increases its own residual-origin + lambda count during ordinary weak-head evaluation on every sufficiently + long valid source `λⁿ.I`, with any closed suffix. The infinite-zero + execution has growth events arbitrarily late: an eventually nongrowing + execution would stabilize to one flat code template without carrying + an advancing tail, and a uniform label bound would contradict + finite-prefix correctness. The result gives neither an explicit input + threshold nor a bit-size bound, and does not quantify over every + successful beta trace. `WeakHeadClock` kernel-checks the supporting bound on head contractions - interspersed with arbitrary beta reductions. The seven `SelfintGrowth` + interspersed with arbitrary beta reductions. The thirteen `SelfintGrowth` modules additionally check data normalization and nongrowth transport, bounded blocked-copy and nonflat-head events, the stable two-copy value classification, uniform fixed-body label bounds, and finite-prefix simulation with a head-clock bound. An exact data-normalizer cost proves strong normalization of every data-reduction order; the extended head - machine and exact-remainder nontermination are also checked. The complete - infinite-execution synthesis remains handwritten. - Integrated `lake build Blc` passes all 42 jobs; a seventeen-theorem + machine, counter stabilization, canonical event selection, and full + infinite-execution synthesis are checked. The colored ordinary-term + realization counts precisely residual copies of the original reader, + including on divergent suffixes; input lambdas are excluded. + Integrated `lake build Blc` passes all 48 jobs; a seventeen-theorem audit across `SelfintZero`, `SelfintProjections`, and `SelfintInert` uses only `propext` and `Quot.sound`, as does a separate four-theorem - `WeakHeadClock` audit. Of twenty-two audited growth-support theorems, - twenty-one use at most those axioms; the infinite-execution event - extraction additionally uses `Classical.choice`. + `WeakHeadClock` audit. The twenty-two growth-support theorems use at most + those axioms after constructive event extraction. A fourteen-theorem + final synthesis/transfer audit has nine using at most those axioms and + five additionally using `Classical.choice` for counter stabilization and + classical event selection; the final valid-source theorem is among them. - **Normal and typed witnesses** (`classical/self-interpreter/normal.md`, `typed-normal.md`): the β-normal interpreter is 204 bits (`int204_normal`, L 21, A 29, X 44). Lean proves its exact wire, diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index 3c7f7893..109eb781 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -323,15 +323,16 @@ at its public stream binder. The corresponding wire floor is 55 bits. This prices that displayed head form, not the source that expands into it; STATUS records the construction's size and current checks. -The independently reviewed handwritten theorem in `remainder.md` also -forces strict interpreter-code growth on some ordinary weak-head trace -of every exact remainder extractor, using a valid source `λⁿ.I` and -suffix `I`. The proof bounds the labels accessible to a constant-count -infinite-zero execution. `Blc/WeakHeadClock.lean` and the `SelfintGrowth` -modules mechanize the head clock, data normalization, both finite-event -counters, stable value forms, fixed-body label bounds, and finite-prefix -simulation. Their synthesis into the full growth theorem remains -handwritten and gives no numerical size bound. +The independently reviewed Lean theorem in `remainder.md` also forces +strict reader-origin code growth during ordinary weak-head evaluation +of every exact remainder extractor on every sufficiently long valid +source `λⁿ.I`, with any closed suffix. The proof bounds the labels +accessible to an eventually nongrowing infinite-zero execution. +`Blc/WeakHeadClock.lean` and the `SelfintGrowth` modules mechanize the full +argument, including residual-origin colors and ordinary weak-head +simulation. This supplies no numerical size bound. Applying the result to +the projection `E F` counts the adapter's lambdas as part of that reader; +it does not by itself isolate growth belonging only to `E`. **Duplication.** At least two syntactic binders of `E` occur at least twice. Lean proves that every term with at most one such binder weakly normalizes; diff --git a/docs/classical/self-interpreter/remainder.md b/docs/classical/self-interpreter/remainder.md index 2e7bc2eb..ad134323 100644 --- a/docs/classical/self-interpreter/remainder.md +++ b/docs/classical/self-interpreter/remainder.md @@ -183,10 +183,11 @@ R (stream(M,N)) =β N for every closed source `M` and every closed suffix `N`. Mark precisely the lambdas originally belonging to `R`, and propagate those marks through beta -reduction. For some `n`, ordinary deterministic weak-head evaluation of +reduction. There is a bound `B` such that, for every `n≥B` and every closed +suffix `N`, ordinary deterministic weak-head evaluation of ``` -R (stream(λⁿ.I,I)) +R (stream(λⁿ.I,N)) ``` contains a contraction that strictly increases the number of marked @@ -195,9 +196,13 @@ stops at an outer lambda or a rigid variable head. The theorem concerns this specific evaluation strategy; it does not assert growth on every successful beta trace. -Codex's argument below has independent written review. The complete growth -theorem is not mechanized; the kernel-checked components are listed below. -In particular, it is stronger than the preceding +Codex's argument below has independent written review and a complete Lean +proof, including the transfer to ordinary lambda terms with residual-origin +colors. `SelfintGrowthColored.remainder_grows_on_towers` is the final +valid-source theorem. `SelfintGrowth.remainder_execution_grows_after` +also proves that growth events occur arbitrarily far along the +infinite-zero execution; a finite initial expansion cannot supply a +permanently nongrowing reader. In particular, this is stronger than the preceding kernel-checked two-nonlinear-binder theorem: a nonlinear contraction can recycle code without increasing its count, as `Δ Δ → Δ Δ` demonstrates. There is no numerical bound on `n`, on the time of the growth step, or on @@ -230,8 +235,8 @@ contractions between them. `Blc/WeakHeadClock.lean` mechanizes this supporting fact. Its `count_reduct` theorem proves monotonicity under arbitrary beta reduction, and `interleaved_bound` bounds any selected head contractions interspersed -with unrestricted beta steps by the initial finite head clock. This does -not mechanize the growth theorem's data-flow and finite-transient arguments. +with unrestricted beta steps by the initial finite head clock. The +`SelfintGrowth` modules supply the data-flow and finite-transient arguments. We will use both suffixes `Ω` and `I`. The former prevents the infinite-zero execution from terminating. The latter makes a finite-prefix execution @@ -272,9 +277,11 @@ therefore decreases the natural number `cost(t)`, even under program lambdas. In particular, an infinite weak-head execution cannot consist eventually of data steps alone. `SelfintGrowthHead` checks this cost argument. -Now suppose, for contradiction, that the infinite-zero head execution -never increases the program-lambda count. Its infinitely many program -head contractions induce an auxiliary execution on full data normal forms. +Now suppose, for contradiction, that the infinite-zero head execution has +no growth after some finite position. Discard that finite prefix for the +counter argument, retaining its actual head trace for the later finite +realization. The remaining infinitely many program head contractions +induce an auxiliary execution on full data normal forms. If an actual program step contracts a binder with `k` occurrences and an argument with `a` program lambdas, the count changes by @@ -452,14 +459,19 @@ contractions interspersed with finite data reductions from a reduct of Exact remainder correctness makes this term beta-join normal `I`, hence normalize to `I` and have a finite weak-head clock. The head-clock fact rules out the displayed infinite execution. This contradicts the assumed -absence of growth in the infinite-zero head trace. - -The infinite-zero ordinary head trace must therefore contain a strict -program-lambda growth step. That step occurs in a finite trace prefix. -Simulate that prefix on a sufficiently long even finite zero prefix with -tail `stream(I,I)`. The actual ordinary weak-head trace follows the same -steps, and the program-lambda counts agree, giving the claimed valid-source -witness. +eventual absence of growth in the infinite-zero head trace. + +The infinite-zero ordinary head trace must therefore contain strict +program-lambda growth steps arbitrarily far along the execution. Each +such step occurs in a finite trace prefix. Simulate that prefix on every +sufficiently long even finite zero prefix, with tail `stream(I,N)` for +any closed `N`. Mark the original `R` lambdas red and the entire input +blue. The colored interpretation commutes with substitution, every data +head becomes one or two blue ordinary head contractions, and every +program head becomes one red ordinary head contraction. The red counts +agree exactly with the extended program-lambda counts. Erasing colors +gives the actual deterministic ordinary weak-head trace, proving the +valid-source statement without counting any input lambda as program code. At a growth step, either a binary binder copies an argument containing at least two program lambdas, or a binder with at least three occurrences @@ -470,7 +482,7 @@ qualitative computational obstruction; it supplies neither a sharp bit bound for remainder extraction nor an additive price for the two self-interpreter projections. -### Kernel-checked components and remaining synthesis +### Kernel-checked proof The `SelfintGrowth` modules check the following components against the same labelled syntax used by `SelfintZero`: @@ -484,8 +496,16 @@ labelled syntax used by `SelfintZero`: | `SelfintGrowthStable` | Closed one-code operands and block-free two-copy values have the stated wrapper/spine forms; flat-body transitions and their label bounds follow. | | `SelfintGrowthSimulation` | A uniformly bounded-label trace realizes on a finite zero prefix, and its selected program head steps are bounded by that realization's weak-head clock. | | `SelfintGrowthHead` | Strict data-cost descent, deterministic extended head execution, finite realization by actual weak-head steps, and infinite-zero nontermination from the exact suffix contract. | - -These are supporting theorems, not a packaged proof of remainder growth. -The synthesis from an arbitrary nongrowing infinite head execution to a -uniformly bounded stable execution remains to be mechanized. Current build -and axiom-audit results are recorded in `docs/STATUS.md`. +| `SelfintGrowthTrace` | Every finite prefix of a stable fixed-template execution has one uniform label bound, including wrapper erasures and pending arguments. | +| `SelfintGrowthSpine` | Canonical closed head decomposition and extraction of a wrapped flat operand from a clean constant-count event. | +| `SelfintGrowthCounters` | Eventual stabilization of all three counters and exclusion of nonflat contractors and blocked operands after stabilization. | +| `SelfintGrowthSequence` | Selection of infinitely many clean canonical program events, preserving finite actual-prefix links. | +| `SelfintGrowth` | Full synthesis: an exact remainder reader has strict program-lambda growth arbitrarily late in its infinite-zero head execution. | +| `SelfintGrowthColored` | Exact source-origin colors and ordinary weak-head simulation, giving growth on every sufficiently long valid tower and every closed suffix. | + +The final theorem requires only closedness and the closed-source, +closed-suffix beta-join contract stated above. It assumes no parser +architecture, normal form, typing discipline, or bound on source size. +Natural-counter stabilization and event selection use ordinary classical +reasoning. Current build and axiom-audit results are recorded in +`docs/STATUS.md`. diff --git a/lean/Blc.lean b/lean/Blc.lean index 5e799213..0e4af462 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -36,3 +36,9 @@ import Blc.SelfintGrowthLabels import Blc.SelfintGrowthStable import Blc.SelfintGrowthSimulation import Blc.SelfintGrowthHead +import Blc.SelfintGrowthTrace +import Blc.SelfintGrowthSpine +import Blc.SelfintGrowthCounters +import Blc.SelfintGrowthSequence +import Blc.SelfintGrowth +import Blc.SelfintGrowthColored diff --git a/lean/Blc/SelfintGrowth.lean b/lean/Blc/SelfintGrowth.lean new file mode 100644 index 00000000..4470ce0c --- /dev/null +++ b/lean/Blc/SelfintGrowth.lean @@ -0,0 +1,217 @@ +/- +Synthesis of the infinite-zero remainder-growth obstruction. +The finite components are in the SelfintGrowth* modules. +-/ +import Blc.SelfintGrowthSpine +import Blc.SelfintGrowthCounters +import Blc.SelfintGrowthSequence + +namespace Blc.SelfintGrowth +open Term SelfintZero SelfintGrowthBlue SelfintGrowthBlocks SelfintGrowthOrigins +open SelfintGrowthLabels SelfintGrowthSimulation SelfintGrowthStable +open SelfintGrowthHead SelfintGrowthCounters SelfintGrowthSpine + +theorem bounded_demand_self (t : Q) : Bounded (demand t) t := by + induction t with + | var | k => trivial + | z i => exact Nat.le_succ i + | lam b ih => exact ih + | app f a ihf iha => + exact ⟨bounded_mono f (Nat.le_max_left _ _) ihf, + bounded_mono a (Nat.le_max_right _ _) iha⟩ + +theorem red_not_done {t u : Q} (h : RedHead t u) : ¬ Done t := by + intro hd + have he := red_next h + rw [done_next hd] at he + cases he + +/-- After one clean canonical transition, the continuing execution has +one fixed template and one uniform label bound. No source-size assumption +or bound on the number of constant-function wrappers is used. -/ +theorem clean_sequence_bounded (state : Nat → Q) + (hn : ∀ i, norm (state i) = state i) + (hc : ∀ i, ClosedQ (state i)) + (hs : ∀ i, ∃ u, CleanHead (state i) u ∧ state (i + 1) = norm u) + (hr : ∀ i, red (state (i + 1)) = red (state i)) + (hz : ∀ i, blocks (state (i + 1)) = blocks (state i)) : + ∃ L, ∀ i, Run L i (state 1) (state (i + 1)) := by + obtain ⟨u, hu, hnext⟩ := hs 0 + obtain ⟨b, d, n, pending, ht, hut, hb, hk, hbn, hbc, hd, hdc, hdn, hp⟩ := + stable_operand hu.head (hn 0) (hc 0) hu.red_eq hu.not_bad hu.not_block + let l := max (demand b) (demand (.lam d)) + have hbl : Bounded l b := bounded_mono b (Nat.le_max_left _ _) (bounded_demand_self b) + have hdl : Bounded l (.lam d) := + bounded_mono (.lam d) (Nat.le_max_right _ _) (bounded_demand_self (.lam d)) + have hre : red (norm (SelfintGrowthStable.apps (substQ 0 (wraps n (.lam d)) b) pending)) = + red (SelfintGrowthStable.apps (.app (.lam b) (wraps n (.lam d))) pending) := by + rw [← hut, ← ht, ← hnext] + exact hr 0 + have hze : blocks (norm (SelfintGrowthStable.apps (substQ 0 (wraps n (.lam d)) b) pending)) = + blocks (SelfintGrowthStable.apps (.app (.lam b) (wraps n (.lam d))) pending) := by + rw [← hut, ← ht, ← hnext] + exact hz 0 + have hne : ¬ Done (norm (SelfintGrowthStable.apps (substQ 0 (wraps n (.lam d)) b) pending)) := by + rw [← hut, ← hnext] + obtain ⟨v, hv, _⟩ := hs 1 + exact red_not_done hv.head + obtain ⟨q, pre, post, fresh, hpend, hshape, hfresh⟩ := + stable_spine_next b d n l pending hb hk hbc hd hdc hdn + (fun v hv => (hp v hv).1) hbl hdl hre hze hne + have hs₁ : state 1 = SelfintGrowthStable.apps + (.app (.lam d) (wraps q (.lam d))) (fresh ++ post) := by + simpa only [← hut, ← hnext] using hshape + obtain ⟨v, hv, _⟩ := hs 1 + have hd2 : oc 0 d = 2 := by + have hvh := hv.head + have hvr := hv.red_eq + rw [hs₁] at hvh hvr + exact (spine_binary d (wraps q (.lam d)) v (fresh ++ post) hvh hvr).1 + have hpn : ∀ w ∈ fresh ++ post, norm (val w) = val w := by + intro w hw + rcases List.mem_append.mp hw with hw | hw + · exact (hfresh w hw).2.1 + · apply (hp w _).1 + rw [hpend] + exact List.mem_append_right pre hw + let L := max (demand (state 1)) (l + 5 * SelfintGrowthLabels.apps d) + have hpb : ∀ w ∈ fresh ++ post, Bounded L (val w) := by + have hsbound : Bounded L (state 1) := + bounded_mono (state 1) (Nat.le_max_left _ _) (bounded_demand_self (state 1)) + rw [hs₁] at hsbound + exact ((apps_bounded _ _ L).mp hsbound).2 + refine ⟨L, ?_⟩ + apply SelfintGrowthTrace.stable_sequence_runs d l L q (fresh ++ post) + (fun i => state (i + 1)) hd hd2 hdc hdn hdl (Nat.le_max_right _ _) hpn hpb hs₁ + · intro i + obtain ⟨v, hv, he⟩ := hs (i + 1) + exact ⟨v, hv.head, he⟩ + · intro i; exact hr (i + 1) + · intro i; exact hz (i + 1) + · intro i + obtain ⟨v, hv, _⟩ := hs (i + 1 + 1) + exact red_not_done hv.head + +/-- A finite actual head prefix followed by full data normalization does +not affect the finite-prefix contradiction. The bound may depend on that +prefix, but the later selected-head trace has one fixed bound. -/ +theorem normal_trace_prefixes_no_run {l n : Nat} {t u : Q} (ht : Trace n t u) + (T : Term) (hT : Closed T) + (hn : ∀ k, HasNormalForm (realize (2 * k) T t)) : + ¬ (∀ k, ∃ v, Run l k (norm u) v) := by + obtain ⟨a, ha⟩ := ht.finite_realize + obtain ⟨b, hb⟩ := data_steps_sim (norm_sound u) + let k := max a (max b (l + 1)) + have ha' : a ≤ 2 * k := by + have := Nat.le_max_left a (max b (l + 1)); omega + have hb' : b ≤ 2 * k := by + have := Nat.le_max_right a (max b (l + 1)) + have := Nat.le_max_left b (l + 1) + omega + have hl : l < 2 * k := by + have := Nat.le_max_right a (max b (l + 1)) + have := Nat.le_max_right b (l + 1) + omega + obtain ⟨_, _, hfirst⟩ := ha (2 * k) ha' T hT + have hred := betas_trans hfirst.betas (hb (2 * k) hb' T hT) + obtain ⟨h, hc⟩ := WeakHeadClock.hasNormalForm_count + (betas_preserve_hasNormalForm hred (hn k)) + exact no_unbounded_run (2 * k) hl T hT hc + +private def identity : Term := .lam (.var 0) + +private theorem identity_normal : NormalForm identity := by + intro u h + cases h with + | lam h => cases h + +/-- Exact remainder extraction excludes a uniformly bounded canonical +tail after any finite actual head prefix on the infinite zero stream. -/ +theorem remainder_trace_no_bounded_run (R : Term) + (hR : ∀ M, Closed M → ∀ N, Closed N → + BetaJoin (.app R (streamOf (blcCode M) N)) N) + {l n : Nat} {u : Q} (ht : Trace n (.app (embed R) (.z 0)) u) : + ¬ (∀ k, ∃ v, Run l k (norm u) v) := by + let T := streamOf (blcCode identity) identity + have hT : Closed T := by decide + apply normal_trace_prefixes_no_run ht T hT + intro k + obtain ⟨w, hw, hi⟩ := hR (SelfintZero.tower k) (SelfintZero.tower_closed k) + identity (by decide) + have he : w = identity := normalForm_betas_eq identity_normal hi + subst w + rw [SelfintZero.tower_stream k identity] at hw + refine ⟨identity, ?_, identity_normal⟩ + simpa only [realize, interp, interp_embed, Nat.sub_zero, T, identity] using hw + +/-- A correct closed remainder extractor has source-lambda growth events +arbitrarily far along its infinite-zero head execution. A finite earlier +phase of growth cannot supply a permanently nongrowing scanner. -/ +theorem remainder_execution_grows_after (R : Term) (hc : Closed R) + (hR : ∀ M, Closed M → ∀ N, Closed N → + BetaJoin (.app R (streamOf (blcCode M) N)) N) + (f : Nat → Q) (h₀ : f 0 = .app (embed R) (.z 0)) + (hf : ∀ i, Head (f i) (f (i + 1))) (N : Nat) : + ∃ i, N ≤ i ∧ red (f i) < red (f (i + 1)) := by + classical + apply Classical.byContradiction + intro hno + have hng : ∀ i, red (f (N + i + 1)) ≤ red (f (N + i)) := by + intro i + by_cases h : red (f (N + i + 1)) ≤ red (f (N + i)) + · exact h + · exact (hno ⟨N + i, by omega, by omega⟩).elim + have hfc : ClosedQ (f 0) := by + rw [h₀] + change Closed (erase (.app (embed R) (.z 0))) + simpa only [erase, erase_embed, Closed, FreeUnder] using + And.intro hc (by decide : Closed (.lam (.var 0))) + let g := fun i => f (N + i) + have hg : ∀ i, Head (g i) (g (i + 1)) := by + intro i + simpa only [g, Nat.add_assoc] using hf (N + i) + have hgc : ClosedQ (g 0) := by + simpa only [g, Nat.add_zero] using SelfintGrowthCounters.execution_closed f hf hfc N + obtain ⟨index, _, _, hclosed, hnorm, _, hstep, hcounts⟩ := + SelfintGrowthSequence.stable_sequence g hg hgc (by + intro i + simpa only [g, Nat.add_assoc] using hng i) + obtain ⟨L, hrun⟩ := clean_sequence_bounded (fun i => norm (g (index i))) hnorm hclosed + (by + intro i + obtain ⟨u, _, he, hu⟩ := hstep i + exact ⟨u, hu, he⟩) + (fun i => (hcounts i).1) (fun i => (hcounts i).2.1) + obtain ⟨n, hn⟩ := SelfintGrowthSequence.execution_trace f hf (N + index 1) + rw [h₀] at hn + apply remainder_trace_no_bounded_run R hR (l := L) hn + intro i + exact ⟨_, hrun i⟩ + +/-- In particular, every actual infinite-zero execution has a growth event. -/ +theorem remainder_execution_grows (R : Term) (hc : Closed R) + (hR : ∀ M, Closed M → ∀ N, Closed N → + BetaJoin (.app R (streamOf (blcCode M) N)) N) + (f : Nat → Q) (h₀ : f 0 = .app (embed R) (.z 0)) + (hf : ∀ i, Head (f i) (f (i + 1))) : + ∃ i, red (f i) < red (f (i + 1)) := by + obtain ⟨i, _, hi⟩ := remainder_execution_grows_after R hc hR f h₀ hf 0 + exact ⟨i, hi⟩ + +/-- Every correct closed remainder extractor has a finite actual head +prefix ending at a program contraction which strictly increases the +number of surviving source-lambda occurrences. Data constants are not +counted as program lambdas. -/ +theorem remainder_growth (R : Term) (hc : Closed R) + (hR : ∀ M, Closed M → ∀ N, Closed N → + BetaJoin (.app R (streamOf (blcCode M) N)) N) : + ∃ n u v, Trace n (.app (embed R) (.z 0)) u ∧ RedHead u v ∧ red u < red v := by + obtain ⟨f, h₀, hf⟩ := remainder_infinite R hc hR + obtain ⟨i, hi⟩ := remainder_execution_grows R hc hR f h₀ hf + obtain ⟨n, hn⟩ := SelfintGrowthSequence.execution_trace f hf i + rw [h₀] at hn + cases hf i with + | red h => exact ⟨n, f i, f (i + 1), hn, h, hi⟩ + | data h => have hh := h.data.red_le; omega + +end Blc.SelfintGrowth diff --git a/lean/Blc/SelfintGrowthColored.lean b/lean/Blc/SelfintGrowthColored.lean new file mode 100644 index 00000000..85a3653f --- /dev/null +++ b/lean/Blc/SelfintGrowthColored.lean @@ -0,0 +1,366 @@ +/- +Finite ordinary weak-head realization with source-lambda colors retained. +Program lambdas are red; the finite zero prefix and supplied red-free suffix +are blue. This transfers Q source-count growth to actual residual-origin +growth, rather than merely preserving a selected contraction count. +-/ +import Blc.SelfintGrowthHead +import Blc.SelfintOrigins +import Blc.SelfintGrowth + +namespace Blc.SelfintGrowthColored +open Term SelfintZero SelfintGrowthBlue SelfintGrowthHead SelfintLowerBound QuoteOrigins + +/-- Coloring all lambdas blue marks an arbitrary input suffix as nonprogram syntax. -/ +def blue : Term → Marked + | .var n => .var n + | .lam b => .lam true (blue b) + | .app f a => .app (blue f) (blue a) + +theorem blue_erase (t : Term) : Marked.erase (blue t) = t := by + induction t with + | var => rfl + | lam b ih => exact congrArg Term.lam ih + | app f a ihf iha => simp only [blue, Marked.erase, ihf, iha] + +theorem blue_redCount (t : Term) : Marked.redCount (blue t) = 0 := by + induction t with + | var => rfl + | lam b ih => simpa only [blue, Marked.redCount, if_true, Nat.add_zero] using ih + | app f a ihf iha => simp only [blue, Marked.redCount, ihf, iha, Nat.add_zero] + +theorem marked_shift_free (t : Marked) (c : Nat) + (h : FreeUnder c (Marked.erase t)) : Marked.shift c t = t := by + induction t generalizing c with + | var n => + have hn : ¬ c ≤ n := by have hh : n < c := h; omega + exact if_neg hn + | lam q b ih => exact congrArg (Marked.lam q) (ih (c + 1) h) + | app f a ihf iha => simp only [Marked.shift, ihf c h.1, iha c h.2] + +theorem marked_shift_closed (t : Marked) (c : Nat) (h : Closed (Marked.erase t)) : + Marked.shift c t = t := marked_shift_free t c (closed_freeUnder h c) + +theorem marked_subst_free (t : Marked) (j : Nat) (s : Marked) + (h : FreeUnder j (Marked.erase t)) : Marked.subst j s t = t := by + induction t generalizing j s with + | var n => + have hn : n < j := h + simp only [Marked.subst, if_neg (Nat.ne_of_lt hn), if_neg (Nat.not_lt.mpr (Nat.le_of_lt hn))] + | lam q b ih => exact congrArg (Marked.lam q) (ih (j + 1) _ h) + | app f a ihf iha => simp only [Marked.subst, ihf j s h.1, iha j s h.2] + +theorem marked_subst_closed (t : Marked) (j : Nat) (s : Marked) + (h : Closed (Marked.erase t)) : Marked.subst j s t = t := + marked_subst_free t j s (closed_freeUnder h j) + +def interpC (ρ : Nat → Marked) : Q → Marked + | .var n => .var n + | .lam b => .lam false (interpC ρ b) + | .app f a => .app (interpC ρ f) (interpC ρ a) + | .k => Marked.bit false + | .z i => ρ i + +theorem interpC_erase (ρ : Nat → Marked) (t : Q) : + Marked.erase (interpC ρ t) = interp (fun i => Marked.erase (ρ i)) t := by + induction t with + | var | k | z => rfl + | lam b ih => exact congrArg Term.lam ih + | app f a ihf iha => simp only [interpC, interp, Marked.erase, ihf, iha] + +theorem interpC_embed (ρ : Nat → Marked) (t : Term) : + interpC ρ (embed t) = Marked.red t := by + induction t with + | var => rfl + | lam b ih => exact congrArg (Marked.lam false) ih + | app f a ihf iha => simp only [interpC, embed, Marked.red, ihf, iha] + +theorem interpC_shift (ρ : Nat → Marked) (hρ : ∀ i, Closed (Marked.erase (ρ i))) + (t : Q) (c : Nat) : interpC ρ (shiftQ c t) = Marked.shift c (interpC ρ t) := by + induction t generalizing c with + | var n => simp only [shiftQ, interpC, Marked.shift]; split <;> rfl + | lam b ih => exact congrArg (Marked.lam false) (ih (c + 1)) + | app f a ihf iha => simp only [shiftQ, interpC, Marked.shift, ihf, iha] + | k => exact (marked_shift_closed (Marked.bit false) c (by decide)).symm + | z i => exact (marked_shift_closed (ρ i) c (hρ i)).symm + +theorem interpC_subst (ρ : Nat → Marked) (hρ : ∀ i, Closed (Marked.erase (ρ i))) + (t s : Q) (j : Nat) : + interpC ρ (substQ j s t) = Marked.subst j (interpC ρ s) (interpC ρ t) := by + induction t generalizing s j with + | var n => simp only [substQ, interpC, Marked.subst]; split <;> (try rfl); split <;> rfl + | lam b ih => simp only [substQ, interpC, Marked.subst, ih, interpC_shift ρ hρ] + | app f a ihf iha => simp only [substQ, interpC, Marked.subst, ihf, iha] + | k => exact (marked_subst_closed (Marked.bit false) j _ (by decide)).symm + | z i => exact (marked_subst_closed (ρ i) j _ (hρ i)).symm + +theorem interpC_redCount (ρ : Nat → Marked) (hρ : ∀ i, Marked.redCount (ρ i) = 0) + (t : Q) : Marked.redCount (interpC ρ t) = SelfintZero.red t := by + induction t with + | var | k => rfl + | z i => exact hρ i + | lam b ih => simp only [interpC, Marked.redCount, Bool.false_eq_true, if_false, red, ih] + | app f a ihf iha => simp only [interpC, Marked.redCount, red, ihf, iha] + +def zerosC : Nat → Marked → Marked + | 0, T => T + | n + 1, T => Marked.pair (Marked.bit false) (zerosC n T) + +theorem zerosC_erase (n : Nat) (T : Marked) : + Marked.erase (zerosC n T) = zeros n (Marked.erase T) := by + induction n with + | zero => rfl + | succ n ih => simp only [zerosC, zeros, Marked.erase_pair, Marked.erase_bit, churchBit, + Bool.false_eq_true, if_false, ih] + +theorem zerosC_closed (n : Nat) (T : Marked) (hT : Closed (Marked.erase T)) : + Closed (Marked.erase (zerosC n T)) := by + rw [zerosC_erase] + exact zeros_closed n hT + +theorem zerosC_redCount (n : Nat) (T : Marked) : + Marked.redCount (zerosC n T) = Marked.redCount T := by + induction n with + | zero => rfl + | succ n ih => simp only [zerosC, Marked.redCount_pair, Marked.redCount_bit, ih, Nat.zero_add] + +def realizeC (m : Nat) (T : Marked) : Q → Marked := interpC (fun i => zerosC (m - i) T) + +theorem realizeC_erase (m : Nat) (T : Marked) (t : Q) : + Marked.erase (realizeC m T t) = realize m (Marked.erase T) t := by + simp only [realizeC, realize, interpC_erase, zerosC_erase] + +theorem realizeC_redCount (m : Nat) (T : Marked) (hT : Marked.redCount T = 0) (t : Q) : + Marked.redCount (realizeC m T t) = SelfintZero.red t := + interpC_redCount _ (fun _ => (zerosC_redCount _ T).trans hT) t + +/-- An ordinary weak-head beta contraction retaining the color of every +surviving or copied lambda. No reduction occurs inside an abstraction. -/ +inductive ColorHead : Marked → Marked → Prop where + | beta (q : Bool) (b a : Marked) : + ColorHead (.app (.lam q b) a) (Marked.subst 0 a b) + | left {f g : Marked} (a : Marked) : ColorHead f g → ColorHead (.app f a) (.app g a) + +theorem ColorHead.step {t u : Marked} (h : ColorHead t u) : Marked.Step t u := by + induction h with + | beta q b a => exact .beta _ _ _ + | left a h ih => exact .appL _ ih + +theorem ColorHead.erase {t u : Marked} (h : ColorHead t u) : + weakStep (Marked.erase t) = some (Marked.erase u) := by + induction h with + | beta q b a => simp only [Marked.erase, weakStep, Marked.erase_subst, contract] + | left a h ih => exact WeakHeadClock.weak_app ih _ + +/-- The selected head contractor itself has source-program origin. -/ +inductive RedColorHead : Marked → Marked → Prop where + | beta (b a : Marked) : + RedColorHead (.app (.lam false b) a) (Marked.subst 0 a b) + | left {f g : Marked} (a : Marked) : RedColorHead f g → + RedColorHead (.app f a) (.app g a) + +theorem RedColorHead.color {t u : Marked} (h : RedColorHead t u) : ColorHead t u := by + induction h with + | beta b a => exact .beta _ _ _ + | left a h ih => exact .left _ ih + +theorem RedColorHead.growth_dup {t u : Marked} (h : RedColorHead t u) + (hg : Marked.redCount t < Marked.redCount u) : Marked.CodeDup t u := by + induction h with + | beta b a => + have hs := Marked.redCount_subst b a 0 + have harg : 0 < Marked.redCount a := by + by_cases hz : Marked.redCount a = 0 + · simp only [Marked.redCount, Bool.false_eq_true, if_false, hz, + Nat.mul_zero, Nat.add_zero] at hg hs + omega + · omega + have hn : 1 < occ 0 (Marked.erase b) := by + by_cases hn : 1 < occ 0 (Marked.erase b) + · exact hn + · have hm := Nat.mul_le_mul_right (Marked.redCount a) (show occ 0 (Marked.erase b) ≤ 1 by omega) + simp only [Marked.redCount, Bool.false_eq_true, if_false] at hg + simp only [Nat.one_mul] at hm + omega + exact .beta hn harg + | left a h ih => exact .appL a (ih (by simp only [Marked.redCount] at hg; omega)) + +theorem red_head_origin {t u : Q} (h : RedHead t u) (m : Nat) (T : Marked) + (hT : Closed (Marked.erase T)) : RedColorHead (realizeC m T t) (realizeC m T u) := by + induction h with + | beta b a => + unfold realizeC + rw [interpC_subst _ (fun i => zerosC_closed _ T hT)] + exact .beta _ _ + | left a h ih => exact .left _ ih + +theorem red_head_color {t u : Q} (h : RedHead t u) (m : Nat) (T : Marked) + (hT : Closed (Marked.erase T)) : ColorHead (realizeC m T t) (realizeC m T u) := by + induction h with + | beta b a => + unfold realizeC + rw [interpC_subst _ (fun i => zerosC_closed _ T hT)] + exact .beta _ _ _ + | left a h ih => exact .left _ ih + +theorem marked_subst_shift (t s : Marked) (c : Nat) : + Marked.subst c s (Marked.shift c t) = t := by + induction t generalizing s c with + | var n => + by_cases hn : c ≤ n + · have hne : n + 1 ≠ c := by omega + have hgt : c < n + 1 := by omega + simp only [Marked.shift, if_pos hn, Marked.subst, if_neg hne, if_pos hgt, + Nat.add_sub_cancel_right] + · have hne : n ≠ c := by omega + have hgt : ¬ c < n := by omega + simp only [Marked.shift, if_neg hn, Marked.subst, if_neg hne, if_neg hgt] + | lam q b ih => exact congrArg (Marked.lam q) (ih (Marked.shift 0 s) (c + 1)) + | app f a ihf iha => simp only [Marked.shift, Marked.subst, ihf, iha] + +inductive ColorTrace : Nat → Marked → Marked → Prop where + | refl (t : Marked) : ColorTrace 0 t t + | step {n : Nat} {t u v : Marked} : ColorHead t u → + ColorTrace n u v → ColorTrace (n + 1) t v + +theorem ColorTrace.trans {n m : Nat} {t u v : Marked} (h : ColorTrace n t u) + (g : ColorTrace m u v) : ColorTrace (n + m) t v := by + induction h with + | refl => simpa only [Nat.zero_add] using g + | step h hs ih => + simpa only [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using ColorTrace.step h (ih g) + +theorem ColorTrace.left {n : Nat} {t u : Marked} (h : ColorTrace n t u) (a : Marked) : + ColorTrace n (.app t a) (.app u a) := by + induction h with + | refl => exact .refl _ + | step h hs ih => exact .step (.left _ h) ih + +theorem ColorTrace.erase {n : Nat} {t u : Marked} (h : ColorTrace n t u) : + WeakTrace n (Marked.erase t) (Marked.erase u) := by + induction h with + | refl => exact .refl _ + | step h hs ih => exact .step h.erase ih + +theorem ColorTrace.steps {n : Nat} {t u : Marked} (h : ColorTrace n t u) : Marked.Steps t u := by + induction h with + | refl => exact .refl _ + | step h hs ih => exact .step h.step ih + +theorem color_true2 (a b : Marked) : ColorTrace 2 (.app (.app (Marked.bit false) a) b) a := by + refine .step (.left b (.beta true (.lam true (.var 1)) a)) ?_ + have hs := ColorHead.beta true (Marked.shift 0 a) b + rw [marked_subst_shift] at hs + exact .step hs (.refl _) + +theorem color_pair (a b x : Marked) : + ColorHead (.app (Marked.pair a b) x) (.app (.app x a) b) := by + have hs := ColorHead.beta true (.app (.app (.var 0) (Marked.shift 0 a)) (Marked.shift 0 b)) x + simpa only [Marked.pair, Marked.subst, if_true, marked_subst_shift] using hs + +/-- Administrative K/Z rules are represented by blue ordinary head +contractions; all source colors in their arguments are retained literally. -/ +theorem data_head_color {t u : Q} (h : DataHead t u) (m : Nat) (T : Marked) + (hm : demand t ≤ m) : + ∃ n, ColorTrace n (realizeC m T t) (realizeC m T u) := by + induction h with + | k a b => exact ⟨2, color_true2 _ _⟩ + | z i a => + have he : m - i = (m - (i + 1)) + 1 := by simp only [demand] at hm; omega + refine ⟨1, .step ?_ (.refl _)⟩ + simpa only [realizeC, interpC, he, zerosC] using + color_pair (Marked.bit false) (zerosC (m - (i + 1)) T) (realizeC m T a) + | @left f g a h ih => + obtain ⟨n, hn⟩ := ih (Nat.le_trans (Nat.le_max_left _ _) hm) + exact ⟨n, hn.left _⟩ + +theorem trace_color {n : Nat} {t u : Q} (h : Trace n t u) : + ∃ b, ∀ m, b ≤ m → ∀ T, Closed (Marked.erase T) → + ∃ k, ColorTrace k (realizeC m T t) (realizeC m T u) := by + induction h with + | refl t => exact ⟨0, fun _ _ _ _ => ⟨0, .refl _⟩⟩ + | red h hs ih => + obtain ⟨b, hb⟩ := ih + refine ⟨b, fun m hm T hT => ?_⟩ + obtain ⟨k, hk⟩ := hb m hm T hT + exact ⟨k + 1, .step (red_head_color h m T hT) hk⟩ + | @data n t v u h hs ih => + obtain ⟨b, hb⟩ := ih + refine ⟨max (demand t) b, fun m hm T hT => ?_⟩ + obtain ⟨k, hk⟩ := hb m (Nat.le_trans (Nat.le_max_right _ _) hm) T hT + obtain ⟨j, hj⟩ := data_head_color h m T (Nat.le_trans (Nat.le_max_left _ _) hm) + exact ⟨j + k, hj.trans hk⟩ + +/-- A finite Q source-count growth event transfers to an actual colored +ordinary weak-head event with exactly the same source-lambda counts. -/ +theorem finite_growth_color {n : Nat} {t a b : Q} (ht : Trace n t a) + (hh : RedHead a b) (hg : SelfintZero.red a < SelfintZero.red b) : + ∃ B, ∀ m, B ≤ m → ∀ T, Closed (Marked.erase T) → Marked.redCount T = 0 → + ∃ k, ColorTrace k (realizeC m T t) (realizeC m T a) ∧ + ColorHead (realizeC m T a) (realizeC m T b) ∧ + Marked.CodeDup (realizeC m T a) (realizeC m T b) ∧ + Marked.redCount (realizeC m T a) < Marked.redCount (realizeC m T b) := by + obtain ⟨B, hB⟩ := trace_color ht + refine ⟨B, fun m hm T hT hz => ?_⟩ + obtain ⟨k, hk⟩ := hB m hm T hT + have hi : Marked.redCount (realizeC m T a) < Marked.redCount (realizeC m T b) := by + simpa only [realizeC_redCount m T hz] using hg + exact ⟨k, hk, red_head_color hh m T hT, (red_head_origin hh m T hT).growth_dup hi, hi⟩ + +theorem tower_streamC (n : Nat) (T : Marked) : + Marked.stream (blcCode (SelfintZero.tower n)) T = + zerosC (2 * n) (Marked.stream (blcCode (.lam (.var 0))) T) := by + induction n with + | zero => rfl + | succ n ih => + have he : 2 * (n + 1) = (2 * n + 1) + 1 := by omega + change Marked.pair (Marked.bit false) (Marked.pair (Marked.bit false) + (Marked.stream (blcCode (SelfintZero.tower n)) T)) = _ + rw [he] + simp only [zerosC, ih] + +/-- The finite-prefix event occurs on every sufficiently long valid +lambda-tower source and every closed suffix. The initial coloring marks +precisely the remainder program's lambdas red and the whole input blue. -/ +theorem growth_on_towers (R : Term) {n : Nat} {a b : Q} + (ht : Trace n (.app (embed R) (.z 0)) a) + (hh : RedHead a b) (hg : SelfintZero.red a < SelfintZero.red b) : + ∃ B, ∀ j, B ≤ j → ∀ N, Closed N → + ∃ k x y, ColorTrace k (.app (Marked.red R) + (Marked.stream (blcCode (SelfintZero.tower j)) (blue N))) x ∧ + ColorHead x y ∧ Marked.CodeDup x y ∧ Marked.redCount x < Marked.redCount y := by + obtain ⟨B, hB⟩ := finite_growth_color ht hh hg + refine ⟨B, fun j hj N hN => ?_⟩ + let T := Marked.stream (blcCode (.lam (.var 0))) (blue N) + have hT : Closed (Marked.erase T) := by + simp only [T, Marked.erase_stream, blue_erase] + exact streamOf_closed _ hN + have hz : Marked.redCount T = 0 := by + simp only [T, Marked.redCount_stream, blue_redCount] + obtain ⟨k, hk, hh, hdup, hinc⟩ := hB (2 * j) (by omega) T hT hz + have he : realizeC (2 * j) T (.app (embed R) (.z 0)) = + .app (Marked.red R) (Marked.stream (blcCode (SelfintZero.tower j)) (blue N)) := by + simp only [realizeC, interpC, interpC_embed, Nat.sub_zero, tower_streamC, T] + rw [he] at hk + exact ⟨k, _, _, hk, hh, hdup, hinc⟩ + +theorem colored_input_erase (R M N : Term) : + Marked.erase (.app (Marked.red R) (Marked.stream (blcCode M) (blue N))) = + .app R (streamOf (blcCode M) N) := by + simp only [Marked.erase, Marked.erase_red, Marked.erase_stream, blue_erase] + +/-- Every closed exact remainder extractor has actual weak-head source-code +growth on all sufficiently long valid lambda-tower inputs. Input and suffix +lambdas are blue throughout; only residual copies of the original R count red. +The selected growth contraction itself is red and copies a red-containing operand. -/ +theorem remainder_grows_on_towers (R : Term) (hc : Closed R) + (hR : ∀ M, Closed M → ∀ N, Closed N → + BetaJoin (.app R (streamOf (blcCode M) N)) N) : + ∃ B, ∀ j, B ≤ j → ∀ N, Closed N → + ∃ k x y, ColorTrace k (.app (Marked.red R) + (Marked.stream (blcCode (SelfintZero.tower j)) (blue N))) x ∧ + ColorHead x y ∧ Marked.CodeDup x y ∧ Marked.redCount x < Marked.redCount y := by + obtain ⟨n, a, b, ht, hh, hg⟩ := SelfintGrowth.remainder_growth R hc hR + exact growth_on_towers R ht hh hg + +end Blc.SelfintGrowthColored diff --git a/lean/Blc/SelfintGrowthCounters.lean b/lean/Blc/SelfintGrowthCounters.lean new file mode 100644 index 00000000..9b923267 --- /dev/null +++ b/lean/Blc/SelfintGrowthCounters.lean @@ -0,0 +1,240 @@ +/- +Eventual stability of the source-lambda, permanent-block, and nonflat-lambda +counters along an infinite nongrowing deterministic head execution. +-/ +import Blc.SelfintGrowthHead + +namespace Blc.SelfintGrowthCounters +open Term SelfintZero SelfintGrowthBlue SelfintGrowthBlocks SelfintGrowthOrigins SelfintGrowthHead + +private theorem decreasing_tail (g : Nat → Nat) (h : ∀ n, g (n + 1) ≤ g n) + (i j : Nat) (hij : i ≤ j) : g j ≤ g i := by + have hh : ∀ k, g (i + k) ≤ g i := by + intro k + induction k with + | zero => exact Nat.le_refl _ + | succ k ih => + have hk := Nat.le_trans (h (i + k)) ih + simpa only [Nat.add_assoc] using hk + obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le hij + exact hh k + +/-- A nonincreasing natural sequence eventually reaches its least attained value. -/ +theorem decreasing_stable (g : Nat → Nat) (h : ∀ n, g (n + 1) ≤ g n) : + ∃ N, ∀ n, N ≤ n → g n = g N := by + classical + have aux : ∀ k, ∀ g : Nat → Nat, g 0 = k → (∀ n, g (n + 1) ≤ g n) → + ∃ N, ∀ n, N ≤ n → g n = g N := by + intro k + induction k using Nat.strongRecOn with + | ind k ih => + intro g hg hh + by_cases hd : ∃ j, g j < g 0 + · obtain ⟨j, hj⟩ := hd + obtain ⟨N, hN⟩ := ih (g j) (by omega) (fun n => g (j + n)) + (by simp only [Nat.add_zero]) (by + intro n + simpa only [Nat.add_assoc] using hh (j + n)) + refine ⟨j + N, fun n hn => ?_⟩ + obtain ⟨i, rfl⟩ := Nat.exists_eq_add_of_le (show j ≤ n by omega) + exact hN i (by omega) + · refine ⟨0, fun n _ => ?_⟩ + have hlo : g 0 ≤ g n := by + by_cases he : g n < g 0 + · exact (hd ⟨n, he⟩).elim + · omega + have hhi := decreasing_tail g hh 0 n (Nat.zero_le _) + omega + exact aux (g 0) g rfl h + +/-- The same stabilization result after a finite prefix. -/ +theorem decreasing_stable_from (g : Nat → Nat) (N : Nat) + (h : ∀ n, N ≤ n → g (n + 1) ≤ g n) : + ∃ M, N ≤ M ∧ ∀ n, M ≤ n → g n = g M := by + obtain ⟨k, hk⟩ := decreasing_stable (fun i => g (N + i)) (by + intro i + simpa only [Nat.add_assoc] using h (N + i) (by omega)) + refine ⟨N + k, by omega, fun n hn => ?_⟩ + obtain ⟨i, rfl⟩ := Nat.exists_eq_add_of_le (show N ≤ n by omega) + exact hk i (by omega) + +/-- A bounded nondecreasing counter also stabilizes after a finite prefix. -/ +theorem increasing_stable_from (g : Nat → Nat) (N B : Nat) + (h : ∀ n, N ≤ n → g n ≤ g (n + 1)) + (hb : ∀ n, N ≤ n → g n ≤ B) : + ∃ M, N ≤ M ∧ ∀ n, M ≤ n → g n = g M := by + obtain ⟨M, hNM, hM⟩ := decreasing_stable_from (fun n => B - g n) N (by + intro n hn + have hh := h n hn + omega) + refine ⟨M, hNM, fun n hn => ?_⟩ + have he := hM n hn + have hbn := hb n (by omega) + have hbM := hb M hNM + omega + +theorem norm_red_le {t u : Q} (h : Head t u) (hr : red u ≤ red t) : + red (norm u) ≤ red (norm t) := by + rcases head_norm_noGrowth h hr with he | ⟨v, hv, he, hvr⟩ + · rw [he]; exact Nat.le_refl _ + · have hn := norm_red v + rw [he] at hn + omega + +/-- Once the canonical source-lambda count is unchanged, blocks cannot +disappear and nonflat lambdas cannot be added across an actual head step. -/ +theorem norm_counters_le {t u : Q} (h : Head t u) (hc : ClosedQ t) + (hr : red u ≤ red t) (he : red (norm u) = red (norm t)) : + blocks (norm t) ≤ blocks (norm u) ∧ bad (norm u) ≤ bad (norm t) := by + cases h with + | data h => + have hn : norm t = norm u := congrArg val h.data.deep_eq + rw [hn] + exact ⟨Nat.le_refl _, Nat.le_refl _⟩ + | red h => + obtain ⟨v, hv, hn, hvr⟩ := h.norm_noGrowth hr + have hnr := norm_red v + have hvred : red v = red (norm t) := by rw [hn] at hnr; omega + have hedata : red (norm v) = red v := by rw [hn]; omega + have hb₁ := head_blocks_le hv hvred + have hb₂ := data_steps_blocks_le (norm_sound v) hedata + have ha₁ := head_bad_le hv (norm_freeUnder t 0 hc) hvred + have ha₂ := data_steps_bad_le (norm_sound v) + rw [hn] at hb₂ ha₂ + exact ⟨Nat.le_trans hb₁ hb₂, Nat.le_trans ha₂ ha₁⟩ + +theorem execution_closed (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) + (hc : ClosedQ (f 0)) (n : Nat) : ClosedQ (f n) := by + induction n with + | zero => exact hc + | succ n ih => exact (h n).closed ih + +/-- All three canonical counters stabilize after one finite position. +The proof chooses attained minima; it does not impose a computable cutoff. -/ +theorem counters_stable (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) + (hc : ClosedQ (f 0)) (hr : ∀ n, red (f (n + 1)) ≤ red (f n)) : + ∃ N, ∀ n, N ≤ n → + red (norm (f n)) = red (norm (f N)) ∧ + blocks (norm (f n)) = blocks (norm (f N)) ∧ + bad (norm (f n)) = bad (norm (f N)) := by + obtain ⟨R, hR⟩ := decreasing_stable (fun n => red (norm (f n))) + (fun n => norm_red_le (h n) (hr n)) + have hm : ∀ n, R ≤ n → + blocks (norm (f n)) ≤ blocks (norm (f (n + 1))) ∧ + bad (norm (f (n + 1))) ≤ bad (norm (f n)) := by + intro n hn + apply norm_counters_le (h n) (execution_closed f h hc n) (hr n) + exact (hR (n + 1) (by omega)).trans (hR n hn).symm + obtain ⟨B, hRB, hB⟩ := increasing_stable_from (fun n => blocks (norm (f n))) R + (red (norm (f R))) (fun n hn => (hm n hn).1) (by + intro n hn + have hh := blocks_le_red (norm (f n)) + rw [hR n hn] at hh + exact hh) + obtain ⟨N, hBN, hN⟩ := decreasing_stable_from (fun n => bad (norm (f n))) B + (fun n hn => (hm n (by omega)).2) + refine ⟨N, fun n hn => ?_⟩ + exact ⟨(hR n (by omega)).trans (hR N (by omega)).symm, + (hB n (by omega)).trans (hB N hBN).symm, hN n hn⟩ + +/-- A canonical constant-count head event whose contractor is flat and +whose copied one-lambda operand has no permanent block. -/ +inductive CleanHead : Q → Q → Prop where + | beta (b a : Q) : Flat (.lam b) → oc 0 b = 2 → red a = 1 → blocks a = 0 → + CleanHead (.app (.lam b) a) (substQ 0 a b) + | left {f g : Q} (a : Q) : CleanHead f g → CleanHead (.app f a) (.app g a) + +theorem CleanHead.head {t u : Q} (h : CleanHead t u) : RedHead t u := by + induction h with + | beta b a => exact .beta _ _ + | left a h ih => exact .left _ ih + +theorem CleanHead.red_eq {t u : Q} (h : CleanHead t u) : red u = red t := by + induction h with + | beta b a hf hk ha hb => simp only [red_subst, red, hk, ha] + | left a h ih => exact congrArg (· + red a) ih + +theorem CleanHead.not_bad {t u v : Q} (h : CleanHead t u) : ¬ BadHead t v := by + induction h generalizing v with + | beta b a hf hk ha hb => + intro hn + cases hn with + | beta b a hnf => exact hnf hf + | left a h => cases h + | left a h ih => + intro hn + cases hn with + | beta b a => cases h + | left a hn => exact ih hn + +theorem CleanHead.not_block {t u v : Q} (h : CleanHead t u) : ¬ CopiesBlock t v := by + induction h generalizing v with + | beta b a hf hk ha hb => + intro hn + cases hn with + | beta b a hp => omega + | left a h => cases h + | left a h ih => + intro hn + cases hn with + | beta b a => cases h + | left a hn => exact ih hn + +theorem clean_of_no_bad_block {t u : Q} (h : RedHead t u) + (hr : red u = red t) (hn : ¬ BadHead t u) (hb : ¬ CopiesBlock t u) : + CleanHead t u := by + induction h with + | beta b a => + have hf : Flat (.lam b) := by + by_cases hf : Flat (.lam b) + · exact hf + · exact (hn (.beta b a hf)).elim + obtain ⟨hk, ha⟩ := constant_beta_parameters b a hr + have hz : blocks a = 0 := by + by_cases he : blocks a = 0 + · exact he + · exact (hb (.beta b a (by omega))).elim + exact .beta b a hf hk ha hz + | @left f g a h ih => + have he : red g = red f := by simp only [red] at hr; omega + exact .left a (ih he (fun h => hn (.left a h)) (fun h => hb (.left a h))) + +/-- Equal stable counters force a clean head event before the following +finite data normalization. The strict bad/block lemmas handle the whole +function spine, so no head-layout premise is hidden here. -/ +theorem stable_event_clean {t u : Q} (h : RedHead t u) (hc : ClosedQ t) + (hr : red u ≤ red t) (hre : red (norm u) = red t) + (hb : blocks (norm u) = blocks t) (ha : bad (norm u) = bad t) : + CleanHead t u := by + have hnr := norm_red u + have he : red u = red t := by omega + have hnd : red (norm u) = red u := by omega + apply clean_of_no_bad_block h he + · intro hn + have hs := hn.strict hc he + have hd := data_steps_bad_le (norm_sound u) + omega + · intro hn + have hs := hn.strict he + have hd := data_steps_blocks_le (norm_sound u) hnd + omega + +/-- After one finite position every actual program head induces a clean +canonical head event, with a flat contractor and an unblocked one-code operand. -/ +theorem eventually_clean (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) + (hc : ClosedQ (f 0)) (hr : ∀ n, red (f (n + 1)) ≤ red (f n)) : + ∃ N, ∀ n, N ≤ n → RedHead (f n) (f (n + 1)) → + ∃ v, RedHead (norm (f n)) v ∧ norm v = norm (f (n + 1)) ∧ + CleanHead (norm (f n)) v := by + obtain ⟨N, hN⟩ := counters_stable f h hc hr + refine ⟨N, fun n hn hh => ?_⟩ + obtain ⟨v, hv, he, hvr⟩ := hh.norm_noGrowth (hr n) + have hcq := norm_freeUnder (f n) 0 (execution_closed f h hc n) + have ha := hN n hn + have hb := hN (n + 1) (by omega) + refine ⟨v, hv, he, stable_event_clean hv hcq hvr ?_ ?_ ?_⟩ + · rw [he]; exact hb.1.trans ha.1.symm + · rw [he]; exact hb.2.1.trans ha.2.1.symm + · rw [he]; exact hb.2.2.trans ha.2.2.symm + +end Blc.SelfintGrowthCounters diff --git a/lean/Blc/SelfintGrowthHead.lean b/lean/Blc/SelfintGrowthHead.lean index ac712b23..fced6823 100644 --- a/lean/Blc/SelfintGrowthHead.lean +++ b/lean/Blc/SelfintGrowthHead.lean @@ -178,17 +178,19 @@ theorem closed_terminal {t : Q} (hc : ClosedQ t) (hn : next t = none) : Done t : after each position: data steps alone cannot form an infinite suffix. -/ theorem infinite_red (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) (n : Nat) : ∃ k, n ≤ k ∧ RedHead (f k) (f (k + 1)) := by - classical - apply Classical.byContradiction - intro hn - have hd : ∀ k, DataStep (f (n + k)) (f (n + k + 1)) := by - intro k - cases h (n + k) with - | red hr => exact (hn ⟨n + k, by omega, hr⟩).elim - | data hd => exact hd.data - exact no_infinite_data (fun k => f (n + k)) (by - intro k - simpa only [Nat.add_assoc] using hd k) + have aux : ∀ c, ∀ n, cost (f n) = c → + ∃ k, n ≤ k ∧ RedHead (f k) (f (k + 1)) := by + intro c + induction c using Nat.strongRecOn with + | ind c ih => + intro n hn + cases h n with + | red hr => exact ⟨n, Nat.le_refl _, hr⟩ + | data hd => + obtain ⟨k, hk, hr⟩ := ih (cost (f (n + 1))) + (hn ▸ data_cost_lt hd.data) (n + 1) rfl + exact ⟨k, by omega, hr⟩ + exact aux (cost (f n)) n rfl /-- Full data normalization stutters at data heads and preserves every nongrowing program head as one nongrowing program head followed by data. -/ diff --git a/lean/Blc/SelfintGrowthSequence.lean b/lean/Blc/SelfintGrowthSequence.lean new file mode 100644 index 00000000..e60b504a --- /dev/null +++ b/lean/Blc/SelfintGrowthSequence.lean @@ -0,0 +1,125 @@ +/- +Selection of canonical program-head events from an actual infinite head +execution. The omitted actual steps are data heads, so their normal forms +stutter and successive selected events fit together exactly. +-/ +import Blc.SelfintGrowthCounters + +namespace Blc.SelfintGrowthSequence +open Term SelfintZero SelfintGrowthBlue SelfintGrowthBlocks SelfintGrowthOrigins +open SelfintGrowthHead SelfintGrowthCounters + +/-- The next program event can be reached through only finitely many +data heads; its starting data normal form is the current one. -/ +theorem next_red (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) (n : Nat) : + ∃ k, n ≤ k ∧ RedHead (f k) (f (k + 1)) ∧ norm (f k) = norm (f n) := by + have aux : ∀ c, ∀ n, cost (f n) = c → + ∃ k, n ≤ k ∧ RedHead (f k) (f (k + 1)) ∧ norm (f k) = norm (f n) := by + intro c + induction c using Nat.strongRecOn with + | ind c ih => + intro n hn + cases h n with + | red hr => exact ⟨n, Nat.le_refl _, hr, rfl⟩ + | data hd => + have hc : cost (f (n + 1)) < c := hn ▸ data_cost_lt hd.data + obtain ⟨k, hk, hr, he⟩ := ih (cost (f (n + 1))) hc (n + 1) rfl + exact ⟨k, by omega, hr, he.trans (hd.data.deep_eq |> congrArg val).symm⟩ + exact aux (cost (f n)) n rfl + +noncomputable def nextIndex (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) + (n : Nat) : Nat := Classical.choose (next_red f h n) + +theorem nextIndex_spec (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) (n : Nat) : + n ≤ nextIndex f h n ∧ + RedHead (f (nextIndex f h n)) (f (nextIndex f h n + 1)) ∧ + norm (f (nextIndex f h n)) = norm (f n) := Classical.choose_spec (next_red f h n) + +noncomputable def indices (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) + (N : Nat) : Nat → Nat + | 0 => nextIndex f h N + | n + 1 => nextIndex f h (indices f h N n + 1) + +theorem indices_ge (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) (N i : Nat) : + N ≤ indices f h N i := by + induction i with + | zero => exact (nextIndex_spec f h N).1 + | succ i ih => + have hh := (nextIndex_spec f h (indices f h N i + 1)).1 + change N ≤ nextIndex f h (indices f h N i + 1) + omega + +theorem indices_strict (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) (N i : Nat) : + indices f h N i < indices f h N (i + 1) := + (nextIndex_spec f h (indices f h N i + 1)).1 + +theorem indices_head (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) (N i : Nat) : + RedHead (f (indices f h N i)) (f (indices f h N i + 1)) := by + cases i with + | zero => exact (nextIndex_spec f h N).2.1 + | succ i => exact (nextIndex_spec f h (indices f h N i + 1)).2.1 + +theorem indices_norm_next (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) (N i : Nat) : + norm (f (indices f h N (i + 1))) = norm (f (indices f h N i + 1)) := + (nextIndex_spec f h (indices f h N i + 1)).2.2 + +/-- Every selected index retains a finite actual execution prefix. -/ +theorem execution_trace (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) (i : Nat) : + ∃ n, Trace n (f 0) (f i) := by + induction i with + | zero => exact ⟨0, .refl _⟩ + | succ i ih => + obtain ⟨n, hn⟩ := ih + obtain ⟨m, hm⟩ := (h i).trace + exact ⟨n + m, hn.trans hm⟩ + +/-- All selected canonical states are closed and nonterminal, each edge +is one clean program head followed by data normalization, and all three +counters are constant. The indices also retain actual finite prefixes. -/ +theorem stable_sequence (f : Nat → Q) (h : ∀ n, Head (f n) (f (n + 1))) + (hc : ClosedQ (f 0)) (hr : ∀ n, red (f (n + 1)) ≤ red (f n)) : + ∃ index : Nat → Nat, + (∀ i, index i < index (i + 1)) ∧ + (∀ i, ∃ n, Trace n (f 0) (f (index i))) ∧ + (∀ i, ClosedQ (norm (f (index i)))) ∧ + (∀ i, norm (norm (f (index i))) = norm (f (index i))) ∧ + (∀ i, ¬ Done (norm (f (index i)))) ∧ + (∀ i, ∃ u, RedHead (norm (f (index i))) u ∧ + norm (f (index (i + 1))) = norm u ∧ CleanHead (norm (f (index i))) u) ∧ + (∀ i, red (norm (f (index (i + 1)))) = red (norm (f (index i))) ∧ + blocks (norm (f (index (i + 1)))) = blocks (norm (f (index i))) ∧ + bad (norm (f (index (i + 1)))) = bad (norm (f (index i)))) := by + obtain ⟨N, hN⟩ := counters_stable f h hc hr + let index := indices f h N + have hidx : ∀ i, N ≤ index i := indices_ge f h N + have hclosed : ∀ i, ClosedQ (norm (f (index i))) := fun i => + norm_freeUnder _ 0 (SelfintGrowthCounters.execution_closed f h hc _) + have hcounts : ∀ i, + red (norm (f (index (i + 1)))) = red (norm (f (index i))) ∧ + blocks (norm (f (index (i + 1)))) = blocks (norm (f (index i))) ∧ + bad (norm (f (index (i + 1)))) = bad (norm (f (index i))) := by + intro i + have ha := hN (index i) (hidx i) + have hb := hN (index (i + 1)) (hidx (i + 1)) + exact ⟨hb.1.trans ha.1.symm, hb.2.1.trans ha.2.1.symm, hb.2.2.trans ha.2.2.symm⟩ + have hnext : ∀ i, ∃ u, RedHead (norm (f (index i))) u ∧ + norm (f (index (i + 1))) = norm u ∧ CleanHead (norm (f (index i))) u := by + intro i + obtain ⟨u, hu, he, hue⟩ := (indices_head f h N i).norm_noGrowth (hr (index i)) + have hn : norm (f (index (i + 1))) = norm u := + (indices_norm_next f h N i).trans he.symm + have hh := hcounts i + refine ⟨u, hu, hn, stable_event_clean hu (hclosed i) hue ?_ ?_ ?_⟩ + · rw [← hn]; exact hh.1 + · rw [← hn]; exact hh.2.1 + · rw [← hn]; exact hh.2.2 + have hnot : ∀ i, ¬ Done (norm (f (index i))) := by + intro i hd + obtain ⟨u, hu, _, _⟩ := hnext i + have hs := red_next hu + rw [done_next hd] at hs + cases hs + exact ⟨index, indices_strict f h N, fun i => execution_trace f h (index i), + hclosed, fun _ => norm_idempotent _, hnot, hnext, hcounts⟩ + +end Blc.SelfintGrowthSequence diff --git a/lean/Blc/SelfintGrowthSpine.lean b/lean/Blc/SelfintGrowthSpine.lean new file mode 100644 index 00000000..d79f919a --- /dev/null +++ b/lean/Blc/SelfintGrowthSpine.lean @@ -0,0 +1,107 @@ +/- +Canonical head decomposition and extraction of the first stable operand. +No eventuality or infinite execution is assumed in these finite lemmas. +-/ +import Blc.SelfintGrowthOrigins +import Blc.SelfintGrowthTrace + +namespace Blc.SelfintGrowthSpine +open Term SelfintZero SelfintGrowthBlue SelfintGrowthBlocks SelfintGrowthOrigins +open SelfintGrowthStable + +/-- A canonical closed program-head event exposes a canonical closed +operand and pending spine; the contractor body is canonical as well. -/ +theorem decompose {t u : Q} (h : RedHead t u) (hn : norm t = t) (hc : ClosedQ t) : + ∃ b a pending, + t = apps (.app (.lam b) a) pending ∧ + u = apps (substQ 0 a b) pending ∧ + norm b = b ∧ norm a = a ∧ FreeUnder 1 (erase b) ∧ ClosedQ a ∧ + ∀ v ∈ pending, norm (val v) = val v ∧ ClosedQ (val v) := by + induction h with + | beta b a => + change Q.app (.lam (norm b)) (norm a) = Q.app (.lam b) a at hn + obtain ⟨hb, ha⟩ := Q.app.inj hn + exact ⟨b, a, [], rfl, rfl, Q.lam.inj hb, ha, hc.1, hc.2, by simp⟩ + | @left f g a h ih => + rw [norm_app_neutral f a h.neutral] at hn + obtain ⟨hfn, han⟩ := Q.app.inj hn + obtain ⟨b, arg, pending, hft, hgt, hbn, hargn, hbc, hargc, hp⟩ := ih hfn hc.1 + refine ⟨b, arg, pending ++ [deep a], ?_, ?_, hbn, hargn, hbc, hargc, ?_⟩ + · rw [apps_snoc] + change Q.app f a = Q.app (apps (.app (.lam b) arg) pending) (norm a) + rw [← hft, han] + · rw [apps_snoc] + change Q.app g a = Q.app (apps (substQ 0 arg b) pending) (norm a) + rw [← hgt, han] + · intro v hv + rcases List.mem_append.mp hv with hv | hv + · exact hp v hv + · have he : v = deep a := by simpa only [List.mem_singleton] using hv + subst v + exact ⟨norm_idempotent a, by change ClosedQ (norm a); rw [han]; exact hc.2⟩ + +theorem bad_head_apps {t u : Q} (h : BadHead t u) (pending : List V) : + BadHead (apps t pending) (apps u pending) := by + induction pending generalizing t u with + | nil => exact h + | cons v pending ih => exact ih (.left (val v) h) + +theorem copies_block_apps {t u : Q} (h : CopiesBlock t u) (pending : List V) : + CopiesBlock (apps t pending) (apps u pending) := by + induction pending generalizing t u with + | nil => exact h + | cons v pending ih => exact ih (.left (val v) h) + +theorem wraps_injective (n : Nat) {t u : Q} (h : wraps n t = wraps n u) : t = u := by + induction n with + | zero => exact h + | succ n ih => exact ih (Q.app.inj h).2 + +/-- Absence of the two finitely counted bad events exposes the wrapped +flat operand needed by the stable-spine transition theorem. -/ +theorem stable_operand {t u : Q} (h : RedHead t u) (hn : norm t = t) (hc : ClosedQ t) + (hr : red u = red t) (hf : ¬ BadHead t u) (hz : ¬ CopiesBlock t u) : + ∃ b d n pending, + t = apps (.app (.lam b) (wraps n (.lam d))) pending ∧ + u = apps (substQ 0 (wraps n (.lam d)) b) pending ∧ + red b = 0 ∧ oc 0 b = 2 ∧ norm b = b ∧ FreeUnder 1 (erase b) ∧ + red d = 0 ∧ ClosedQ (.lam d) ∧ norm (.lam d) = .lam d ∧ + ∀ v ∈ pending, norm (val v) = val v ∧ ClosedQ (val v) := by + obtain ⟨b, a, pending, ht, hu, hbn, han, hbc, hac, hp⟩ := decompose h hn hc + have hred : red (substQ 0 a b) = red (.app (.lam b) a) := by + rw [ht, hu, apps_red, apps_red] at hr + omega + obtain ⟨hk, ha⟩ := constant_beta_parameters b a hred + have hflat : Flat (.lam b) := by + by_cases hfl : Flat (.lam b) + · exact hfl + · have he := bad_head_apps (.beta b a hfl) pending + rw [← ht, ← hu] at he + exact (hf he).elim + have hblock : blocks a = 0 := by + by_cases hbl : blocks a = 0 + · exact hbl + · have he := copies_block_apps (.beta b a (Nat.pos_of_ne_zero hbl)) pending + rw [← ht, ← hu] at he + exact (hz he).elim + obtain ⟨n, d, he, hd, hdc⟩ := one_red_unblocked (deep a) + (by change ClosedQ (norm a); rw [han]; exact hac) + (by change red (norm a) = 1; rw [han]; exact ha) + (by change blocks (norm a) = 0; rw [han]; exact hblock) + change norm a = wraps n (.lam d) at he + rw [han] at he + have hdn : norm (.lam d) = .lam d := by + rw [he, wraps_norm] at han + exact wraps_injective n han + exact ⟨b, d, n, pending, he ▸ ht, he ▸ hu, hflat.1, hk, hbn, hbc, hd, hdc, hdn, hp⟩ + +/-- Constant count at an exposed canonical self-copy spine forces its +template to be binary, independently of the pending arguments. -/ +theorem spine_binary (b a u : Q) (pending : List V) + (h : RedHead (apps (.app (.lam b) a) pending) u) + (hr : red u = red (apps (.app (.lam b) a) pending)) : oc 0 b = 2 ∧ red a = 1 := by + have he := SelfintGrowthTrace.head_deterministic h (apps_head (.beta b a) pending) + rw [he, apps_red, apps_red] at hr + exact constant_beta_parameters b a (by omega) + +end Blc.SelfintGrowthSpine diff --git a/lean/Blc/SelfintGrowthTrace.lean b/lean/Blc/SelfintGrowthTrace.lean new file mode 100644 index 00000000..34ac5aa3 --- /dev/null +++ b/lean/Blc/SelfintGrowthTrace.lean @@ -0,0 +1,193 @@ +/- +Trace closure of the stable fixed-template spine. The bound applies to +every selected data step and is independent of constant-wrapper depth. +-/ +import Blc.SelfintGrowthStable +import Blc.SelfintGrowthSimulation + +namespace Blc.SelfintGrowthTrace +open Term SelfintZero SelfintGrowthBlue SelfintGrowthBlocks SelfintGrowthStable +open SelfintGrowthLabels SelfintGrowthSimulation + +theorem apps_step {f g : Q} (h : DataStep f g) (vs : List V) : + DataStep (SelfintGrowthStable.apps f vs) (SelfintGrowthStable.apps g vs) := by + induction vs generalizing f g with + | nil => exact h + | cons v vs ih => exact ih (.left (val v) h) + +theorem apps_boundTrace {l : Nat} {f g : Q} (h : BoundTrace l f g) (vs : List V) + (hv : ∀ v ∈ vs, Bounded l (val v)) : + BoundTrace l (SelfintGrowthStable.apps f vs) (SelfintGrowthStable.apps g vs) := by + induction vs generalizing f g with + | nil => exact h + | cons v vs ih => + exact ih (h.left (val v) (hv v (by simp))) + (fun w hw => hv w (List.mem_cons_of_mem v hw)) + +/-- Peeling wrappers performs only K erasures, so it does not increase +the label bound even when the number of wrappers is unbounded. -/ +theorem peel_trace (f : Q) (pre post : List V) (l : Nat) (hf : Bounded l f) + (hv : ∀ v ∈ pre ++ post, Bounded l (val v)) : + BoundTrace l (SelfintGrowthStable.apps (wraps pre.length f) (pre ++ post)) + (SelfintGrowthStable.apps f post) := by + induction pre with + | nil => exact .refl _ ((apps_bounded f post l).mpr ⟨hf, hv⟩) + | cons v pre ih => + have hb : Bounded l (SelfintGrowthStable.apps (wraps (v :: pre).length f) + ((v :: pre) ++ post)) := + (apps_bounded _ _ _).mpr ⟨(wraps_bounded _ _ _).mpr hf, hv⟩ + have ht := ih (fun w hw => hv w (List.mem_cons_of_mem v hw)) + exact .head hb (apps_step (.k (wraps pre.length f) (val v)) (pre ++ post)) ht + +theorem boundTrace_run {l : Nat} {t u : Q} (h : BoundTrace l t u) : Run l 0 t u := by + induction h with + | refl t _ => exact .refl _ + | head hb hd _ ih => exact .data hb hd ih + +theorem run_trans {l n m : Nat} {t u v : Q} (h : Run l n t u) (g : Run l m u v) : + Run l (n + m) t v := by + induction h with + | refl => simpa only [Nat.zero_add] using g + | data hb hd _ ih => exact .data hb hd (ih g) + | head hd _ ih => + simpa only [Nat.add_assoc, Nat.add_comm, Nat.add_left_comm] using Run.head hd (ih g) + +/-- Once local normalization has produced a wrapped normal lambda spine, +the rest of global normalization merely erases old pending arguments. -/ +theorem wrapped_spine_trace (raw f : Q) (m l : Nat) (pending : List V) + (htrace : BoundTrace l raw (norm raw)) + (hshape : norm raw = wraps m f) (hf : ∃ n, deep f = .neu n) (hfn : norm f = f) + (hp : ∀ v ∈ pending, norm (val v) = val v) + (hpb : ∀ v ∈ pending, Bounded l (val v)) + (hn : ¬ Done (norm (SelfintGrowthStable.apps raw pending))) : + BoundTrace l (SelfintGrowthStable.apps raw pending) + (norm (SelfintGrowthStable.apps raw pending)) := by + have hglobal : norm (SelfintGrowthStable.apps raw pending) = + norm (SelfintGrowthStable.apps (wraps m f) pending) := by + rw [(apps_data (norm_sound raw) pending).norm_eq, hshape] + obtain ⟨pre, post, he, hm, hpeel⟩ := peel_wrappers m f pending (hglobal ▸ hn) + have hfb : Bounded l f := (wraps_bounded m f l).mp (hshape ▸ htrace.finish) + have hpost : ∀ v ∈ post, norm (val v) = val v := by + intro v hv + apply hp v + rw [he] + exact List.mem_append_right pre hv + have heq : norm (SelfintGrowthStable.apps raw pending) = + SelfintGrowthStable.apps f post := + hglobal.trans (hpeel.trans (norm_apps_fixed f post hf hfn hpost)) + have hfirst := apps_boundTrace htrace pending hpb + rw [hshape] at hfirst + have hlast := peel_trace f pre post l hfb (he ▸ hpb) + rw [hm, ← he] at hlast + rw [heq] + exact hfirst.trans hlast + +/-- One whole stable transition has the fixed-body label bound, including +every intermediate data state and arbitrarily many wrapper erasures. -/ +theorem stable_spine_run (b d : Q) (n l L : Nat) (pending : List V) + (hb : red b = 0) (hk : oc 0 b = 2) (hbc : FreeUnder 1 (erase b)) + (hd : red d = 0) (hdc : ClosedQ (.lam d)) (hdn : norm (.lam d) = .lam d) + (hp : ∀ v ∈ pending, norm (val v) = val v) + (hpb : ∀ v ∈ pending, Bounded L (val v)) + (hbl : Bounded l b) (hdl : Bounded l (.lam d)) + (hL : l + 5 * SelfintGrowthLabels.apps b ≤ L) + (hr : red (norm (SelfintGrowthStable.apps (substQ 0 (wraps n (.lam d)) b) pending)) = + red (SelfintGrowthStable.apps (.app (.lam b) (wraps n (.lam d))) pending)) + (hz : blocks (norm (SelfintGrowthStable.apps (substQ 0 (wraps n (.lam d)) b) pending)) = + blocks (SelfintGrowthStable.apps (.app (.lam b) (wraps n (.lam d))) pending)) + (hn : ¬ Done (norm (SelfintGrowthStable.apps (substQ 0 (wraps n (.lam d)) b) pending))) : + Run L 1 (SelfintGrowthStable.apps (.app (.lam b) (wraps n (.lam d))) pending) + (norm (SelfintGrowthStable.apps (substQ 0 (wraps n (.lam d)) b) pending)) := by + obtain ⟨m, q, vs, he, _⟩ := flat_spine_transition b d n pending hb hk hbc hd hdc hdn hr hz + let f := SelfintGrowthStable.apps (.app (.lam d) (wraps q (.lam d))) vs + have hf : ∃ a, deep f = .neu a := apps_deep_neutral _ vs ⟨_, rfl⟩ + have hfn : ∃ a, deep (norm f) = .neu a := by rw [deep_norm]; exact hf + have he' : norm (substQ 0 (wraps n (.lam d)) b) = wraps m (norm f) := by + calc + _ = norm (norm (substQ 0 (wraps n (.lam d)) b)) := (norm_idempotent _).symm + _ = norm (wraps m f) := congrArg norm he + _ = wraps m (norm f) := wraps_norm m f + obtain ⟨k, hk', ht⟩ := flat_body_bound b (.lam d) n l hb hdn hbl hdl + have htl : BoundTrace L (substQ 0 (wraps n (.lam d)) b) + (norm (substQ 0 (wraps n (.lam d)) b)) := + ht.mono (Nat.le_trans (Nat.add_le_add_left hk' l) hL) + have hg := wrapped_spine_trace _ (norm f) m L pending htl he' hfn + (norm_idempotent f) hp hpb hn + exact .head (apps_head (.beta b (wraps n (.lam d))) pending) (boundTrace_run hg) + +theorem head_deterministic {t u v : Q} (h : RedHead t u) (g : RedHead t v) : u = v := by + induction h generalizing v with + | beta b a => + cases g with + | beta => rfl + | left _ h => cases h + | @left f g a h ih => + cases g with + | beta => cases h + | left _ hg => exact congrArg (fun t => Q.app t a) (ih hg) + +/-- A continuing canonical constant-count/block-count execution from a +flat binary self-copy state has a single label bound for every finite +prefix. Its pending arguments can carry arbitrary other code. -/ +theorem stable_sequence_runs (d : Q) (l L n₀ : Nat) (pending₀ : List V) + (state : Nat → Q) + (hd : red d = 0) (hk : oc 0 d = 2) (hdc : ClosedQ (.lam d)) + (hdn : norm (.lam d) = .lam d) (hdl : Bounded l (.lam d)) + (hL : l + 5 * SelfintGrowthLabels.apps d ≤ L) + (hp₀ : ∀ v ∈ pending₀, norm (val v) = val v) + (hb₀ : ∀ v ∈ pending₀, Bounded L (val v)) + (h₀ : state 0 = SelfintGrowthStable.apps (.app (.lam d) (wraps n₀ (.lam d))) pending₀) + (hs : ∀ i, ∃ u, RedHead (state i) u ∧ state (i + 1) = norm u) + (hr : ∀ i, red (state (i + 1)) = red (state i)) + (hz : ∀ i, blocks (state (i + 1)) = blocks (state i)) + (hn : ∀ i, ¬ Done (state (i + 1))) : + ∀ i, Run L i (state 0) (state i) := by + have hall : ∀ i, ∃ n pending, + state i = SelfintGrowthStable.apps (.app (.lam d) (wraps n (.lam d))) pending ∧ + (∀ v ∈ pending, norm (val v) = val v) ∧ + (∀ v ∈ pending, Bounded L (val v)) ∧ Run L i (state 0) (state i) := by + intro i + induction i with + | zero => exact ⟨n₀, pending₀, h₀, hp₀, hb₀, .refl _⟩ + | succ i ih => + obtain ⟨n, pending, he, hp, hb, hrun⟩ := ih + obtain ⟨u, hu, hnext⟩ := hs i + have hstep := apps_head (.beta d (wraps n (.lam d))) pending + rw [he] at hu + have hue := head_deterministic hu hstep + rw [hue] at hnext + have hre : red (norm (SelfintGrowthStable.apps (substQ 0 (wraps n (.lam d)) d) pending)) = + red (SelfintGrowthStable.apps (.app (.lam d) (wraps n (.lam d))) pending) := by + rw [← hnext, ← he] + exact hr i + have hze : blocks (norm (SelfintGrowthStable.apps (substQ 0 (wraps n (.lam d)) d) pending)) = + blocks (SelfintGrowthStable.apps (.app (.lam d) (wraps n (.lam d))) pending) := by + rw [← hnext, ← he] + exact hz i + have hne : ¬ Done (norm (SelfintGrowthStable.apps (substQ 0 (wraps n (.lam d)) d) pending)) := + hnext ▸ hn i + obtain ⟨q, pre, post, fresh, hpend, htarget, hfresh⟩ := + stable_spine_next d d n l pending hd hk hdc hd hdc hdn hp hdl hdl hre hze hne + have hpnext : ∀ v ∈ fresh ++ post, norm (val v) = val v := by + intro v hv + rcases List.mem_append.mp hv with hv | hv + · exact (hfresh v hv).2.1 + · apply hp v + rw [hpend] + exact List.mem_append_right pre hv + have hbnext : ∀ v ∈ fresh ++ post, Bounded L (val v) := by + intro v hv + rcases List.mem_append.mp hv with hv | hv + · exact bounded_mono _ hL (hfresh v hv).2.2 + · apply hb v + rw [hpend] + exact List.mem_append_right pre hv + have hone := stable_spine_run d d n l L pending hd hk hdc hd hdc hdn hp hb + hdl hdl hL hre hze hne + rw [← hnext, ← he] at hone + exact ⟨q, fresh ++ post, hnext.trans htarget, hpnext, hbnext, run_trans hrun hone⟩ + intro i + obtain ⟨_, _, _, _, _, hi⟩ := hall i + exact hi + +end Blc.SelfintGrowthTrace From ca07a01eefa0414dac567c7ab7e21849de559388 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 21:21:05 -0400 Subject: [PATCH 25/41] Narrow normal and compressed cheap-reader shapes --- docs/STATUS.md | 19 +- .../self-interpreter/cheap-tail-bound.md | 858 +++++++++++++++++- .../classical/self-interpreter/interpreter.md | 15 +- 3 files changed, 877 insertions(+), 15 deletions(-) diff --git a/docs/STATUS.md b/docs/STATUS.md index 9a2ccee5..cf950637 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -199,14 +199,23 @@ with all features (three opt-in tests ignored) and 328 with default features. no affine source redex and exactly four or five applications: the three-application normal cases and all nonlinear compression through four applications are excluded. A four-application minimum must be - beta-normal; the normal `(A,L,k)=(4,4,2)` shape is also excluded, - where `k` counts leading lambdas. Without free stream access, every + beta-normal, use the whole stream, and have at most one leading lambda: + all normal four-application cases without `s`, and all with two leading + lambdas, are excluded. With one leading lambda, only three or four + source lambdas remain; with no leading lambda, a candidate must be + affine and have at least four source lambdas. Without free stream access, every affine handler fails the variable law once `m>A(H)+2L(H)+5`; a separate live-binder-antichain obstruction also allows nonaffine redexes. These exclude all five-application nonlinear compression without free - `s`. The only remaining compressed leaf allocation is `u,u,j,c,s,v`, - where `u` is the contracted nonlinear binder and `v` belongs to one - affine source binder. Other normal shapes remain open + `s`. An index-tax classification excludes the remaining compressed + four-lambda cases, including proper copied-argument contexts. The only + remaining compressed allocation is `u,u,j,c,s,v` with three source + lambdas and `X≤6`, where `u` is the contracted nonlinear binder and + `v` belongs to one affine source binder. Every remaining normal + five-application candidate is stream-headed with no leading lambda: + either three lambdas with `X≤6`, or four with `X≤4`. The exclusions use + closed-helper classifications, guarded functional-index arguments, + and the zero-branch leaf budget. These remaining shapes are open (`classical/self-interpreter/cheap-tail-bound.md`, `classical/self-interpreter/protocol-obstructions.md`). The zero arm ≥ 14, APP lift ≥ 19, reader/handler knot-tree and cell/APP diff --git a/docs/classical/self-interpreter/cheap-tail-bound.md b/docs/classical/self-interpreter/cheap-tail-bound.md index 0a2f8c1b..4383fcc5 100644 --- a/docs/classical/self-interpreter/cheap-tail-bound.md +++ b/docs/classical/self-interpreter/cheap-tail-bound.md @@ -1813,6 +1813,238 @@ Thus all no-`s` five-application nonlinear compression is excluded. The only remaining compressed allocation at the improving budget is `u,u,j,c,s,v`, with `v` bound by one affine source lambda. +### Four lambdas cannot fit the remaining compressed allocation + +The following handwritten exclusion has been independently reviewed. It +uses the same rigid ambient frame and reader laws. Write `P=cons K R` on +the zero branch, whose target is `H K R P =β R j`; the variable target +remains `H F V S =β c V N`. + +Assume a minimum successful handler at at most 34 bits has A=5, L=4 and +the sole remaining leaf allocation + + u,u,j,c,s,v. + +The chosen redex is (lambda u.B) D, u occurs twice, and v is the sole +occurrence of a distinct live binder. The other two source binders are +vacuous. There is no affine source redex. In particular D is beta-normal. +Write d for the number of lambdas in D. + +#### The index budget as a sum of taxes + +The mandatory ambient indices contribute 1+2=3. For a source lambda l, +let its tax count every variable leaf in its body whose binder lies outside +l, including ambient leaves, but excluding leaves bound by l itself or by +an inner lambda. Then + + X-3 = sum_l tax(l) <= 1. + +Thus at most one source lambda has positive tax, and that tax is one. +A vacuous lambda with tax zero must enclose a live source binder: otherwise +its nonempty body would have a free leaf. Only u and v are live. If such a +lambda encloses u, it also encloses the argument D, since u is already an +applied source lambda. If it encloses v inside D while itself lying outside +D, it encloses all of D. + +Consequently, if D is nonclosed and contains the binder v, every vacuous +lambda outside D has positive tax. Also, no initial leading lambda is +possible: j,c beneath it would already contribute X>=5. A leading lambda +in B is impossible too, because both u occurrences would cross it and +consume two extra index units. + +For use with singleton arguments, the exact wire change when contracting +u is + + Delta = |D| + (f-1)(d1+d2) - 8 - r, + +where f counts free leaves of D, di is the depth of the i-th u occurrence +below its binder, and r counts other body references whose index drops. +For a singleton lambda-free D, f=1 and |D|<=5, so the contraction strictly +reduces size. Closed I and F arguments similarly give a strict decrease. + +#### d=0 + +A singleton D is excluded by the strict wire decrease. Suppose D has at +least two leaves. If it contains free v, the binder v encloses D and at +least one ambient leaf, so tax(v)>=1. Both vacuous lambdas must then have +tax zero. Neither can enclose v, since that would also enclose the ambient +leaf. Neither can enclose u without v, since its body then contains both +the free v and that ambient leaf in D. There is no other live binder for +a zero-tax vacuous lambda to enclose. This is impossible. + +Thus D contains only ambient leaves. If j is in D, its zero specialization +has j permanently guarded in a rigid j/c-headed neutral. Indeed D is an +application-only expression with distinct leaves from s,j,c and at most +one s. A head j/c stays rigid; a head P receives a j/c-headed callback and +also becomes rigid. Every j is beneath an application headed by j or c. +Neither duplication nor application can extract a bare j from this normal +neutral, whereas the zero target requires precisely a bare j. + +Otherwise D is exactly s c or c s, and becomes c-headed on the zero input. +All s occurrences are in D. Following the source's left spine, a rigid j +head fails immediately, while a lambda head must be the u redex: there +is no initial leading lambda and no affine source redex. B has no leading +lambda, and its head is u or a rigid j. A free enclosing v would place both +ambient leaves of D beneath v and cost two tax units. Hence after u +contracts the zero head is c or j, never R. + +#### d=1, with v bound inside D + +If D is closed, it is I and its contraction strictly reduces size. +If D is nonclosed, both remaining vacuous lambdas lie outside D and each +has positive tax by the index observation. This exceeds the sole spare unit. + +#### d=1, with the lambda of D vacuous + +The vacuous lambda in D has positive tax. If D contains free v and any +ambient leaf, tax(v) is positive as well, impossible. With no ambient leaf, +D is lambda q.v, whose size is at most five and f=1; contracting u strictly +reduces size. + +Otherwise D contains no v. Its vacuous lambda must be exactly lambda q.a +for one ambient a; placing a second free leaf beneath it would already +cost two units. The remaining vacuous lambda has tax zero and must enclose +v in a closed block. That block is F=lambda q v.v: putting its vacuous +lambda below the live v would add a second tax unit. It cannot enclose u, +because D is nonclosed. The F block is disjoint from D. + +If D is just lambda q.a, its size is at most seven, f=1, and contraction +strictly reduces size. Otherwise D is an application-only normal context +over ambient leaves and lambda q.a. The latter cannot be in function +position. Its zero specialization is therefore j/c-headed: a head P either +receives lambda q.a and yields a R, with a=j or c, or receives an already +rigid callback. + +If j occurs in D, it is guarded and cannot supply the bare target j. +Otherwise D uses s,c and becomes c-headed. All code outside its two copies +is application-only over F,j and those c-headed neutrals. The functional +normal forms of this little algebra are only F and I; every other result +is rigid-headed. The final K,R,P give F K R P -> R P and I K R P -> R. +A rigid result keeps its final P. None gives R j. + +#### d=2, with v bound inside D + +If D is closed, its two lambdas form F or K. F has strict negative wire +delta. K spends the spare index unit, so no ambient can lie in B and both +u occurrences have depth zero. Thus B=u u, and contracting the core gives +K K. The outside vacuous lambda must have tax zero. It cannot sit inside +B above a u, nor above any ambient leaf. It therefore surrounds the whole +closed redex, giving the one closed block + + Z = lambda q.((lambda u.u u) K) ->* lambda q.K K. + +All three ambient leaves lie outside Z. Since the original handler has no +affine source redex, Z occurs only in argument position. Its only possible +activation on zero is a callback use P Z, and + + P Z -> Z K R -> K. + +Otherwise the head is already j/c. Replacing that activation by K leaves +an applicative expression over K,j,c with exactly one occurrence of each. +Its normal form has a j/c head, possibly below the one vacuous lambda of +K applied to a j/c-headed argument. The external K,R,P cannot change that +head to R. This excludes the closed K argument as well. + +If D is nonclosed, the sole remaining vacuous lambda outside D has positive +tax and spends the entire allowance. Every lambda inside D has tax zero. +They therefore form the closed F block, and D is a normal application-only +context over that single F and ambient leaves. Also tax(u)=0, so B has no +ambient leaf; only the two u occurrences and possibly the outside vacuum +occur there. + +On zero, a head P with first argument F yields R, possibly followed by +rigid arguments. Any other first argument is j/c-headed. Consequently D +becomes an R- or j/c-headed neutral; it never becomes a functional value. +If s occurs in D, all remaining syntax is application-only over these +rigid neutrals and j,c, with one vacuous lambda. At most one of the three +external inputs can be consumed by that lambda, and every exposed rigid +head retains a suffix ending in P. This cannot give R j. + +If s does not occur in D, its normal j/c-headed value is independent of +the branch. It is a normal application containing j/c and the closed F +block, but no R or N. It cannot equal a subterm of R j: it is neither R, +j, nor R j. It also cannot equal a subterm of c V N. The target's neutral +c-headed prefixes contain N, while its remaining subterms are bare c/N, +the closed Booleans, or N-containing Scott subterms; none is this fixed +j/c-containing application. Outside reduction cannot dismantle D's rigid +head or alter its arguments. Thus every copy would have to be erased in +both successful target reductions. But D contains at least one of the +unique mandatory j/c leaves. Erasing all its copies removes every origin +of that free name. The zero target requires j and the variable target +requires c, so the corresponding branch is then impossible. + +If both lambdas of D were vacuous and v lay outside, each would have +positive tax: no live binder is available inside D to make either body +closed. This directly exceeds the budget. + +#### d=3: all remaining lambdas are in D + +The normal lambda-block classification has three possibilities: + +1. One closed three-argument projection P3, selecting the last argument + (tax zero) or the middle argument (tax one). Selecting the first costs + two units and is excluded. +2. Disjoint closed F and lambda q.a, where a is the sole ambient below a + lambda. The latter vacuum has tax one. +3. One block lambda q.a F, where a is the sole ambient below a lambda. + The outer vacuum has tax one; the inner closed F has tax zero. + +Here is why these are exhaustive. A zero-tax vacuous lambda in D must +enclose v. If both vacua have tax zero, both enclose v and give the last +projection. A positive tax at live v would put an ambient beneath v and +therefore also beneath both zero-tax vacua, impossible. If one vacuum has +tax one because it encloses a free v, the other zero-tax vacuum surrounds +v and gives the middle projection. If it instead encloses an ambient a, +the zero-tax vacuum and v form F. This F is either outside that vacuum, +giving case 2, or inside its body. In the latter case source normality +forces the body a F, giving case 3. F a would be an affine source redex. + +In cases 2 and 3, tax(u)=0 and there are no lambdas outside D, so B=u u. +In case 2 the two functional blocks can occur only as arguments to a +free head. A zero head P yields R followed by arguments if its first +argument is F, or a R followed by arguments if its first argument is +lambda q.a. Other callbacks are already j/c-headed. Thus D becomes a +rigid neutral, and D D remains rigid with an additional argument. +If D contains s, the outer context contains only j,c and cannot remove +that argument or the final external P. If it does not contain s, its +j/c head also guards it when the outer P uses it as a callback. + +In case 3, a bare block with a=s becomes K R, and its self-product is R. +A bare block with a=j or c has a rigid self-product. A proper normal +application context has a free head. If that head is s, then a is j/c +and the callback gives a F R, still rigid; a j/c head is immediate. +Thus D D and its outside context again have a rigid head and cannot give +R j after all three external inputs. + +For the last-argument P3 of case 1, a closed D has wire delta -r. If r>0, +contraction strictly decreases size. Otherwise B=u u, and D D reduces to +F; the resulting whole source has at most two lambdas and is excluded +by the normal two-lambda floor after affine normalization. +For the middle-argument P3, its tax already spends the extra unit, +so again B=u u. Its self-product is K, and the same two-lambda argument +excludes a closed D. + +For a proper normal context around P3, its only possible functional zero +result comes from s P3. With the last projection this gives I, and adding +a further rigid argument makes the result rigid. With the middle +projection it gives K R, and any further argument exposes rigid R. +A head s with any other callback becomes j/c-headed; all other heads +are j/c from the start. + +For the middle projection B=u u, so D D becomes R or a rigid neutral; +the outside context cannot give R j after K,R,P. For the last projection, +D is either already j/c-headed or is exactly s P3 and becomes I. In the +first case a remaining s, if outside D, receives only rigid callbacks and +also becomes rigid. In the second, s has been used inside D. Substitution +leaves an application-only expression over I,j,c. If the spare unit puts +one rigid a in B, that body's two I copies expose head a; otherwise +the I self-product is I. The remaining j,c context is rigid-headed. +This also fails the zero law. + +Consequently five-application nonlinear compression at the improving +budget remains only with **three source lambdas**, `X≤6`, and the leaf +allocation `u,u,j,c,s,v`. + ## Normal whole-stream handlers with at most three applications Write `P=cons K R` on the zero input and `S=Pₘ(N)`, @@ -2128,6 +2360,612 @@ exhaust the remaining block. Thus `(A,L,k)=(4,4,2)` cannot satisfy the whole-stream reader laws. +## Normal four-application handlers without whole-stream access + +Suppose `H` is beta-normal, has `A=4`, has size at most 34, and contains no +free `s`. The previous results allow us to assume that `H` has at least +three lambdas, has nonaffine nested live binders, and is neither a three- +leading-lambda handler nor the shape `(A,L,k)=(4,4,2)`. + +Its five leaves must therefore be exactly `j,c,u,u,v`, with `u` bound twice +by one binder and `v` bound once by another. Otherwise it is affine, has +only one live binder, or has a live-binder antichain, all already excluded. +If `k` is the number of leading lambdas, a rigid normal body head fails. +There is no stream head available. A second-input head at `k=2` retains +final `P` on the zero branch; a third-input head has `k=3`, already +excluded. Thus its normal form is + +``` +H = λ^k. b A₁ ... A_q, +``` + +where `b` is the first leading binder and `q≥1`. All leading-lambda counts +permitted by the size bound remain in scope; in particular `L=5,k=1` is not +discarded. + +If `b` is the duplicated binder `u`, substitute the closed affine Boolean +`F` for it. All remaining source binders are affine, including every +inserted copy of `F`. Thus `H′ = λignored. H F` is an affine handler without +free `s`, and + +``` +H′ F V S =β H F V S. +``` + +The arbitrary-size affine no-stream theorem uses only the variable law, so +excludes this possibility. No zero law for `H′` is asserted. + +Now let `b=v` be affine. The sole other live binder is `u`, used twice. If +`u` is not leading, its binder and both occurrences belong to one of the +arguments `A_i`: a binder enclosing the head `b` would itself be leading. +For `q=1`, the variable Boolean erases `A₁`, including the mandatory `c`, so +this case fails. + +For `q≥2`, the zero Boolean selects `A₁` and the variable Boolean selects +`A₂`, followed by the common arguments `A₃,...,A_q` and any unconsumed +external inputs. + +* If the `u` island is in `A₁`, the variable branch erases the only + remaining live binder. Every surviving source lambda is vacuous, and the + source code contains only rigid `j/c` leaves. A normal term made from + those leaves and vacuous lambdas, applied to source arguments and the + remaining external `V,S`, can only erase successive arguments until + exposing its fixed rigid head. It cannot activate a received argument: + none of its binders uses that argument. Thus its final rigid spine either + retains the original last input `S`, or all inputs have been erased and + only fixed `j/c` syntax remains. Neither gives `c V N`. +* If the `u` island is in `A₂`, the zero branch similarly erases it. The + surviving normal code consists only of rigid `j/c` and vacuous lambdas. It + cannot return or activate the later received `R`, so cannot produce head + `R`. +* If the island is in a common argument, then `q≥3`. Its two `u` leaves need + at least one application inside that argument. At `A=4`, this forces + `q=3`; `A₁` and `A₂` each have one leaf, namely `j` and `c` in some order, + under vacuous lambda chains. The zero-selected `A₁` has a fixed rigid + `j/c` head and cannot produce `R`. At `q=4`, all arguments have one leaf, + so the island cannot fit. + +It remains that `u` is the second leading binder `r`. Here `k≥2`; the +already excluded three-leading case leaves `k=2`. The mandatory `j,c` +contribute seven index units, so `L≤4`; the existing `(L,k)=(4,2)` result +leaves exactly `L=3`. The third lambda is vacuous. Again `q=1` erases `c` on +the variable branch. + +For `q≥3`, zero selects `A₁` and leaves at least two ordered arguments +attached to it, ending in `P`. After substituting rigid `r=R`, the selected +source argument is normal and has only the one possible vacuous lambda. It +can consume at most one of those arguments before exposing a rigid head. A +head `R` therefore still has final argument `P`, and cannot be `R j`. + +For `q=2`, zero needs `r,j` in `A₁`; variable output needs `c` in `A₂`. If +both occurrences of `r` were in `A₁`, the variable branch would again be +only a vacuous `c` chain, incapable of `c V N`. Thus the branch leaves are +exactly `r,j` and `r,c`, with one application in each branch. To give zero +output `R j`, the single vacuous lambda must wrap `A₁` and consume final +`P`; otherwise that final edge remains on the rigid output. Consequently +`A₂` is exactly `r c` or `c r`. The variable outputs are respectively + +``` +c F Pₘ₋₂ S, c V S +``` + +for `m≥2`. Neither equals `c V N`. + +This exhausts normal no-stream handlers with four applications and size at +most 34. + +## Four applications, stream access, and two leading lambdas + +Suppose a beta-normal whole-stream handler of size at most 34 bits has +`A=4`, contains `s`, and has exactly two leading lambdas, `H=λb r.B`. The +mandatory j,c,s contribute at least `7+2=9` index units. Since L≥3 and 2L+X≤16, +this forces L=3 and X≤10. There is exactly one inner source lambda D. + +A rigid body head fails. A body headed by r retains final P on the zero +branch. Thus the body head is b or s. + +If it is b, the index-one head spends the final unit. The occurrences of +j,c,s must all lie outside D, and no outer binder can occur inside D. The +fifth source leaf must therefore be D's own bound leaf, so D=I. There is no +r occurrence. On the variable branch the body is application-only over F,S,I +and rigid j,c, and final S remains pending. The safe algebra excludes the +desired c V N. + +Now let the body head be s. On the variable branch substitute b=F,r=V, +leaving final S pending, and abstract the sole inner lambda D by a rigid +marker d. Choose m sufficiently large that every first invocation of d by a +functional Scott value supplies F rather than terminal K, as in the one- +marker index lemma. The syntax outside D is application-only safe data. + +If the mandatory c is outside D, an opaque result with functional head or +head d has no way to acquire that outside c as its own head after the final +S is appended unless d has already been invoked internally. An opaque result +headed c retains final S. More directly, if d is invoked internally, +contracting its unique source lambda replaces its bound occurrences by safe +arguments and leaves entirely safe applicative code; if it is never invoked, +the functional or rigid-head alternatives fail, except potentially a bare d +returned to receive the final S. That bare-d alternative can yield c only if +c is inside D. + +It therefore suffices to exclude a bare opaque result d when c is inside D. +This placement spends the one index unit remaining after j,c,s, so j is +outside D and b is absent. Every exterior bound occurrence is the leading r +outside D, hence substitutes to V. The opaque context is consequently +application-only over S,V,d,j (and any other rigid leaves), with at least +one occurrence of j. + +For this restricted basis, a functional normal form is S, V, I, or Q, with +possible duplicate identical Scott values. Pair/pair interactions return +I,Q, or an N-headed neutral; identity forwards its argument; Q returns N; +and a Scott value applied to a neutral preserves its head and adds two +arguments. In particular, a functional normal form can only come from +subexpressions containing no opaque rigid leaves: in the application table, +every row returning a functional value has functional children. The row I A +forwards a neutral unchanged but its function subtree has no opaque rigid +leaves. + +Inductively, a normal form equal to bare d can therefore come only from a +context whose sole opaque rigid leaf is that occurrence of d. Every step +forwarding bare d is an identity step; a Scott invocation adds arguments, +and Q changes its head to N. Since the actual context also contains j, it +cannot return bare d. + +Thus D is either lost or trapped under another rigid head, or is invoked +internally with a safe argument. In the last case its body is application- +only, so the result lies in the safe algebra before final S is appended. Its +functional results contain no c and its c-headed results retain final S, +which is not N. This excludes the s-headed case and hence every normal +s-present A4 handler with two leading lambdas at the improving budget. + +## Five applications, one leading lambda, and stream access + +Suppose a beta-normal handler has five applications, three lambdas, one +leading lambda, at most 34 bits, and a free occurrence of `s`. Write +`H = λb.B`. The variable-stream law would require + +``` +B[b:=F,s:=P_m] P_(m-1) P_m =β c P_(m-1) N, +``` + +for every `m≥1`, where `P_0 = cons K N`, `P_(i+1)=cons F P_i`, and +`N` is rigid. The claim below excludes this case using a sufficiently +large `m`. + +### Tight syntax inventory + +The wire identity gives `X≤6`. The required occurrences of `j,c` have +indices at least 2 and 3 under the leading binder. The required `s` +has index at least 1. They exhaust the index budget. Hence there is +exactly one occurrence of each, all outside the two inner lambdas, and +the other three leaves have index zero. Every inner lambda block is +therefore closed. An index-zero leaf outside the inner blocks is `b`. + +With two inner lambdas and at most three leaves, their complete +beta-normal placement inventory is as follows. Omitted leaves are +exterior occurrences of `b`. + +* Two separate blocks: `I,I`, or `I,Δ`, where `I=λa.a` and + `Δ=λa.a a`. +* A nested block with consecutive lambdas: `F=λa d.d`, + `G₂=λa d.d d`, or `G₃=λa d.d d d`. +* A nested block with the inner lambda as an argument: + `J=λa.a I`, `Jleft=λa.a a I`, `Jright=λa.a(a I)`, + `Jmid=λa.a I a`, or `JΔ=λa.a Δ`. + +Here application associates to the left. The list follows by distributing +one, two, or three bound leaves among the two lambdas. Consecutive +binders can use only the inner one. In the nonconsecutive case, the +inner block must occur as an argument because the whole term is normal; +with two remaining outer leaves, the three listed placements are all +binary application trees with outer head `a` and one inner-`I` leaf. + +### Functional data and opaque helper markers + +After substituting `b=F`, treat each not-yet-activated closed block as +an opaque marker. Normalize the surrounding application-only expression +bottom-up using the data algebra. Its functional data values are + +``` +P_i, F, I, Q=K N, +``` + +and every other result is headed by a rigid variable or a helper marker. +In particular, no base functional value contains `c`. + +The pair/pair cases are important: + +``` +P_0 P_0 →* Q, +P_0 P_(j+1) →* I, +P_(i+1) P_0 →* N P_i, +P_(i+1) P_(j+1) →* P_j P_i. +``` + +Their recursion decreases `i+j` and ends in `I`, `Q`, or an +`N`-headed neutral. It never returns a Scott cell as its functional +normal form. This recursion may traverse the entire prefix; the +argument does not bound its number of beta steps. + +When a functional Scott cell is applied to a helper-headed neutral, +it passes its bit and tail to that helper. We must ensure that this +cell has positive index, so that its passed bit is `F`, not bare `K`. +Without this guard the proof is false: `JΔ P_0 →* K`. + +An exposed functional Scott value here means a Scott-valued result that +can still become a function or a first helper argument in this evaluation. +Scott cells or bare `K` values permanently buried in an ordinary rigid +`N`, `j`, or `c` argument spine are excluded: a helper can forward that +whole neutral or apply it to more arguments, but cannot project one of +its arguments. Their indices can be arbitrarily low after pair/pair +cancellation without affecting the guard. + +For a finite data phase, regard each already available `P_i`, `F`, +`I`, and `Q` as one macro leaf. If the phase starts with at most `M` +macro applications and all exposed functional Scott leaves have index +at least `h`, every functional Scott normal form obtained in the phase +has index at least `h-M`. This is induction on the application tree: +`P_i F → P_(i-1)` spends an application; identity forwards an existing +value; pair/pair never produces a Scott functional normal form; other +table cases produce no new functional Scott value. The tail exposed +along a helper-headed neutral has the same bound with one additional +unit of margin. + +The resulting macro tree has at most `2M` applications. In the table, +the only growth is a Scott cell applied to a neutral, which replaces +one application by two appended spine slots. Bare `K` values buried +in an ordinary rigid neutral never become functional values. The +positive-index guard ensures that they are not instead exposed as +helper arguments. + +### Activating the closed helpers + +The actions of the possible blocks are + +``` +I U → U, +Δ U → U U, +F U → I, +G₂ U → Δ, +G₃ U → D₃, D₃ = λd.d d d, +J U → U I, +Jleft U → U U I, +Jright U → U (U I), +Jmid U → U I U, +JΔ U → U Δ. +``` + +Thus an activated helper either discards its input and returns a fixed +closed block, or exposes its input as a function, applied only to +itself or fixed closed blocks. If the input is `c`-headed, the result +is immediately `c`-headed. If it is another rigid neutral, that head +also persists. If it is functional data, all results remain `c`-free. +In particular these helpers never build a functional closure that +retains `c`. + +No complex helper can receive an argument containing itself. There is +one occurrence of a complex helper, except for the separate pair +`I,Δ`, and all other initial reducers are affine. Before that helper +is activated, its unique occurrence is neither duplicated nor placed +inside its own argument. In the separate pair, eliminate affine `I` +first. The helper may duplicate a base-data or neutral argument, but +not complex code. `G₂`, `G₃`, and `JΔ` can expose their pre-existing +inner `Δ` or `D₃`; this gives at most two complex activations in all. +The other helper blocks are affine, and their fixed identity outputs +can be included in the base algebra. + +For completeness, a uniform prefix guard can be chosen before any +evaluation. Start with `M≤5`. Normalize one data phase, then activate +a complex helper. Its body has at most two applications and uses its +argument at most three times, so the next macro expression has at +most `6M+2` applications. Across at most two such activations, the +successive phase bounds are `5,32,194`. Their total is 231; the +tail-delivery margins and two helper-internal application margins are +less than 10. Taking, for example, `m>600` therefore makes every +Scott cell that supplies a bit to an active helper positive. This +bounds exposed functional-index ancestry, not total data reduction +steps: the unbounded pair/pair cancellation just described is allowed. + +After all helpers have been processed, the normal form of +`B[F,P_m]` is therefore either a `c`-free functional value, or a +rigid-headed neutral. Any remaining closed helper value is also +`c`-free and can only be applied to the `c`-free pending arguments. + +### The output contradiction + +A `c`-free functional normal form cannot acquire head `c` by application +to the two pending `c`-free arguments `P_(m-1),P_m`. A rigid-headed +normal form keeps its head. If the head is `c`, applying those two +pending arguments appends them to its spine. To match the required +two-argument normal form `c P_(m-1) N`, the already normalized body +must be exactly `c`, and the final argument would then be `P_m`, not +`N`. Both are normal and distinct. Every case contradicts the +variable-stream law. + +The exclusion uses only the variable law. It applies exactly to the +normal `(A,L,k)=(5,3,1)` shape with free `s`, not to the other normal +five-application placements. + +## Five applications and one leading lambda without stream access + +Suppose `H=λb.B` is beta-normal, has five applications and three +lambdas, and contains no free `s`. The wire identity gives `X≤6`. +Mandatory `j,c` already contribute `2+3=5` under the leading binder. +Thus each occurs once, at most one can lie under one further lambda, +and only one other positive index unit is available. + +A rigid body head cannot satisfy the zero law. Hence + +``` +B = b A₁ ... A_q, q≥1. +``` + +For `q=1`, the variable input `F` erases all source arguments, including +`c`, so this fails. For `q≥2`, `K` selects `A₁` and `F` selects `A₂`, +followed by the common arguments `A₃,...,A_q` and the two external +arguments `R,P` or `V,S`. + +### Only three nonlinear leaf patterns remain + +If both inner binders are affine, the source term +`λignored.B[b:=F]` is an affine handler without free `s` and satisfies +the required variable law. The already established arbitrary-size affine +no-stream theorem excludes it. Thus an inner binder `u` must occur at +least twice. It is nonleading, so its binder and all its bound occurrences +belong to one argument `A_i`. + +There are only six leaves, including mandatory `j,c`, the head `b`, and +two `u` leaves. The remaining leaf is exactly one of: + +* another `b`, with the other inner lambda vacuous; +* a third `u`, with the other inner lambda vacuous; +* one occurrence `v` of the other inner binder. + +Another rigid ambient leaf or a repeated `j/c` would exceed the index +budget. Both inner binders cannot be nonlinear because that would need +at least seven leaves including the head and `j,c`. + +### A selected branch containing u + +If the `u` island lies in `A₁`, the variable selector erases it. The +surviving variable branch is affine, even if the source had another +occurrence of `b`, because all surviving `b` occurrences are closed +copies of affine `F`. The affine no-stream variable-law theorem again +excludes it. + +If the `u` island lies in `A₂`, the zero selector erases it. In the +extra-`b` or extra-`u` leaf patterns, every remaining source binder is +vacuous; only `K` selectors and vacuous erasers remain. The ordered-input +argument already used for one live first-input binder excludes `R j`: +selectors forward arguments whole and erasers discard them, but neither +can insert a later received rigid `R` into a fixed source application +with the earlier `j`. Exposing `R` before the last input is consumed +retains final `P`; exposing or returning `P` after that input edge is +consumed leaves no later argument with which to activate it. + +In the extra-`v` pattern, `b` occurs only once. After zero selects `A₁`, +there is no internal Boolean `K` and no `s` occurrence in the remaining +source. At most one source lambda remains, the affine `v` binder. +All other source terms before the external `R,P` are rigid expressions. +If that lambda is internally activated, it consumes a rigid source +argument and leaves no source lambda. If it is reached as a bare +function, its first supplied argument is either such a rigid source +argument or `R`; it cannot first receive `P` while the earlier `R` +input is still pending. In either case an exposed `R` still has final +`P` attached. Thus this zero branch cannot be `R j` either. + +### A shared argument containing u + +It remains that the `u` island is in `A_i` for `i≥3`. Its two bound +leaves require an internal application, so `q≤4`. + +#### Four head arguments + +For `q=4`, the one remaining application is inside the `u` island. +That argument has exactly its two `u` leaves; the other three arguments +are one-leaf chains over `j,c` and the extra `b` or `v`. A third `u` +cannot fit. The `u` island has no rigid `j/c` leaf. + +Zero correctness rules out `A₁` being a chain over `j` or `c`: such +a vacuous chain can only expose its fixed rigid head. Hence `A₁` is +the `b` or `v` chain. Variable correctness then rules out a `j` chain +as `A₂`, so `A₂` must be the `c` chain. After selection, it receives +four ordered arguments, `A₃,A₄,V,S`. The `u` binder is in a shared +argument, so at most the other inner lambda can wrap this `c` chain. +It can erase at most one of the four arguments before exposing `c`. +At least three arguments remain on the rigid output, whereas the target +`c V N` has exactly two. This excludes `q=4`. + +#### Three head arguments + +For `q=3`, the shared `u` island is `A₃`. There are exactly two +applications inside the three arguments. + +If `A₃` has three leaves, it uses both applications, and `A₁,A₂` +are one-leaf chains. Its third leaf is one of `u,b,v,j,c`. + +* If it is `u,b`, or `v`, both rigid leaves are in the selected + one-leaf branches. The zero-selected branch has a fixed rigid head + and cannot produce `R`. +* If it is `j`, the remaining branches have `c` and `b` or `v`. + Zero correctness forces the nonrigid branch to be `A₁`, leaving + `A₂=c`. The `j` inside the `u` island spends the only extra index + unit, so `c` is under no inner lambda. Variable selection therefore + produces `c A₃ V S`, with three arguments rather than two. +* If it is `c`, the analogous head requirement for the variable branch + forces the nonrigid branch to be `A₂`, leaving `A₁=j` with no + inner lambda, so the zero branch has the wrong head. + +If `A₃` has exactly its two `u` leaves, it uses one application. +One selected branch therefore has two leaves and the other has one. +Since `j` must survive zero and `c` must survive the variable branch, +`j` belongs to `A₁` and `c` to `A₂`. + +In the extra-`v` pattern, the branch containing `v` also contains its +sole live binder. If it is `A₂`, the zero-selected `A₁` is bare `j` +and fails. If it is `A₁`, all inner lambdas are already in `A₁,A₃`, +so `A₂` is bare `c`, and variable output is `c A₃ V S`, again +with three arguments. + +In the extra-`b` pattern, a one-leaf zero branch over `j` fails. Thus +`A₁` contains `b,j` and `A₂` contains `c`. A `j`-headed application +cannot give head `R`, leaving only `A₁=b J`, where `J` is `j` or a +vacuous chain over `j`. Zero selects `K J`; applying shared `A₃` +returns `J`, after which only `R,P` remain. It has fixed head `j`, +so cannot give `R j`. A vacuous lambda around all of `b J` would +raise both the `b` and `j` indices, spending two units when only one +is available. Wrapping its head alone would be a source beta redex, +contrary to normality. These cover placements affecting `A₁`; a +lambda outside `A₁`, including in `A₂` or around the `u` island, +cannot change this zero computation. The extra-`u` pattern cannot have only two `u` leaves +inside its unique binding island. + +This exhausts the common-argument cases and therefore excludes the +normal `(A,L,k)=(5,3,1)` shape without free `s`. + +## Five lambdas and one leading lambda with stream access + +Let a beta-normal whole-stream handler have `A=4, L=5`, exactly one leading lambda, +and size at most 34 bits. Suppose it contains `s`. Write `H=λb.B`. The wire +budget is `X≤6`. Mandatory `j,c,s` under `b` contribute exactly `2+3+1=6`, so they +occur exactly once, all outside the four inner lambdas. Every other leaf has +index zero. Every inner lambda block is therefore closed; an index-zero +occurrence outside those blocks is b. + +There are only two bound leaves in all. Write F_h=λ a1...ah.ah for the +h-argument last projection, with F₁=I and F₂=F. The complete normal block +inventory is: + +* One block F₄, and one exterior b leaf. +* Two separate blocks F_h,F_l, with h+l=4. +* One consecutive block λ a b c d.d d, namely three vacuous lambdas followed by + Δ=λ d.d d. +* One nonconsecutive block J_(h,l)=λ a1...ah.ah F_l, with h+l=4 and h,l≥1. + +To see completeness, with one leaf all lambdas form a last-projection chain. With +two leaves in separate blocks each is such a chain. With two leaves in one +block, either both refer to the innermost binder on one consecutive chain, +or the inner block is an argument to the outer bound head. Normality +excludes an inner lambda in function position, and index zero excludes capturing +an outer binder inside the inner block. There is exactly one inner +application in either of these two-leaf single-block cases. + +Substitute b=F and s=Pₘ. Extend the safe functional algebra by all last +projections F_h. Their application rules are + + F₁ U =β U, + F_(h+1) U =β F_h, + P_i F₁ =β I (i>0), or Q (i=0), + P_i F₂ =β tail_i, + P_i F_(h+2) =β F_h (h≥1). + +Together with the original safe table, these rules close the application- +only algebra over P_i,Q,F_h and rigid neutrals. A functional result contains +no c; applying a functional Scott cell to a neutral preserves the neutral +head. No bare K is introduced, even at i=0. + +For either of the two-leaf single-block cases, both bound leaves are inside +that block. There is no exterior b and no other source lambda block. The normal +exterior therefore contains only the sole s, this block D, and rigid j,c. +Its head must be s. If its first callback is rigid-headed, that rigid head +receives the Scott bit and tail and later the external V,S, so fails. +Otherwise its first callback is the literal block D: source normality +excludes applying D in the callback's own syntax. Thus the only potentially +successful activation starts with S D. + +For J_(h,l), h+l=4, the three possibilities on S=Pₘ, m≥1, are + + S J_(1,3) =β V, + S J_(2,2) =β V F =β tail_(m-1), + S J_(3,1) =β J_(1,1) = λ z.z I. + +The first two are safe data, and the last receives only rigid j/c source +arguments before the pending V,S. It either remains a closed c-free helper +or preserves the head of the rigid argument on which it is activated. These +computations also explain why no terminal-K assumption is hidden: if the +initial stream were P₀, the h=1 callback gives K F_l N =β F_l; h≥2 discards +the terminal K in a vacuous binder. + +For D=λ a b c.Δ, its first two vacuous binders discard the stream bit and +tail: + + S D =β λ c.Δ. + +The sole internal Scott source has now disappeared. There is no exterior b +or other block. Before the pending V,S, the remaining arguments are made +only from rigid j,c. Consequently the result is either a closed c-free +remainder of D/Δ, or a rigid-headed neutral. In particular bare Δ cannot be +re-invoked as a Scott callback internally. This point is necessary: P₀ Δ =β +K would not be safe in an unrestricted helper algebra. + +Thus the fully processed body B[F,Pₘ] is either a c-free functional value or +a rigid neutral. Appending the two pending c-free arguments V=Pₘ₋₁ and S=Pₘ +cannot create c in the functional case. In the rigid case, head c retains +both arguments; equality with c V N would require the body to be bare c and +S=N, which is false. This excludes the variable law and hence every such +A4,L5,k1 handler. + +## Nonleading nonlinear four-application handlers with stream access + +Suppose H is beta-normal, has A=4, has no leading lambda, contains s, and +has size at most 34 bits. Assume it is nonaffine. Its five leaves must be +exactly j,c,s,u,u: u is the sole live source binder, occurring twice, and +both other ambient letters and the stream occur once. Every other source +binder is vacuous. The size identity gives 2L+X≤16. + +A rigid head fails the zero law, so write + + H = s A₁ ... A_q, q≥1. + +The first callback A₁ has no s and no free bound variables. If it is +application-headed, its normal head is rigid j/c, and P A₁ preserves that +head. Therefore it must be a leading lambda block D. Its normal body head +must be the sole live binder u; a rigid body head could never give zero head +R. Thus u lies on D's leading lambda chain. Let d be that chain's length. +Other lambdas inside D or its common arguments are vacuous. + +After expanding the zero cell P=cons K R, D receives the ordered list + + K,R,A₂,...,A_q,K,R,P. + +This list has n=q+4≥5 entries. A successful zero computation cannot leave +any of D's d leading lambdas unapplied. Consider the argument received by +the unique live binder u. + +If it is a source common argument A_i, that argument contains only rigid j/c +and vacuous lambdas: u's binding scope is inside A₁, and the unique s has +already been used at the outer head. Such a normal argument can only discard +arguments before exposing a fixed rigid j/c head, or remain a lambda if +insufficiently applied. Its copies cannot yield head R. + +If u receives K, all earlier leading binders were vacuous, so any earlier +direct R was discarded. After substituting K for the two u occurrences, only +selectors and vacuous erasers remain. The ordered-input argument from the +one-live first-input case applies: selectors return an argument whole and +vacuous binders discard it; neither inserts a later received R into a fixed +source application with the earlier j. Exposing R before the last input is +consumed retains final P. Selecting final P only after earlier input edges +have disappeared leaves it with no later argument. Neither case yields R j. + +If u receives a direct R, substituting this rigid value creates no redex in +D's normal body. Once the d leading binders have been consumed, the rigid R +head retains every remaining ordered argument. Thus zero correctness +requires d≥n, so that final P has already been consumed. If u receives the +final P itself, its position on the leading chain likewise requires d≥n. + +In either last case, every common argument containing the unique j has been +discarded by a vacuous binder: the only live binder receives R or P. +Consequently the surviving j must occur inside D's body, beneath all d +leading lambdas. Its index contributes at least d+1, and mandatory c +contributes at least 2. With L≥d, the wire budget would require + + 16 ≥ 2L+X ≥ 2d+(d+1)+2 = 3d+3 ≥ 18, + +a contradiction. + +These are every possible input to u. Hence no nonlinear, nonleading, +s-present normal A4 handler fits the improving budget. The remaining +nonleading normal A4 handlers are affine and have at most two live binders. + ## Established bound and remaining scope Combining the compression lemmas, the beta-normal three-lambda floor, @@ -2144,11 +2982,21 @@ this joint-handler interface. The whole-stream operand `T=s` at would have no affine source redex, at least three source lambdas, and exactly four or five applications. At four applications it must be beta-normal. The three-leading-lambda special case and -the normal shape `(A,L,k)=(4,4,2)` are also excluded. The remaining -normal shapes must either use `s` or have nonaffine, nested live -binders. Five-application nonlinear compression remains only with -the leaf allocation `u,u,j,c,s,v`, where `u` binds the nonlinear -redex and `v` is the sole occurrence of one other live binder. +the normal shape `(A,L,k)=(4,4,2)` are also excluded. Every remaining +normal four-application shape +uses `s` and has zero or one leading lambda; with one leading +lambda it has three or four source lambdas. A remaining nonleading +four-application handler is affine; the existing affine floor then +requires at least four source lambdas. +Every remaining normal five-application shape has zero leading lambdas, +uses `s`, and has either three lambdas with `X≤6` or four lambdas with +`X≤4`. Indeed, the mandatory `j,c` under one leading lambda would already +cost five index units, excluding the four-lambda case; the leading-case +proofs exclude the three-lambda case with one leading lambda. +Five-application nonlinear compression remains only with three source +lambdas, `X≤6`, and the leaf allocation `u,u,j,c,s,v`, where `u` +binds the nonlinear redex and `v` is the sole occurrence of one other +live binder. Neither the independence assumptions on the ambient continuations nor the specified reader interface have been removed. This is not a global optimality theorem for the 165-bit interpreter. diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index 109eb781..b72ec946 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -429,13 +429,18 @@ These are Codex's handwritten proofs, with targeted reduction checks in At `T=s`, `|H|≤34`, every successful handler has at least three source lambdas even before normalization. A minimum successful handler has no affine source redex and exactly four or five applications. - At four applications it must be beta-normal; the `(A,L,k)=(4,4,2)` - normal shape is also excluded, with `k` the number of leading lambdas. + At four applications it must be beta-normal, use `s`, and have at most + one leading lambda; the no-stream and two-leading-lambda cases are excluded. + With one leading lambda, only three or four source lambdas remain. + With no leading lambda, it must be affine and have at least four. Without free `s`, every affine handler fails its variable law, and a live-binder-antichain theorem also excludes nonaffine handlers. These - close every five-application compressed case without free `s`; only - the leaf allocation `u,u,j,c,s,v` remains in the compressed case. - Other normal shapes stay open. + close every five-application compressed case without free `s`. + The remaining four-lambda compressed cases are excluded by the index + budget, leaving only three lambdas, `X≤6`, and leaves `u,u,j,c,s,v`. + Every remaining normal five-application candidate is stream-headed with + no leading lambda, with either three source lambdas and `X≤6` or four + and `X≤4`. Those normal shapes stay open. - **The zero arm costs at least 14 bits**, even with `bit0 := K` and the whole zero cell available to borrow. With `R` absent and the neighbours rigid, `Z R R = R next` forces the normal form `λu v. u next` (15) or From f2ec96bd79605f1725516a9f20edc4e12aed40bd Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 22:07:43 -0400 Subject: [PATCH 26/41] Complete the conditional cheap-reader lower bounds --- docs/STATUS.md | 62 +- .../self-interpreter/cheap-tail-bound.md | 1762 ++++++++++++++++- .../self-interpreter/handler-bound.md | 8 +- .../classical/self-interpreter/interpreter.md | 46 +- .../self-interpreter/protocol-obstructions.md | 10 +- 5 files changed, 1718 insertions(+), 170 deletions(-) diff --git a/docs/STATUS.md b/docs/STATUS.md index cf950637..6fa2973d 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -160,8 +160,9 @@ with all features (three opt-in tests ignored) and 328 with default features. (minima summing to 168) is conditional on opaque modules, the clause the 165 breaks; it still bounds the NEXT region the two share. The handwritten reader bound now permits arbitrary handlers: independent rigid laws force - `|H| ≥ 27`, so `s H S` still costs at least 43 and the unchanged surrounding - interpreter at least 165 (`classical/self-interpreter/handler-bound.md`). + `|H| ≥ 27`, so `s H S` costs at least 43 and the unchanged surrounding + interpreter at least 165 within that independent rigid interface + (`classical/self-interpreter/handler-bound.md`). The strengthened handwritten theorem also permits the actual stream, tag, selector, and suffix correlations, including whole-stream access inside `H`, with the skip fixed to `s s s` and other ambient parameters @@ -176,46 +177,23 @@ with all features (three opt-in tests ignored) and 328 with default features. showing why same-handler replacement by `s` fails. The common inert-operand replacement principle is kernel-checked in `SelfintInert`; the per-operand equation and absence checks are handwritten. - A separate handwritten - theorem proves that handlers for `T=s` and `T=s s` need at least two - explicit lambdas, even with whole-stream access and beta redexes. - The strengthened theorem rules out every beta-normal handler with at - most two lambdas for either operand, regardless of size. Explicit - beta-normal three-lambda handlers cost 49 and 45 bits respectively; - `handler_bound.py` checks their zero laws and fixed variable instances. - Exactly three leading lambdas are excluded at the improving `T=s` - budget. For `T=s s`, affine reductions preserve the 30-bit budget; - the reviewed nonlinear-redex classification now also excludes the - five-application compressed cases, including proper argument contexts. - Every remaining beta-normal four-application shape is also excluded, - completing the handwritten `T=s s` threshold: every successful - handler costs at least 31 bits, and its reader at least 43. This - includes the full ambient frame, whole-stream access, and arbitrary - source redexes. The proof extends the safe-data argument to affine - callbacks, then separates affine input-edge accounting from the - case that can copy vacuous closures. At the improving `T=s`, `|H|≤34` - budget, every successful handler has at least three source lambdas, - including before beta-normalization. A minimum successful handler has - no affine source redex and exactly four or five applications: the - three-application normal cases and all nonlinear compression through - four applications are excluded. A four-application minimum must be - beta-normal, use the whole stream, and have at most one leading lambda: - all normal four-application cases without `s`, and all with two leading - lambdas, are excluded. With one leading lambda, only three or four - source lambdas remain; with no leading lambda, a candidate must be - affine and have at least four source lambdas. Without free stream access, every - affine handler fails the variable law once `m>A(H)+2L(H)+5`; a - separate live-binder-antichain obstruction also allows nonaffine redexes. - These exclude all five-application nonlinear compression without free - `s`. An index-tax classification excludes the remaining compressed - four-lambda cases, including proper copied-argument contexts. The only - remaining compressed allocation is `u,u,j,c,s,v` with three source - lambdas and `X≤6`, where `u` is the contracted nonlinear binder and - `v` belongs to one affine source binder. Every remaining normal - five-application candidate is stream-headed with no leading lambda: - either three lambdas with `X≤6`, or four with `X≤4`. The exclusions use - closed-helper classifications, guarded functional-index arguments, - and the zero-branch leaf budget. These remaining shapes are open + The complete handwritten cheap-reader bounds are `|H|≥35` for `T=s` + and `|H|≥31` for `T=s s`. Together with `|H|≥27` for `T=s s s`, + they make 43 bits the exact minimum across these three operand families. + With the other 122 bits fixed, 165 is minimal within these three operand + families under the stated independent rigid reader laws. The bounds permit + every ambient variable, arbitrary whole-stream access, and source beta + redexes. The proof excludes every source-compression case, then all + remaining normal shapes. Its continuation-ancestry argument counts + lambda bodies containing `c`: the original external application edges + must consume enough such lambdas, while small index budgets restrict + their number even under binary copying. The proof has independent + reviews but no Lean formalization. Both cheap operands require at least + two explicit source lambdas, or three in beta-normal code; explicit + three-lambda handlers cost 49 and 45 bits, with fixed equations checked + by `handler_bound.py`. Bare operands `j,c`, lambda-containing operands, + other reader heads, actual NEXT/parser behavior, and arbitrary complete + interpreters remain outside the bound (`classical/self-interpreter/cheap-tail-bound.md`, `classical/self-interpreter/protocol-obstructions.md`). The zero arm ≥ 14, APP lift ≥ 19, reader/handler knot-tree and cell/APP diff --git a/docs/classical/self-interpreter/cheap-tail-bound.md b/docs/classical/self-interpreter/cheap-tail-bound.md index 4383fcc5..8a9f9ca2 100644 --- a/docs/classical/self-interpreter/cheap-tail-bound.md +++ b/docs/classical/self-interpreter/cheap-tail-bound.md @@ -1,15 +1,17 @@ -# Cheap-reader lambda floors and the self-application bound +# Lower bounds for whole-stream and self-application readers This is Codex's handwritten proof record. It concerns the reader `s H T` in the ambient frame `[s,j,c,p,x]`, with `j,c,p,x` independent rigid variables. The handler may use every ambient variable and arbitrary beta redexes. The two operands considered here are `T=s` and `T=s s`. -For `T=s s`, the argument excludes every handler of at most 30 bits -that satisfies both reader laws. It allows arbitrary source beta -redexes, whole-stream access through `s`, and every variable in the -ambient frame. The proof is handwritten, not a Lean formalization. -The corresponding 34-bit threshold for `T=s` remains open. +The argument excludes every handler of at most 34 bits for `T=s`, and +at most 30 bits for `T=s s`, that satisfies both reader laws. Thus either +reader costs at least 43 bits. Together with the standard-skip theorem in +`handler-bound.md`, none of the operands `s`, `s s`, or `s s s` can improve +the 165 while its surrounding code and this interface stay fixed. +The proof is handwritten and independently reviewed, not a Lean +formalization. It does not establish global 165-bit optimality. Write @@ -20,13 +22,16 @@ P₀ = cons K N, Pᵢ₊₁ = cons F Pᵢ, I = λa.a, Q = K N. ``` -Here `N` is a fresh rigid variable. On a variable stream `s=Pₘ`, -`m≥1`, the required reader law is +Here `R,N` are fresh rigid variables. The zero-stream law, with +`Z=cons K R`, and the variable-stream law, with `m≥1`, are ``` -H F Pₘ₋₁ T =β c Pₘ₋₁ N. +H[Z/s] K R T[Z/s] =β R j, +H[Pₘ/s] F Pₘ₋₁ T[Pₘ/s] =β c Pₘ₋₁ N. ``` +The substitution notation is suppressed below when the stream is clear. + For `T=s`, the final argument is `Pₘ`; for `T=s s`, it reduces to `Q`. Both are beta-normal abstractions, distinct from the rigid `N`. Correctness on all variable streams alone forces **at least two explicit @@ -35,8 +40,7 @@ zero-stream law is not needed for these floors. A reader improvement requires `|H|≤34` with `T=s`, or `|H|≤30` with `T=s s`. The lambda floors alone do not exclude those budgets; -the compression and shape arguments below complete the exclusion for -`T=s s`. +the compression and shape arguments below complete both exclusions. ## The application-only data algebra @@ -343,6 +347,151 @@ lambda must therefore be activated internally before the external arguments are supplied. This leaves at most two source lambdas and all three pending arguments, so the lemma applies. +## Two source lambdas with one binary binder + +This independently reviewed handwritten argument strengthens the +safe-data pending-argument obstruction. It uses the same fixed, fresh rigid N and safe +functional atoms F,I,Q,P_m,P_(m-1). Rigid neutrals may contain safe data, +source lambdas, and trapped terminal K; their arguments cannot be extracted +through a rigid head. A source lambda means an explicit code binder, not +a binder already inside a safe data atom. + +Claim. Let G be any source term with at most two source lambdas, with at +most one binder having two bound occurrences and every other source binder +affine. No beta-normality assumption is made. For every sufficiently long +prefix, it cannot satisfy + + G F P_(m-1) P_m =beta c P_(m-1) N. + +The initial source may contain arbitrary safe atoms and rigid markers. +Its source grammar and macro application count are fixed independently of +m. This is a restricted two-source-lambda theorem: two nonlinear binders, +or a binder with three occurrences, are not included. + +### Controlled outermost activation and the long-prefix guard + +Use the existing opaque-marker normalization strategy: replace each +outermost source-lambda block by one distinct rigid marker, normalize only +the exterior application context with the data-algebra table, and restore +and activate a source block only when its marked head is exposed. Source +lambda bodies remain opaque until their enclosing binder is activated. +In particular, a source binder below another source binder cannot be the +first activated source binder. + +Until the first source activation, all reductions are affine data +reductions. No source block is copied, so there is at most one occurrence +of the possibly binary source lambda U. The other source lambda, if +present, is V and is affine. A functional data result has no c; an ordinary +rigid result retains all pending external arguments. These results already +fail. Otherwise the normalized exterior is a marked source lambda, bare +or supplied with one or more internal arguments. + +As in the established index-ancestry proof, take m sufficiently large +that this and every subsequent source activation cannot receive bare +terminal K. This bounds offsets of exposed functional Scott values, not +the total number of beta steps: a pair/pair reduction may traverse the +whole prefix but returns I,Q or a rigid neutral, never an exposed terminal +callback. Each functional predecessor costs a macro application. + +There are at most three source activations in the strategy below. An +opaque normalization phase at most doubles the macro application count; +the only potentially copying source contraction has multiplicity two and +at most doubles that count once. The other source contractions are affine. +Consequently all exposed Scott offsets have a finite bound independent of +m. For example, with initial macro application count A and initial Scott +offsets at most one, the generous choice + + m > 64 (A+2) + +dominates the successive phase and tail-supply bounds. This allows the +already proved affine and one-source-lambda arguments to be reused after +the first activation, with their finite enlarged macro counts and offsets. + +### First activation of the affine binder + +Suppose V is activated first. Whether its argument is internal or the +first external F, its affine contraction cannot copy U. It leaves at most +one source lambda, U. There are respectively three or two external inputs +still pending, and their final input remains the original P_m. + +The extended one-source-lambda obstruction already proved applies: its +body may use its bound variable more than once; an internal argument has +no other source lambda, and the long-prefix guard supplies only safe data +or a rigid neutral. If the remaining U is returned bare, it consumes one +pending safe argument and leaves the final P_m. Thus neither placement +can give the required target. If the first activation erased U entirely, +the base-data case applies instead. + +This case also accounts for an affine V enclosing U. Activating V first +removes its binding scope before U can duplicate a former free V occurrence. +An affine substitution cannot increase the multiplicity of U's own bound +variable. The exterior argument cannot refer to that bound variable, +because its binding lambda lies inside V's body. + +### First activation of the binary binder + +Now suppose U is activated first. The opaque strategy guarantees that V +does not enclose U. This qualification matters: reducing U below an intact +V could otherwise copy a free occurrence bound by V and make V nonlinear. + +If U has an internal argument, restore the actual source blocks in that +argument and contract U before supplying any of the three external inputs. +The argument cannot contain U itself: before this contraction there is +only one U occurrence, and it is the function being contracted. Any other +source lambda in the argument is V, which is affine. If V lies in the +argument, it is copied at most twice and each copy remains affine. If V +lies in U's body or in disjoint exterior syntax, it remains a single +affine source lambda. No enclosing V remains to have a bound occurrence +duplicated. The complete reduct is therefore affine, with at most two +source lambdas and all three external inputs still pending. + +The established affine pending-argument lemma applies at k<=2,n=3. +Its source lambdas may contain c and may become constant closures; that +lemma counts these residual lambdas, including moved or copied closures, +and does not assume that a copied block is c-free. Safe data and ordinary +rigid neutrals are allowed in its exterior basis. + +If U is returned bare, give it the first external argument F. Copying F +introduces no source lambda. At most the single affine V remains, with the +two inputs P_(m-1),P_m pending. The affine bound at k<=1,n=2 applies. + +These alternatives exhaust the first exposed source block and prove the +claim. With no binary binder the ordinary affine bound already suffices. + +### Application to normal application-headed three-lambda handlers + +Let H be source-beta-normal and application-headed, with exactly three +source lambdas, at most one binary binder u, and every other source binder +affine. Its initial exterior basis contains only s and rigid markers; +multiple occurrences of s are allowed. +If no source lambda activates internally, safe data or a rigid head +receives all three external inputs and fails. Otherwise a first activation +can be chosen at a literal source subterm s D, for an outermost block D. +For a sufficiently long variable stream, + + S (lambda a.W) -> W[F/a] P_(m-1). + +This consumes one source lambda and copies no source lambda. If a=u, the +two remaining source binders are affine, so the existing k<=2,n=3 bound +applies. If a is an affine binder, the residual has at most two +source lambdas: one binary u and one affine binder. Substitution of safe F +cannot increase u's own bound multiplicity. The theorem just proved then +excludes the residual, with all three external reader inputs still pending. + +Thus every such three-lambda handler fails the variable law, regardless +of its application count or index budget. The all-affine case is already +covered by the existing restricted affine observation. + +At A=5,L=3, mandatory j,c and at least one s consume three of the six +variable leaves. The remaining at most three leaves permit at most one +nonlinear binder. If its multiplicity is two, the new result applies, +including repeated s or other ambient leaves. The only higher-multiplicity +pattern is s,j,c,u,u,u. It has exactly one live binder and exactly one s, +so the independently reviewed ordered-input obstruction excludes it at +the improving 34-bit budget. Consequently every remaining normal +A=5,L=3,k=0 allocation is excluded. Larger source-lambda counts are not +covered by this argument. + ## Three leading lambdas do not fit the whole-stream operand For `T=s`, a beta-normal handler with exactly three source lambdas, @@ -2045,6 +2194,452 @@ Consequently five-application nonlinear compression at the improving budget remains only with **three source lambdas**, `X≤6`, and the leaf allocation `u,u,j,c,s,v`. +### Three lambdas with both remaining binders inside the copied argument + +The following handwritten exclusion has been independently reviewed. +In the remaining compressed T=s allocation + + A=5, L=3, X<=6, leaves u,u,j,c,s,v, + +a minimum successful handler cannot have both source lambdas other than u +inside the argument D copied by the chosen redex (lambda u.B) D. One of +these two binders is live and affine, binding v; the other is vacuous. +The claim allows every placement of the three ambient leaves s,j,c. +The normal-case obstruction uses only the variable law. + +Because there is no affine source redex, D is beta-normal. Contracting u +leaves an application-only context of exactly two copies of D and whichever +of s,j,c were outside D. Every surviving source binder is affine. Call the +result H0. It is a nontrivial application tree; no source lambda lies +outside its two D copies. + +#### Closed D + +If D contains no ambient leaf, its sole variable leaf is v, so D=K or F. +The exact contraction formula is + + Delta = |D| + (f-1)(d1+d2) - 8 - r, + +where f is the number of free leaves of D, di are the occurrence depths of +u below its binder, and r counts the other body references whose indices +drop. Here f=0 and |K|=7, |F|=6. Thus Delta<0, contradicting minimum wire +size. Hence D contains at least one ambient leaf in what follows. + +#### A restricted application-headed affine observation + +Use the established affine pending-argument lemma with this consequence: +a beta-normal application-headed affine source with k source lambdas fails +with n>=k pending safe reader arguments, ending in S=P_m, if its initial +exterior basis consists only of s and rigid markers. Choose m sufficiently +large relative to the fixed source. + +Indeed, before any source activation, opaque source blocks cannot be +returned as bare functional values by this exterior basis. If no block +is activated, the result is safe data or a rigid neutral and fails. The +first activation consumes a source lambda without copying another. At +most k-1 source lambdas remain with n>=(k-1)+1 arguments pending, which is +the established affine pending-argument bound. The restriction on the +initial exterior basis is essential; arbitrary initial F/I could return a +bare source block without activation. If a leading vacuum has discarded +the first external F, this exterior basis is unchanged. + +We use this only at (k,n)=(3,3) or (2,2). We also use the established +unrestricted affine bound at k<=2,n=3; that version allows safe data atoms. + +#### Normalize H0 before substituting the reader input + +Affine source normalization terminates. If two or more source lambdas +contract or are erased, at most two remain and the affine bound excludes +the result with all three external inputs pending. + +Suppose exactly one source lambda is lost. The first source contraction +is a whole copy D applied to some X: D itself is normal, and all exterior +syntax is application-only. If its outer lambda is live, write + + D=lambda v.W. + +The one-loss reduct is W[X/v]. Any leading source lambda of the full normal +result must have been exposed by this contraction, and this redex must +have been the entire H0; a surrounding application would require another +contraction to expose that lambda at the root. As v occurs once and W has +one other lambda, a lambda-headed W[X/v] can arise in only two ways. + +First, W begins with the vacuous lambda q. Its body contains the unique v +and at least one ambient leaf, hence is application-headed before +substitution. If its head becomes the other bare D inside X, it has a +source argument and causes a second contraction. Otherwise its normal +body remains application-headed, with the other copy's two source +lambdas. The result has one leading vacuum followed by that body. After +the vacuum discards external F, the restricted (k,n)=(2,2) observation +excludes it. + +Second, W could have head v with no argument, in which case substitution +could expose a bare lambda from X. But W=v has no place for either the +other source lambda or an ambient leaf, so this case is impossible. +If W has head v with an argument and X becomes lambda-headed, another +source contraction is required. If W has rigid head, substitution cannot +change it. This exhausts the ways to expose a lambda. + +If D's outer lambda is vacuous, its first contraction erases X. Exactly +one loss requires X to contain no copy of D; the other copy survives +outside that redex. The exposed inner lambda therefore cannot be the +whole normal source: all initial exterior syntax was application-only, +and eliminating an exterior application would require another source +contraction. Hence the full source normal form is application-headed. + +Every other one-loss case is likewise application-headed with three affine +source lambdas and is excluded by the restricted (3,3) observation. + +Thus any remaining candidate has no source contraction at all: H0 is +already beta-normal, application-headed, and contains both intact D copies. + +#### Lambda-headed D + +If s lies inside D, the outside application tree has only j/c as rigid +leaves. Its head cannot be a D copy, since H0 is normal. Its head is +therefore rigid j/c, and retains all three external inputs. This fails. + +Otherwise s lies outside D. All free variables inside D are j/c. If a +source lambda is ever activated before the external inputs, a first one +can be chosen at a literal source subterm s D, by the established first- +activation argument. If none is activated, safe data or a rigid head +receives all three external inputs and fails. + +Let S=P_m and V=P_(m-1), with m sufficiently large. That activation is + + S D ->* D F V. + +If D has two leading lambdas, both source lambdas are consumed. At most +the other copy's two source lambdas remain; the affine bound excludes the +result with all three external inputs still pending. + +Suppose D has exactly one leading lambda. If it is vacuous, write +D=lambda q.W. W is application-headed and its head is rigid j/c: the live +binder is nonleading, and q is unused. The reduct W V has an immutable +rigid prefix whose first argument comes from W and contains no N. + +If the leading binder is live, write D=lambda v.W. The other, vacuous +lambda is nonleading in W. If W has rigid head, W[F/v] V again has a +rigid prefix with an N-free first argument. If W has head v, write + + W=v A1 ... At, t>=1. + +There is no other occurrence of v, so every Ai contains only rigid j/c +and possibly the unique vacuous lambda. For t=1, + + F A1 V -> V + +erases that lambda. For t>=2 the result is + + A2 A3 ... At V. + +If A2 is lambda-headed, its vacuous lambda consumes the next argument +(V when t=2), eliminating the second source lambda. If A2 is rigid-headed +with a nonempty spine, its first argument is N-free. If A2 is a bare rigid +and t>=3, A3 is its N-free first argument. If A2 is bare and t=2, the +vacuous lambda had to lie in A1 and has already been erased. + +Consequently every activation either loses both source lambdas of the +activated copy, or produces a rigid normal prefix with an N-free first +argument that permanently guards its remaining source lambda. Normalize +the arguments of this prefix; they are affine, and its first argument +remains N-free. + +The prefix matches no subterm of the required target c V N: a j-headed +prefix is impossible because j is absent; a c-headed prefix has first +argument unequal to V, since V contains free N. Its rigid normal head and +arguments cannot be changed by outside reductions. Any successful trace +must erase it. Replace this entire prefix by a fresh rigid atom and replay +the outside trace. Only the other copy's two source lambdas remain, and +the unrestricted affine pending-argument bound gives a contradiction. +This is an erased-prefix replay, not contextual equivalence. + +This handles every lambda-headed D, with any number of ambient leaves. + +#### Application-headed D + +If D has rigid head j/c and s lies inside it, all leaves in the exterior +application tree are rigid-headed, so H0 already has rigid head j/c and +retains all three external inputs. If s lies outside D, each copy of D is +a fixed normal j/c-headed application containing no N. Its nonempty first +argument is N-free, so the same erased-prefix argument freezes both copies. +The residual is application-only over s and rigid markers, and fails the +base data-algebra obstruction. + +It remains that D has head s. There is exactly one occurrence of s, so + + D=s A1 ... Ak, k>=1, + +and each Ai contains only j/c and the one live binder v plus one vacuous +binder q. The two binders may occur together or in different arguments. +All Ai are source-normal. We claim that, after s=S is substituted, D +normalizes to exactly one of these three kinds: + +1. a safe functional data value from the base algebra; +2. a rigid j/c-headed neutral (its arguments may contain source lambdas); +3. a constant lambda q.J, where J is a fixed N-free application-only + expression over j,c. + +If A1 is application-headed or a bare variable, its head is rigid j/c; +S A1 -> A1 F V is already rigid-headed. So assume A1 is lambda-headed. + +If A1 contains both source lambdas, the analysis of A1 F V is the same +as the lambda-headed case just given. When both lambdas disappear, the +residual is application-only over safe F,V and rigid j/c, hence base-safe +or rigid. A guarded surviving lambda gives a rigid head. All later Ai +are application-only over j/c, so applying them preserves these two kinds. + +If A1 contains only the vacuous lambda, its body is application-only over +j/c. Its invocation yields that rigid body followed by V, so it is rigid. +The live binder in some later Ai cannot change that head. + +The remaining case is A1=lambda v.B, where B is application-only, contains +v once, and otherwise uses j/c. The vacuous lambda lies in a later Ai. +If B has rigid head, the invocation is rigid. If B=v B1 ... Bt with +t>=1, the Bi are application-only over j/c. For t>=2, F B1 ... Bt V +has rigid head. For t=1 it is V, but at least A2 remains because the +vacuous lambda lies outside A1. Applying V to an application-headed or +bare A2 gives a rigid head. If A2=lambda q.J, then V A2 -> J P_(m-2), +also rigid. Here J is application-only over j/c. + +Finally B=v makes A1=I and S I -> I. Thus D reduces to + + A2 ... Ak. + +These source-normal arguments together contain just one vacuous lambda +and rigid j/c. A functional result is possible only when k=2 and +A2=lambda q.J itself: it is kind 3. If another argument is present, that +lambda discards it and exposes rigid J. If A2 is application-headed or +bare, its head is already rigid. This proves the three-kind classification. + +Now normalize each identical D copy before any external input is supplied. +The whole H0 is a nontrivial application tree over those two results and +the remaining rigid j/c leaves. For kind 1 the base data algebra applies; +functional results contain no c, while rigid results retain three external +inputs. For kind 2 every possible head is rigid before those inputs. For +kind 3 any applied copy lambda q.J immediately exposes rigid J, and the +whole tree is nontrivial, so again its normal head is rigid. Every case +fails the variable law. + +This exhausts D and proves the d=2 exclusion for L=3. Any remaining +compressed handler has zero or one source lambda in its copied argument D. + +### Three lambdas with one binder inside the copied argument + +This handwritten exclusion has also been independently reviewed. +The setting is the remaining minimum T=s handler with + + A=5, L=3, X<=6, leaves u,u,j,c,s,v. + +The source redex is (lambda u.B) D, u occurs twice, v is the sole +occurrence of the other live binder, and the third source binder q is +vacuous. There is no affine source redex. We claim that D cannot contain +exactly one source lambda. + +The ambient indices contribute 3, and the remaining index units are the +sum of source-binder taxes: + + X-3 = tax(u)+tax(v)+tax(q) <= 3. + +A binder's tax counts body leaves whose binders lie outside it. Because q +is vacuous and is the only lambda inside D whenever q lies there, it has +positive tax: its body is nonempty and every leaf is free relative to q. + +We use the affine pending-argument bound and the restricted application- +headed consequence proved in the preceding section: an affine normal source +with at most two source lambdas fails with three pending reader arguments; +an application-headed affine normal source with k lambdas and initial +exterior basis s plus rigid markers fails with n>=k pending arguments. + +#### The lambda inside D is the live binder v + +Contract u. There are two normal affine D copies and one vacuous lambda +outside them. All three resulting source lambdas are affine. + +If any source lambda contracts or is erased during source normalization, +at most two remain and the affine bound applies with all three external +inputs pending. Otherwise the post-u source is already normal with three +source lambdas. If application-headed, the restricted (k,n)=(3,3) bound +applies. + +If it is lambda-headed, the leading lambda must be the exterior vacuum q. +A copied D cannot be exposed bare at the root without another source +contraction: the body B contains two u leaves and any exterior syntax is +applications and the single q binder. A body consisting of only u would +be required to substitute a bare D at the root. Thus the only possible +leading prefix is q. Its body is application-headed and has the two live +D copies. After q discards the external F, the restricted (2,2) bound +excludes that body. This exhausts the live-binder case. + +#### The lambda inside D is vacuous, and v occurs freely in D + +The v binder encloses the u redex, since it binds a leaf in D. Consequently +all three source lambdas lie inside the one v block V0=lambda v.W. +This block cannot be the whole handler: its tax would count all three +ambient leaves s,j,c, and the vacuous q already has positive tax, exceeding +the allowance 3. Nor can this initially affine v block be applied in +source function position, since that would be an affine source redex. + +The handler is therefore an application-only context of the single V0 +block and the ambient leaves outside it. If s lies inside V0, its exterior +head is rigid j/c and cannot satisfy the variable law. Otherwise s lies +outside V0. Before a source block is activated, the established literal- +stream argument applies to the exterior source: a first activation can be +chosen at a literal subterm s V0. If no activation occurs, safe data or a +rigid head receives all three external inputs and fails. + +For a sufficiently long variable stream this activation gives + + S V0 -> W[F/v] V, V=P_(m-1). + +Now contract u inside W[F/v]. Its two copied arguments contain only the +one vacuous source lambda q and safe F plus rigid j/c. The result has at +most two source lambdas, both vacuous, with all three external inputs +still pending. The affine pending-argument bound excludes it. Any source +erasures only decrease this count. No nonlinear v remains: the v binder +was supplied F before u was contracted. + +#### The lambda inside D is vacuous, and v lies outside D + +Contract u. The result has two vacuous q copies and the original affine +v binder. It is affine. As above, any source contraction or erasure leaves +at most two lambdas and is excluded; a normal application-headed result +is excluded by the restricted (3,3) bound. + +Only a normal lambda-headed result remains. A copied q block cannot become +the bare whole result without a source contraction, because B contains +two u leaves. Thus the leading binder is v. + +The original handler cannot already have begun with v: that would give +tax(v)=3 from all three ambient leaves and tax(q)>0. The leading v must +therefore be newly exposed by contracting the whole root u redex: + + H=(lambda u.lambda v.T) D. + +There is no other exterior application or lambda. Both u occurrences lie +below v and cost tax(v)>=2; q costs at least one. The index allowance is +therefore saturated: + + tax(v)=2, tax(q)=1, tax(u)=0. + +No ambient leaf can lie in T. All three s,j,c lie in D, while T is an +application-only tree over exactly u,u,v. Since q is D's only lambda and +has tax one, its body is a single ambient leaf a. Thus q occurs in the +normal block K a=lambda q.a, for a one of s,j,c. D is application-headed +and is the normal three-leaf application tree over s,j,c with this one +leaf wrapped by the vacuum. + +On the zero branch set P=cons K R. The specialization D0=D[P/s] has +rigid head j or c. If its source head is j/c this is immediate. If its +source head is s, its arguments use the two rigid leaves j,c, possibly +with one wrapped as K a. The first argument is either rigid-headed or +is K a for a=j/c. In the first case P appends K,R to that rigid head. +In the second case P (K a) -> a R, again rigid. A wrapped s could not be +the source head because D is source-normal. Further source arguments +preserve the rigid head. + +After the first external K, the zero branch becomes + + T[D0/u,K/v] R P. + +The tree T has two rigid-headed D0 leaves and exactly one K leaf. Its +normal form is rigid-headed, or is a single constant K J with J +rigid-headed. To verify this directly, any application whose function is +D0 keeps its rigid head. The only other function is the unique K; with +one argument it forms K J where J is built from D0 leaves, and with two +arguments it returns its first such rigid-headed argument. Neither D0 +nor an application of D0 can discard the remaining K to return it bare. +Thus the pending R,P expose a j/c head, never the required R j. + +This closes the final d=1 placement. Any remaining compressed L=3 +candidate must have a lambda-free copied argument D. + +### Three lambdas with a lambda-free copied argument + +The following handwritten exclusion has independent exact review. Assume +the minimum successful whole-stream handler has +`A=5,L=3,X≤6`, no affine source redex, and leaves `u,u,j,c,s,v`. +The chosen nonlinear redex is `(λu.B) D`. Its binder occurs exactly twice; +the other live binder `v` occurs once in the source, and the third binder +`w` is vacuous. Suppose the copied argument `D` contains no lambda. + +The claim excludes this entire `d=0` slice. It uses the variable law and +the source's exact index budget, without any candidate enumeration. + +If `D` does not contain free `v`, contracting `u` leaves exactly two +source lambdas, both affine. The established affine pending-argument lemma +with `k=2,n=3` excludes the variable law. Every copied argument is +lambda-free; no other source binder becomes nonlinear. + +Suppose `D` contains `v`. Its binder is outside the chosen redex and +encloses both `u` and `D`. A singleton `D=v` strictly decreases wire size +when `u` contracts: the contraction formula has `f=1`, hence +`Δ=|D|-8-r<0`. Here `v` crosses at most the sole vacuous binder on its +way to `D`, so `|D|≤3`. Such a source is not minimum. Thus `D` also +contains at least one ambient leaf. + +Use the source index-tax identity `X-3=Σ tax(λ)≤3`, with the ambient +base contributions `j:1,c:2,s:0`. A leading `v` would have tax three, +since every ambient leaf would lie below it. The remaining vacuous binder +has positive tax. Indeed a zero-tax vacuum must enclose a live binder; +it cannot enclose its ancestor `v`, and enclosing `u` also encloses `D`, +including its free `v` and ambient leaf. A vacuum elsewhere has a free +leaf in its nonempty body. This exceeds the tax budget. A leading `w` +would likewise have tax three, while `v` has positive tax from the ambient +leaf in `D`. Thus the handler has no leading lambda. + +The unique `s` must be its source head; a rigid `j/c` head fails. The +whole `v` block contains the only source redex and cannot itself occur +in source function position, since its binder is initially affine and +there is no affine source redex. The only other source lambda is `w`. +Its position relative to the `v` block is either inside, outside and +disjoint, or enclosing. + +If `w` is inside the `v` block, the exterior has just that one lambda +block and the remaining ambient leaves. Since the unique `s` is the +whole source head, it is outside the block. Every other free exterior +head is rigid `j/c`. Hence a successful first Scott invocation must use +the literal `v` block as callback: a source application headed by `j/c` +stays rigid, and applying the `v` block in the callback's syntax would +have been an affine source redex. On a variable stream this first +invocation supplies `F` to `v`, followed by `V=P_(m-1)`. + +Contract `v` with this `F` before contracting `u`. Now the lambda-free +argument `D[F/v]` contains only safe data and rigid variables. Contracting +`u` copies no source lambda and leaves only the single vacuous `w`. +The complete remaining expression is affine, with at most one source +lambda and all three external reader inputs still pending. The affine +pending-argument lemma excludes it. The additional Scott tail and source +common arguments belong to that remaining expression, not to the three +external inputs. + +If `w` is disjoint from the `v` block, its body contains no live source +binder and no `s`, because the unique `s` is already the exterior head. +Its body is application-only over rigid `j/c`, so a first callback use +of `w` immediately gives a rigid head and fails. The first successful +callback must instead be the literal `v` block, receiving `F` as above. +Contracting `u` afterwards leaves the one disjoint vacuum. The same +affine `k≤1,n=3` contradiction applies. + +Finally let `w` enclose the `v` block. It is the only exterior lambda +block. Again the unique `s` is outside it, and a successful first Scott +callback must be that literal block. Write it `λw.C[λv.W]`. Its first +argument `F` is discarded. If `C[λv.W]` is application-headed, its head +is rigid `j/c`: the only source redex is inside `λv.W`, and placing +that affine block in function position is forbidden. This case fails. +The only remaining shape is `λw.λv.W`. The same Scott invocation then +supplies its tail `V` to `v`. Contracting `u` after this substitution +again copies a lambda-free safe-data expression. No source lambda remains, +and the three external reader inputs are untouched. The base algebra, +equivalently the affine pending-argument lemma at `k=0,n=3`, excludes it. + +These placements exhaust the source. Thus the lambda-free copied argument +cannot occur in a minimum successful handler in the remaining allocation. + +Together with the preceding copied-argument cases, this excludes every +five-application nonlinear compression at the improving budget. A minimum +successful whole-stream handler of at most 34 bits is therefore beta-normal. + ## Normal whole-stream handlers with at most three applications Write `P=cons K R` on the zero input and `S=Pₘ(N)`, @@ -2904,103 +3499,1084 @@ both arguments; equality with c V N would require the body to be bare c and S=N, which is false. This excludes the variable law and hence every such A4,L5,k1 handler. -## Nonleading nonlinear four-application handlers with stream access +## A unique stream occurrence and at most one live binder + +Let `H` be beta-normal and nonleading, contain exactly one occurrence of +`s`, and have at most one live source binder. Its multiplicity is +unrestricted; every other source binder is vacuous. The mandatory rigid +names `j,c` may occur more than once. If it satisfies the zero law, then + +``` +L ≥ q+4, 2L+X ≥ 3q+15 ≥ 18, +``` + +where `q≥1` is the number of arguments on its outer `s` spine. + +A rigid head fails the zero law, so write `H=s A₁ ... A_q`. The first +callback `A₁` has no `s` and no free source-bound variable. If it is +application-headed, its normal head is rigid and `P A₁` preserves that +head. It must therefore be a leading lambda block `D`. Its normal body +head must be the unique live binder `u`; with no live binder, a fixed +rigid body head fails immediately. Thus `u` lies on `D`'s leading chain. +Let `d` be the length of that chain. + +After expanding the zero cell `P=cons K R`, `D` receives the ordered list + +``` +K,R,A₂,...,A_q,K,R,P. +``` + +It has `n=q+4≥5` entries. Consider the argument received by `u`. + +If it is a common source argument `A_i`, that argument contains only +rigid ambient names and vacuous lambdas: `u`'s binding scope is inside +`A₁`, and the unique `s` has already been used at the outer head. Such a +normal argument can only discard arguments before exposing a fixed +rigid head, or remain a lambda if insufficiently applied. Its copies +cannot yield head `R`. + +If `u` receives `K`, all earlier leading binders were vacuous, so any +earlier direct `R` was discarded. After substituting `K` for every +`u` occurrence, only selectors and vacuous erasers remain. Vacuous +wrappers may still contain fixed `K` and `j`; they do not capture a +received argument. The ordered-input argument from the one-live +first-input case applies: selectors return an argument whole and +vacuous binders discard it; neither inserts a later received `R` into a +fixed source application with the earlier `j`. Exposing `R` before the +last input is consumed retains final `P`. Selecting final `P` only after +earlier input edges have disappeared leaves it with no later argument. +Neither case yields `R j`. + +If `u` receives a direct `R`, substituting this rigid value creates no +redex in `D`'s normal body. Once its `d` leading binders have been +consumed, the rigid head retains every remaining ordered argument. +Thus zero correctness requires `d≥n`, so that final `P` has already +been consumed. If `u` receives final `P` itself, its position on the +leading chain likewise requires `d≥n`. + +In either last case, every common argument containing a `j` has been +discarded by a vacuous binder: the only live binder receives `R` or `P`. +Consequently a surviving `j` must occur inside `D`'s body beneath all +`d` leading lambdas. Its index contributes at least `d+1`, and mandatory +`c` contributes at least two. Since `L≥d`, + +``` +2L+X ≥ 2d+(d+1)+2 = 3d+3 ≥ 3q+15. +``` + +This proves the stated bounds. In particular `L≤4` is impossible +regardless of the application count. + +For an improving four-application handler, the budget is `2L+X≤16`, +so every unique-`s` case with at most one live binder is excluded. In +particular a nonlinear nonleading `A=4` handler has exactly the leaves +`j,c,s,u,u` and falls under this result. Every remaining nonleading +normal `A=4` handler is affine with at most two live binders. + +For an improving five-application handler, `2L+X≤12`, so the same +unique-`s` cases are excluded. A remaining nonlinear nonleading `A=5` +handler therefore has exactly one of the leaf allocations + +``` +j,c,s,u,u,s, j,c,s,u,u,v, +``` + +where `v` is the sole occurrence of a distinct affine binder in the +second allocation. + +## Affine nonleading four-application handlers with a single outer callback + +Suppose H is beta-normal and affine, A=4, |H|<=34, and H=s D with exactly one outer head argument. Suppose the leaves are exactly s,j,c,u,v, with u,v distinct live binders. (The unique-s cases with at most one live binder are already covered by the ordered-input lemma.) Both live binders and all source lambdas lie inside D. Its four leaves are u,v,j,c and it has three applications. + +Write D=lambda^d.w B1...Bp. Its normal head w must be one of its leading bound variables; a rigid head cannot produce zero head R. Mandatory j,c lie under all d leading lambdas, so X>=2d+3. Since L>=d and 2L+X<=16, d<=3. The zero activation supplies D with + + K,R,K,R,P. + +A leading head bound to R would expose rigid R while final P remains, because d<=3<5. No leading binder can yet receive P. Thus the head receives K, from input one or three. The internal head arity p is one, two, or three. + +We use one small zero-law fact. A beta-normal source containing mandatory j,c, no s, and exactly one affine live binder cannot produce R j when supplied K,R,P, or R,P. Its head must be that live binder. A K value leaves only selectors and vacuous erasers and fails the ordered-input argument. A rigid R substitution creates no redex in the source normal body, which still contains c if all pending inputs are consumed, and retains final P otherwise. If the binder receives final P, this is the sole occurrence of P. Its callback contains only rigid j/c and vacuous lambdas, so P applied to that callback has a fixed j/c head, never R. These cases exhaust the possible received arguments. + +### One or two leading callback lambdas + +For d=1 the K-valued head is the first binder. For d=2 it is again the first binder, and the second live binder is either the leading R binder or lies inside an argument. + +If p=1, the head is K B1. For d=1, the next supplied R is discarded, leaving B1 K R P. For d=2, the next supplied K is discarded, leaving B1 R P. All remaining source leaves are the other bound leaf,j,c. If that bound leaf is bound inside B1, the preceding one-affine-binder fact applies. If it is the leading R binder at d=2, substituting rigid R preserves B1's normal form, including mandatory c; vacuous lambdas can only discard the pending arguments. It cannot give R j. + +If p=2, K selects B1 and discards B2. Zero correctness forces the other bound leaf and j to be in B1 and c in B2: without the bound leaf B1 has only a fixed rigid head; j cannot be discarded. Each branch then has respectively two leaves and one leaf, so B1 has exactly one application. A j-headed branch fails. If the bound head v receives K, its sole source argument is a fixed j chain, so selection exposes that fixed head rather than R. If v receives final P, it invokes that rigid or vacuous j callback, again yielding head j. Thus only v=R can succeed. Its argument must then be bare j: a vacuous lambda around j would remain under the rigid R. The only useful form is consequently a lambda chain over v j, with v either an inner bound variable receiving R or the already supplied R. The selected branch receives four pending inputs for d=1, or three for d=2, ending in P. All must be consumed before rigid R is exposed, and j must be bare. Thus j lies below at least five source lambdas in total, and L>=5. The c leaf is beneath at least the d leading lambdas of D. In particular X>=6+3=9 and 2L+X>=19>16. This is impossible. + +If p=3, all B1,B2,B3 are one-leaf lambda chains over the other bound leaf,j,c. A selected j/c chain has the wrong head. The only alternative is a chain projecting the other bound leaf, with j in B3 and c in B2. It is applied first to B3 and then to the remaining ordered inputs ending P. Such a one-leaf chain only discards arguments or returns one whole: it contains no fixed application that could attach the earlier j to the later R after final P has been consumed. Returning R earlier retains final P; returning it after all inputs gives bare R; returning j or final P also fails. Thus p=3 is impossible. + +### Three leading callback lambdas + +For d=3, the mandatory j,c already give X>=9. The budget forces L=3, so there are no inner source lambdas. The second live leaf is either R or another K. If it is another K, only selectors and vacuous erasers remain; the ordered-input argument excludes R j with pending R,P. + +If it is R, the application-only body has exactly one occurrence each of K,R,j,c. Its functional normal form can contain at most one constant lambda, of the form K A: there is only one K occurrence, and all other leaves are rigid. A rigid result retains final P. A one-constant result applied to R,P exposes A and still applies P to it; A is rigid because no K remains inside A. A bare K, even if returned, gives R after these inputs, not R j. Thus the body cannot absorb both pending inputs and return R j. + +This exhausts the d<=3 possibilities. Hence no affine, nonleading normal A4 handler H=s D with unique s fits the improving budget. + +## Nonleading five-application handlers with four or five outer arguments + +Suppose a beta-normal +handler has no leading lambda, has five applications and at most four +source lambdas, and satisfies the zero law. Its normal head must be `s`, +so write + +``` +H = s A₁ ... A_q, +P = cons K R, +H[P/s] K R P =β R j. +``` + +Here `R,j` are distinct fresh rigid variables. The claim is that `q≤3`. +This covers both remaining normal A5 lambda counts at the 34-bit budget. + +### Where the output application can come from + +Use an ordinary weak-head trace to the rigid head of the required normal +form, then normalize its arguments. Label application constructors by their +source. A beta step deletes its contracted application and copies the +application constructors already in the lambda body or its substituted +argument; it does not create an application constructor of a new origin. + +The zero input data has only the Scott body `h K R` and projection +body of `K`. Every application in a Scott body has fixed right argument +`K` or `R`. Those right arguments cannot normalize to `j`. Projection +or eraser lambda chains have no applications in their bodies. Consequently +the final application `R j` must come from a source application of `H`. + +An application on the original root spine of `H` is followed by the +three external argument edges carrying `K,R,P`. During head reduction, +that original edge stays on the pending global spine until it is consumed. +Its constructor is never placed in an argument: the pending root edges +are consumed in order, while substitution moves their argument subterms, +not the enclosing pending application constructors. If such an edge +survived as `R j`, the later external `P` edge would still be appended. +If it is consumed, that constructor is gone. Thus the target `R j` +cannot originate on the root spine. + +### Five outer arguments + +For `q=5`, all five applications lie on the root spine. Every `A_i` +is a lambda chain over one leaf. There is no remaining source application +that can become the target `R j`, so the zero law fails. + +### Four outer arguments + +For `q=4`, exactly one source application lies inside an `A_i`. It +must supply the final `R j` constructor. Its function child is a bare +variable because the source is beta-normal and this is the only inner +application. Its argument child must also be a bare variable: an enclosing +lambda on that right child could not disappear while this same application +constructor survives under the final rigid head `R`. + +The function leaf cannot be a rigid ambient variable, and it cannot be +free `s`: substituting `P` would make this application itself a beta +redex and consume its constructor. It must be a bound variable `u` +whose supplied value becomes bare `R` without consuming this application. +The right leaf must become `j`. In particular the two leaves cannot be +the same bound variable: confluence would then make the same supplied +term equal to the distinct normal rigid variables `R` and `j`. + +Call the lambda chain enclosing this unique application `D`. It has at +least one lambda. Its only body application is `u j` or `u v`, and +every other source block is a one-leaf projection/eraser chain. There is +no other nonlinear source code that could copy `D` before it is used; +the input data is affine as well. + +#### D is the first callback + +If `D=A₁`, expanding the zero stream gives it the ordered inputs + +``` +K,R,A₂,A₃,A₄,K,R,P. +``` + +It has at most four leading lambdas. If its function variable `u` +receives the first `K`, the distinguished inner application is consumed. +If it receives the second input `R`, exposing its rigid body still leaves +the final `P` pending. If it receives `A₂` or `A₃`, that source +argument is a beta-normal one-leaf chain: it is a lambda, a rigid ambient +variable, or literal `P`, never bare `R`. A lambda consumes the +distinguished application; a rigid head is wrong. No later input can yet +reach `u`. Thus this case fails. + +#### D is a later argument + +Now `A₁` is a one-leaf chain with at most three lambdas, because `D` +uses at least one of the at most four source lambdas. Its leaf is one of +its bound inputs, free `s`, or a rigid ambient variable. The following +cases exhaust its head behavior. A rigid result cannot give `R j`. + +With no lambda, the only possible functional leaf is `P`. +`P P → K R`, and the next argument is discarded before exposing `R` +with final `P` still pending. + +With one lambda, the only relevant cases are `I` or a constant chain +returning `P`. They give respectively `P I → K R` and +`(λ_.P) K R → P R → R K R`. Both expose `R` too early. + +With two lambdas, the projections are `K` and `F`, and the remaining +functional possibility is a constant chain returning `P`. + +* `F` exposes the first tail `R` too early. +* `K` leaves the state `A₂ A₄ K R P`. If `A₂=D`, then `D` + has at most two lambdas and receives only `A₄,K`; neither can supply + a bare `R` while preserving the distinguished application. If `A₂` + is another source chain, it has at most one lambda. Identity forwards + `A₄`, whose only possible `D` then receives `K`. A constant + returning `P` gives `P K R P → R`. If `A₂` is literal `P`, + it invokes `A₄`: a `D` there has at most two lambdas and receives + `K,R`, after which `K,R,P` still remain; another literal `P` + exposes `R` too early. All rigid cases fail. +* A constant chain returning `P` leaves + `P A₂ A₃ A₄ K R P`. A `D` in `A₂` has at most two lambdas, + receives `K,R`, and still leaves the final `P`. Any other source + chain in `A₂` has at most one lambda: identity, constant `P`, + literal `P`, and rigid cases reduce exactly as in the preceding + one-lambda cases, exposing `R` early or a wrong rigid head. + +With three lambdas, no other source chain can have a lambda except the +single lambda of `D`. + +* Selecting the first input returns `K`, which selects `A₃` and + leaves `A₃ K R P`. A `D` there receives `K`; literal `P` + gives `P K R P → R`; rigid cases fail. +* Selecting the second input exposes `R` too early. +* Selecting the third input leaves `A₂ A₃ A₄ K R P`. A `D` + in `A₂` receives the normal source argument `A₃`, never bare + `R`. If `A₂` is literal `P`, a `D` in `A₃` receives `K`, + while another literal `P` exposes `R` too early. Rigid cases fail. +* A constant chain returning `P` leaves `P A₃ A₄ K R P`. + A `D` in `A₃` receives `K`; a literal `P` exposes `R` too + early; and a rigid callback has the wrong head. + +In all cases a supplied value that is a lambda consumes the distinguished +application itself, so cannot be an unmentioned way for that constructor +to survive as `R j`. The cases above exhaust the at-most-three-lambda +prefix before `D` and show that it never receives a bare `R` and then +consumes the final `P` before exposing its body. This excludes `q=4`. + +Therefore every remaining nonleading normal A5 handler at the improving +budget has at most three outer arguments. + +## One index-tax unit cannot absorb the three external inputs + +The following handwritten argument has been independently reviewed. It +excludes every affine handler with `X≤4`, regardless of its lambda count, +and also the remaining nonlinear `A=5,L=4` allocations. Those allocations +have exactly one binary binder `u` and are + +``` +j,c,s,u,u,s, j,c,s,u,u,v. +``` + +Every other binder is affine. The proof tracks which lambda constructors +can contain `c` in their bodies when they are contracted. + +### The positive-tax inventory + +The mandatory ambient leaves `j,c` contribute at least `1+2=3` to `X`. +Every remaining index contribution is a crossing through a source lambda +whose binder does not bind that occurrence. Thus there is at most one +positive-tax source lambda `Z`, with tax one. Every zero-tax source lambda +is a closed whole subterm: all leaves in its body are bound by itself or +by an inner lambda, including any references to outer source binders in +this closedness test. The initial `c` is unique, since a second occurrence +would already give ambient index sum at least five. A second `j` spends +the last unit and leaves no positive-tax lambda at all. + +Use the outermost opaque-source-block normalization strategy. A lambda +body remains opaque until its enclosing binder is activated. Every +zero-tax lambda and every copy of it therefore stays closed while present: +substitution outside a closed subterm does not change it. When it is +applied, its constructor is consumed before its argument enters the body. +It cannot be contracted with `c` already in its function body. + +Only `Z` can contain `c` at contraction, either initially or after +substitution for its one free bound-variable occurrence. In the affine +case, `Z` is never copied, so at most one source contraction can have this +property. + +In the binary case write `U=λu.B`. Before its first activation, every +other reduction is affine, so its sole occurrence is never copied. Its +argument cannot contain `U` itself: the unique occurrence is the function +being contracted, and finite term syntax cannot contain that same +occurrence also in its argument. Moreover every enclosing source binder +has already been consumed by the outermost strategy. Its contraction +therefore cannot duplicate an occurrence bound by an intact enclosing +affine binder and make that binder nonlinear. + +After `U` contracts, all remaining source binders are affine. Thus `U` +fires at most once and copies its argument at most twice. The constructor +`Z` has at most two copies over the whole strategy: if already activated, +it is gone; if in `U`'s argument it is copied at most twice; if in `U`'s +body it is not copied. If `Z=U`, it has only its original activation. +Consequently at most two source-lambda contractions have `c` in their +function bodies. This counts all copies of `c`, not just a selected one. +Copying `c` elsewhere cannot turn a closed lambda into a lambda containing +`c` while that constructor remains intact. + +### Safe data cannot add a lambda that captures c + +Choose a sufficiently long prefix using the established functional-index +ancestry guard, counting the three final applications in the starting +macro syntax. In the affine case, with `A` source applications and `L` +source lambdas, `m>2^(L+1)(A+5)` suffices. The argument uses the finite +number of source activations; it does not require the pending-argument +inequality `n≥L+1`. + +In the binary four-lambda case, `U` can add at most three source-lambda +copies. There are at most seven source activations and eight opaque +data-normalization phases. Each phase at most doubles the macro +application count, and `U` at most doubles it once more. The conservative +choice `m>2^10(A+5)` dominates the exposed-offset and tail-supply bounds. + +The guard prevents a source callback from receiving bare terminal `K`. +It bounds exposed functional Scott offsets, not total beta steps: a +pair/pair calculation can traverse the prefix but returns `I,Q` or a +rigid neutral, never an exposed terminal callback. + +The safe atoms `F,I,Q` and Scott cells have no surviving inner lambda +that captures a supplied argument containing `c`. The only exception in +the finite input representation would be the inner lambda of bare `K`. +The data algebra never returns bare `K` functionally, and the guard +excludes a terminal callback supplying it to a source block. A `K` inside +a rigid neutral stays trapped; pair/pair uses apply it only to data +without `c`. Hence no data-lambda contraction in this strategy has `c` +in its function body. + +Across source and data alike, at most one contraction in the affine case, +or two in the binary case, can contract a lambda whose body contains `c`. + +### Three original root applications require three such contractions + +Tag the three original root-spine applications carrying +`F,V=Pₘ₋₁,S=Pₘ`. Their right subterms contain no `c` and remain so. +At least one source occurrence of `c` must survive to the required +normal form `c V N`. + +The final original application to `S` must contract: otherwise its normal +right argument remains the final argument `S`, which is not +beta-equivalent to `N`. Its function can become a lambda only after the +preceding original application to `V` contracts. That contraction in turn +requires the preceding original application to `F` to contract. An +uncontracted application remains an application at the root of its own +subterm and cannot itself become a lambda. + +At each of these three contractions, a surviving `c` lies in the function +lambda's body. The original right data argument has no `c`, and erasing +every `c` on this root spine could not yield the target. Thus the three +distinct original application constructors require three contractions +whose lambda bodies contain `c`. This contradicts both upper bounds. + +Therefore all affine `X≤4` handlers and both remaining nonlinear +`A=5,L=4,X≤4` allocations are excluded. Together with the preceding +three-lambda and compression arguments, **no improving whole-stream +handler has five applications**. The affine result also excludes +nonleading `A=4,L≥6` candidates, since their wire budget gives +`X≤16−2L≤4`. + + +## Affine four-application handlers with a unique stream and several arguments + +Let H be normal and nonleading, with A=4, a unique s, +and the other four leaves j,c,u,v for distinct affine live binders. +Assume 2L+X<=16. The affine floor gives L>=4. The affine X<=4 obstruction excludes +L>=6 at this budget, so only L=4 or L=5 remains. +Write H=s D A2...Aq, q>=2. Expand the initial zero cell to obtain + + D K R A2...Aq K R P, n=q+4 original input edges. + +The established ordered-input invariant applies unchanged with final P: +all n input edges must disappear, and the final Rj application comes +from one of the 4-q fixed source applications inside the arguments. +The first callback D must have a lambda and a bound body head. There is +no other free s in any argument. + +### Four arguments + +If q=4 there is no fixed source application, so Rj has no possible origin. + +### The source-head path with two live occurrences + +We use the same two-live-occurrence accounting as in the 30-bit proof. +Only a source live occurrence can move a supplied R into a fixed source +application. A supplied K can select a source block; its two contractions +consume at most two original input edges. There can be at most one useful +such K before the final R-producing occurrence. Thus L>=n-2=q+2. + +Here L<=5=5 and +L>=5. Since j,c have base index contribution three, + + 2L+X >= 2*5 + (5+3) = 18 > 16. + +If no K is used, the same argument gives the stronger depth n. + +### The final R occurrence is in a later argument + +The D block contains only the first live occurrence. If it also contained +c, its normal body could only apply its head to a fixed c-containing +block: a K head selects that wrong fixed head, while a forwarded callback +would spend a source contraction on the fixed c argument in addition to +all original input edges. The latter has no useful K and already needs +L>=n>5. A rigid R head fails immediately. Thus D is a one-leaf +projection chain, and c is in one of the later source arguments. + +For q=2, both j,c lie in A2. A projection merely forwarding A2 uses +its only live occurrence for that forwarding, leaving no useful K before +the final R occurrence; L= 8: + first row: j=4, c>=2, D's a=1, selected r=1; + second row: j=3, c>=2, D's a=2, selected r=1. + +Additional unused lambdas only increase L or X. Thus 2L+X>=18, again +outside the budget. + +This excludes q=2,3,4 and completes the unique-s/two-affine-live-leaf +nonleading A4 case. The affine X<=4 obstruction is used only to reduce +L to four or five. + +## Normal four-application handlers with one leading lambda and bound body head + +Let H be beta-normal in frame [s,j,c,p,x], have A=4, +L=3 or4, exactly one leading lambda, mandatory j,c and at least one s, +and size at most34. Suppose H=lambda b.B and the normal body head is b. +Then H cannot satisfy both whole-stream reader laws. + +Write B=b A1...Aq, 1<=q<=4. There are five source leaves: the head b, +j,c,s, and one additional leaf a. The latter may be a second b, a leaf +bound by an inner lambda, or any ambient variable. All inner binders +except possibly the one binding a are vacuous. At zero put s=P=cons K R; +at a sufficiently long variable put s=S=P_m and V=P_(m-1). + +### One or four body arguments + +For q=1 the variable reduct is F A1 V S -> V S, with no c, so fails. + +For q=4 every source application lies on the body root spine. None can +become the final R j constructor: until consumed it stays on the pending +root spine before the final external P edge, and consuming it deletes its +constructor. Zero-input data applications have fixed right argument K or +R, so none can supply the j argument. All source arguments are one-leaf +lambda chains with no application constructors. Thus the zero law fails. + +### Three body arguments + +There is exactly one inner source application. As above it must become +final R j. Its right child must be bare j: a lambda there would survive +under rigid R. Its function child is a variable, since a lambda there +would violate source normality. A rigid ambient variable has the wrong +head; s specializes to P and would consume the distinguished constructor; +b specializes to K and would do the same. Consequently its function is +the additional leaf a, bound by an inner lambda, and its value must become +bare R without consuming that constructor. + +Let D be the lambda chain containing this sole application a j. It has +d>=1 lambdas. The two other arguments are vacuous lambda chains over c +and s. D cannot be A2, which is erased on zero together with j. + +If D=A1, its ordered zero inputs are A3,R,P. A3 is a normal one-leaf +chain over c or s, never bare R. Receiving P would consume the distinguished +application. Thus a must receive R, and all three inputs must be consumed +before the rigid R is exposed. This forces d>=3. Together with the outer +b lambda, L>=4 and j has index contribution at least5. The c and s leaves +under b contribute at least3 and1. Hence X>=9, whereas L=4 requires +X<=8. For L=3 the lambda count already fails. + +If D=A3, zero leaves A1 D R P. A1 is a vacuous chain over c or s. +A c chain cannot produce head R. A positive-length chain over s erases D +on its first argument, losing j. Only literal A1=s remains, giving +P D R P -> D K R R P. D has at most L-1<=3 lambdas. If a receives K, +its distinguished application is consumed. If it receives either R, +the final P is still pending. It cannot receive the fourth input P. +Again final R j is impossible. + +### Two body arguments + +The two branch laws are + + A1[K/b,P/s] R P =beta R j, + A2[F/b,S/s] V S =beta c V N. + +The two branches together have four leaves. Zero requires a j in A1; +variable correctness requires a c in A2. If A1 has only one leaf it is a +vacuous chain over j, which cannot give zero head R. If A2 has only one +leaf it is a vacuous chain over c: applying V,S yields c V S, c S, c, +or a remaining abstraction, never c V N. Thus both branches have exactly +two leaves and one inner application. + +If A1 has no live inner binder, its only source application cannot become +R j. Its function variable is b=K, s=P, or a rigid ambient variable; a +K/P function consumes that constructor, and a rigid source head is wrong. +Any surrounding inner lambdas are vacuous. The remaining external edges +have right arguments R,P, and the data edges have right K,R, none j. +This excludes every allocation except A1 containing the sole inner bound +leaf a as well as j. In that allocation A2 has exactly c,s and only vacuous +lambdas. + +A beta-normal, one-application expression over c,s with only vacuous +lambdas is one of + + kappa^r (c (kappa^t s)), + kappa^r (s (kappa^t c)), + +where kappa^r is r vacuous lambdas. The first form, after V,S are applied, +has either the wrong number of c arguments or first argument kappa^t S; +that argument is not V. For the second form use + + S c -> c F V, + S (kappa c) -> c V, + S (kappa^t c) -> kappa^(t-2) c (t>=2). + +The outer r vacua discard an initial segment of V,S, after which the +remaining suffix is appended. Every resulting two-argument c spine is +c F V or c V S; other cases have another arity or remain abstractions. +For sufficiently large m neither is c V N. This excludes the last branch +allocation and completes the bound-head case. + +## The repeated-stream affine five-lambda four-application allocation + +This handwritten exclusion has been independently reviewed. Assume a +beta-normal nonleading whole-stream handler has + + A=4, L=5, X<=6, leaves s,s,j,c,v, + +with v bound once and the other four source binders vacuous. We claim +this remaining L=5 allocation fails the variable law. Use the established +long-prefix guard and the requirement of three source contractions with +c in their function bodies, forced by the original F,V,S root edges. +The source is affine, so each source lambda contracts at most once. + +### The live binder is a closed projection + +The base ambient index contribution is three, leaving total source-lambda +tax at most three. The live binder's body cannot contain an ambient leaf. +If it did, that live lambda would have positive tax, and every vacuum +would also have positive tax. A vacuum containing the live binder would +also contain that ambient leaf; one not containing the live binder has +no live binder in its own nonempty body, so has a free leaf there. This +would give total tax at least five. + +Thus the live lambda is a closed projection: its body has only its one +bound leaf, with some number h of vacuous lambdas between that binder and +the leaf. Each of these h inner vacua has tax one. Write r for the number +of source lambdas above the unique ambient c leaf. None is the live +binder, so all r are vacuous and each has tax at least one. + +The two sets are disjoint. A source lambda can contain c at contraction +only if it initially lies above c, or if it is one of the h inner vacua +and the live binder has been supplied an argument containing c. There is +no other live binder through which c could enter a body. A vacuum above +the whole live block activates before that block and cannot acquire c +later through its substitution. + +Consequently the three required contractions imply r+h>=3, while the tax +budget gives r+h<=3. Equality holds: + + r+h=3, + +all these lambdas have tax exactly one, and every other lambda has tax +zero. In particular neither j nor either s can lie under any source +lambda. No one of the r+h potentially c-containing constructors can be +spent in an internal contraction: all three are needed at the three +original external root applications. + +### A captured c cannot supply the missing constructors + +The source-normal block containing c is a consecutive vacuous chain + + C=lambda^r.c B1 ... Bt. + +Every Bi is closed: j and s are forbidden below these lambdas, c is +unique, and there is no surrounding live binder. A normal application +outside that c head cannot be headed by a closed lambda block, since +that would be a source redex. This also shows that the r c-ancestor +lambdas are consecutive; without another ambient head, a normal body +that still contains c beneath a further lambda must begin with that +lambda. + +Any closed source block appearing among the Bi is permanently guarded +by rigid c. It cannot be extracted to receive an argument containing c. +Thus if the live binder ever receives c, its projection block must lie +outside this c-headed block. + +In that case every source lambda is either one of the r lambdas in C, +one of the h inner vacua of the live projection, the live binder itself, +or a closed vacuous prefix immediately above the live binder. A zero-tax +vacuum must enclose the sole live binder, and its closed one-leaf body +forces this consecutive prefix. Since L=5 and r+h=3, there is exactly +one such prefix vacuum. The complete closed projection is therefore + + D=lambda w v.lambda^h.v. + +Before a source activation, the exterior basis consists only of the two +copies of S and rigid markers. It cannot return a source block bare; a +first activation can be chosen at a literal s callback. The callback +cannot be C, because that would spend one of the three c-containing +constructors internally. It must be D. Its Scott invocation supplies F +to w and V=P_(m-1) to v. The only live binder therefore receives data +without c, contradicting this case. This rules out c entering any of the +h inner vacua through capture. + +The same argument covers r=0: the c-headed normal source expression is +rigid, and the only lambda block that can be activated is D. + +### The three constructors must already enclose c + +Since capture is impossible, all three required constructors must be +above c initially. Thus r=3 and h=0. The only other two source lambdas +form the closed block + + F=lambda w v.v. + +If this F block lies inside C, all source lambdas lie in C and the first +source activation spends a c-containing constructor internally, which +is impossible. Otherwise F is outside C and C=lambda^3.c: its body +cannot contain j or s, and the only remaining bound leaf belongs to the +disjoint F block. + +The first successful source activation must therefore be the literal +s F; it returns V and consumes both source lambdas of F. Only the intact +constant chain C remains. Internally activating it would again spend a +constructor needed at an external root. A bare C given the three external +arguments returns bare c, not c V N. Safe functional data has no c, and +an ordinary rigid head retains the final input S. These alternatives +exhaust the outer normalization and all fail. + +The repeated-stream affine A4,L5 allocation is therefore excluded. + +## Four lambdas with two stream leaves and one affine live binder + +Suppose H is beta-normal, nonleading and affine, with A=4, +L=4, X<=8, and leaf allocation + + s,s,j,c,u, + +where u is the sole bound-variable occurrence. We exclude the variable +law using the source-constructor accounting from the affine tax proof. + +Choose a sufficiently long variable stream S=P_m and V=P_(m-1), so the +affine safe-data guard excludes c-carrying data lambdas. The three original +external application constructors carrying F,V,S must each contract with +a source lambda whose body contains the unique c. Thus three distinct +source lambda constructors are consumed by those original external edges. + +Because H is source-normal and application-headed, exposing any source +lambda at the global head requires an internal source activation. The +first such activation can be chosen at a literal source subterm s D; +its first source contraction supplies F to the first binder of D. There +are only four source lambda constructors and no copying. Consequently +this is the only source-lambda contraction that is not one of the three +original external contractions. In particular there is no later internal +source activation, even during normalization of output arguments. + +All four source contractions therefore have c-free arguments: the first +has F, and the other three have the unchanged original data F,V,S. No +source substitution can move c into a source lambda that did not already +contain c. The safe data cannot do so either. Each of the three source +lambda constructors used by the original external edges must therefore +be an original ancestor of c in H. + +Let Z be the innermost of these three ancestors. It is in fact the +innermost source lambda above c: the fourth lambda cannot lie inside Z +and be the first activation, because the opaque-block strategy does not +activate a source binder below an intact outer source binder. Its source +body B contains no further source lambda. Any additional lambda in B +would have to be the fourth one, which again could not have been the +first internal activation before Z was reached. All the other three +lambda constructors are ancestors of c, so none can lie in a side branch +of B. + +The source depth of c is at least three. The ambient base of j,c is +three, leaving at most five source-crossing units because X<=8. If either +s or j occurred in B, it too would lie beneath the same three original +source ancestors and contribute three further crossings. Along with the +three crossings already charged by c this would exceed the allowance +five. Thus B has no s or j. Its only possible leaves are c and the +single bound occurrence u, and it has no source lambda. It is therefore +one of + + c, c u, u c. + +The first internal activation may have been an ancestor of Z or may have +occurred in a separate helper; this does not affect the conclusion. Any +u occurrence in B is supplied with one of F,V,S, since these are exactly +the source-contraction arguments. The three c-bearing ancestor lambdas +are consumed by the original external edges in their nesting order, so +Z is the lambda contracted by the final original S edge. That edge is +the outermost application of the complete invocation. After it contracts, +the entire result is B with the already determined safe value U substituted +for u. No old source application remains outside this body. + +If B=c or c u, the result has respectively zero or one argument to c, +not the required two. If B=u c, then + + F c = I, + V c = c F P_(m-2), + S c = c F V. + +For sufficiently large m none is c V N: the Scott cases have first +argument F instead of V. This contradiction excludes the allocation. + +## Four applications, one leading lambda, and a stream-headed three-lambda body + +Suppose a beta-normal whole-stream handler has four applications, three +source lambdas, exactly one leading lambda, and normal body head `s`: + +``` +H = λb.B, B = s A₁ ... A_q, q≥1. +``` + +There are five variable leaves and two source lambdas inside `B`. Mandatory +`j,c,s` occupy at least three leaves. We exclude the variable law; the wire +budget and the zero law are not needed in this last shape argument. + +Choose a sufficiently long variable stream `S=P_m`, with `V=P_(m-1)`. +The invocation first contracts the leading binder against `F`, leaving +`B[F/b] V S`. We use the established opaque-source normalization strategy +and safe-data ancestry guard. In particular no data lambda can capture a +surviving `c`, and a first source activation in a normal expression with +exterior basis only `S` and rigid variables is at a literal source `s D`, +supplying `F` to the first binder of `D`. + +### The leading binder is used + +If `b` is absent, before the first inner source activation the exterior +algebra contains only `S`, `Q`, rigid neutrals, and opaque source blocks. +It cannot return a source block bare: applying `S` to that block activates +it, and `Q` erases its argument. If no inner source activation occurs, the +ordinary data-algebra obstruction applies. + +At the first activation `s D`, the first source binder receives `F`. +Even if that binder is nonlinear, copying `F` copies no source lambda. +At most one source lambda then remains, with both original external inputs +`V,S` still pending. The extended one-source-lambda obstruction excludes +this result. Thus a successful candidate must contain a `b` leaf. + +Once `b` occurs, the five-leaf budget allows at most one occurrence bound +by either inner source lambda: `s,j,c,b` already occupy four leaves. +Both inner source lambdas are therefore affine after substituting `F` +for `b`; a second `b` copies only the safe data `F`. + +### Both inner lambdas must surround the eventual c + +Tag the original external applications carrying `V,S`. To obtain +`c V N`, the final `S` application must contract, since otherwise its +unchanged right argument would be the final `S`, not `N`. Its function +can become a lambda only after the original `V` application contracts. +Each of these two contractions has a surviving `c` in the function +lambda's body: the original right arguments contain no `c`. + +Safe data cannot supply such a lambda. There are exactly two affine +source lambdas left, so both are consumed by these two tagged applications. +There is no inner source activation before them or elsewhere in the +required normalization. Their only earlier source substitution was +`b:=F`, which is `c`-free. Consequently both source lambda constructors +were original ancestors of a single occurrence of `c` that survives to +the result. They lie in one outermost source block `D`. + +Before the original `V` edge contracts, exterior normalization must +therefore return this `D` bare, without activating either source lambda. +There must be an occurrence of `b` outside `D`. Otherwise the exterior +basis is only `S` and rigid variables; as above that algebra cannot return +an opaque source block bare without activating it. The source head `s` +also lies outside `D`. Hence `D` has at most three variable leaves. + +If `D` has three leaves, the exterior has exactly the three macro leaves +`s,b,D`. Since its head is `s`, its four possible application trees are + +``` +s b D, s D b, s (b D), s (D b). +``` + +The last is not source-normal. After `b:=F`, the second activates `D` +internally. The first reduces to `V D`, which also activates `D` +internally for `m≥2`. The third reduces to `S I = I` and erases `D`. +Each contradicts the required bare return of `D`. Thus `D` has at most +two variable leaves. + +### The remaining block grammar fails directly + +If `D` has only one leaf, both lambdas surround that `c`, so +`D=λu v.c` and `D V S=c`, of the wrong arity. + +If `D` has two leaves, write the second one as `e`. Both lambdas surround +`c`, `D` is normal, and there is only one application inside it. Its full +grammar is therefore + +``` +D = λu v.c e, D = λu v.e c, D = λu.e (λv.c). +``` + +In the first two forms, after the inputs `V,S` and the earlier substitution +`b:=F`, the leaf `e` becomes one of `F,V,S` or a rigid ambient variable. +The first form gives `c e`, with only one argument. In the second, + +``` +F c = I, V c = c F P_(m-2), S c = c F V. +``` + +A rigid `e` has the wrong head, or gives the one-argument `c c`. +The Scott cases have first argument `F`, whereas the target's first +argument is `V`; these are distinct for large `m`. + +In the last form, `v` is vacuous and `e` cannot refer to it. Write +`K_c=λv.c`. The full result is `e K_c S`, with `e` again one of +`F,V,S` or a rigid ambient variable. The three data cases are + +``` +F K_c S = S, V K_c S = c P_(m-2) S, S K_c S = c V S. +``` + +A rigid `e` either has the wrong head or produces `c K_c S`. +Every `c`-headed result retains final `S`, not `N`. + +Thus no beta-normal `A=4,L=3` handler with exactly one leading lambda and +stream-headed body satisfies the whole-stream reader laws. + +## Four applications and four lambdas, with a leading stream-headed body + +Let H=lambda b.B be source-beta-normal, with exactly one +leading lambda, A=4,L=4,X<=8, and normal body head s. Its five leaves are +j,c,s and two additional leaves. On a variable input, first substitute +b=F. The residual has three source lambdas, and the original final inputs +V=P_(m-1),S=P_m are still pending. + +### Which inner lambdas can carry c + +The mandatory j,c,s under the outer binder contribute 2+3+1=6 to X. +At most two inner crossing units remain. For affine residual code, each +of the two final original application edges must consume a source lambda +whose body contains c, by the guarded c-ancestry argument. The relevant +crossings are the inner ancestors of c and crossings of an occurrence +bound by an inner live binder. Crossings of j,s, or b cannot supply c: +j stays rigid, s is initially safe c-free data, and b has become safe F. +Source lambdas containing only those fixed outside references are closed +with respect to c transport until an inner live binder supplies c through +one of its crossed occurrences. Count each such possibly c-carrying +lambda once; its existence costs one of the relevant crossing units. + +Consequently the affine cases require at least two relevant inner crossing +units. Since there are at most two units altogether, equality holds: +j,s,b are outside all inner lambdas, no extra ambient occurrence is +possible, and the two relevant units are the entire inner tax. In +particular a repeated ambient s costs its outer crossing, while a repeated +j costs even more, leaving fewer than two relevant units and failing. + +The only nonlinear residual possibility has both spare leaves bound by +one inner binder u. Then b is vacuous and s is unique. The ordered-input +one-live proof applies with the shortened zero list + + K,R,A2,...,Aq,R,P, + +of length q+3>=4. A K value leaves selectors and vacuous erasers; a common +argument has a fixed rigid head; and an R or final P value requires the +leading callback chain to consume the entire list. Thus at least four +inner source lambdas would be necessary. There are only three. This +excludes the nonlinear residual without using the affine argument. + +If both spare leaves are b, the residual has no inner live binder. Two +c-carrying inner lambdas require c below two of them and spend both units. +The third inner lambda must also have a leaf in its body, but there is no +inner bound leaf available and no other ambient crossing unit. It cannot +be placed. Thus this case is impossible as well. + +### The outer binder is vacuous + +The remaining affine allocation without b is j,c,s,u,v, with two distinct +inner live binders. The exterior initial data basis is just S and rigid +markers. Its first source activation must therefore occur internally at +a literal s D and supplies F, as in the normal lambda-floor proof. + +There are exactly three inner source lambdas: this one internal activation +and the two original external contractions using V,S exhaust them. All +three arguments are c-free. Hence the two source lambdas used by the +external edges were already ancestors of c. Their two crossings spend +the complete inner tax; no other source crossing is possible. + +The first internally activated lambda is not an ancestor of c, since +that would require a third crossing. It is a separate one-lambda block, +with one bound leaf, necessarily I. The two remaining source lambdas form +the c block. If they are consecutive, the outer one is vacuous: a reference +to its binder below the inner lambda would spend an additional unit. The +other live occurrence is then bound by the innermost lambda, whose body is +c v or v c. After the final original S edge contracts these give c S or +S c=c F V, neither c V N. + +If the two c ancestors are not consecutive, their only normal arrangement +with leaves c,v is lambda v. v (lambda a.c). Its outer lambda receives +the first external V, after which V (lambda a.c) invokes the inner source +lambda internally with F. That leaves no source lambda for the final +original S edge, contradicting the required two external contractions. +These cases exhaust the c block and exclude the vacuous-outer case. -Suppose H is beta-normal, has A=4, has no leading lambda, contains s, and -has size at most 34 bits. Assume it is nonaffine. Its five leaves must be -exactly j,c,s,u,u: u is the sole live source binder, occurring twice, and -both other ambient letters and the stream occur once. Every other source -binder is vacuous. The size identity gives 2L+X≤16. +### One outer occurrence b and one inner occurrence u -A rigid head fails the zero law, so write +Now the leaves are j,c,s,b,u. The inner binder U is affine. Equality above +puts j,s,b outside all three inner lambdas. Their entire source syntax +therefore involves only c and u. Write - H = s A₁ ... A_q, q≥1. + C_r=lambda^r.c, D_p=lambda u.lambda^(p-1).u. -The first callback A₁ has no s and no free bound variables. If it is -application-headed, its normal head is rigid j/c, and P A₁ preserves that -head. Therefore it must be a leading lambda block D. Its normal body head -must be the sole live binder u; a rigid body head could never give zero head -R. Thus u lies on D's leading lambda chain. Let d be that chain's length. -Other lambdas inside D or its common arguments are vacuous. +A chain of zero lambdas is allowed for C_0=c. There are only two possible +arrangements of the two leaves and three lambdas. -After expanding the zero cell P=cons K R, D receives the ordered list +If they lie in separate chains, let r be the number around c and p the +number around u. Then r+p=3. If u is bound at position i in its chain, +the relevant tax is r+(p-i)=3-i=2, so i=1. Thus the chains are exactly +C_r,D_p with r=0,1,2 and p=3-r. + +If they are joined by their one source application, beta-normality makes +the function leaf c or u. A u-headed application requires the u binder +to enclose the c branch; the three lambdas then contribute at least three +relevant crossing units, impossible. In a c-headed application, u cannot +be bound in a common prefix, for the same reason. Thus the expression is + + lambda^r. c D_p, r+p=3, p>=1. + +The closed D_p is trapped as an argument of rigid c and cannot acquire c. +Only the r outer vacuous lambdas can carry c. Therefore r must be at least +two, forcing r=2,p=1. This block yields c I after the two original external +contractions, rather than c V N. + +It remains to handle the separate chains C_r,D_p. If r=2,p=1, C_2 must +supply both c-carrying external contractions. It has body c, so the final +result after the S edge is c. Any earlier activation of C_2 would leave +fewer than two c-carrying lambdas for the external edges. + +Suppose r<=1, so p>=2. The two c-carrying lambda constructors must be all +r lambdas of C_r and all p-1 inner vacuous lambdas of D_p. Consequently +C_r cannot activate internally, and D_p's outer U must be activated +internally with an argument containing c. Supplying it F or any other +c-free value leaves its entire residual chain c-free and cannot work. + +Before this U activation, treat D_p and C_r as markers d,z (with z=c for +r=0). No source lambda has yet activated. The body is an application tree +of exactly four applications over the five single-occurrence atoms + + s,b,j,d,z, - K,R,A₂,...,A_q,K,R,P. +with head s. Source normality forbids d, and z when r>0, in source function +position. After b=F, a direct callback d would receive F and fail the +c-carrying requirement. A callback z either spends a forbidden internal +c-carrying contraction or is rigid c. A j-headed callback stays rigid. -This list has n=q+4≥5 entries. A successful zero computation cannot leave -any of D's d leading lambdas unapplied. Consider the argument received by -the unique live binder u. +A bare callback b gives S F=V; with b now gone, its next callback can only +be d,z, or a rigid-headed expression, so has the same failure. The only +way to expose d without first supplying it the Scott bit F is to make the +first callback I. With the single b occurrence this requires b X. Its +erased argument X must be j: erasing either d or z loses a required block. +A callback b X Y instead forwards Y, returning to the already excluded +callback cases. If a third argument is already inside the callback, the +only c-preserving possibility within four applications is + + B = s (b j D_p C_r). -If it is a source common argument A_i, that argument contains only rigid j/c -and vacuous lambdas: u's binding scope is inside A₁, and the unique s has -already been used at the outer head. Such a normal argument can only discard -arguments before exposing a fixed rigid j/c head, or remain a lambda if -insufficiently applied. Its copies cannot yield head R. +Here D_p C_r produces lambda^2.c, which the surrounding S immediately +invokes internally. This spends c-carrying lambdas before the two external +edges and fails. The reversed arrangement s (b j C_r D_p) likewise activates +C_r internally, or exposes rigid c when r=0. These alternatives also cover nested application operands, +since an erased operand containing d or z loses that unique block. -If u receives K, all earlier leading binders were vacuous, so any earlier -direct R was discarded. After substituting K for the two u occurrences, only -selectors and vacuous erasers remain. The ordered-input argument from the -one-live first-input case applies: selectors return an argument whole and -vacuous binders discard it; neither inserts a later received R into a fixed -source application with the earlier j. Exposing R before the last input is -consumed retains final P. Selecting final P only after earlier input edges -have disappeared leaves it with no later argument. Neither case yields R j. +Thus the only viable four-application arrangement is -If u receives a direct R, substituting this rigid value creates no redex in -D's normal body. Once the d leading binders have been consumed, the rigid R -head retains every remaining ordered argument. Thus zero correctness -requires d≥n, so that final P has already been consumed. If u receives the -final P itself, its position on the leading chain likewise requires d≥n. + B = s (b j) D_p C_r. -In either last case, every common argument containing the unique j has been -discarded by a vacuous binder: the only live binder receives R or P. -Consequently the surviving j must occur inside D's body, beneath all d -leading lambdas. Its index contributes at least d+1, and mandatory c -contributes at least 2. With L≥d, the wire budget would require +The reverse order exposes C_r internally or rigid c and fails. On the +variable input the displayed arrangement reduces to - 16 ≥ 2L+X ≥ 2d+(d+1)+2 = 3d+3 ≥ 18, + S (F j) D_p C_r =beta D_p C_r + =beta lambda^(p-1).C_r. -a contradiction. +Since (p-1)+r=2, applying V,S gives bare c. It cannot give c V N. -These are every possible input to u. Hence no nonlinear, nonleading, -s-present normal A4 handler fits the improving budget. The remaining -nonleading normal A4 handlers are affine and have at most two live binders. +All leaf allocations are exhausted. Hence no normal A=4,L=4,k=1 handler +with body head s and X<=8 satisfies both whole-stream laws. -## Established bound and remaining scope +## Established bounds and remaining scope -Combining the compression lemmas, the beta-normal three-lambda floor, -and the exhaustive shape arguments proves: +Combining the compression lemmas, the beta-normal lambda floors, and the +complete shape arguments proves: > In the ambient frame `[s,j,c,p,x]`, with `j,c,p,x` independent -> and rigid, no handler `H` of BLC size at most 30 satisfies both -> `T=s s` reader laws. This includes handlers with arbitrary source -> beta redexes and arbitrary whole-stream use of `s`. - -Thus the self-application operand cannot improve the reader within -this joint-handler interface. The whole-stream operand `T=s` at -`|H|≤34` remains open. At that budget a minimum successful handler -would have no affine source redex, at least three source lambdas, -and exactly four or five applications. At four applications it -must be beta-normal. The three-leading-lambda special case and -the normal shape `(A,L,k)=(4,4,2)` are also excluded. Every remaining -normal four-application shape -uses `s` and has zero or one leading lambda; with one leading -lambda it has three or four source lambdas. A remaining nonleading -four-application handler is affine; the existing affine floor then -requires at least four source lambdas. -Every remaining normal five-application shape has zero leading lambdas, -uses `s`, and has either three lambdas with `X≤6` or four lambdas with -`X≤4`. Indeed, the mandatory `j,c` under one leading lambda would already -cost five index units, excluding the four-lambda case; the leading-case -proofs exclude the three-lambda case with one leading lambda. -Five-application nonlinear compression remains only with three source -lambdas, `X≤6`, and the leaf allocation `u,u,j,c,s,v`, where `u` -binds the nonlinear redex and `v` is the sole occurrence of one other -live binder. -Neither the independence assumptions on the ambient continuations -nor the specified reader interface have been removed. This is not -a global optimality theorem for the 165-bit interpreter. - -The standard-skip handler bounds, including whole-stream access, live -in `handler-bound.md`; neutral-operand domination is in -`protocol-obstructions.md`. +> and rigid, every handler satisfying both whole-stream reader laws has +> `|H|≥35` for `T=s`, or `|H|≥31` for `T=s s`. This includes handlers +> with arbitrary source beta redexes and arbitrary use of `s`. + +The reduction to normal shapes does not assume that every small source +term normalizes. Affine contractions either preserve the improving budget +or have the separately excluded growing shape; every remaining nonlinear +source-redex allocation is excluded. A minimum successful candidate would +therefore be beta-normal. The normal cases with at most three applications +fail; the five-application cases fail by the two-source binary/affine and +continuation-ancestry arguments; and the four-application cases are exhausted +by leading-lambda count, stream multiplicity, and bound-leaf allocation. + +The size identity for the reader is `|s H T|=6+|H|+|T|` in the stated +frame. The two bounds give `6+35+2=43` and `6+31+6=43`. The standard-skip +bound in `handler-bound.md` gives `6+27+10=43`, attained by the existing +reader. Thus **43 bits is the minimum across these three operand families**, +With the other 122 bits fixed, **165 is minimal within these three operand +families under the stated independent rigid reader laws**. + +The independent rigid continuation assumptions and the specified reader +interface have not been removed. Bare operands `j,c`, operands containing +lambdas, other reader heads, exploitation of the actual NEXT/parser +behavior, and arbitrary complete interpreters remain outside this theorem. +This is not a global optimality theorem for the 165-bit interpreter. +Neutral-operand domination and the application-only operand classification +are in `protocol-obstructions.md`. diff --git a/docs/classical/self-interpreter/handler-bound.md b/docs/classical/self-interpreter/handler-bound.md index 1bc61945..9da8df24 100644 --- a/docs/classical/self-interpreter/handler-bound.md +++ b/docs/classical/self-interpreter/handler-bound.md @@ -728,9 +728,11 @@ rigid parameters and fixes the skip to `s s s`. Exploiting the actual behaviour of NEXT or the recursive parser is outside its hypotheses. Other reader heads, arbitrary skip operands, and arbitrary sub-165 programs remain open without further decomposition or a different global invariant. -`cheap-tail-bound.md` proves separate lambda floors for `T=s` and -`T=s s`, and excludes every `T=s s` handler below 31 bits, keeping -that reader at least 43 bits. The improving `T=s` threshold remains open. +`cheap-tail-bound.md` excludes every `T=s` handler below 35 bits and +every `T=s s` handler below 31 bits, including arbitrary source redexes. +Both readers therefore cost at least 43 bits, so the existing 43-bit +reader is minimal across these three operand families. That theorem +also retains the independent rigid parameters and the specified interface. The five explicit witnesses and the arithmetic are checked by `tools/self-interpreter/theory/handler_bound.py`, including the 40-bit diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index b72ec946..71f50066 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -394,7 +394,8 @@ These are Codex's handwritten proofs, with targeted reduction checks in syntax, normality, dispatch shape, or absence of common arguments. `handler-bound.md` gives the complete small-budget case proof. The skip costs at least 10 and the two applications with `s` 6, so the reader costs - at least 43; with the other 122 bits unchanged the minimum is 165. + at least 43; with the other 122 bits unchanged the minimum is 165 + within that independent rigid interface. The stronger theorem in that note retains the 27-bit minimum under actual stream/tag/selector/suffix correlations, including whole-stream access inside `H`, for the fixed skip `s s s`. Other ambient parameters @@ -414,33 +415,22 @@ These are Codex's handwritten proofs, with targeted reduction checks in `s,j,c,s s,(s s) s`; bare `j,c` remain substantive separate cases. `Blc/SelfintInert.lean` kernel-checks the common replacement principle; the specific operand equations and absence checks are handwritten. - `cheap-tail-bound.md` proves that both families require at least two - explicit lambdas in `H`, even with arbitrary whole-stream use and beta - redexes. Every beta-normal handler needs at least three lambdas, - regardless of size; explicit three-lambda constructions show this - count is sharp. Exactly three leading lambdas are excluded at the - improving `T=s` budget. - For `T=s s`, every possible 30-bit improvement has a beta-normal - minimum representative: affine contractions preserve its budget, and - the remaining nonlinear source-redex cases are excluded. Its last - possible normal shapes, with at least three lambdas and exactly four - applications, are also excluded. Thus every successful `T=s s` - handler costs at least 31 bits, keeping the reader at least 43. - At `T=s`, `|H|≤34`, every successful handler has at least three - source lambdas even before normalization. A minimum successful handler - has no affine source redex and exactly four or five applications. - At four applications it must be beta-normal, use `s`, and have at most - one leading lambda; the no-stream and two-leading-lambda cases are excluded. - With one leading lambda, only three or four source lambdas remain. - With no leading lambda, it must be affine and have at least four. - Without free `s`, every affine handler fails its variable law, and a - live-binder-antichain theorem also excludes nonaffine handlers. These - close every five-application compressed case without free `s`. - The remaining four-lambda compressed cases are excluded by the index - budget, leaving only three lambdas, `X≤6`, and leaves `u,u,j,c,s,v`. - Every remaining normal five-application candidate is stream-headed with - no leading lambda, with either three source lambdas and `X≤6` or four - and `X≤4`. Those normal shapes stay open. + `cheap-tail-bound.md` gives the complete handwritten exclusions: + every handler costs at least 35 bits for `T=s`, or 31 bits for `T=s s`. + Both readers therefore cost at least 43 bits. With the standard-skip + bound, 43 is the exact minimum across these three operand families. + With the surrounding 122 bits fixed, 165 is minimal within these three + operand families under the stated independent rigid reader laws. + The proof allows arbitrary source beta redexes and whole-stream access. + It excludes affine and nonlinear source-compression cases before + exhausting the normal shapes. In particular, the index tax limits how + many source lambdas can contain the surviving continuation `c`, while + the original external applications require distinct such contractions. + This remains a handwritten, independently reviewed proof rather than + a Lean theorem. Both cheap operands require at least two source lambdas, + or three in beta-normal code; explicit three-lambda constructions show + the normal lambda count is sharp. The bare `j,c` families, operands + containing lambdas, and other reader architectures remain open. - **The zero arm costs at least 14 bits**, even with `bit0 := K` and the whole zero cell available to borrow. With `R` absent and the neighbours rigid, `Z R R = R next` forces the normal form `λu v. u next` (15) or diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index fa5ccaca..3453f2b4 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -233,10 +233,12 @@ The per-operand domination proofs and the complete classification were independently reviewed. They neither identify the operands as beta-equal nor prove a minimum reader size. They reduce the application-only operand classification through -ten bits to the five displayed families. The `T=s`, `T=j`, and `T=c` -families remain open at the budgets needed for a reader improvement. -The separate proof in `cheap-tail-bound.md` excludes every productive-thunk -`T = s s` handler below 31 bits, keeping that reader at least 43 bits. +ten bits to the five displayed families. The `T=j` and `T=c` families +remain open at the budgets needed for a reader improvement. +The separate proof in `cheap-tail-bound.md` excludes every `T=s` handler +below 35 bits and every productive-thunk `T=s s` handler below 31 bits. +With the standard-skip bound, the existing 43-bit reader is minimal +across the other three operand families. No conclusion about arbitrary sub-165 interpreters follows. ## The raw NEXT diagonal still fails for every skip function From 0f2fae6a2d3be534e06ed603dc197da559dd85a8 Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 22:20:49 -0400 Subject: [PATCH 27/41] Construct a parser sharing its generator with value application --- .../machines/int323_shared_tag.blc | 1 + .../machines/int323_shared_tag.lam | 4 + data/self-interpreter/theory/shared_tag.json | 34 +++++ docs/STATUS.md | 12 +- .../self-interpreter/cheap-tail-bound.md | 2 +- .../classical/self-interpreter/interpreter.md | 1 + .../self-interpreter/protocol-obstructions.md | 123 +++++++++++++++++- tools/self-interpreter/theory/shared_tag.py | 121 +++++++++++++++++ 8 files changed, 291 insertions(+), 7 deletions(-) create mode 100644 data/self-interpreter/machines/int323_shared_tag.blc create mode 100644 data/self-interpreter/machines/int323_shared_tag.lam create mode 100644 data/self-interpreter/theory/shared_tag.json create mode 100644 tools/self-interpreter/theory/shared_tag.py diff --git a/data/self-interpreter/machines/int323_shared_tag.blc b/data/self-interpreter/machines/int323_shared_tag.blc new file mode 100644 index 00000000..a86afee1 --- /dev/null +++ b/data/self-interpreter/machines/int323_shared_tag.blc @@ -0,0 +1 @@ +01000000010101010101111011101010000010100000000101111110110100000000000010100010111000010110000001101111000000001010110111111111101110110010111011011000000100010111100110000000000101011011110000001111110000001011101110011011110110011010010101010111111110111111101010000010100000000001010110111100001011111111010011111010110 diff --git a/data/self-interpreter/machines/int323_shared_tag.lam b/data/self-interpreter/machines/int323_shared_tag.lam new file mode 100644 index 00000000..c8337983 --- /dev/null +++ b/data/self-interpreter/machines/int323_shared_tag.lam @@ -0,0 +1,4 @@ +-- Shared parser/APP generator; generated by shared_tag.py. +-- 323 bits: generator sharing is possible, but this is not sub-165. +-- E C ( ++ N) =beta C (lambda z.M) N for closed M. +(\g\c\s.g g s s (\e\x.x) s (\q\f\n.c f n)) (\g\u\v\f\r.((\next.r (\bit.bit (\unused\tail.tail next) (\value\tail\k.k g value tail)) (r r r)) (\bit\rest.(\v.bit (v (\g\f\n\k.k g (\e\a.f (\b\r.b a (r e))) n)) (v v)) (g g rest rest (\e\x.x) rest))) (\g\h\n\k.k g (\e.f e (h e)) n)) diff --git a/data/self-interpreter/theory/shared_tag.json b/data/self-interpreter/theory/shared_tag.json new file mode 100644 index 00000000..2c35aa30 --- /dev/null +++ b/data/self-interpreter/theory/shared_tag.json @@ -0,0 +1,34 @@ +{ + "search_performed": false, + "sizes": { + "generator": 262, + "public_adapter": 59, + "outer_application": 2, + "interpreter": 323 + }, + "generator_parts": { + "five_generator_binders": 10, + "next_let_lambda_and_application": 4, + "whole_stream_reader_in_frame": 73, + "next_in_frame": 124, + "common_map_application": 2, + "common_map_in_frame": 49 + }, + "rigid_equations": [ + "box_self_application_calls_parser_generator", + "box_maps_abstraction", + "box_maps_application_accumulator", + "left_seed_is_exact_on_lambda_payloads", + "public_box_consumer" + ], + "battery": { + "ok": 667, + "skipped": 1, + "failures": [] + }, + "divergent_source_suffixes": [ + "omega", + "lambda_omega" + ], + "elapsed_seconds": 1.788 +} diff --git a/docs/STATUS.md b/docs/STATUS.md index 6fa2973d..01227353 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -337,9 +337,15 @@ with all features (three opt-in tests ignored) and 328 with default features. 303 bits. Its four rigid equations, 667/1/0 battery, and Ω / λa.Ω suffix probes pass in 1.92 seconds (`data/self-interpreter/theory/metadata_parser.json`). Eliminating its boxes against the public consumer recovers the 165's - CPS interface without a further saving. Except for the unconditional - non-idempotence and its generator corollary, these are protocol-specific - handwritten proofs. + CPS interface without a further saving. A separate 323-bit construction + uses the actual parser generator as each value's application control: + `v v` reparses the left value's remainder and combines the next value. + Its five rigid equations, 667/1/0 battery, and Ω / λa.Ω exact suffix + probes pass in 1.788 seconds (`data/self-interpreter/theory/shared_tag.json`). + The handwritten structural proof includes divergent sources. The shared + generator costs 262 bits and its public adapter 59; triple boxes and + maps outweigh the sharing. Except for the unconditional non-idempotence + and its generator corollary, these are protocol-specific handwritten proofs. - **The universal machine** (`classical/self-interpreter/universal.md`): Tromp's wirings around the 165's body give 175 (non-strict) and 187 (strict), against 178 and 190 around the 168's. Wirings around the new body diff --git a/docs/classical/self-interpreter/cheap-tail-bound.md b/docs/classical/self-interpreter/cheap-tail-bound.md index 8a9f9ca2..34c0644e 100644 --- a/docs/classical/self-interpreter/cheap-tail-bound.md +++ b/docs/classical/self-interpreter/cheap-tail-bound.md @@ -4569,7 +4569,7 @@ by leading-lambda count, stream multiplicity, and bound-leaf allocation. The size identity for the reader is `|s H T|=6+|H|+|T|` in the stated frame. The two bounds give `6+35+2=43` and `6+31+6=43`. The standard-skip bound in `handler-bound.md` gives `6+27+10=43`, attained by the existing -reader. Thus **43 bits is the minimum across these three operand families**, +reader. Thus **43 bits is the minimum across these three operand families**. With the other 122 bits fixed, **165 is minimal within these three operand families under the stated independent rigid reader laws**. diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index 71f50066..b95d48ee 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -572,6 +572,7 @@ Unless marked, each passes the battery and is larger than the 168. | **Recursion** | | | | Self-passing `next` with a shared parser, best of 72 orders | 182 | carrier plumbing exceeds the knot | | Recursion inside the bit handler | 196 / 206 | shared/unshared self-application; recursive entry needs a Scott adapter (`protocol-obstructions.md`) | +| One generator for parsing and value-driven APP | 323 | `v v` enters the actual parser on the left remainder; triple boxes, maps, and the public adapter dominate (`protocol-obstructions.md`) | | Recursor passed through continuations | 204 / 206 | callback arguments plus a public adapter | | A cell holding F performs the knot: `cell(a,e) cell(a,e) = λk. a a (k e e)` | 199 | the continuation receives two extra arguments | | Both recursive call heads replaced, with the knot removed | — | 221,930,567 pairs (34 free bits): no survivor | diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index 3453f2b4..d229acff 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -837,6 +837,122 @@ another necessary control task before consumption. These source-domain equations do not assert beta equality of the two complete parsers on arbitrary inputs. +### A shared parser and application generator + +Codex's explicit 323-bit construction makes the value's application control +the parser generator itself. It establishes that this sharing is possible; +the added representation still costs more than the 165. Write + +```text +F = lambda e x.x +S(f,h) = lambda e.f e (h e) +Cell(a,e) = lambda b r.b a (r e) +A(f) = lambda e a.f (Cell(a,e)) +V_g(f,N) = lambda k.k g f N +Abs = lambda g f n.V_g(A(f),n) +Map_f = lambda g h n.V_g(S(f,h),n) +Box_g = lambda value tail.V_g(value,tail) + +P_g(r) = g g r r F r +Next_g = lambda bit rest. + (lambda v.bit (v Abs) (v v)) (P_g(rest)) +Read_g(r) = (lambda next. + r (lambda bit.bit (lambda unused tail.tail next) Box_g) + (r r r)) Next_g + +G = lambda g u v f r.Read_g(r) Map_f +E = (lambda g C s. + (g g s s F s) (lambda q f n.C f n)) G. +``` + +The `u,v` arguments of `G` are unused. Initial and first-child calls fill +their positions with the already-bound stream variable. For independently +rigid `g,f,R,h,N`, the box application equation is + +```text +V_g(f,R) V_g(h,N) ->* g g h N f R. +``` + +In particular, if `v=V_G(f,R)`, then `v v ->* G G f R f R`. This enters +the same `G` used by `P_G`: after consuming the two unused arguments, it +parses `R` with accumulator `f`. There is no separate application tag +generator. The right box's two fields are ignored; when `R` is the actual +stream beginning with the right operand, that operand is parsed from `R`. +The other box equations are + +```text +V_g(f,N) Abs ->* V_g(A(f),N) +V_g(h,N) Map_f ->* V_g(S(f,h),N) +V_g(f,N) (lambda q value tail.C value tail) ->* C f N. +``` + +For correctness, retain the ordinary variable closures `X_n(N)` and define +the canonical closure with its actual source suffix by + +```text +D(var n,N) = X_n(N) +D(lambda M,N) = A(D(M,N)) +D(M L,N) = S(D(M,quote(L) ++ N), D(L,N)). +``` + +Each `D(M,N)` is syntactically a lambda abstraction. Therefore +`S(F,D(M,N)) ->* D(M,N)` by beta reduction: `S(F,h)` reduces to +`lambda e.h e`, which beta-reduces to `h` when `h` is lambda-headed. This +last equality is not asserted for an arbitrary rigid `h`. + +For arbitrary terms `f,N`, structural induction on the source proves + +```text +Q_f(quote(M) ++ N) ->* V_G(S(f,D(M,N)),N), +where Q_f(s) = G G s s f s. +``` + +The two unused fields can be changed freely. In particular `P_G=Q_F`, so +the lambda-headed observation gives +`P_G(quote(M) ++ N) ->* V_G(D(M,N),N)`. + +For a variable, the whole-stream reader returns `V_G(X_n(N),N)` and +`Map_f` gives the result. For an abstraction, the induction hypothesis on +its body gives `v=V_G(D(M,N),N)`; the second tag selects `v Abs`, and the +common `Map_f` finishes the recurrence. For an application `M L`, put +`R=quote(L) ++ N`. The first parse gives `v=V_G(D(M,R),R)`, and the +second tag selects + +```text +v v ->* G G D(M,R) R D(M,R) R + ->* V_G(S(D(M,R),D(L,N)),N). +``` + +The last reduction uses the induction hypothesis on `L`, after ignoring +the two unused fields. The common `Map_f` finishes the outer recurrence. +The public consumer returns `C D(M,N) N`; the ordinary closure/environment +induction gives `D(M,N) ->* lambda z.M` for closed `M`, using the same +`X_n`, `Cell`, `A`, and `S` semantics as the 165. This handwritten proof +establishes the exact contract without normalizing the source program and +therefore includes divergent sources. + +The application equation is source-correlated: it does not preserve +pointwise semantic application for independently chosen boxes, nor does the +projection extracting the constant `G` field preserve application. Thus it +does not meet the constant-control obstruction's hypotheses. The full +internal values depend on payload and remainder, and `G G` is the +accumulator parser, not the complete public interpreter `E`. + +The closed generator costs 262 bits, the public adapter 59, and their +application two, totaling **323**. In the generator's actual binding frame, +its five binders cost 10, the `next` let four, the reader 73, NEXT 124, +and the common map plus its application 51. These sizes sum to 262. +The explicit triple boxes, their consumers, and the accumulator map +outweigh the eliminated separate tag operation. This is a construction +demonstrating sharing, not a size lower bound or a smaller interpreter. + +`tools/self-interpreter/theory/shared_tag.py` generates +`data/self-interpreter/machines/int323_shared_tag.{lam,blc}` and checks the +rigid box equations, the standard battery, and exact suffix extraction on +`Omega` and `lambda a.Omega`. Its report is +`data/self-interpreter/theory/shared_tag.json`; current measurements belong +in `docs/STATUS.md`. No candidate enumeration is involved. + ## Swapping a closure's two arguments is not an exact involution A tempting wrapper swaps a closure's environment and source-argument @@ -967,9 +1083,10 @@ next stream. Hoisting the skip through this distributed protocol does not recover the 165's saving. The root adapter and both recursive adapters each need a whole-stream skip. The directly derived formula costs 220 bits; no search -is needed to see that this arrangement is larger. The surviving design -question is whether an adapter can perform a required semantic operation -while carrying its control. +is needed to see that this arrangement is larger. The shared-generator +construction above does combine semantic application and parser entry, +using a larger boxed interface. A protocol that makes such sharing cheaper +than the 165 remains open. ## Reproduction diff --git a/tools/self-interpreter/theory/shared_tag.py b/tools/self-interpreter/theory/shared_tag.py new file mode 100644 index 00000000..82c69266 --- /dev/null +++ b/tools/self-interpreter/theory/shared_tag.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python3 +"""A 323-bit interpreter sharing the parser generator with APP control. + +This explicit construction uses one generator for parsing and value-driven +application. Its boxes and adapters make it larger than the 165. +No candidate enumeration is used. +""" +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import json +import sys +import time + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +sys.path.insert(0, str(ROOT / 'tools/self-interpreter')) +import battery as b + +F = r'(\e\x.x)' +BOX = r'(\value\tail\k.k g value tail)' +ABS = r'(\g\f\n\k.k g (\e\a.f (\b\r.b a (r e))) n)' +MAP = r'(\g\h\n\k.k g (\e.f e (h e)) n)' +NEXT = rf'(\bit\rest.(\v.bit (v {ABS}) (v v)) (g g rest rest {F} rest))' +READ = rf'((\next.r (\bit.bit (\unused\tail.tail next) {BOX}) (r r r)) {NEXT})' +GENERATOR = rf'(\g\u\v\f\r.{READ} {MAP})' +ADAPTER = rf'(\g\c\s.g g s s {F} s (\q\f\n.c f n))' +SOURCE = f'{ADAPTER} {GENERATOR}' + + +def nf(source): + result = b.normalize(b.enc(b.compile_lam(source)), 1 << 17) + assert result is not None, source + return result + + +def divergent_suffix(interpreter, source): + term = b.compile_lam(source) + probe = ('L', ('A', ('A', b.shift(interpreter, 1), b.FALSE), + b.bitlist(b.enc(term), ('V', 0)))) + result = b.normalize(b.enc(probe), 1 << 18) + assert result == '0010', (source, result) + + +def main(): + start = time.monotonic() + term = b.compile_lam(SOURCE) + generator = b.compile_lam(GENERATOR) + core = generator + for _ in range(5): + assert core[0] == 'L' + core = core[1] + read, map_ = core[1:] + reader = read[1][1] + next_ = read[2] + sizes = { + 'generator': len(b.enc(generator)), + 'public_adapter': len(b.enc(b.compile_lam(ADAPTER))), + 'outer_application': 2, + 'interpreter': len(b.enc(term)), + } + assert sizes == {'generator': 262, 'public_adapter': 59, + 'outer_application': 2, 'interpreter': 323}, sizes + generator_parts = { + 'five_generator_binders': 10, + 'next_let_lambda_and_application': 4, + 'whole_stream_reader_in_frame': len(b.enc(reader)), + 'next_in_frame': len(b.enc(next_)), + 'common_map_application': 2, + 'common_map_in_frame': len(b.enc(map_)), + } + assert sum(generator_parts.values()) == 262, generator_parts + equations = [ + ('box_self_application_calls_parser_generator', + r'\g\f\r.(\k.k g f r) (\k.k g f r)', + r'\g\f\r.g g f r f r'), + ('box_maps_abstraction', + rf'\g\f\n.(\k.k g f n) {ABS}', + r'\g\f\n\k.k g (\e\a.f (\b\r.b a (r e))) n'), + ('box_maps_application_accumulator', + rf'\f\g\h\n.(\k.k g h n) {MAP}', + r'\f\g\h\n\k.k g (\e.f e (h e)) n'), + ('left_seed_is_exact_on_lambda_payloads', + rf'\a.\e.{F} e ((\z.a z) e)', + r'\a\z.a z'), + ('public_box_consumer', + r'\c\g\f\n.(\k.k g f n) (\q\v\r.c v r)', + r'\c\g\f\n.c f n'), + ] + with ThreadPoolExecutor(max_workers=2) as pool: + results = list(pool.map(nf, [s for _, left, right in equations + for s in (left, right)])) + for i, (name, _, _) in enumerate(equations): + assert results[2*i] == results[2*i+1], name + ok, skipped, failures = b.check(term, max_bits=18, threads=2) + assert (ok, skipped, len(failures)) == (667, 1, 0), failures + divergent = {'omega': r'(\x.x x) (\x.x x)', + 'lambda_omega': r'\a.(\x.x x) (\x.x x)'} + with ThreadPoolExecutor(max_workers=2) as pool: + list(pool.map(lambda src: divergent_suffix(term, src), divergent.values())) + report = {'search_performed': False, 'sizes': sizes, + 'generator_parts': generator_parts, + 'rigid_equations': [name for name, _, _ in equations], + 'battery': {'ok': ok, 'skipped': skipped, 'failures': failures}, + 'divergent_source_suffixes': list(divergent), + 'elapsed_seconds': round(time.monotonic() - start, 3)} + machines = ROOT / 'data/self-interpreter/machines' + name = 'int323_shared_tag' + (machines / f'{name}.lam').write_text( + '-- Shared parser/APP generator; generated by shared_tag.py.\n' + '-- 323 bits: generator sharing is possible, but this is not sub-165.\n' + '-- E C ( ++ N) =beta C (lambda z.M) N for closed M.\n' + + SOURCE + '\n') + (machines / f'{name}.blc').write_text(b.enc(term) + '\n') + path = ROOT / 'data/self-interpreter/theory/shared_tag.json' + path.write_text(json.dumps(report, indent=2) + '\n') + print(json.dumps(report, indent=2)) + + +if __name__ == '__main__': + main() From 1032ea0351999baaf49329ba2fd40532c6347c2b Mon Sep 17 00:00:00 2001 From: a9lim Date: Tue, 20 Oct 2026 22:58:20 -0400 Subject: [PATCH 28/41] Prove a 70-bit suffix parser and sharpen interpreter structure bounds --- data/self-interpreter/machines/rem70.blc | 1 + data/self-interpreter/machines/rem70.lam | 1 + data/self-interpreter/machines/rem93.blc | 1 - data/self-interpreter/machines/rem93.lam | 6 - data/self-interpreter/theory/remainder.json | 31 +- docs/STATUS.md | 22 +- .../self-interpreter/capture-width.md | 432 ++++++++++++++++++ .../classical/self-interpreter/interpreter.md | 16 +- docs/classical/self-interpreter/remainder.md | 90 ++-- .../self-interpreter/structural-bounds.md | 11 + lean/Blc/SelfintRemainder.lean | 178 ++++---- tools/self-interpreter/theory/remainder.py | 75 +-- 12 files changed, 669 insertions(+), 195 deletions(-) create mode 100644 data/self-interpreter/machines/rem70.blc create mode 100644 data/self-interpreter/machines/rem70.lam delete mode 100644 data/self-interpreter/machines/rem93.blc delete mode 100644 data/self-interpreter/machines/rem93.lam create mode 100644 docs/classical/self-interpreter/capture-width.md diff --git a/data/self-interpreter/machines/rem70.blc b/data/self-interpreter/machines/rem70.blc new file mode 100644 index 00000000..ec51c7bc --- /dev/null +++ b/data/self-interpreter/machines/rem70.blc @@ -0,0 +1 @@ +0001000101110101000000110010111000000001010101111011001011101010101010 diff --git a/data/self-interpreter/machines/rem70.lam b/data/self-interpreter/machines/rem70.lam new file mode 100644 index 00000000..ebab2600 --- /dev/null +++ b/data/self-interpreter/machines/rem70.lam @@ -0,0 +1 @@ +\s.(\d.s d d) (\b\r.r (b (\t\u\d.t u (u d d) d d) r)) diff --git a/data/self-interpreter/machines/rem93.blc b/data/self-interpreter/machines/rem93.blc deleted file mode 100644 index e5878c3c..00000000 --- a/data/self-interpreter/machines/rem93.blc +++ /dev/null @@ -1 +0,0 @@ -010001101000010000010110000101100000011000000111111110010111010011111111010100101101010011010 diff --git a/data/self-interpreter/machines/rem93.lam b/data/self-interpreter/machines/rem93.lam deleted file mode 100644 index 26dcbf7e..00000000 --- a/data/self-interpreter/machines/rem93.lam +++ /dev/null @@ -1,6 +0,0 @@ --- 93-bit exact remainder extractor, for arbitrary well-formed BLC syntax. --- R ( ++ N) ->* N, including open and divergent source M. --- Factor the common recursive call across the second-tag alternatives. -(\x.x x) (\x.(\p.\s. - s (\b.b (\u\r.r (\t\u.p (t u (p u)))) b) (s s s)) - (x x)) diff --git a/data/self-interpreter/theory/remainder.json b/data/self-interpreter/theory/remainder.json index 6718db3f..9ae0d971 100644 --- a/data/self-interpreter/theory/remainder.json +++ b/data/self-interpreter/theory/remainder.json @@ -1,20 +1,23 @@ { - "bits": 93, - "explicit_variants": { - "shared_body": 97, - "factored_inline": 93 + "bits": 70, + "source_counts": { + "lambdas": 7, + "applications": 12, + "index_tax": 6 }, + "context_bits": 53, + "next_bits": 36, + "adapter_and_application_bits": 17, "symbolic_head_clause_steps": { - "knot": 1, - "unfold": 3, - "variable": 6, - "zero": 6, - "abstraction_head": 3, - "application_head": 3, - "abstraction_argument": 2, - "application_argument": 2 + "unfold": 2, + "variable_head": 3, + "zero_head": 3, + "variable_argument": 2, + "zero_argument": 2, + "abstraction": 6, + "application": 6 }, - "formal_contract": "forall M N, rem93 (streamOf (blcCode M) N) ->* N", + "formal_contract": "forall M N, rem70 (streamOf (blcCode M) N) ->* N", "source_restrictions": "none: open and divergent source syntax included", - "seconds": 0.0069 + "seconds": 0.0044 } diff --git a/docs/STATUS.md b/docs/STATUS.md index 01227353..b3ba0f40 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -207,8 +207,20 @@ with all features (three opt-in tests ignored) and 328 with default features. literal 165. A 742-bit β-normal witness also has exactly two closed nonlinear binders, with its contract kernel-checked as β-joinability. Thus the minimum count two is attained even among β-normal interpreters. - Every interpreter must also contain a live abstraction capturing an - enclosing local variable. + Statman's published width obstruction, combined with a handwritten + interface argument, strengthens the capture requirement: every interpreter + has a subterm with three distinct free variables and at least two live + capturing abstractions. A literal two-argument interface, including every + beta-normal interpreter, needs three such internal variables and two + internal captures, plus the public stream binder's capture of the + continuation. Together with the nonlinear theorem these give handwritten + bit floors 27 globally and 40 for literal interfaces; the Lean numerical + floor remains 18. A shared-S construction attains width three, two + nonlinear binders, and the required capture counts simultaneously, even + in the beta-normal fragment with every zero-based index at most two. + It is an existential structural construction, not a compact measured + interpreter or an additive decomposition + (`classical/self-interpreter/capture-width.md`). A colored reduction theorem proves that quotation-origin binders remain affine, retain one of three protected head shapes, and cannot acquire a live capture; live quotation bodies stay normal and contain only @@ -252,11 +264,11 @@ with all features (three opt-in tests ignored) and 328 with default features. numerical minimum yet. The literal 165's three existing redexes increase size by 147, 3, and 5 bits when contracted individually; the same fixed check validates each charge. - The separate syntactic remainder task has a 93-bit construction - (`rem93`, `classical/self-interpreter/remainder.md`): Lean proves exact + The separate syntactic remainder task has a 70-bit construction + (`rem70`, `classical/self-interpreter/remainder.md`): Lean proves exact suffix extraction for every source term, including open and divergent sources, and every suffix. The fixed source/wire and symbolic-clause - check takes 0.007 seconds (`data/self-interpreter/theory/remainder.json`). + check takes 0.004 seconds (`data/self-interpreter/theory/remainder.json`). This is an unrestricted upper bound for a parser projection, not a self-interpreter or a beta-normal remainder bound. `SelfintZero` proves that every exact remainder extractor needs two nonlinear diff --git a/docs/classical/self-interpreter/capture-width.md b/docs/classical/self-interpreter/capture-width.md new file mode 100644 index 00000000..c6e9b7d6 --- /dev/null +++ b/docs/classical/self-interpreter/capture-width.md @@ -0,0 +1,432 @@ +# Capture width and its sharpness + +Every self-interpreter for the repository's exact closed-source contract has +a source subterm with at least three distinct free variables. Consequently +its source contains at least two live abstractions that capture an enclosing +variable. Both bounds are sharp, even simultaneously with the established +minimum of two nonlinear binders. + +The lower bound uses a published theorem of Rick Statman and Codex's +handwritten interface argument below. The sharpness construction is also +handwritten. These results are not Lean theorems in this repository and do +not establish a useful numerical lower bound near 165 bits. + +## The source measure + +For a term `T`, define + +```text +width(T) = max { |FV(U)| : U is a syntactic subterm of T }. +``` + +`FV(U)` counts distinct variables free relative to `U`, including variables +bound outside `U` in the enclosing term. It does not count occurrences. +Use globally distinct names for the binders when computing these sets; +equivalently, count the distinct external de Bruijn indices of each +subterm. The resulting width is invariant under alpha conversion. + +A binder is *live* if its own variable occurs in its body. A live binder +*captures* if its abstraction subterm also contains an occurrence bound by +an enclosing abstraction. A vacuous abstraction is not a live capture, +even when its body mentions enclosing variables. + +Width is a measure of the source syntax, not a quantity that decreases +under beta reduction. For example, + +```text +λf g.(λp.λx.p x) (f g) → λf g x.f g x +``` + +increases width from two to three. The lower bound therefore needs the +specific impossibility theorem below; it does not follow by comparing +input and output widths along a reduction. + +## Statman's obstruction + +Write + +```text +S = λf g x.f x (g x), +K = λa b.a, +I = λx.x. +``` + +Statman's *Two Variables Are Not Enough* states the following consequence +on page 406: + +```text +P closed and P =β S ⇒ width(P) ≥ 3. +``` + +The paper also states the corresponding consequence for `B`. Its +two-variable result concerns the number of reusable variable names, not +the total number of abstraction nodes. The connection to free-variable +width allows insertion of `K` applications for vacuous abstractions; the +displayed consequence is stated directly in the paper. + +Sources inspected: + +- Rick Statman, [*Two Variables Are Not Enough*, ICTCS 2005, pp. 406–409](https://doi.org/10.1007/11560586_32). + The publisher's [two-page preview](https://page-one.springer.com/pdf/preview/10.1007/11560586_32) + contains the width consequence on page 406 and the conversion of + two-variable terms into HOT combinations on pages 406–407. +- Rick Statman, [*Combinators Hereditarily of Order Two*, CMU Mathematics + Research Report 88-33, August 1988](https://doi.org/10.1184/R1/6477068.v1). + Printed pages 2–7 give the HOT definitions and the strict hierarchy by + definitional rank. The report distinguishes HOT rewriting from beta + conversion of the expanded lambda terms; its negative result is about + the latter. + +The hierarchy prevents a finite collection of HOT definitions from +representing every higher rank. This is a restriction on exact lambda-term +representation, despite the computational power of the HOT system. The +argument here invokes the published width consequence rather than +claiming a new proof of Statman's theorem. + +## The exact interpreter contract crosses the obstruction + +Let `E` be closed and satisfy, for every closed source `M` and independent +rigid `C,N`, + +```text +E C (stream(M,N)) =β C (λz.M) N. +``` + +Here `stream(M,N)` is the Scott list of the BLC bits of `M`, ending in +`N`. Its cells are `λk.k b t`, and its bit terms are `K,F`, where +`F = λa b.b`. + +Take the closed source `M=S`. Capture-avoiding substitution of `C:=K` and +`N:=I` into the finite beta-join diagram gives + +```text +E K (stream(S,I)) =β K (λz.S) I. +``` + +Apply both sides to `I`. The resulting closed term + +```text +P = E K (stream(S,I)) I +``` + +satisfies + +```text +P =β K (λz.S) I I →* S. +``` + +This uses only beta conversion. It does not strengthen the interpreter's +joinability contract to a directed reduction on arbitrary divergent +sources. + +Every tail of `stream(S,I)` is closed. In a cell `λk.k b t`, both `b` and +`t` are closed, so its application subterms have at most the one free +variable `k`. Induction on the list, together with the literal definitions +of `K,F,I`, gives + +```text +width(stream(S,I)) = width(K) = width(I) = 1. +``` + +An application of two closed terms adds no new free-variable support at +its root; its other subterms belong to its two operands. Thus + +```text +width(P) = max(width(E), 1). +``` + +Statman's obstruction forces `width(E) ≥ 3`. The quotation and the two +closed public arguments cannot supply the required source subterm. + +## At least two live capturing abstractions + +Choose a subterm `U` of the closed `E` with three distinct free variables. +Their binders are ancestors of `U` in one syntax tree, so order them from +outermost to innermost as `b₁,b₂,b₃`. + +The abstraction `b₂` is live because `U` contains its bound occurrence. +Its body also contains the occurrence bound by `b₁`, so it captures an +enclosing variable. Likewise `b₃` is live and captures `b₁` and `b₂`. +These are two distinct abstraction occurrences in the original `E`. + +This argument does not require either capturing binder to be nonlinear. +The stronger claim that some binder must be both nonlinear and capturing +is already refuted by the checked construction in `two-nonlinear.md`. + +## The required support can lie wholly inside a literal interface + +There is a stronger source statement when the interpreter is literally +written `E = λc s.B`. Some subterm of `B` has three distinct free variables +whose binders are inside `B`, excluding both public variables `c,s`. +Consequently at least two live captures occur wholly among internal +binders: neither the public binders nor a capture of a public variable +supplies these two witnesses. + +Set `Q = stream(S,I)` as above and perform the two interface contractions. +The closed term + +```text +B[K/c,Q/s] I +``` + +is beta-convertible to `S`, so Statman's theorem requires width at least +three. Both substituted terms are closed and have width one. A subterm +inside an inserted copy therefore cannot witness width three. Every +remaining subterm descends from a subterm `U` of `B`, and its free-variable +set is exactly `FV(U) \ {c,s}`: closed substitution removes the two public +variables and introduces no external variable. The final application to +the closed `I` contributes no new support. Thus some original `U` has at +least three free variables other than `c,s`. + +Since `λc s.B` is closed, those three variables must be bound inside `B`. +Ordering their ancestor binders gives the two internal live captures by +the preceding argument. This statement concerns the literal source +interface; it does not price a head normal form reached by expanding a +different source term. + +In fact a literal two-lambda interface has at least three live captures +in total. Both `c` and `s` must occur in `B`: on the normal source `I`, +omitting `c` would leave the invocation without its required rigid head +`C`, while omitting `s` would leave it without its required rigid suffix +`N`. Beta reduction cannot introduce either absent free variable. Hence +the public `s` binder is live and captures `c`, in addition to the two +internal witnesses. + +By the exact-arity argument in `head-decomposition.md`, a beta-normal +self-interpreter has this literal two-lambda interface. It therefore also +has at least three live captures. + +## Small numerical consequences + +Combining width with the two-nonlinear theorem gives the handwritten +bounds + +```text +|E|_BLC ≥ 27 for every exact self-interpreter, +|E|_BLC ≥ 40 when E is literally λc s.B, + hence also when E is beta-normal. +``` + +Let `L,V,X` count abstractions, variable leaves, and the sum of zero-based +de Bruijn indices. The BLC size identity is + +```text +|E|_BLC = 2L + 4V - 2 + X. +``` + +Width three requires at least three distinct live binders. Two nonlinear +binders add at least two occurrences beyond one per live binder, so +`L ≥ 3` and `V ≥ 5`. For the three free variables of a width witness, +order their ancestor binders from outermost to innermost and select one +occurrence of each. Their zero-based indices are at least `2,1,0`, +respectively, even when additional binders intervene. Thus `X ≥ 3`, +giving 27. + +For a literal interface, the internal width witness and the two internal +nonlinear binders instead require at least three internal abstractions +and five internally bound leaves. The live public variables `c,s` add +two abstractions and two leaves. Every occurrence of `c` lies beneath +the `s` binder and therefore adds at least one index unit, on a leaf +distinct from the three internal witnesses. Hence `L ≥ 5`, `V ≥ 7`, +and `X ≥ 4`, giving 40. Head normalization can increase BLC size, so +this second argument does not give a 40-bit bound for arbitrary sources. + +These inequalities are sharp for the stated syntax constraints, not for +self-interpretation. The closed normal term + +```text +H = λa.a (λb.b (λx.a b x)) +``` + +has exactly 27 bits, width three, two nonlinear binders, and two live +captures. The closed normal `λc s.s H c` has exactly 40 bits, two internal +nonlinear binders, and three live captures. Neither term is claimed to be +an interpreter. The repository's kernel-checked numerical lower bound +remains the weaker 18-bit theorem in `structural-bounds.md`; the new +27- and 40-bit consequences also depend on the published width theorem. + +## Joint sharpness by one shared S + +The following translation applies to every closed lambda term `T`, +including an exact self-interpreter. Compile it into a finite applicative +expression `P(S,K)` by ordinary beta-exact bracket abstraction. Treat `S,K` +as closed constant symbols during compilation and use + +```text +[x]x = S K K, +[x]A = K A if x is absent from A, +[x](A B) = S ([x]A) ([x]B) otherwise. +``` + +Compile variables and applications structurally and replace each lambda +by this bracket operation after compiling its body. No eta optimization +is used. Expanding the constants gives a finite directed reduction + +```text +P(S,K) →* T. +``` + +For completeness, the bracket invariant is `[x]A →* λx.A` after constant +expansion. The variable case follows from `S K K →* λx.x`; the absent +case follows from `K A →* λx.A`; and the application case reduces first +to `λx.([x]A) x (([x]B) x)` and then to `λx.A B`. Structural induction +on `T` proves the displayed reduction, without reducing any source +redex that need not be reduced. + +Replace every syntactic occurrence of the constant `S` in `P` by a fresh +variable `s`, leave the literal `K` copies in place, and define + +```text +T_shared = (λs.P(s,K)) S. +``` + +Then `T_shared →* T`. Its source syntax has the following exact structure: + +- `λs.P(s,K)` is closed in isolation. Its body is an application tree of + `s` occurrences and closed `K` copies, and has width one. +- Every `K` copy has an outer binder that captures nothing and a vacuous + inner binder. Neither is a live capture or nonlinear. +- The sole literal `S` has width three. Its middle `g` and inner `x` + binders are its only live capturing abstractions. Only `x` is nonlinear. + +Consequently `T_shared` has width exactly three, exactly two live captures, +and at most two nonlinear binders: `S.x` and, if `P` uses `S` more than +once, the sharing binder `s`. + +Take `T` to be the proved literal interpreter. Directed reduction to `T` +transfers its beta-join contract to `T_shared`. The kernel-checked +two-nonlinear lower bound from `structural-bounds.md` then rules out the +case where the sharing binder is affine. Thus this one construction +simultaneously attains + +```text +width = 3, live captures = 2, nonlinear binders = 2. +``` + +No new expanded witness or bit count is needed for this existential +argument. The applicative control expression `P(s,K)` can still be large. +A substantial size lower bound must constrain that control, or another +weighted property of the source, rather than increase any of these three +sharp structural minima. + +There is exact wire accounting for this particular representation. If +`P(s,K)` has `m` variable leaves and `k` literal `K` leaves, its application +tree has `m+k-1` applications. Each `s` occurrence costs two bits, each +closed `K` costs seven, and each application costs two. The outer sharing +lambda and application cost four bits and the single `S` costs 23. Hence + +```text +|T_shared|_BLC = 25 + 4m + 9k. +``` + +This gives a weighted control target for the shared-S representation. It +is not a lower bound on an arbitrary interpreter: bracket abstraction can +increase size, and no cost-preserving conversion into this form has been +proved. + +The literal-interface refinement is sharp as well. Wrapping the same +closed construction as `λc s.T_shared c s` adds exactly one live capture, +the public `s` binder, and no nonlinear binder. It preserves width three +and the exact interpreter contract. Thus among literal two-lambda +interfaces, the simultaneous minima are width three, three live captures +of which two are internal, and two nonlinear binders. +This wrapper contains beta redexes; the next construction attains the +same three minima simultaneously in the beta-normal fragment. + +## Joint sharpness among normal interpreters + +Codex's following first-bit construction gives a beta-normal exact +interpreter with width three, exactly three live captures, and exactly +two nonlinear binders. Every zero-based de Bruijn index in its source is +at most two. + +First adapt a closed exact interpreter `T` to accept the tail after its +first zero bit, followed by the continuation: + +```text +T₀ = λr c.T c (λk.k K r). +``` + +Compile `T₀` into the beta-exact SK expression `P(S,K)`. Write +`Fbit = λu v.v` and replace the two constant symbols in that application +tree by projections from one variable: + +```text +J = λh.h S K, +F₀ = λp.P(p K, p Fbit). +``` + +Both terms are closed and beta-normal. In `F₀`, the application tree's +leaves have the rigid head `p`; every selector is a closed literal `K` +or `Fbit`. These selectors have width one and no live capture. Thus +`F₀` has width one, no live capture, and only one possible nonlinear +binder, its outer `p`. The pair binder `J.h` is affine and closed in +isolation. + +The projections reduce directly: + +```text +J K → K S K →* S, +J Fbit → Fbit S K →* K. +``` + +Consequently `F₀ J →* P(S,K) →* T₀`. No normalization with a rigid +placeholder is needed. + +Now define + +```text +H = λb.b F₀ I J, +E_normal = λc s.s H c. +``` + +The three closed terms `F₀,I,J` each occur literally once in `H`. The +source is beta-normal: the displayed application heads are the variables +`s,b`, and `F₀,I,J` are themselves normal. + +Every closed BLC source begins with the zero bit `K`. For its stream +`Q = λk.k K R`, the gate reduces after the two public-interface +contractions as follows: + +```text +Q H C + → H K R C + → K F₀ I J R C + →* F₀ J R C + →* T₀ R C + →* T C Q + =β C (λz.M) N. +``` + +The dummy branch `I` is discarded by the known zero bit. This leaves +`R` available as the first argument of `F₀ J`, so the public stream need +not be duplicated. All administrative steps reduce directly to the +original invocation `T C Q`; its exact beta-join contract supplies the +last line. + +The source counts are explicit: + +- The public `s` binder is live and captures `c`. The closed handler + `H` adds no live capture; neither do `F₀,I` or the pair binder `J.h`. + The sole `S` inside `J` adds exactly its two captures, `g,x`. + Thus there are exactly three. +- The outer application spine mentions only `c,s`. The handler's + application nodes mention only `b`, the pair's application nodes + mention only `h`, and `F₀,I` have width at most one. The literal `S` + supplies width exactly three. +- The public `c,s`, handler `b`, and pair binder `h` are affine. + The binder `S.x` is nonlinear, and `F₀.p` must also be nonlinear: + otherwise the proved + interpreter `E_normal` would have only one nonlinear binder, + contradicting the established lower bound. Every other binder is + affine. Thus there are exactly two nonlinear binders. +- Occurrences of `p,h,b,s` have zero-based index zero, and the public + `c` has index one. Closed `K,Fbit,I` copies have maximum index at most + one. The sole `S` has maximum index two. Closed insertion changes none + of these indices, so the whole source has maximum index exactly two. + +This attains all three minima simultaneously within the beta-normal +fragment and rules out any necessary occurrence of index three or +higher, even within that fragment. It is an existential structural +construction, not a new measured compact interpreter or a proof of +165-bit optimality. diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index b95d48ee..8aa04def 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -346,8 +346,20 @@ whose contract is kernel-checked as β-joinability. See `structural-bounds.md`, `Blc/SelfintLowerBound.lean`, and `Blc/SelfintSharp.lean`. -**Capture and provenance.** Some live abstraction of `E` captures an -enclosing local variable. Lean proves that absence of this property is +**Capture and provenance.** Statman's published width obstruction implies +that some subterm of `E` has three distinct free variables, forcing two +live capturing abstractions. For a literal `λc s.B`, three variables of +such a witness must be internal to `B`; the two internal captures and the +public stream binder's capture give three in total. Combined with the +nonlinear theorem, these give handwritten wire floors of 27 globally and +40 for literal interfaces, including beta-normal interpreters. +`capture-width.md` states the published result and the interface proof, +and gives a shared-S construction attaining these structural minima +simultaneously, including in the beta-normal fragment with all zero-based +indices at most two. The floors are sharp only for the necessary syntax +constraints, not for interpretation. + +Lean separately proves that absence of any live capturing abstraction is preserved by β-reduction and holds for the quotation, while the normal output for `λa b.a b` violates it. A separate colored reduction theorem tracks quotation-origin binders through unrestricted interpreter diff --git a/docs/classical/self-interpreter/remainder.md b/docs/classical/self-interpreter/remainder.md index ad134323..bd425d53 100644 --- a/docs/classical/self-interpreter/remainder.md +++ b/docs/classical/self-interpreter/remainder.md @@ -12,80 +12,90 @@ This task recognizes syntax; it does not evaluate the encoded source. It is one of the independent projections supplied by a continuation-headed self-interpreter in `head-decomposition.md`. -Codex's construction `rem93` satisfies this contract in 93 bits. Its +Codex's construction `rem70` satisfies this contract in 70 bits. Its named source and exact wire are -`data/self-interpreter/machines/rem93.lam` and `rem93.blc`. +`data/self-interpreter/machines/rem70.lam` and `rem70.blc`. This is an upper bound, not an optimality result for remainder extraction. -The term contains beta redexes, so it does not give this upper bound for +The term contains a beta redex, so it does not give this upper bound for the beta-normal fragment. ## Construction -Write `P` for the recursive parser and define +The input stream activates a shared context that passes itself to its +recursive calls: ``` -NEXT = λt u.P (t u (P u)), -H = λb.b (λu r.r NEXT) b, -P s = s H (s s s). +Q = λt u d.t u (u d d) d d, +D = λb r.r (b Q r), +P(s) = s D D, +R = λs.(λd.s d d) D. ``` -The actual finite term ties the recursion with self-application, sharing -`p=x x` and inlining `NEXT` inside the reader: +Here `P(s)` is notation for the displayed term, not an extra source +binding. The actual finite source is ``` -(λx.x x) (λx.(λp s. - s (λb.b (λu r.r (λt u.p (t u (p u)))) b) (s s s)) - (x x)). +λs.(λd.s d d) (λb r.r (b (λt u d.t u (u d d) d d) r)). ``` -The bit polarity is `0=K=λa b.a`, `1=F=λa b.b`. The reader uses the -first bit itself as its variable-branch continuation. With a first bit -`F`, it returns the third argument directly. With a first bit `K`, it -applies that argument to `NEXT`: +The bit polarity is `0=K=λa b.a`, `1=F=λa b.b`. A stream cell +`cons b r` reduces `P(cons b r)` to `D b r D`. For a variable's +first bit, `b=F`, the context selects ``` -(cons F r) H S →* S, -(cons K r) H S →* S NEXT. +D F r D →* r r D. ``` -The existing skip identity gives `s s s →* N` when the stream starts -with a variable's unary index `1ⁿ0`, and `s s s →* r` when -`s=cons K r`. Thus a variable returns its suffix immediately. For an -abstraction or application, the remaining second tag selects +The immediate tail is `r=1ⁱ0 ++ N`. The existing unary-skip identity +`r r →* λ_.N` erases the supplied context and returns `N`. Thus the +same copy of `D` that supplies recursion in the constructor branch is +the variable branch's discarded skip operand. + +For a constructor's first bit, `b=K`, the context selects + +``` +D K r D →* r Q D. +``` + +The second tag and the remaining stream enter `Q` before the pending +context `D`, keeping its four bound occurrences innermost. They give ``` -NEXT K u →* P u, -NEXT F u →* P (P u). +P(cons K (cons K u)) →* u D D = P(u), +P(cons K (cons F u)) →* (u D D) D D = P(P(u)). ``` An abstraction discards one recursively encoded body. An application discards its first child and then its second child. Uniformity in the suffix permits the second child's entire encoding to be the first -child's suffix. +child's suffix. The reader `Q` costs 36 bits and the whole context `D` +costs 53; the surrounding binders and applications cost 17. The complete +source has `L=7`, `A=12`, and `X=6`, so `2L + 4A + 2 + X = 70`. ## Kernel proof and fixed checks -`Blc.SelfintRemainder.rem93_contract` proves +`Blc.SelfintRemainder.rem70_contract` proves ``` -∀ M N, Betas (rem93 (streamOf (blcCode M) N)) N. +∀ M N, Betas (rem70 (streamOf (blcCode M) N)) N. ``` -The proof first checks symbolic head-reduction clauses for the knot, -unfolding, the two first-bit branches, and the two second-bit prefixes. -The latter reach `P (K u (P u))` and `P (F u (P u))`; two contextual -beta steps inside the outer argument then select `P u` or `P (P u)`. -It lifts them to arbitrary terms with the existing substitution theorem, -then uses structural induction on `M`. The application case reduces the -inner parse under an application context before the outer parse. -The proof imposes no source closedness, normality, or suffix restriction. +The proof checks five symbolic head-reduction clauses: the public +adapter, the first-bit variable and constructor branches, and the two +second-bit branches. The first-bit clauses also use two Boolean +reductions inside the selected argument to `r`. It lifts the clauses to +arbitrary terms with the existing substitution theorem, then uses +structural induction on `M`. The +variable case uses the unary skip theorem and its final erasing beta +step. The application case reduces the first parse under two application +contexts before the second parse. The proof imposes no source closedness, +normality, or suffix restriction. -The kernel also checks closedness, the literal 93-bit length, and the +The kernel also checks closedness, the literal 70-bit length, and the exact wire. `tools/self-interpreter/theory/remainder.py` pins the named -source to that wire and replays the same fixed symbolic clauses. It -compares only two explicit constructions: the displayed inlined factored -form and a shared `λt u.(t I P)(P u)`, which gives a 97-bit complete extractor. -`data/self-interpreter/theory/remainder.json` records those checks. +source to that wire and replays those five head clauses and the two fixed +Boolean argument clauses. `data/self-interpreter/theory/remainder.json` +records those checks. No source census or candidate search is involved. This construction separates the remainder task from value reconstruction diff --git a/docs/classical/self-interpreter/structural-bounds.md b/docs/classical/self-interpreter/structural-bounds.md index f01714fb..dd5949ae 100644 --- a/docs/classical/self-interpreter/structural-bounds.md +++ b/docs/classical/self-interpreter/structural-bounds.md @@ -112,6 +112,17 @@ The formal conclusions are: These are source-syntax constraints. They do not say that the captured binder must itself be nonlinear. +The handwritten argument in `capture-width.md` strengthens this to two +live capturing abstractions, or three for a literal two-argument interface +and hence for a beta-normal interpreter. It applies Statman's published +obstruction to a width-two term representing `S`: the closed quotation and +interface arguments have width one, so the necessary width-three subterm +must come from the interpreter. Combining that requirement with the +nonlinear theorem gives 27- and 40-bit floors, respectively. The same +document proves simultaneous sharpness of the width, capture, and nonlinear +counts by a shared-S construction. These additions are handwritten; they +do not strengthen the kernel-checked numerical theorem above. + ## Quotation-origin binders cannot provide arbitrary binding structure `Blc.SelfintOrigins` colors abstractions by origin: interpreter syntax is diff --git a/lean/Blc/SelfintRemainder.lean b/lean/Blc/SelfintRemainder.lean index c7af6caf..a60fdc96 100644 --- a/lean/Blc/SelfintRemainder.lean +++ b/lean/Blc/SelfintRemainder.lean @@ -1,7 +1,7 @@ /- -A 93-bit exact syntactic remainder extractor. It parses arbitrary BLC +A 70-bit exact syntactic remainder extractor. It parses arbitrary BLC terms, including open and divergent terms, without evaluating the source. -The proof is structural induction, with fixed symbolic head clauses. +The source stream activates a shared context that supplies its own recursion. This is a construction, not an optimality result for remainder extraction. -/ import Blc.Selfint165 @@ -10,140 +10,124 @@ namespace Blc open Term namespace SelfintRemainder -/-- NEXT, with parser p free at index j outside its two local binders. -/ -def nextAt (j : Nat) : Term := - .lam (.lam (.app (.var (j + 2)) - (.app (.app (.var 1) (.var 0)) (.app (.var (j + 2)) (.var 0))))) - -/-- The inline reader under p and s. -/ -def handlerBody : Term := - .lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (nextAt 4))))) (.var 0)) - -def body : Term := - .lam (.lam (.app (.app (.var 0) handlerBody) - (.app (.app (.var 0) (.var 0)) (.var 0)))) +/-- Q = λt u d.t u (u d d) d d. The input's two fields are consumed +before the self-passed context, keeping its four occurrences innermost. -/ +def next : Term := + .lam (.lam (.lam (.app (.app + (.app (.app (.var 2) (.var 1)) + (.app (.app (.var 1) (.var 0)) (.var 0))) (.var 0)) (.var 0)))) -def knot : Term := .lam (.app body (.app (.var 0) (.var 0))) -def parser : Term := .app knot knot -def rem93 : Term := .app (.lam (.app (.var 0) (.var 0))) knot +/-- D = λb r.r (b Q r). Boolean selection shares the operator r. -/ +def context : Term := + .lam (.lam (.app (.var 0) (.app (.app (.var 1) next) (.var 0)))) -def rem93Wire : List Bool := [false, true, false, false, false, true, true, false, true, false, false, false, false, true, false, false, false, false, false, true, false, true, true, false, false, false, false, true, false, true, true, false, false, false, false, false, false, true, true, false, false, false, false, false, false, true, true, true, true, true, true, true, true, false, false, true, false, true, true, true, false, true, false, false, true, true, true, true, true, true, true, true, false, true, false, true, false, false, true, false, true, true, false, true, false, true, false, false, true, true, false, true, false] +/-- The recursive operation is self-passing, with no fixed-point wrapper. -/ +def parse (s : Term) : Term := .app (.app s context) context -theorem wire_rem93 : blcCode rem93 = rem93Wire := by decide +def rem70 : Term := + .lam (.app (.lam (.app (.app (.var 1) (.var 0)) (.var 0))) context) -def next : Term := - .lam (.lam (.app parser - (.app (.app (.var 1) (.var 0)) (.app parser (.var 0))))) +def rem70Wire : List Bool := [false, false, false, true, false, false, false, true, false, true, true, true, false, true, false, true, false, false, false, false, false, false, true, true, false, false, true, false, true, true, true, false, false, false, false, false, false, false, false, true, false, true, false, true, false, true, true, true, true, false, true, true, false, false, true, false, true, true, true, false, true, false, true, false, true, false, true, false, true, false] -def handler : Term := - .lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) next)))) (.var 0)) +theorem wire_rem70 : blcCode rem70 = rem70Wire := by decide -theorem parser_closed : Closed parser := by decide +theorem context_closed : Closed context := by decide theorem next_closed : Closed next := by decide -theorem handler_closed : Closed handler := by decide -theorem rem93_closed : Closed rem93 := by decide -theorem rem93_size : (blcCode rem93).length = 93 := by decide +theorem rem70_closed : Closed rem70 := by decide +theorem rem70_size : (blcCode rem70).length = 70 := by decide -theorem subst_parser (j : Nat) (s : Term) : substDec j s parser = parser := - substDec_closed j s parser_closed +theorem subst_context (j : Nat) (s : Term) : substDec j s context = context := + substDec_closed j s context_closed theorem subst_next (j : Nat) (s : Term) : substDec j s next = next := substDec_closed j s next_closed -theorem subst_handler (j : Nat) (s : Term) : substDec j s handler = handler := - substDec_closed j s handler_closed - -theorem run_knot : spineSteps 1 rem93 = some parser := by decide +theorem subst_rem70 (j : Nat) (s : Term) : substDec j s rem70 = rem70 := + substDec_closed j s rem70_closed -theorem run_unfold : spineSteps 3 (.app parser (.var 0)) = - some (.app (.app (.var 0) handler) - (.app (.app (.var 0) (.var 0)) (.var 0))) := by decide +theorem run_unfold : spineSteps 2 (.app rem70 (.var 0)) = + some (parse (.var 0)) := by decide -theorem run_var : - spineSteps 6 (.app (.app (pairT churchFalse (.var 0)) handler) (.var 1)) = - some (.var 1) := by decide +theorem run_var : spineSteps 3 (parse (pairT churchFalse (.var 0))) = + some (.app (.app (.var 0) (.app (.app churchFalse next) (.var 0))) context) := by decide -theorem run_zero : - spineSteps 6 (.app (.app (pairT churchTrue (.var 0)) handler) (.var 1)) = - some (.app (.var 1) next) := by decide +theorem run_zero : spineSteps 3 (parse (pairT churchTrue (.var 0))) = + some (.app (.app (.var 0) (.app (.app churchTrue next) (.var 0))) context) := by decide -theorem run_lam : spineSteps 3 (.app (pairT churchTrue (.var 0)) next) = - some (.app parser (.app (.app churchTrue (.var 0)) (.app parser (.var 0)))) := by decide +theorem run_lam : spineSteps 6 (.app (.app (pairT churchTrue (.var 0)) next) context) = + some (parse (.var 0)) := by decide -theorem run_app : spineSteps 3 (.app (pairT churchFalse (.var 0)) next) = - some (.app parser (.app (.app churchFalse (.var 0)) (.app parser (.var 0)))) := by decide +theorem run_app : spineSteps 6 (.app (.app (pairT churchFalse (.var 0)) next) context) = + some (parse (parse (.var 0))) := by decide -theorem unfold_parser (s : Term) : - SpineReds (.app parser s) (.app (.app s handler) (.app (.app s s) s)) := by +theorem unfold_rem70 (s : Term) : SpineReds (.app rem70 s) (parse s) := by have h := spineReds_instN [s] 0 (spineReds_of_spineSteps _ run_unfold) - simpa [instN, substDec, shift, subst_parser, subst_handler, shift_zero] using h - -theorem variable_clause (r S : Term) : - SpineReds (.app (.app (pairT churchFalse r) handler) S) S := by - have h := spineReds_instN [r, S] 0 (spineReds_of_spineSteps _ run_var) - simpa [instN, pairT, substDec, shift, subst_handler, shift_churchFalse, - substDec_churchFalse, shift_shift0, substDec_shift0, shift_zero] using h - -theorem zero (r S : Term) : - SpineReds (.app (.app (pairT churchTrue r) handler) S) (.app S next) := by - have h := spineReds_instN [r, S] 0 (spineReds_of_spineSteps _ run_zero) - simpa [instN, pairT, substDec, shift, subst_handler, subst_next, shift_churchTrue, - substDec_churchTrue, shift_shift0, substDec_shift0, shift_zero] using h + simpa [instN, parse, substDec, shift, subst_rem70, subst_context, shift_zero] using h + +theorem variable_clause (r : Term) : + Betas (parse (pairT churchFalse r)) (.app (.app r r) context) := by + have h := spineReds_instN [r] 0 (spineReds_of_spineSteps _ run_var) + have h' : SpineReds (parse (pairT churchFalse r)) + (.app (.app r (.app (.app churchFalse next) r)) context) := by + simpa [instN, parse, pairT, substDec, shift, subst_context, subst_next, + shift_churchFalse, substDec_churchFalse, substDec_shift0, shift_zero] using h + exact betas_trans (betas_of_spineReds h') + (betas_appL context (betas_appR r (betas_of_spineReds (spine_false2 next r)))) + +theorem zero (r : Term) : + Betas (parse (pairT churchTrue r)) (.app (.app r next) context) := by + have h := spineReds_instN [r] 0 (spineReds_of_spineSteps _ run_zero) + have h' : SpineReds (parse (pairT churchTrue r)) + (.app (.app r (.app (.app churchTrue next) r)) context) := by + simpa [instN, parse, pairT, substDec, shift, subst_context, subst_next, + shift_churchTrue, substDec_churchTrue, substDec_shift0, shift_zero] using h + exact betas_trans (betas_of_spineReds h') + (betas_appL context (betas_appR r (betas_of_spineReds (spine_true2 next r)))) theorem abstraction (r : Term) : - Betas (.app (pairT churchTrue r) next) (.app parser r) := by + SpineReds (.app (.app (pairT churchTrue r) next) context) (parse r) := by have h := spineReds_instN [r] 0 (spineReds_of_spineSteps _ run_lam) - have h' : SpineReds (.app (pairT churchTrue r) next) - (.app parser (.app (.app churchTrue r) (.app parser r))) := by - simpa [instN, pairT, substDec, shift, subst_next, subst_parser, shift_churchTrue, - substDec_churchTrue, substDec_shift0, shift_zero] using h - exact betas_trans (betas_of_spineReds h') - (betas_appR parser (betas_of_spineReds (spine_true2 r (.app parser r)))) + simpa [instN, parse, pairT, substDec, shift, subst_next, subst_context, + shift_churchTrue, substDec_churchTrue, substDec_shift0, shift_zero] using h theorem application (r : Term) : - Betas (.app (pairT churchFalse r) next) (.app parser (.app parser r)) := by + SpineReds (.app (.app (pairT churchFalse r) next) context) (parse (parse r)) := by have h := spineReds_instN [r] 0 (spineReds_of_spineSteps _ run_app) - have h' : SpineReds (.app (pairT churchFalse r) next) - (.app parser (.app (.app churchFalse r) (.app parser r))) := by - simpa [instN, pairT, substDec, shift, subst_next, subst_parser, shift_churchFalse, - substDec_churchFalse, substDec_shift0, shift_zero] using h - exact betas_trans (betas_of_spineReds h') - (betas_appR parser (betas_of_spineReds (spine_false2 r (.app parser r)))) + simpa [instN, parse, pairT, substDec, shift, subst_next, subst_context, + shift_churchFalse, substDec_churchFalse, substDec_shift0, shift_zero] using h /-- The recursion theorem is uniform in the entire suffix, so the APP case can use another complete term's stream as that suffix. -/ -theorem parser_contract : ∀ (M N : Term), - Betas (.app parser (streamOf (blcCode M) N)) N := by +theorem parse_contract : ∀ (M N : Term), + Betas (parse (streamOf (blcCode M) N)) N := by intro M induction M with | var i => intro N - refine betas_trans (betas_of_spineReds (unfold_parser _)) ?_ rw [code_var, streamOf_cons] - exact betas_trans (betas_of_spineReds (variable_clause _ _)) - (betas_of_spineReds (pastZero_self (.var i) N _ (.refl _))) + refine betas_trans (variable_clause _) ?_ + refine betas_trans (betas_of_spineReds (spineReds_appL context (skip_self i N))) ?_ + have h := spine_beta (shift 1 0 N) context + have e : contract (shift 1 0 N) context = N := substDec_shift N _ 0 + rw [e] at h + exact betas_of_spineReds h | lam M ih => intro N - refine betas_trans (betas_of_spineReds (unfold_parser _)) ?_ - refine betas_trans (betas_of_spineReds (zero _ _)) ?_ - refine betas_trans (betas_appL next - (betas_of_spineReds (pastZero_self (.lam M) N _ (.refl _)))) ?_ - exact betas_trans (abstraction _) (ih N) + refine betas_trans (zero _) ?_ + exact betas_trans (betas_of_spineReds (abstraction _)) (ih N) | app M Q ihM ihQ => intro N - refine betas_trans (betas_of_spineReds (unfold_parser _)) ?_ - refine betas_trans (betas_of_spineReds (zero _ _)) ?_ - refine betas_trans (betas_appL next - (betas_of_spineReds (pastZero_self (.app M Q) N _ (.refl _)))) ?_ - refine betas_trans (application _) ?_ - change Betas (.app parser (.app parser (streamOf (blcCode M ++ blcCode Q) N))) N + refine betas_trans (zero _) ?_ + refine betas_trans (betas_of_spineReds (application _)) ?_ + change Betas (parse (parse (streamOf (blcCode M ++ blcCode Q) N))) N rw [streamOf_append] - exact betas_trans (betas_appR parser (ihM (streamOf (blcCode Q) N))) (ihQ N) + exact betas_trans + (betas_appL context (betas_appL context (ihM (streamOf (blcCode Q) N)))) + (ihQ N) /-- Exact remainder extraction for every syntactically valid source, with no closedness, normalization, or suffix hypothesis. -/ -theorem rem93_contract (M N : Term) : - Betas (.app rem93 (streamOf (blcCode M) N)) N := - betas_trans (betas_appL _ (betas_of_spineReds - (spineReds_of_spineSteps _ run_knot))) (parser_contract M N) +theorem rem70_contract (M N : Term) : + Betas (.app rem70 (streamOf (blcCode M) N)) N := + betas_trans (betas_of_spineReds (unfold_rem70 _)) (parse_contract M N) end SelfintRemainder end Blc diff --git a/tools/self-interpreter/theory/remainder.py b/tools/self-interpreter/theory/remainder.py index 2992f20d..78bc072c 100644 --- a/tools/self-interpreter/theory/remainder.py +++ b/tools/self-interpreter/theory/remainder.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Two explicit remainder parsers and fixed symbolic head clauses. +"""The 70-bit remainder parser and five fixed symbolic head clauses. No source or candidate enumeration. Lean proves the all-syntax contract; this script pins the named source/wire and checks its defining clauses. @@ -42,49 +42,64 @@ def check_clause(source, target, expected_steps): return expected_steps +def counts(term): + if term[0] == "V": + return 0, 0, term[1] + if term[0] == "L": + lambdas, apps, tax = counts(term[1]) + return lambdas + 1, apps, tax + left, right = counts(term[1]), counts(term[2]) + return left[0] + right[0], left[1] + right[1] + 1, left[2] + right[2] + + def main(): start = time.monotonic() - named = (ROOT / "data/self-interpreter/machines/rem93.lam").read_text() + named = (ROOT / "data/self-interpreter/machines/rem70.lam").read_text() source = battery.compile_lam(named) bits = lc.enc(source) - assert bits == (ROOT / "data/self-interpreter/machines/rem93.blc").read_text().strip() - assert len(bits) == 93 + assert bits == (ROOT / "data/self-interpreter/machines/rem70.blc").read_text().strip() + assert len(bits) == 70 proof = (ROOT / "lean/Blc/SelfintRemainder.lean").read_text() - literal = re.search(r"def rem93Wire : List Bool := \[([^]]+)\]", proof)[1] + literal = re.search(r"def rem70Wire : List Bool := \[([^]]+)\]", proof)[1] proof_bits = "".join("1" if b.strip() == "true" else "0" for b in literal.split(",")) assert bits == proof_bits - reader = r"(\n.\s.s(\b.b(\u\r.r n)b)(s s s))" - shared_body = battery.compile_lam( - r"(\x.x x)(\x.(\p." + reader + r"(\t\u.(t (\i.i) p)(p u)))(x x))") - factored_inline = battery.compile_lam( - r"(\x.x x)(\x.(\p.\s.s(\b.b(\u\r.r(\t\u.p(t u(p u))))b)(s s s))(x x))") - assert factored_inline == source - variants = {"shared_body": lc.size(shared_body), "factored_inline": lc.size(factored_inline)} - assert variants == {"shared_body": 97, "factored_inline": 93} - - parser = app(source[2], source[2]) - next_term = lc.beta(battery.compile_lam(r"\p.\t\u.p(t u(p u))"), parser) - handler = lc.beta(battery.compile_lam(r"\n.\b.b(\u\r.r n)b"), next_term) - r, suffix = ("V", 0), ("V", 1) + context = battery.compile_lam(r"\b\r.r (b (\t\u\d.t u (u d d) d d) r)") + adapter = battery.compile_lam(r"\s\d.s d d") + assert source == ("L", app(adapter[1], context)) + assert lc.size(context) == 53 + assert lc.size(adapter) + 2 == 17 + next_term = battery.compile_lam(r"\t\u\d.t u (u d d) d d") + assert lc.size(next_term) == 36 + + def parse(stream): + return app(app(stream, context), context) + + r = ("V", 0) + false_selection = app(app(lc.FALSE, next_term), r) + true_selection = app(app(lc.TRUE, next_term), r) clauses = { - "knot": check_clause(source, parser, 1), - "unfold": check_clause(app(parser, r), app(app(r, handler), app(app(r, r), r)), 3), - "variable": check_clause(app(app(lc.pair(lc.FALSE, r), handler), suffix), suffix, 6), - "zero": check_clause(app(app(lc.pair(lc.TRUE, r), handler), suffix), app(suffix, next_term), 6), - "abstraction_head": check_clause(app(lc.pair(lc.TRUE, r), next_term), - app(parser, app(app(lc.TRUE, r), app(parser, r))), 3), - "application_head": check_clause(app(lc.pair(lc.FALSE, r), next_term), - app(parser, app(app(lc.FALSE, r), app(parser, r))), 3), - "abstraction_argument": check_clause(app(app(lc.TRUE, r), app(parser, r)), r, 2), - "application_argument": check_clause(app(app(lc.FALSE, r), app(parser, r)), app(parser, r), 2), + "unfold": check_clause(app(source, r), parse(r), 2), + "variable_head": check_clause(parse(lc.pair(lc.FALSE, r)), + app(app(r, false_selection), context), 3), + "zero_head": check_clause(parse(lc.pair(lc.TRUE, r)), + app(app(r, true_selection), context), 3), + "variable_argument": check_clause(false_selection, r, 2), + "zero_argument": check_clause(true_selection, next_term, 2), + "abstraction": check_clause(app(app(lc.pair(lc.TRUE, r), next_term), context), parse(r), 6), + "application": check_clause(app(app(lc.pair(lc.FALSE, r), next_term), context), parse(parse(r)), 6), } + lambdas, apps, tax = counts(source) + assert 2 * lambdas + 4 * apps + 2 + tax == len(bits) report = { "bits": len(bits), - "explicit_variants": variants, + "source_counts": {"lambdas": lambdas, "applications": apps, "index_tax": tax}, + "context_bits": lc.size(context), + "next_bits": lc.size(next_term), + "adapter_and_application_bits": lc.size(adapter) + 2, "symbolic_head_clause_steps": clauses, - "formal_contract": "forall M N, rem93 (streamOf (blcCode M) N) ->* N", + "formal_contract": "forall M N, rem70 (streamOf (blcCode M) N) ->* N", "source_restrictions": "none: open and divergent source syntax included", "seconds": round(time.monotonic() - start, 4), } From a409a394c42bce7d90c3dc1fdaf1a8180f2b4e91 Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 01:19:15 -0400 Subject: [PATCH 29/41] Prove nonlinear branching obstruction and record self-passed interpreter --- .../machines/int191_selfpassed.blc | 1 + .../machines/int191_selfpassed.lam | 3 + data/self-interpreter/theory/selfpassed.json | 34 ++ docs/STATUS.md | 32 +- .../self-interpreter/capture-width.md | 300 ++++++++++++++++-- .../classical/self-interpreter/interpreter.md | 18 +- .../self-interpreter/protocol-obstructions.md | 96 ++++++ .../self-interpreter/structural-bounds.md | 20 +- lean/Blc.lean | 1 + lean/Blc/SelfintNonlinearChain.lean | 225 +++++++++++++ tools/self-interpreter/theory/selfpassed.py | 128 ++++++++ 11 files changed, 810 insertions(+), 48 deletions(-) create mode 100644 data/self-interpreter/machines/int191_selfpassed.blc create mode 100644 data/self-interpreter/machines/int191_selfpassed.lam create mode 100644 data/self-interpreter/theory/selfpassed.json create mode 100644 lean/Blc/SelfintNonlinearChain.lean create mode 100644 tools/self-interpreter/theory/selfpassed.py diff --git a/data/self-interpreter/machines/int191_selfpassed.blc b/data/self-interpreter/machines/int191_selfpassed.blc new file mode 100644 index 00000000..950393a7 --- /dev/null +++ b/data/self-interpreter/machines/int191_selfpassed.blc @@ -0,0 +1 @@ +00000100010101110101110100000010111001100000000001010111101000010111111001111000000111100000010111011100110111100001010110111000011111100001011111010011101011101000000101110111001011110111010 diff --git a/data/self-interpreter/machines/int191_selfpassed.lam b/data/self-interpreter/machines/int191_selfpassed.lam new file mode 100644 index 00000000..6edce9d5 --- /dev/null +++ b/data/self-interpreter/machines/int191_selfpassed.lam @@ -0,0 +1,3 @@ +-- Self-passed recursive context; generated by selfpassed.py. +-- E C ( ++ N) =beta C (\z.M) N for closed M. +\c\s.(\d.s d c d) (\b\r.b (r (\t\u\c\d.u d (\f.t (c (\e\a.f (\b\r.b a (r e)))) (\v.v d (\g.c (\e.f e (g e))) d)) d)) (\c\d.c r (r r d))) diff --git a/data/self-interpreter/theory/selfpassed.json b/data/self-interpreter/theory/selfpassed.json new file mode 100644 index 00000000..9728e3cc --- /dev/null +++ b/data/self-interpreter/theory/selfpassed.json @@ -0,0 +1,34 @@ +{ + "search_performed": false, + "name": "int191_selfpassed", + "bits": 191, + "source_counts": { + "lambdas": 19, + "applications": 28, + "index_tax": 39 + }, + "context_bits": 166, + "next_bits": 122, + "adapter_and_application_bits": 25, + "symbolic_head_clause_steps": { + "unfold": 3, + "variable": 7, + "zero": 5, + "abstraction_parse": 5, + "application_parse": 5, + "abstraction_return": 3, + "application_second_parse": 4, + "application_return": 1 + }, + "battery": { + "ok": 667, + "skipped": 1, + "failures": [] + }, + "divergent_source_suffix": { + "omega": true, + "lambda_omega": true + }, + "proof_status": "handwritten recurrence derivation; no separate Lean proof", + "elapsed_seconds": 6.189 +} diff --git a/docs/STATUS.md b/docs/STATUS.md index b3ba0f40..6bc6dd85 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -207,16 +207,25 @@ with all features (three opt-in tests ignored) and 328 with default features. literal 165. A 742-bit β-normal witness also has exactly two closed nonlinear binders, with its contract kernel-checked as β-joinability. Thus the minimum count two is attained even among β-normal interpreters. + `SelfintNonlinearChain` kernel-checks a stronger requirement: two + nonlinear binders must lie in incomparable branches of the source tree, + including wholly inside the body of a literal two-argument interface. + A single ancestor chain is preserved by beta reduction and cannot + produce the required two-branch Ω output from an affine quotation. Statman's published width obstruction, combined with a handwritten interface argument, strengthens the capture requirement: every interpreter has a subterm with three distinct free variables and at least two live capturing abstractions. A literal two-argument interface, including every beta-normal interpreter, needs three such internal variables and two internal captures, plus the public stream binder's capture of the - continuation. Together with the nonlinear theorem these give handwritten - bit floors 27 globally and 40 for literal interfaces; the Lean numerical - floor remains 18. A shared-S construction attains width three, two - nonlinear binders, and the required capture counts simultaneously, even + continuation. Together with the incomparable-binder theorem these give + handwritten bit floors 34 globally and 46 for literal interfaces; + the Lean numerical floor remains 18. The three live binders on the width + witness's ancestor chain cannot contain the incomparable pair, so a + fourth live binder is necessary. This gives a preliminary global floor + of 33; analytical exclusion of its equality cases raises it to 34. + A shared-S construction attains width three, two nonlinear binders, + and the required capture counts simultaneously, even in the beta-normal fragment with every zero-based index at most two. It is an existential structural construction, not a compact measured interpreter or an additive decomposition @@ -331,15 +340,24 @@ with all features (three opt-in tests ignored) and 328 with default features. handler protocol. Lean proves `E E` cannot be β-equal to `E` for any exact interpreter, excluding an idempotent control response whose self-application would supply the full parser. Root transparency and - context independence already - force canonical closed internal values, sharpening the cell/APP collision. + context independence already force canonical closed internal values, + sharpening the cell/APP collision. A continuation-specific handler whose + variable projection returns `C v (v v k)` cannot also return every exact + constructor value: the closed source `K` forces `v v k =β λy.k`, which + cannot be a rigid suffix for any `k`. This excludes that projection, + not all handler factories. A representation that erases β distinctions cannot have an exact decoder using only that representation; closed two-sided β-inverse coercions are necessarily identities. A Scott-handler recursion arrangement costs 196 bits with shared self-application, 206 without; both pass the 667/1/0 battery and Ω suffix check in 3.5 seconds combined (`data/self-interpreter/theory/stream_handler.json`). The adapters still - cost more than the 165's parser interface. + cost more than the 165's parser interface. A self-passed context removes + the explicit fixed-point wrapper and costs 191 bits. Its eight fixed + parser equations, 667/1/0 battery, and Ω / λa.Ω suffix probes pass in + 6.189 seconds (`data/self-interpreter/theory/selfpassed.json`); the full + structural correctness derivation is handwritten. The context costs + 166 bits and the public interface and sharing application add 25. A proper one-sided applicative retraction preserves application exactly: `D(A x) →* x` and `(A x)(A y) →* A(x y)`. Its seven rigid equations and two distinct-normal-form checks pass; a scoped missing-variable argument diff --git a/docs/classical/self-interpreter/capture-width.md b/docs/classical/self-interpreter/capture-width.md index c6e9b7d6..656c236f 100644 --- a/docs/classical/self-interpreter/capture-width.md +++ b/docs/classical/self-interpreter/capture-width.md @@ -6,10 +6,12 @@ its source contains at least two live abstractions that capture an enclosing variable. Both bounds are sharp, even simultaneously with the established minimum of two nonlinear binders. -The lower bound uses a published theorem of Rick Statman and Codex's -handwritten interface argument below. The sharpness construction is also -handwritten. These results are not Lean theorems in this repository and do -not establish a useful numerical lower bound near 165 bits. +The width lower bound uses a published theorem of Rick Statman and Codex's +handwritten interface argument below. The incomparable-nonlinear-binder +obstruction is kernel-checked; the numerical counting and exclusion +arguments and the sharpness constructions are handwritten. Together they +give 34 bits globally and 46 for literal or beta-normal interpreters, +without establishing 165-bit optimality. ## The source measure @@ -196,14 +198,77 @@ By the exact-arity argument in `head-decomposition.md`, a beta-normal self-interpreter has this literal two-lambda interface. It therefore also has at least three live captures. -## Small numerical consequences +## Two nonlinear binders must be incomparable -Combining width with the two-nonlinear theorem gives the handwritten -bounds +The two required nonlinear binders cannot all lie on one ancestor chain. +Every exact interpreter contains two nonlinear abstraction occurrences +such that neither is an ancestor of the other. + +For a term `T`, let `NS(T)` assert that all its nonlinear binders lie on +one ancestor chain, allowing the empty chain. Equivalently, + +```text +NS(variable) = true, +NS(λx.B) = NS(B), +NS(F A) = NS(F) and NS(A) + and (nonlinear(F)=0 or nonlinear(A)=0). +``` + +This property is preserved by beta reduction. For a root redex +`(λx.B) A`, there are two relevant cases: + +- If `x` is nonlinear, the application condition forces `A` to have no + nonlinear binder. Substitution only inserts affine code, so the + remaining nonlinear binders are those of `B`, with their ancestor + relations unchanged. +- If `x` is affine and `A` has a nonlinear binder, the application + condition forces `B` to have none. Substitution inserts `A` at most + once, preserving its single chain. If `A` also has none, the first + argument applies directly. + +The context cases require care. An affine term stays affine under beta +reduction: simultaneous induction proves both zero nonlinear binders +and nonincrease of every free-variable occurrence count. The latter +fact preserves an enclosing binder's affineness in the lambda case. +Thus an application context preserves its required zero-nonlinear side. +A lambda context imposes no extra condition in the definition of `NS`. +A reduction may make that enclosing lambda nonlinear, but the new +nonlinear binder is an ancestor of every nonlinear binder in its body; +it cannot create an incomparable pair. + +Now assume `NS(E)` for an exact interpreter. Apply its contract to the +closed source + +```text +Δ = λx.x x, +Ω = Δ Δ, +``` + +with rigid independent `C,N`. Quotation cells and bits have no nonlinear +binders, so `NS(E C (stream(Ω,N)))` holds. Its required output +`C (λz.Ω) N` has two incomparable nonlinear binders, the two copies of +`Δ`. Every beta reduct of this output is the identical term: the only +available contraction is the self-reproducing `Ω` redex. Therefore the +contract's beta join gives a directed reduction from the invocation to +this output, contradicting preservation of `NS`. + +For a literal `λc s.B`, the incomparable pair lies wholly inside `B`. +The public binders are ancestors of every internal abstraction and of +each other, so neither can participate in the pair. + +`Blc.SelfintNonlinearChain` kernel-checks the predicate as `Chain`, its +preservation as `chain_beta` and `chain_betas`, and the interpreter +consequences as `selfInterpreter_not_chain` and +`selfInterpreter_body_not_chain`. + +## Numerical consequences: 34 and 46 bits + +Combining the incomparable-pair theorem with the published width +obstruction and the 33-bit exclusion below gives ```text -|E|_BLC ≥ 27 for every exact self-interpreter, -|E|_BLC ≥ 40 when E is literally λc s.B, +|E|_BLC ≥ 34 for every exact self-interpreter, +|E|_BLC ≥ 46 when E is literally λc s.B, hence also when E is beta-normal. ``` @@ -214,36 +279,201 @@ de Bruijn indices. The BLC size identity is |E|_BLC = 2L + 4V - 2 + X. ``` -Width three requires at least three distinct live binders. Two nonlinear -binders add at least two occurrences beyond one per live binder, so -`L ≥ 3` and `V ≥ 5`. For the three free variables of a width witness, -order their ancestor binders from outermost to innermost and select one -occurrence of each. Their zero-based indices are at least `2,1,0`, -respectively, even when additional binders intervene. Thus `X ≥ 3`, -giving 27. - -For a literal interface, the internal width witness and the two internal -nonlinear binders instead require at least three internal abstractions -and five internally bound leaves. The live public variables `c,s` add -two abstractions and two leaves. Every occurrence of `c` lies beneath -the `s` binder and therefore adds at least one index unit, on a leaf -distinct from the three internal witnesses. Hence `L ≥ 5`, `V ≥ 7`, -and `X ≥ 4`, giving 40. Head normalization can increase BLC size, so -this second argument does not give a 40-bit bound for arbitrary sources. - -These inequalities are sharp for the stated syntax constraints, not for -self-interpretation. The closed normal term +A width-three witness supplies three distinct live binders on one +ancestor chain. The two incomparable nonlinear binders cannot both be +among those three, so there are at least four live binders in total. +Each requires a bound occurrence, and the two nonlinear binders require +at least two further occurrences. Consequently `L ≥ 4` and `V ≥ 6`. +For the three variables of the width witness, select one occurrence of +each and order their ancestor binders from outermost to innermost. +Their indices are at least `2,1,0`, respectively, even if other binders +intervene. Thus `X ≥ 3`, giving the preliminary global bound +`2·4 + 4·6 - 2 + 3 = 33`. + +For a literal interface, both the three-binder width witness and the +incomparable nonlinear pair are internal. They require at least four +internal live binders and six internally bound leaves. The live public +variables `c,s` add two abstractions and two leaves. Every occurrence of +`c` lies beneath `s` and adds at least one index unit, on a leaf distinct +from the internal width witnesses. Hence `L ≥ 6`, `V ≥ 8`, and `X ≥ 4`, +giving `2·6 + 4·8 - 2 + 4 = 46`. + +Head normalization can increase BLC size. The literal-interface bound +therefore does not transfer to an arbitrary source merely because its +head normal form has two leading lambdas. + +The counts themselves are attainable. The closed term `Δ S` has 33 bits, +width three, and two incomparable nonlinear binders; the literal +`λc s.s (Δ S) c` has 46 bits and meets the internal counting constraints. +Neither term is an interpreter. These are witnesses for the syntax +counts, not proofs that either numerical interpreter bound is optimal. + +The repository's kernel-checked numerical lower bound remains the weaker +18-bit theorem in `structural-bounds.md`. The 34- and 46-bit consequences +also use the published width theorem and handwritten interface, counting, +and exclusion arguments here. + +## Excluding a 33-bit interpreter + +The following handwritten argument excludes the equality case of the +global count bound. It uses the kernel-checked incomparable-pair theorem, +exact beta wire costs, and the two-nonlinear-binders theorem inside a +literal interface, together with the head-decomposition result in +`head-decomposition.md`. No closed-term enumeration is used. + +Choose a globally minimum interpreter `E`; existence follows from the +proved 165-bit witness. Suppose its size is 33. Every beta reduct remains +an interpreter, so each source redex is nonshrinking. Its head normal form +exists and has exactly two leading lambdas. The literal-interface bound +rules out two leading source lambdas. A neutral head under one leading +lambda would already give the wrong head arity. Hence the head spine +reaches a source redex after zero or one leading lambdas. + +### The head redex has only two possible contexts + +Equality in the counting bound gives `L=4,V=6,X=3`. All four binders are +live, exactly two are nonlinear, each with two occurrences, and the other +two are affine. A width witness supplies three live binders on one +ancestor chain `W`. The fourth binder is one of the incomparable +nonlinear pair; the other nonlinear binder belongs to `W`. + +The fourth binder is the literal closed `Δ`. It cannot contain a binder +from `W`, since both would then be comparable with the nonlinear binder +of `W`. Any `W` variable it could capture belongs to an affine ancestor +of that nonlinear binder; its unique occurrence is already required in +the width witness below that binder, outside the fourth binder's +subtree. Capture is therefore impossible. Its body has no other binder +and only its two bound occurrences, so it is `λd.d d`. + +If there is a leading source binder `y`, it is affine: a nonlinear root +would be comparable with every binder, leaving no incomparable pair +among the two available nonlinear binders. An argument at the selected +head redex thus has at most one free occurrence, of `y`; without a +leading lambda it is closed. + +Write the redex `(λx.B) A`, and use `k,f,D,g` from the exact wire-cost +identity in `head-decomposition.md`. If `x` were affine, `k=1` and +`f≤1` would give `(f-1)D-6-g<0`, contradicting minimality. Thus `x` is +one of the two nonlinear binders. + +If `x` belonged to `W`, the width witness would lie inside `B`. Every +non-leading `W` binder would also lie there, and a possible leading `y` +would already spend its sole occurrence in that witness. The argument +`A` would have no possible free leaf and no possible binder except the +fourth binder, forcing `A=Δ`. Its exact wire change would then be +`8-D-8-g=-D-g<0`: the outermost `W` binder has a width occurrence at +depth at least two, and any other `W` binder has an ancestor reference +in `B`. This is again impossible. + +Therefore the head redex's binder is `Δ`'s binder. All other leaves and +non-leading binders lie in its argument. A leaf in any pending argument +or other context could only be a leading `y`, but its sole occurrence +is already needed in the argument's width witness. The source must be +one of + +```text +E = Δ N, +E = λy.Δ A(y). +``` + +Here `N` has three lambdas, four leaves, index sum three, width three, +and one nonlinear binder. The open `A` has two lambdas, four leaves, +index sum three, free `y` exactly once, and one internal nonlinear +binder. Its width witness counts `y` among its three variables. + +Both arguments are beta-normal. Their three live variables lie on one +chain, so an internal redex has no live binder in its argument. If that +redex binder occurs `k` times, its body contains at least `k+2` leaves +for the width witness, leaving at most `2-k` argument leaves. The +nonlinear case `k=2` is impossible; the affine case has at most one +free argument occurrence and strictly decreases wire size. + +### Normal argument shapes + +Let `T₃(a,b,c)` be an application tree containing each of `a,b,c` once, +and let `T₄(a,b,c,c)` have exactly that four-leaf multiset. The width +witness spends the full index sum `2+1+0`. The remaining occurrence +must have index zero: before the next live binder or inside the +innermost binder. Normality forces a variable exposed before a lambda +block to be its function, since the reverse order would be a redex. +Consequently `N` has one of exactly these three shapes: + +```text +λa.a (λb c.T₃(a,b,c)), +λa b.b (λc.T₃(a,b,c)), +λa b c.T₄(a,b,c,c). +``` + +Since `y` is affine, `A(y)` has only the corresponding latter two shapes: + +```text +λb.b (λc.T₃(y,b,c)), +λb c.T₄(y,b,c,c). +``` + +If `A` has the latter shape, the source reduces to +`λy c.T₄(y,A,c,c)`. Only the one inserted copy of `A` contributes an +internal nonlinear binder; `y,c` are the public interface. This +contradicts the two-internal-nonlinear theorem. + +For the former shape, every abstraction body in `A` has an application +at its root. Starting from `A A`, a head contraction substitutes into +such an application-rooted body and again leaves an application at the +root. A head step in a function subterm also keeps the root application. +Thus head reduction cannot expose another leading lambda. The source +`λy.A A` is unsolvable or has only one leading lambda in head normal +form, contrary to the exact head decomposition. + +For closed `N` with the innermost-duplication shape, `N N` reduces to +`λb c.T₄(N,b,c,c)`, again with just one internal nonlinear binder. +For its middle-duplication shape, `N N` reduces to +`λb.b (λc.T₃(N,b,c))`, a head normal form with only one leading lambda. +Both are excluded. + +### The remaining twelve linear layouts + +It remains to consider `N=λa.a (λb c.T₃(a,b,c))`. Define ```text -H = λa.a (λb.b (λx.a b x)) +J(a) = λb c.T₃(a,b,c), +N = λa.a J(a), +B = J(J(N)). ``` -has exactly 27 bits, width three, two nonlinear binders, and two live -captures. The closed normal `λc s.s H c` has exactly 40 bits, two internal -nonlinear binders, and three live captures. Neither term is claimed to be -an interpreter. The repository's kernel-checked numerical lower bound -remains the weaker 18-bit theorem in `structural-bounds.md`; the new -27- and 40-bit consequences also depend on the published width theorem. +Three head contractions give `N N →³ λc.T₃(N,B,c)`. The two binary +application trees on the three distinct leaves have the following +exhaustive classification: + +- The four `c`-headed layouts already give one leading lambda. + The layouts `(a c)b`, `a(c b)`, and `(b c)a` reduce respectively to + `λc.c J(c) B`, `λc.c B J(c B)`, and `λc.c N J(N)`. + These seven cases all have the wrong head arity. +- If `T₃=(a b)c`, then `N` eta-reduces to `Δ`, and `N N` eta-reduces + to `Ω`. If `T₃=(b a)c`, then `N` eta-reduces to + `D=λa.a (λb.b a)`. Write `J₀(X)=λb.b X`. After its first step, + `D D` follows the exact head cycle + `D J₀(D) → J₀(D) J₀(J₀(D)) → J₀(J₀(D)) D → D J₀(D)`. + The cycle terms have no eta redex, and their only beta redex is the + displayed head redex. Applying either cycle to rigid `C` and the + beta-eta-normal quotation of source `I` leaves those arguments + pending forever. Beta-eta confluence rules out the required + beta-eta-normal result `C (λe x.x) Ntail`. This uses eta only in an + impossibility proof, not to relax the interpreter's beta contract. +- If `T₃=a(b c)`, eight head contractions from `N N` give + `λc z.c J(B c) z J(c J(B c) z)`. Its rigid head has three arguments, + whereas the required output has two. +- If `T₃=b(a c)`, five contractions give + `λc z.c J(c) (J(N) z)`, where `J(c)=λp q.p(c q)`. + After invocation the first payload is already normal and contains + rigid `C`; it cannot equal the closed normal value `λe x.x` + required for source `I`. +- If `T₃=b(c a)`, four contractions give + `λc z.c N (z J(N))`. The first payload is the fixed normal `N`, + distinct from the required `λe x.x`; source `I` again excludes it. + +Every possible 33-bit minimum interpreter is therefore excluded. The +unrestricted numerical lower bound is 34 bits. This last exclusion is +handwritten, not a new Lean theorem. ## Joint sharpness by one shared S diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index 8aa04def..77c574ca 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -343,6 +343,11 @@ both closed in isolation, by sharing one `λx.x x` across an affine translation of the 165. Its reduction to the literal 165 is kernel-checked. The minimum count two is attained even by a β-normal 742-bit witness, whose contract is kernel-checked as β-joinability. +The two required nonlinear binders must occupy incomparable source +branches: `Blc/SelfintNonlinearChain.lean` proves that putting all nonlinear +binders on one ancestor chain is preserved by full beta reduction, whereas +the required Ω output violates that property. For a literal interface, +both witnesses are internal. See `structural-bounds.md`, `Blc/SelfintLowerBound.lean`, and `Blc/SelfintSharp.lean`. @@ -351,13 +356,17 @@ that some subterm of `E` has three distinct free variables, forcing two live capturing abstractions. For a literal `λc s.B`, three variables of such a witness must be internal to `B`; the two internal captures and the public stream binder's capture give three in total. Combined with the -nonlinear theorem, these give handwritten wire floors of 27 globally and -40 for literal interfaces, including beta-normal interpreters. +incomparable-nonlinear theorem, these give handwritten wire floors of +34 globally and 46 for literal interfaces, including beta-normal +interpreters. The three binders on the width witness's ancestor chain +cannot contain the incomparable pair, forcing a fourth live binder and +a preliminary global floor of 33; analytical exclusion of the equality +cases raises that floor to 34. `capture-width.md` states the published result and the interface proof, and gives a shared-S construction attaining these structural minima simultaneously, including in the beta-normal fragment with all zero-based -indices at most two. The floors are sharp only for the necessary syntax -constraints, not for interpretation. +indices at most two. The preliminary 33/46 syntax counts are attained; +these witnesses do not establish optimal interpreter sizes. Lean separately proves that absence of any live capturing abstraction is preserved by β-reduction and holds for the quotation, while the normal @@ -584,6 +593,7 @@ Unless marked, each passes the battery and is larger than the 168. | **Recursion** | | | | Self-passing `next` with a shared parser, best of 72 orders | 182 | carrier plumbing exceeds the knot | | Recursion inside the bit handler | 196 / 206 | shared/unshared self-application; recursive entry needs a Scott adapter (`protocol-obstructions.md`) | +| Self-passed context activated by the input stream | 191 | no explicit fixed-point wrapper; the context travels through both recursive parses (`protocol-obstructions.md`) | | One generator for parsing and value-driven APP | 323 | `v v` enters the actual parser on the left remainder; triple boxes, maps, and the public adapter dominate (`protocol-obstructions.md`) | | Recursor passed through continuations | 204 / 206 | callback arguments plus a public adapter | | A cell holding F performs the knot: `cell(a,e) cell(a,e) = λk. a a (k e e)` | 199 | the continuation receives two extra arguments | diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index d229acff..f3e342bf 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -981,6 +981,45 @@ closures do not satisfy this restriction: evaluation can return an arbitrary runtime argument. Enforcing such a domain therefore requires a changed value representation and a beta-exact root decoder. +## A diagonal return projection cannot retain exact values + +A continuation-specific handler can expose its constructor operation and +variable return operation as the two fields of a Scott pair. Consider +Codex's proposed protocol + +```text +h_C = lambda b. b H V_C +V_C = lambda v k. C v (v v k) +P_C(s) = s h_C h_C. +``` + +Here `H` is independent of `C`, so `h_C K` recovers the shared constructor +operation and `h_C F` recovers `V_C`. On an actual variable stream +`s = cons F r`, where `r = 1^(n-1)0 ++ N`, this return is correct: +`r r ->* K N`, hence `P_C(s) ->* C r N`. This suggests using `h_C F` +also to return constructor values, avoiding a separate captured `C`. + +That projection cannot return every ordinary exact value, even if the +return code chooses its last operand `k` freely. For the closed source +`M = lambda x y.x`, the required value is + +```text +v =beta lambda e x y.x, +v v k =beta lambda y.k. +``` + +For a fresh rigid remainder `N`, the latter term cannot be beta-equal to +`N`: every reduct retains its leading lambda. Consequently +`V_C v k` cannot equal `C v N` for rigid `C,N`, by Church-Rosser. +Closed-source correctness and a transparent, context-independent root +callback already force the displayed exact value, as proved above; no +open-environment correctness assumption is needed. + +This is an obstruction to the stated diagonal return projection, not to +all handler factories. A changed value representation with a public +decoder, a different return projection, or an independently recovered +continuation remains outside it. The argument is handwritten. + ## Recursion entered through Scott handlers Two explicit constructions move recursive entry to the input stream's @@ -1088,6 +1127,63 @@ construction above does combine semantic application and parser entry, using a larger boxed interface. A protocol that makes such sharing cheaper than the 165 remains open. +### A self-passed recursive context + +Codex's 191-bit construction uses the same mechanism as the exact +remainder extractor in `remainder.md`: the input activates a context and +passes another copy to the recursive calls. With `A` and `B` as defined +above, write + +```text +Q = lambda t u c d. + u d (lambda f. + t (c A(f)) + (lambda v. v d (lambda g. c B(f,g)) d)) d, +D = lambda b r. b (r Q) (lambda c d. c r (r r d)), +P_c(s) = s D c D, +E = lambda c s. (lambda d. s d c d) D. +``` + +`Q` occurs once inside `D`, and `D` occurs once in the finite source. +The pending continuation and context arrive after the second input +cell's tag and tail. There is no explicit fixed-point wrapper. + +On a variable stream `cons F r`, the parser returns +`c r (r r D)`. The unary tail satisfies `r r ->* lambda _.N`, so the +context is erased and the result is `c r N`. On a constructor stream, +the equations give + +```text +P_c(cons K (cons t u)) + ->* P_(lambda f. + t (c A(f)) + (lambda v. P_(lambda g. c B(f,g))(v)))(u). +``` + +The abstraction tag returns `A(f)` at the first child's suffix; the +application tag parses the second child there and returns `B(f,g)`. +These are the standard open-parser equations, with unchanged raw unary +variable closures and environment operations. Structural parsing and the +existing closure-denotation induction therefore give the exact closed +source contract, including divergent source syntax and arbitrary suffixes. +This derivation is handwritten; the construction has no separate Lean +proof. + +The complete source has `L=19`, `A=28`, and `X=39`, giving 191 bits. +`Q` costs 122 bits, its enclosing `D` costs 166, and the public interface +and sharing application add 25. Thus this reuse improves the displayed +Scott-handler constructions but remains larger than the 165-bit +interpreter. + +The canonical files are +`data/self-interpreter/machines/int191_selfpassed.{lam,blc}`. +`tools/self-interpreter/theory/selfpassed.py` checks eight fixed symbolic +clauses, the ordinary bounded contract battery, and exact suffix recovery +for the divergent sources `Omega` and `lambda a.Omega`. +`data/self-interpreter/theory/selfpassed.json` records the checks; current +measurements are in `docs/STATUS.md`. The script checks this one explicit +construction and performs no candidate search. + ## Reproduction `python tools/self-interpreter/theory/erased_skip.py --battery` checks the diff --git a/docs/classical/self-interpreter/structural-bounds.md b/docs/classical/self-interpreter/structural-bounds.md index dd5949ae..6927d8e1 100644 --- a/docs/classical/self-interpreter/structural-bounds.md +++ b/docs/classical/self-interpreter/structural-bounds.md @@ -78,6 +78,17 @@ each has exactly two nonlinear binders, both closed in isolation. Thus a live capturing binder need not itself be nonlinear, and neither normality nor the absence of a nonlinear capture raises this count. +`Blc.SelfintNonlinearChain` strengthens the necessary arrangement: two +nonlinear binders must be incomparable in the source ancestor order. +It proves that putting all nonlinear binders on one chain is preserved +by unrestricted beta reduction. Scott quotations and rigid public +arguments add no nonlinear binders, while the required output for Ω +contains two incomparable ones and reduces only to itself. This +contradicts the exact beta-join contract. The public binders of a literal +two-argument interface cannot witness incomparability, so the pair lies +inside its body. `capture-width.md` gives the proof and numerical +consequences with Statman's width obstruction. + ## A live abstraction must capture an enclosing variable Call an abstraction *live* when its own bound variable occurs in its body. @@ -118,8 +129,13 @@ and hence for a beta-normal interpreter. It applies Statman's published obstruction to a width-two term representing `S`: the closed quotation and interface arguments have width one, so the necessary width-three subterm must come from the interpreter. Combining that requirement with the -nonlinear theorem gives 27- and 40-bit floors, respectively. The same -document proves simultaneous sharpness of the width, capture, and nonlinear +incomparable-binder theorem and the 33-bit exclusion gives 34- and 46-bit +floors, respectively: +the three live binders on the width witness's ancestor chain cannot +contain both incomparable nonlinear binders, requiring a fourth live +binder. The resulting 33-bit global floor rises to 34 by analytically +excluding its equality cases. The same document proves simultaneous +sharpness of the width, capture, and nonlinear counts by a shared-S construction. These additions are handwritten; they do not strengthen the kernel-checked numerical theorem above. diff --git a/lean/Blc.lean b/lean/Blc.lean index 0e4af462..f7dc2d38 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -17,6 +17,7 @@ import Blc.Selfint import Blc.SelfintProof import Blc.Selfint165 import Blc.SelfintLowerBound +import Blc.SelfintNonlinearChain import Blc.SelfintNormal import Blc.SelfintCapture import Blc.SelfintOrigins diff --git a/lean/Blc/SelfintNonlinearChain.lean b/lean/Blc/SelfintNonlinearChain.lean new file mode 100644 index 00000000..8cc90842 --- /dev/null +++ b/lean/Blc/SelfintNonlinearChain.lean @@ -0,0 +1,225 @@ +/- +Nonlinear binders of an exact interpreter cannot all lie on one ancestor +chain. The chain property is preserved by full beta reduction, whereas +interpreting the closed source Omega must expose two incomparable binders. +-/ +import Blc.SelfintLowerBound + +namespace Blc.SelfintNonlinearChain +open Term SelfintLowerBound + +/-- No application separates two subterms that each contain a nonlinear +binder. Equivalently, every nonlinear binder lies on one ancestor chain. -/ +def Chain : Term → Prop + | .var _ => True + | .lam b => Chain b + | .app f a => Chain f ∧ Chain a ∧ (nonlinear f = 0 ∨ nonlinear a = 0) + +theorem chain_of_affine (t : Term) (ht : nonlinear t = 0) : Chain t := by + induction t with + | var n => trivial + | lam b ih => + apply ih + simp only [nonlinear] at ht + omega + | app f a ihf iha => + have hf : nonlinear f = 0 := by simp only [nonlinear] at ht; omega + have ha : nonlinear a = 0 := by simp only [nonlinear] at ht; omega + exact ⟨ihf hf, iha ha, Or.inl hf⟩ + +theorem chain_shift (t : Term) (d c : Nat) : Chain (shift d c t) ↔ Chain t := by + induction t generalizing c with + | var n => simp only [shift]; split <;> rfl + | lam b ih => exact ih (c + 1) + | app f a ihf iha => + simp only [shift, Chain, ihf, iha, nonlinear_shift_any] + +/-- Inserting binder-affine code introduces no new nonlinear branch, +regardless of how often the substituted variable occurs. -/ +theorem chain_subst_affine (t s : Term) (j : Nat) + (ht : Chain t) (hs : nonlinear s = 0) : Chain (substDec j s t) := by + induction t generalizing s j with + | var n => + simp only [substDec] + split + · exact chain_of_affine s hs + · split <;> trivial + | lam b ih => + apply ih (shift 1 0 s) (j + 1) ht + simpa only [nonlinear_shift] using hs + | app f a ihf iha => + refine ⟨ihf s j ht.1 hs, iha s j ht.2.1 hs, ?_⟩ + simpa only [nonlinear_subst, hs, Nat.mul_zero, Nat.add_zero] using ht.2.2 + +/-- An affine body inserts a chain-shaped argument at most once. -/ +theorem chain_subst_once (t s : Term) (j : Nat) + (ht : nonlinear t = 0) (hs : Chain s) (ho : occ j t ≤ 1) : + Chain (substDec j s t) := by + induction t generalizing s j with + | var n => + simp only [substDec] + split + · exact hs + · split <;> trivial + | lam b ih => + have hb : nonlinear b = 0 := by simp only [nonlinear] at ht; omega + exact ih (shift 1 0 s) (j + 1) hb ((chain_shift s 1 0).2 hs) ho + | app f a ihf iha => + have hf : nonlinear f = 0 := by simp only [nonlinear] at ht; omega + have ha : nonlinear a = 0 := by simp only [nonlinear] at ht; omega + have hof : occ j f ≤ 1 := by simp only [occ] at ho; omega + have hoa : occ j a ≤ 1 := by simp only [occ] at ho; omega + refine ⟨ihf s j hf hs hof, iha s j ha hs hoa, ?_⟩ + have hz : occ j f = 0 ∨ occ j a = 0 := by simp only [occ] at ho; omega + rcases hz with hz | hz + · left; simp only [nonlinear_subst, hf, hz, Nat.zero_mul, Nat.add_zero] + · right; simp only [nonlinear_subst, ha, hz, Nat.zero_mul, Nat.add_zero] + +/-- Affine reduction cannot duplicate a free occurrence or create a nonlinear binder. -/ +theorem affine_beta_progress {t u : Term} (h : Beta t u) + (ht : nonlinear t = 0) : + nonlinear u = 0 ∧ ∀ j, occ j u ≤ occ j t := by + induction h with + | beta b a => + have hb : nonlinear b = 0 := by simp only [nonlinear] at ht; omega + have ha : nonlinear a = 0 := by simp only [nonlinear] at ht; omega + have hk : occ 0 b ≤ 1 := by + by_cases hn : occ 0 b ≤ 1 + · exact hn + · have hyes : 1 < occ 0 b := by omega + simp [nonlinear, hyes] at ht + refine ⟨by simp [contract, nonlinear_subst, hb, ha], ?_⟩ + intro j + rw [contract, occ_substDec_ge b a j 0 (by omega)] + simp only [occ] + have hm : occ 0 b * occ j a ≤ occ j a := by + simpa using Nat.mul_le_mul_right (occ j a) hk + omega + | appL a h ih => + rename_i f f' + have hf : nonlinear f = 0 := by simp only [nonlinear] at ht; omega + have ha : nonlinear a = 0 := by simp only [nonlinear] at ht; omega + obtain ⟨hf', ho⟩ := ih hf + refine ⟨by simp [nonlinear, hf', ha], ?_⟩ + intro j + simp only [occ] + exact Nat.add_le_add_right (ho j) _ + | appR f h ih => + rename_i a a' + have hf : nonlinear f = 0 := by simp only [nonlinear] at ht; omega + have ha : nonlinear a = 0 := by simp only [nonlinear] at ht; omega + obtain ⟨ha', ho⟩ := ih ha + refine ⟨by simp [nonlinear, hf, ha'], ?_⟩ + intro j + simp only [occ] + exact Nat.add_le_add_left (ho j) _ + | lam h ih => + rename_i b b' + have hb : nonlinear b = 0 := by simp only [nonlinear] at ht; omega + have hk : occ 0 b ≤ 1 := by + by_cases hn : occ 0 b ≤ 1 + · exact hn + · have hyes : 1 < occ 0 b := by omega + simp [nonlinear, hyes] at ht + obtain ⟨hb', ho⟩ := ih hb + have hk' : ¬ 1 < occ 0 b' := by have hh := ho 0; omega + refine ⟨by simp [nonlinear, hb', hk'], ?_⟩ + intro j + simpa only [occ] using ho (j + 1) + + +/-- Full reduction preserves the chain property. In a root redex, either +its argument is affine or its binder and body are affine. -/ +theorem chain_beta {t u : Term} (h : Beta t u) (ht : Chain t) : Chain u := by + induction h with + | beta b a => + change Chain (substDec 0 a b) + rcases ht.2.2 with hf | ha + · have hb : nonlinear b = 0 := by simp only [nonlinear] at hf; omega + have ho : occ 0 b ≤ 1 := by + by_cases ho : occ 0 b ≤ 1 + · exact ho + · have hn : 1 < occ 0 b := by omega + simp [nonlinear, hn] at hf + exact chain_subst_once b a 0 hb ht.2.1 ho + · exact chain_subst_affine b a 0 ht.1 ha + | appL a h ih => + refine ⟨ih ht.1, ht.2.1, ?_⟩ + rcases ht.2.2 with hf | ha + · exact Or.inl (affine_beta_progress h hf).1 + · exact Or.inr ha + | appR f h ih => + refine ⟨ht.1, ih ht.2.1, ?_⟩ + rcases ht.2.2 with hf | ha + · exact Or.inl hf + · exact Or.inr (affine_beta_progress h ha).1 + | lam _ ih => exact ih ht + +theorem chain_betas {t u : Term} (h : Betas t u) (ht : Chain t) : Chain u := by + induction h with + | refl => exact ht + | head hb _ ih => exact ih (chain_beta hb ht) + +private def delta : Term := .lam (.app (.var 0) (.var 0)) +private def omegaTerm : Term := .app delta delta +private theorem omega_spine : Spine omegaTerm := Spine.redex (by decide) (by decide) +private theorem omega_beta_eq {u : Term} (h : Beta omegaTerm u) : u = omegaTerm := by + have hs := headStep_complete (spine_beta_head omega_spine h) + exact Option.some.inj hs.symm + +private def omegaOutput : Term := .app (.app (.var 0) (.lam omegaTerm)) (.var 1) + +private theorem omega_output_beta_eq {u : Term} (h : Beta omegaOutput u) : + u = omegaOutput := by + cases h with + | appL _ h => + cases h with + | appL _ h => cases h + | appR _ h => + cases h with + | lam h => + have he := omega_beta_eq h + subst he + rfl + | appR _ h => cases h + +private theorem omega_output_betas_eq {u : Term} (h : Betas omegaOutput u) : + u = omegaOutput := by + have aux : ∀ t v, Betas t v → t = omegaOutput → v = omegaOutput := by + intro t v hs + induction hs with + | refl => exact id + | head hb _ ih => + intro ht + apply ih + subst ht + exact omega_output_beta_eq hb + exact aux _ _ h rfl + +private theorem omega_output_not_chain : ¬ Chain omegaOutput := by + simp [omegaOutput, omegaTerm, delta, Chain, nonlinear, occ] + +/-- An exact interpreter has two incomparable nonlinear binders somewhere +in its full source tree. This is a global obstruction: the statement assumes +no parser decomposition, normal form, or literal interface lambdas. -/ +theorem selfInterpreter_not_chain {E : Term} (hE : IsSelfInterpreter E) : + ¬ Chain E := by + intro hc + let input := streamOf (blcCode omegaTerm) (.var 1) + have hi : nonlinear input = 0 := by + simp only [input, nonlinear_stream, nonlinear] + have hs : Chain (.app (.app E (.var 0)) input) := + ⟨⟨hc, trivial, Or.inr rfl⟩, chain_of_affine input hi, Or.inr hi⟩ + obtain ⟨w, hw1, hw2⟩ := hE.2 omegaTerm (by decide) + have hw : Chain w := chain_betas hw1 hs + have he := omega_output_betas_eq hw2 + rw [he] at hw + exact omega_output_not_chain hw + +/-- The public continuation and stream lambdas cannot supply this branching: +they are ancestors of every binder in the literal body. -/ +theorem selfInterpreter_body_not_chain {B : Term} + (hE : IsSelfInterpreter (.lam (.lam B))) : ¬ Chain B := + selfInterpreter_not_chain (E := .lam (.lam B)) hE + +end Blc.SelfintNonlinearChain diff --git a/tools/self-interpreter/theory/selfpassed.py b/tools/self-interpreter/theory/selfpassed.py new file mode 100644 index 00000000..86572a89 --- /dev/null +++ b/tools/self-interpreter/theory/selfpassed.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python3 +"""One hand-derived interpreter with a self-passed recursive context. + +No candidate enumeration. The fixed equations implement the ordinary open +parser recurrence; the battery and divergent-source probes check this one +191-bit source. Its all-source correctness derivation is handwritten. +""" +from pathlib import Path +import json +import sys +import time + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +MACHINES = ROOT / "data/self-interpreter/machines" +RESULTS = ROOT / "data/self-interpreter/theory" +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery as b +import lc +from remainder import check_clause, counts + + +ABS = r"(\e\a.f (\b\r.b a (r e)))" +APP = r"(\e.f e (g e))" +CONTINUATION = rf"\t\d\c\f.t (c {ABS}) (\v.v d (\g.c {APP}) d)" +NEXT = rf"\t\u\c\d.u d (\f.t (c {ABS}) (\v.v d (\g.c {APP}) d)) d" +CONTEXT = rf"\b\r.b (r ({NEXT})) (\c\d.c r (r r d))" +SOURCE = rf"\c\s.(\d.s d c d) ({CONTEXT})" + + +def apps(function, *arguments): + for argument in arguments: + function = ("A", function, argument) + return function + + +def instantiate(source, *arguments): + term = b.compile_lam(source) + for argument in arguments: + term = lc.beta(term, argument) + return term + + +def fixed_clauses(term, context, next_term): + continuation, tail, stream, first, second, remainder = [("V", i) for i in range(6)] + + def parse(callback, source): + return apps(source, context, callback, context) + + abs_value = instantiate(r"\f." + ABS, first) + app_value = instantiate(r"\f\g." + APP, first, second) + abs_callback = instantiate(CONTINUATION, lc.TRUE, context, continuation) + app_callback = instantiate(CONTINUATION, lc.FALSE, context, continuation) + second_callback = instantiate(r"\c\f\g.c " + APP, continuation, first) + return { + "unfold": check_clause(apps(term, continuation, tail), parse(continuation, tail), 3), + "variable": check_clause(parse(continuation, lc.pair(lc.FALSE, tail)), + apps(continuation, tail, apps(tail, tail, context)), 7), + "zero": check_clause(parse(continuation, lc.pair(lc.TRUE, tail)), + apps(tail, next_term, continuation, context), 5), + "abstraction_parse": check_clause(apps(lc.pair(lc.TRUE, stream), next_term, + continuation, context), + parse(abs_callback, stream), 5), + "application_parse": check_clause(apps(lc.pair(lc.FALSE, stream), next_term, + continuation, context), + parse(app_callback, stream), 5), + "abstraction_return": check_clause(apps(abs_callback, first, remainder), + apps(continuation, abs_value, remainder), 3), + "application_second_parse": check_clause(apps(app_callback, first, remainder), + parse(second_callback, remainder), 4), + "application_return": check_clause(apps(second_callback, second, remainder), + apps(continuation, app_value, remainder), 1), + } + + +def divergent_suffix_probe(term, source): + source_term = b.compile_lam(source) + tail_selector = b.compile_lam(r"\value\rest.rest") + probe = ("L", apps(b.shift(term, 1), tail_selector, + b.bitlist(b.enc(source_term), ("V", 0)))) + assert b.normalize(b.enc(probe), 1 << 16) == "0010" + + +def main(): + start = time.monotonic() + term = b.compile_lam(SOURCE) + context = b.compile_lam(CONTEXT) + next_term = b.compile_lam(NEXT) + bits = b.enc(term) + assert len(bits) == 191 + clauses = fixed_clauses(term, context, next_term) + lambdas, applications, tax = counts(term) + assert 2 * lambdas + 4 * applications + 2 + tax == len(bits) + (MACHINES / "int191_selfpassed.lam").write_text( + "-- Self-passed recursive context; generated by selfpassed.py.\n" + "-- E C ( ++ N) =beta C (\\z.M) N for closed M.\n" + + SOURCE + "\n" + ) + (MACHINES / "int191_selfpassed.blc").write_text(bits + "\n") + ok, skipped, failures = b.check(term, max_bits=18, threads=2) + divergent_sources = { + "omega": r"(\x.x x) (\x.x x)", + "lambda_omega": r"\a.(\x.x x) (\x.x x)", + } + for source in divergent_sources.values(): + divergent_suffix_probe(term, source) + result = { + "search_performed": False, + "name": "int191_selfpassed", + "bits": len(bits), + "source_counts": {"lambdas": lambdas, "applications": applications, "index_tax": tax}, + "context_bits": lc.size(context), + "next_bits": lc.size(next_term), + "adapter_and_application_bits": len(bits) - lc.size(context), + "symbolic_head_clause_steps": clauses, + "battery": {"ok": ok, "skipped": skipped, "failures": failures}, + "divergent_source_suffix": dict.fromkeys(divergent_sources, True), + "proof_status": "handwritten recurrence derivation; no separate Lean proof", + "elapsed_seconds": round(time.monotonic() - start, 3), + } + assert ok == 667 and skipped == 1 and not failures, result + (RESULTS / "selfpassed.json").write_text(json.dumps(result, indent=2) + "\n") + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + main() From 1294c4a036cecdfa7489a2cae34e34a9bf9e241e Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 05:35:21 -0400 Subject: [PATCH 30/41] Raise the self-interpreter floors to 37 handwritten and 27 in Lean MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Twelve reasoning lanes on a sub-165 interpreter or a proof of optimality. None found an interpreter below 165; the record keeps their bounds. - global-floor.md: every interpreter has at least 37 bits. The handwritten proof excludes 34-36 after the existing 33 exclusion; two independent adversarial reviews found it correct. Blc/SelfintFloor37 kernel-checks its 144 fixed reduction clauses, regenerated by theory/floor37/verify.py. - SelfintFloor*: kernel-checked SelfintSizeBound 27, up from 18, without Statman's theorem. - SelfintKnot: an opaque fixed point costs at least 18 + 2k bits, so the 165's 31 bits of recursion overhead are minimal in its frame. - Remainder extractors cost 27..70 bits (reviewed handwritten floor); SelfintRemainderChain proves incomparable nonlinear binders and the transfer |E| >= Rmin - 8; SelfintTower45, SelfintResidualControl, SelfintSharedS647 and SelfintFixedResiduals check the 45-bit tower reader, the pending-source obligation, a 647-bit extractor with two nonlinear binders, and the near misses' failures. - A literal continuation-headed interpreter costs at least 73 bits. - interpreter.md §6 gains the new variants (a 168 passing NEXT as the reader's third operand, a 171 curried cell, two reset bootstraps at 192, a from-scratch 220) and letopt minima for recorded ones (174, 186, 194). - tools/self-interpreter/polish.py: battery plus optimal let structure. - data/self-interpreter/reasoning_floor/: the lanes' reports, proofs, constructions and reviews. --- README.md | 7 +- .../self-interpreter/reasoning_floor/BRIEF.md | 123 + .../reasoning_floor/README.md | 32 + .../reasoning_floor/blind/PROMPT.md | 16 + .../reasoning_floor/blind/REPORT.md | 103 + .../reasoning_floor/blind/baseline165.lam | 6 + .../reasoning_floor/blind/battery.log | 14 + .../reasoning_floor/blind/beta1.lam | 1 + .../reasoning_floor/blind/beta2.lam | 1 + .../reasoning_floor/blind/blind-findings.md | 79 + .../reasoning_floor/blind/borrow_zero.lam | 6 + .../reasoning_floor/blind/build.py | 98 + .../reasoning_floor/blind/check.py | 54 + .../reasoning_floor/blind/common_return.lam | 7 + .../reasoning_floor/blind/handler_knot.lam | 8 + .../blind/local-identities.log | 4 + .../reasoning_floor/blind/local_identities.py | 65 + .../reasoning_floor/blind/next_knot.lam | 7 + .../reasoning_floor/blind/parser_scope.lam | 6 + .../blind/parser_scope_under_tag.lam | 6 + .../reasoning_floor/blind/reversed_lookup.lam | 7 + .../reasoning_floor/blind/second_build.py | 48 + .../blind/selected_operator.lam | 6 + .../reasoning_floor/blind/split_next.lam | 6 + .../reasoning_floor/blind/stream_first.lam | 7 + .../reasoning_floor/blind/thread_cont.lam | 6 + .../reasoning_floor/dispatch/PROMPT.md | 27 + .../reasoning_floor/dispatch/REPORT.md | 258 + .../reasoning_floor/dispatch/algebra_scan.py | 64 + .../dispatch/dup_replay_180.lam | 12 + .../dispatch/fake_var_second_parse.lam | 8 + .../reasoning_floor/dispatch/lab.py | 216 + .../reasoning_floor/dispatch/next_knot.lam | 9 + .../reasoning_floor/dispatch/variants1.py | 13 + .../reasoning_floor/dispatch/variants2.py | 17 + .../reasoning_floor/env/PROMPT.md | 32 + .../reasoning_floor/env/REPORT.md | 640 + .../reasoning_floor/env/battery.log | 2 + .../reasoning_floor/env/boolean-section.md | 455 + .../reasoning_floor/env/boolean_checks.json | 37 + .../reasoning_floor/env/borrow_abs_tag.blc | 1 + .../reasoning_floor/env/borrow_abs_tag.lam | 8 + .../env/borrowed-data-bound.md | 222 + .../reasoning_floor/env/check.py | 163 + .../env/check_boolean_bounds.py | 142 + .../reasoning_floor/env/checks.json | 52 + .../reasoning_floor/env/followup.md | 19 + .../env/origin_arithmetic.json | 109 + .../reasoning_floor/env/origin_arithmetic.py | 27 + .../reasoning_floor/env/reference165.blc | 1 + .../reasoning_floor/env/reference165.lam | 13 + .../reasoning_floor/gemini/PROMPT.md | 23 + .../reasoning_floor/gemini/consult.md | 136 + .../reasoning_floor/global/PROJECTIONS.md | 206 + .../reasoning_floor/global/PROMPT.md | 40 + .../reasoning_floor/global/PROOF37.md | 556 + .../reasoning_floor/global/REPORT.md | 231 + .../reasoning_floor/global/batteries.txt | 18 + .../reasoning_floor/global/check34.json | 134 + .../reasoning_floor/global/check34.py | 76 + .../reasoning_floor/global/check35.json | 966 ++ .../reasoning_floor/global/check35.py | 52 + .../reasoning_floor/global/check36.json | 602 + .../reasoning_floor/global/check36.py | 33 + .../reasoning_floor/global/check36open.json | 162 + .../reasoning_floor/global/control366.blc | 1 + .../reasoning_floor/global/control366.lam | 1 + .../global/count_search_space.py | 24 + .../reasoning_floor/global/lean-check.log | 5 + .../global/projection-control.json | 9 + .../global/projection_control.py | 35 + .../reasoning_floor/global/search-count.json | 8 + .../reasoning_floor/global/verified.json | 851 + .../reasoning_floor/global/verify.py | 321 + .../reasoning_floor/grok/PROMPT.md | 23 + .../reasoning_floor/grok/consult1.md | 151 + .../reasoning_floor/grok/consult2.md | 158 + .../reasoning_floor/grok/followup.md | 17 + .../reasoning_floor/knot/PROMPT.md | 31 + .../reasoning_floor/knot/REPORT.md | 370 + .../reasoning_floor/knot/battery.json | 74 + .../reasoning_floor/knot/build_and_check.py | 55 + .../reasoning_floor/knot/carrier_check.json | 81 + .../reasoning_floor/knot/checks.py | 101 + .../reasoning_floor/knot/identities.json | 15 + .../reasoning_floor/knot/identity_check.py | 66 + .../reasoning_floor/knot/lean_check.log | 6 + .../reasoning_floor/knot/probe189.py | 51 + .../reasoning_floor/knot/reference165.blc | 1 + .../reasoning_floor/knot/reference165.lam | 13 + .../reasoning_floor/knot/reference192.blc | 1 + .../reasoning_floor/knot/reference192.lam | 12 + .../reasoning_floor/knot/reset_cont192.blc | 1 + .../reasoning_floor/knot/reset_cont192.lam | 7 + .../knot/reset_generator192.blc | 1 + .../knot/reset_generator192.lam | 7 + .../reasoning_floor/lean-floor/NOTES.md | 88 + .../reasoning_floor/lean-floor/PROMPT.md | 36 + .../reasoning_floor/lean-floor/REPORT.md | 231 + .../reasoning_floor/nextfuse/PROMPT.md | 28 + .../reasoning_floor/nextfuse/REPORT.md | 78 + .../reasoning_floor/nextfuse/build.py | 35 + .../reasoning_floor/nextfuse/checks.py | 60 + .../reasoning_floor/nextfuse/h.py | 57 + .../nextfuse/v_dispatch_first.lam | 1 + .../nextfuse/v_optional_parse.lam | 1 + .../nextfuse/v_select_first.lam | 7 + .../reasoning_floor/nextfuse/v_share_head.lam | 7 + .../nextfuse/v_sharedZ_kapp.lam | 1 + .../nextfuse/v_sharedZ_vabs.lam | 1 + .../reasoning_floor/reader-proof/PROMPT.md | 35 + .../reasoning_floor/reader-proof/REPORT.md | 858 + .../reader-proof/splice/r165_control.lam | 7 + .../reader-proof/splice/r46_k1.lam | 7 + .../reader-proof/splice/r49_betashortcut.lam | 7 + .../reader-proof/splice/r50_tnext.lam | 7 + .../reader-proof/splice/r58_tau.lam | 7 + .../reader-proof/tools/algebra.py | 96 + .../reader-proof/tools/examples.py | 42 + .../reader-proof/tools/menu.py | 27 + .../reasoning_floor/reader-proof/tools/rt.py | 136 + .../reader-proof/tools/symbolic.py | 38 + .../reasoning_floor/remainder/PROMPT.md | 43 + .../reasoning_floor/remainder/REPORT.md | 879 + .../reasoning_floor/remainder/audit.json | 290 + .../reasoning_floor/remainder/audit.py | 189 + .../reasoning_floor/remainder/check.py | 159 + .../reasoning_floor/remainder/checks.json | 13350 ++++++++++++++++ .../remainder/diagonal63_failed.blc | 1 + .../remainder/diagonal63_failed.lam | 1 + .../remainder/drop_second_skip_failed.blc | 1 + .../remainder/drop_second_skip_failed.lam | 1 + .../remainder/fixedpoint_direct.blc | 1 + .../remainder/fixedpoint_direct.lam | 1 + .../remainder/fixedpoint_select_after.blc | 1 + .../remainder/fixedpoint_select_after.lam | 1 + .../reasoning_floor/remainder/floated71.blc | 1 + .../reasoning_floor/remainder/floated71.lam | 1 + .../reasoning_floor/remainder/followup.md | 23 + .../remainder/int165_projection.blc | 1 + .../remainder/int165_projection.lam | 14 + .../remainder/int584_projection.blc | 1 + .../remainder/int584_projection.lam | 1 + .../reasoning_floor/remainder/lean-checks.txt | 11 + .../remainder/lean-residual-checks.txt | 21 + .../remainder/pack_handler65.blc | 1 + .../remainder/pack_handler65.lam | 1 + .../reasoning_floor/remainder/pack_tail65.blc | 1 + .../reasoning_floor/remainder/pack_tail65.lam | 1 + .../remainder/partial_diagonal69.blc | 1 + .../remainder/partial_diagonal69.lam | 1 + .../reasoning_floor/remainder/pin_failures.py | 71 + .../reasoning_floor/remainder/pin_shared.py | 118 + .../reasoning_floor/remainder/reference70.blc | 1 + .../reasoning_floor/remainder/reference70.lam | 1 + .../remainder/residual-checks.json | 7160 +++++++++ .../remainder/residual_checks.py | 190 + .../remainder/right_diagonal67.blc | 1 + .../remainder/right_diagonal67.lam | 1 + .../remainder/shared_s_remainder.blc | 1 + .../remainder/shared_s_remainder.lam | 1 + .../reasoning_floor/remainder/tower45.blc | 1 + .../reasoning_floor/remainder/tower45.lam | 1 + .../reasoning_floor/remainder/tower51.blc | 1 + .../reasoning_floor/remainder/tower51.lam | 1 + .../remainder/triple67_capped.blc | 1 + .../remainder/triple67_capped.lam | 1 + .../reasoning_floor/remainder/unary_only.blc | 1 + .../reasoning_floor/remainder/unary_only.lam | 1 + .../remainder/zero_tower_only.blc | 1 + .../remainder/zero_tower_only.lam | 1 + .../reasoning_floor/scratch/PROMPT.md | 34 + .../reasoning_floor/scratch/REPORT.md | 299 + .../scratch/a2_shared_parse.battery.log | 2 + .../scratch/a2_shared_parse.blc | 1 + .../scratch/a2_shared_parse.lam | 1 + .../a2_shared_parse.letopt-no-inline.log | 171 + .../scratch/a2_shared_parse.polish.log | 3 + .../scratch/a3_shared_read.battery.log | 2 + .../scratch/a3_shared_read.blc | 1 + .../scratch/a3_shared_read.lam | 1 + .../a3_shared_read.letopt-no-inline.log | 6 + .../scratch/a3_shared_read.polish.log | 3 + .../scratch/a4_local_unary.battery.log | 2 + .../scratch/a4_local_unary.blc | 1 + .../scratch/a4_local_unary.lam | 1 + .../scratch/a4_local_unary.polish.log | 3 + .../scratch/a5_polished.battery.log | 2 + .../reasoning_floor/scratch/a5_polished.blc | 1 + .../reasoning_floor/scratch/a5_polished.lam | 1 + .../scratch/a5_polished.polish.log | 3 + .../scratch/a5_shared_recursion.battery.log | 2 + .../scratch/a5_shared_recursion.blc | 1 + .../scratch/a5_shared_recursion.lam | 1 + .../scratch/a5_shared_recursion.letopt.log | 14 + .../scratch/a5_shared_recursion.polish.log | 3 + .../scratch/a6_input_selectors.battery.log | 2 + .../scratch/a6_input_selectors.blc | 1 + .../scratch/a6_input_selectors.lam | 1 + .../scratch/a6_input_selectors.polish.log | 3 + .../a7_shared_unary_update.battery.log | 2 + .../scratch/a7_shared_unary_update.blc | 1 + .../scratch/a7_shared_unary_update.lam | 1 + .../scratch/a7_shared_unary_update.letopt.log | 8 + .../scratch/a7_shared_unary_update.polish.log | 3 + .../scratch/a_env_cps.battery.log | 2 + .../reasoning_floor/scratch/a_env_cps.blc | 1 + .../reasoning_floor/scratch/a_env_cps.lam | 1 + .../scratch/a_env_cps.letopt-no-inline.log | 6 + .../scratch/a_env_cps.letopt.log | 2 + .../scratch/a_env_cps.polish.log | 3 + .../scratch/b_tree_fold.battery.log | 2 + .../reasoning_floor/scratch/b_tree_fold.blc | 1 + .../reasoning_floor/scratch/b_tree_fold.lam | 1 + .../scratch/b_tree_fold.letopt-no-inline.log | 6 + .../scratch/b_tree_fold.letopt.log | 2 + .../scratch/b_tree_fold.polish.log | 3 + .../reasoning_floor/scratch/best.battery.log | 2 + .../reasoning_floor/scratch/best.blc | 1 + .../reasoning_floor/scratch/best.lam | 1 + .../reasoning_floor/scratch/best.polish.log | 3 + .../scratch/c_direct_pair.battery.log | 2 + .../reasoning_floor/scratch/c_direct_pair.blc | 1 + .../reasoning_floor/scratch/c_direct_pair.lam | 1 + .../c_direct_pair.letopt-no-inline.log | 6 + .../scratch/c_direct_pair.letopt.log | 2 + .../scratch/c_direct_pair.polish.log | 3 + .../reasoning_floor/scratch/check.py | 30 + .../scratch/d_trie_environment.battery.log | 2 + .../scratch/d_trie_environment.blc | 1 + .../scratch/d_trie_environment.lam | 1 + .../d_trie_environment.letopt-no-inline.log | 6 + .../scratch/d_trie_environment.polish.log | 3 + .../reasoning_floor/scratch/derive.py | 208 + .../scratch/e_unified_decoder.battery.log | 2 + .../scratch/e_unified_decoder.blc | 1 + .../scratch/e_unified_decoder.lam | 1 + .../scratch/e_unified_decoder.polish.log | 3 + .../reasoning_floor/scratch/letopt.py | 28 + .../reasoning_floor/verify/v37.md | 28 + .../reasoning_floor/verify/v37_codex.md | 77 + .../reasoning_floor/verify/v37_fixed_check.py | 226 + .../reasoning_floor/verify/v37_gemini.md | 61 + .../verify/v37_gemini_prompt.md | 28 + .../reasoning_floor/verify/vrem.md | 32 + .../reasoning_floor/verify/vrem_codex.md | 76 + .../verify/vrem_codex_checks.json | 266 + .../verify/vrem_codex_checks.py | 269 + data/self-interpreter/theory/floor37.json | 851 + docs/STATUS.md | 83 +- .../self-interpreter/capture-width.md | 16 +- .../self-interpreter/global-floor.md | 560 + .../self-interpreter/head-decomposition.md | 32 +- .../classical/self-interpreter/interpreter.md | 80 +- docs/classical/self-interpreter/remainder.md | 355 +- .../self-interpreter/structural-bounds.md | 23 +- lean/Blc.lean | 8 + lean/Blc/SelfintFixedResiduals.lean | 59 + lean/Blc/SelfintFloor37.lean | 323 + lean/Blc/SelfintFloorApp.lean | 735 + lean/Blc/SelfintFloorArg.lean | 259 + lean/Blc/SelfintFloorCount.lean | 211 + lean/Blc/SelfintFloorEmerge.lean | 228 + lean/Blc/SelfintFloorLambda.lean | 295 + lean/Blc/SelfintFloorLiteral.lean | 122 + lean/Blc/SelfintKnot.lean | 162 + lean/Blc/SelfintRemainderChain.lean | 219 + lean/Blc/SelfintResidualControl.lean | 224 + lean/Blc/SelfintSharedS647.lean | 478 + lean/Blc/SelfintTower45.lean | 96 + lean/README.md | 27 +- tools/self-interpreter/polish.py | 64 + .../theory/floor37/check34.py | 76 + .../theory/floor37/check35.py | 52 + .../self-interpreter/theory/floor37/verify.py | 324 + 275 files changed, 41343 insertions(+), 54 deletions(-) create mode 100644 data/self-interpreter/reasoning_floor/BRIEF.md create mode 100644 data/self-interpreter/reasoning_floor/README.md create mode 100644 data/self-interpreter/reasoning_floor/blind/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/blind/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/blind/baseline165.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/battery.log create mode 100644 data/self-interpreter/reasoning_floor/blind/beta1.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/beta2.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/blind-findings.md create mode 100644 data/self-interpreter/reasoning_floor/blind/borrow_zero.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/build.py create mode 100644 data/self-interpreter/reasoning_floor/blind/check.py create mode 100644 data/self-interpreter/reasoning_floor/blind/common_return.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/handler_knot.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/local-identities.log create mode 100644 data/self-interpreter/reasoning_floor/blind/local_identities.py create mode 100644 data/self-interpreter/reasoning_floor/blind/next_knot.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/parser_scope.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/parser_scope_under_tag.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/reversed_lookup.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/second_build.py create mode 100644 data/self-interpreter/reasoning_floor/blind/selected_operator.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/split_next.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/stream_first.lam create mode 100644 data/self-interpreter/reasoning_floor/blind/thread_cont.lam create mode 100644 data/self-interpreter/reasoning_floor/dispatch/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/dispatch/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/dispatch/algebra_scan.py create mode 100644 data/self-interpreter/reasoning_floor/dispatch/dup_replay_180.lam create mode 100644 data/self-interpreter/reasoning_floor/dispatch/fake_var_second_parse.lam create mode 100644 data/self-interpreter/reasoning_floor/dispatch/lab.py create mode 100644 data/self-interpreter/reasoning_floor/dispatch/next_knot.lam create mode 100644 data/self-interpreter/reasoning_floor/dispatch/variants1.py create mode 100644 data/self-interpreter/reasoning_floor/dispatch/variants2.py create mode 100644 data/self-interpreter/reasoning_floor/env/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/env/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/env/battery.log create mode 100644 data/self-interpreter/reasoning_floor/env/boolean-section.md create mode 100644 data/self-interpreter/reasoning_floor/env/boolean_checks.json create mode 100644 data/self-interpreter/reasoning_floor/env/borrow_abs_tag.blc create mode 100644 data/self-interpreter/reasoning_floor/env/borrow_abs_tag.lam create mode 100644 data/self-interpreter/reasoning_floor/env/borrowed-data-bound.md create mode 100644 data/self-interpreter/reasoning_floor/env/check.py create mode 100644 data/self-interpreter/reasoning_floor/env/check_boolean_bounds.py create mode 100644 data/self-interpreter/reasoning_floor/env/checks.json create mode 100644 data/self-interpreter/reasoning_floor/env/followup.md create mode 100644 data/self-interpreter/reasoning_floor/env/origin_arithmetic.json create mode 100644 data/self-interpreter/reasoning_floor/env/origin_arithmetic.py create mode 100644 data/self-interpreter/reasoning_floor/env/reference165.blc create mode 100644 data/self-interpreter/reasoning_floor/env/reference165.lam create mode 100644 data/self-interpreter/reasoning_floor/gemini/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/gemini/consult.md create mode 100644 data/self-interpreter/reasoning_floor/global/PROJECTIONS.md create mode 100644 data/self-interpreter/reasoning_floor/global/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/global/PROOF37.md create mode 100644 data/self-interpreter/reasoning_floor/global/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/global/batteries.txt create mode 100644 data/self-interpreter/reasoning_floor/global/check34.json create mode 100644 data/self-interpreter/reasoning_floor/global/check34.py create mode 100644 data/self-interpreter/reasoning_floor/global/check35.json create mode 100644 data/self-interpreter/reasoning_floor/global/check35.py create mode 100644 data/self-interpreter/reasoning_floor/global/check36.json create mode 100644 data/self-interpreter/reasoning_floor/global/check36.py create mode 100644 data/self-interpreter/reasoning_floor/global/check36open.json create mode 100644 data/self-interpreter/reasoning_floor/global/control366.blc create mode 100644 data/self-interpreter/reasoning_floor/global/control366.lam create mode 100644 data/self-interpreter/reasoning_floor/global/count_search_space.py create mode 100644 data/self-interpreter/reasoning_floor/global/lean-check.log create mode 100644 data/self-interpreter/reasoning_floor/global/projection-control.json create mode 100644 data/self-interpreter/reasoning_floor/global/projection_control.py create mode 100644 data/self-interpreter/reasoning_floor/global/search-count.json create mode 100644 data/self-interpreter/reasoning_floor/global/verified.json create mode 100644 data/self-interpreter/reasoning_floor/global/verify.py create mode 100644 data/self-interpreter/reasoning_floor/grok/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/grok/consult1.md create mode 100644 data/self-interpreter/reasoning_floor/grok/consult2.md create mode 100644 data/self-interpreter/reasoning_floor/grok/followup.md create mode 100644 data/self-interpreter/reasoning_floor/knot/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/knot/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/knot/battery.json create mode 100644 data/self-interpreter/reasoning_floor/knot/build_and_check.py create mode 100644 data/self-interpreter/reasoning_floor/knot/carrier_check.json create mode 100644 data/self-interpreter/reasoning_floor/knot/checks.py create mode 100644 data/self-interpreter/reasoning_floor/knot/identities.json create mode 100644 data/self-interpreter/reasoning_floor/knot/identity_check.py create mode 100644 data/self-interpreter/reasoning_floor/knot/lean_check.log create mode 100644 data/self-interpreter/reasoning_floor/knot/probe189.py create mode 100644 data/self-interpreter/reasoning_floor/knot/reference165.blc create mode 100644 data/self-interpreter/reasoning_floor/knot/reference165.lam create mode 100644 data/self-interpreter/reasoning_floor/knot/reference192.blc create mode 100644 data/self-interpreter/reasoning_floor/knot/reference192.lam create mode 100644 data/self-interpreter/reasoning_floor/knot/reset_cont192.blc create mode 100644 data/self-interpreter/reasoning_floor/knot/reset_cont192.lam create mode 100644 data/self-interpreter/reasoning_floor/knot/reset_generator192.blc create mode 100644 data/self-interpreter/reasoning_floor/knot/reset_generator192.lam create mode 100644 data/self-interpreter/reasoning_floor/lean-floor/NOTES.md create mode 100644 data/self-interpreter/reasoning_floor/lean-floor/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/lean-floor/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/nextfuse/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/nextfuse/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/nextfuse/build.py create mode 100644 data/self-interpreter/reasoning_floor/nextfuse/checks.py create mode 100644 data/self-interpreter/reasoning_floor/nextfuse/h.py create mode 100644 data/self-interpreter/reasoning_floor/nextfuse/v_dispatch_first.lam create mode 100644 data/self-interpreter/reasoning_floor/nextfuse/v_optional_parse.lam create mode 100644 data/self-interpreter/reasoning_floor/nextfuse/v_select_first.lam create mode 100644 data/self-interpreter/reasoning_floor/nextfuse/v_share_head.lam create mode 100644 data/self-interpreter/reasoning_floor/nextfuse/v_sharedZ_kapp.lam create mode 100644 data/self-interpreter/reasoning_floor/nextfuse/v_sharedZ_vabs.lam create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/splice/r165_control.lam create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/splice/r46_k1.lam create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/splice/r49_betashortcut.lam create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/splice/r50_tnext.lam create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/splice/r58_tau.lam create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/tools/algebra.py create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/tools/examples.py create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/tools/menu.py create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/tools/rt.py create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/tools/symbolic.py create mode 100644 data/self-interpreter/reasoning_floor/remainder/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/remainder/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/remainder/audit.json create mode 100644 data/self-interpreter/reasoning_floor/remainder/audit.py create mode 100644 data/self-interpreter/reasoning_floor/remainder/check.py create mode 100644 data/self-interpreter/reasoning_floor/remainder/checks.json create mode 100644 data/self-interpreter/reasoning_floor/remainder/diagonal63_failed.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/diagonal63_failed.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/drop_second_skip_failed.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/drop_second_skip_failed.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/fixedpoint_direct.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/fixedpoint_direct.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/fixedpoint_select_after.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/fixedpoint_select_after.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/floated71.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/floated71.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/followup.md create mode 100644 data/self-interpreter/reasoning_floor/remainder/int165_projection.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/int165_projection.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/int584_projection.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/int584_projection.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/lean-checks.txt create mode 100644 data/self-interpreter/reasoning_floor/remainder/lean-residual-checks.txt create mode 100644 data/self-interpreter/reasoning_floor/remainder/pack_handler65.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/pack_handler65.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/pack_tail65.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/pack_tail65.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/partial_diagonal69.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/partial_diagonal69.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/pin_failures.py create mode 100644 data/self-interpreter/reasoning_floor/remainder/pin_shared.py create mode 100644 data/self-interpreter/reasoning_floor/remainder/reference70.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/reference70.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/residual-checks.json create mode 100644 data/self-interpreter/reasoning_floor/remainder/residual_checks.py create mode 100644 data/self-interpreter/reasoning_floor/remainder/right_diagonal67.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/right_diagonal67.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/shared_s_remainder.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/shared_s_remainder.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/tower45.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/tower45.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/tower51.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/tower51.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/triple67_capped.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/triple67_capped.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/unary_only.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/unary_only.lam create mode 100644 data/self-interpreter/reasoning_floor/remainder/zero_tower_only.blc create mode 100644 data/self-interpreter/reasoning_floor/remainder/zero_tower_only.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/scratch/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.letopt-no-inline.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a3_shared_read.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a3_shared_read.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/a3_shared_read.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/a3_shared_read.letopt-no-inline.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a3_shared_read.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a4_local_unary.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a4_local_unary.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/a4_local_unary.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/a4_local_unary.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a5_polished.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a5_polished.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/a5_polished.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/a5_polished.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.letopt.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.letopt.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a_env_cps.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a_env_cps.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/a_env_cps.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/a_env_cps.letopt-no-inline.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a_env_cps.letopt.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/a_env_cps.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/b_tree_fold.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/b_tree_fold.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/b_tree_fold.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/b_tree_fold.letopt-no-inline.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/b_tree_fold.letopt.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/b_tree_fold.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/best.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/best.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/best.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/best.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/c_direct_pair.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/c_direct_pair.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/c_direct_pair.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/c_direct_pair.letopt-no-inline.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/c_direct_pair.letopt.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/c_direct_pair.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/check.py create mode 100644 data/self-interpreter/reasoning_floor/scratch/d_trie_environment.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/d_trie_environment.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/d_trie_environment.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/d_trie_environment.letopt-no-inline.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/d_trie_environment.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/derive.py create mode 100644 data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.battery.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.blc create mode 100644 data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.lam create mode 100644 data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.polish.log create mode 100644 data/self-interpreter/reasoning_floor/scratch/letopt.py create mode 100644 data/self-interpreter/reasoning_floor/verify/v37.md create mode 100644 data/self-interpreter/reasoning_floor/verify/v37_codex.md create mode 100644 data/self-interpreter/reasoning_floor/verify/v37_fixed_check.py create mode 100644 data/self-interpreter/reasoning_floor/verify/v37_gemini.md create mode 100644 data/self-interpreter/reasoning_floor/verify/v37_gemini_prompt.md create mode 100644 data/self-interpreter/reasoning_floor/verify/vrem.md create mode 100644 data/self-interpreter/reasoning_floor/verify/vrem_codex.md create mode 100644 data/self-interpreter/reasoning_floor/verify/vrem_codex_checks.json create mode 100644 data/self-interpreter/reasoning_floor/verify/vrem_codex_checks.py create mode 100644 data/self-interpreter/theory/floor37.json create mode 100644 docs/classical/self-interpreter/global-floor.md create mode 100644 lean/Blc/SelfintFixedResiduals.lean create mode 100644 lean/Blc/SelfintFloor37.lean create mode 100644 lean/Blc/SelfintFloorApp.lean create mode 100644 lean/Blc/SelfintFloorArg.lean create mode 100644 lean/Blc/SelfintFloorCount.lean create mode 100644 lean/Blc/SelfintFloorEmerge.lean create mode 100644 lean/Blc/SelfintFloorLambda.lean create mode 100644 lean/Blc/SelfintFloorLiteral.lean create mode 100644 lean/Blc/SelfintKnot.lean create mode 100644 lean/Blc/SelfintRemainderChain.lean create mode 100644 lean/Blc/SelfintResidualControl.lean create mode 100644 lean/Blc/SelfintSharedS647.lean create mode 100644 lean/Blc/SelfintTower45.lean create mode 100644 tools/self-interpreter/polish.py create mode 100644 tools/self-interpreter/theory/floor37/check34.py create mode 100644 tools/self-interpreter/theory/floor37/check35.py create mode 100644 tools/self-interpreter/theory/floor37/verify.py diff --git a/README.md b/README.md index 4dce2c1f..5d88dddc 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,10 @@ proven. it, and the 168, a self-interpreter for every closed program. Nothing smaller appears in its let structure, βη and contextual components, or any slot of its reader, and the 168's modular lower bound still pins the part the two - share. The same reader gives universal machines of 175 (non-strict) and 187 + share. Every self-interpreter has at least 37 bits by a reviewed handwritten + proof, and at least 27 kernel-checked in Lean + ([global floor](docs/classical/self-interpreter/global-floor.md)). The same + reader gives universal machines of 175 (non-strict) and 187 (strict) bits, against Tromp's 178 and 190 ([universal](docs/classical/self-interpreter/universal.md)). - **The rest of tromp/AIT** ([golf](docs/classical/golf.md), sent upstream as @@ -433,7 +436,7 @@ guarantees, and records of what the measurements and searches establish. | classical engine | [architecture](docs/classical/architecture.md), [running programs: notation, blc, uni](docs/classical/programs.md), [speed prior](docs/classical/speed.md) | | classical results | [bits of Ω](docs/classical/omega.md), [coding theorem](docs/classical/coding.md), [AIT golf](docs/classical/golf.md) | | certificates | [specification](docs/classical/certificates/specification.md), [frontier maps](docs/classical/certificates/frontier.md), [BB(33/34/35)](docs/classical/certificates/busy-beaver.md), [Lean](lean/README.md) | -| self-interpreter | [the 165](docs/classical/self-interpreter/interpreter.md), [universal machine](docs/classical/self-interpreter/universal.md), [slot searches](docs/classical/self-interpreter/slots.md) | +| self-interpreter | [the 165](docs/classical/self-interpreter/interpreter.md), [global floor](docs/classical/self-interpreter/global-floor.md), [universal machine](docs/classical/self-interpreter/universal.md), [slot searches](docs/classical/self-interpreter/slots.md) | | qBLC | [architecture](docs/quantum/architecture.md), [frontier adjudication](docs/quantum/escalation.md), [Galois structure](docs/quantum/galois.md), [odd-sector search](docs/quantum/oddmin.md), [bisimulation](docs/quantum/bisimulation.md) | | qALC | [architecture](docs/quantum-algebraic/architecture.md), [token machine](docs/quantum-algebraic/token.md), [kernel register](docs/quantum-algebraic/kernel.md), [instance identity](docs/quantum-algebraic/instance-identity.md), [objects](docs/quantum-algebraic/objects.md), [speed prior](docs/quantum-algebraic/speed.md), [Rust pillar](docs/quantum-algebraic/rust-pillar.md), [reference and proof records](qalc/README.md) | diff --git a/data/self-interpreter/reasoning_floor/BRIEF.md b/data/self-interpreter/reasoning_floor/BRIEF.md new file mode 100644 index 00000000..e282b53c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/BRIEF.md @@ -0,0 +1,123 @@ +# Overnight push: below 165 bits, or a proof that 165 is optimal + +Repo: /Users/a9lim/Work/blam (branch dev). You are one lane of a parallel +reasoning effort coordinated by a Claude seat. Your lane's own angle is given +in the prompt that sent you this file; this file is the shared ground truth. + +READ FIRST, in this order (skim what is not relevant to your lane): + +1. `docs/classical/self-interpreter/interpreter.md` — the record of the 165: + anatomy, why its reader works, everything searched, the lower bounds, the + exclusions proved at every size, and ~120 protocol variants already built. + **Do not re-propose anything it lists.** +2. `docs/STATUS.md`, section "Self-interpreter and universal machine". +3. For proof lanes: `structural-bounds.md`, `capture-width.md`, + `head-decomposition.md`, `handler-bound.md`, `protocol-obstructions.md` + (all in `docs/classical/self-interpreter/`); `cheap-tail-bound.md` is a + 4,500-line case analysis — read its intro and section list, not all of it. +4. `data/self-interpreter/reasoning_165/*/SUMMARY.md` — nine earlier + reasoning consults (identities, constructions, obstructions). + +## The contract (fixed) + +`⌜λM⌝ = 00⌜M⌝`, `⌜M N⌝ = 01⌜M⌝⌜N⌝`, `⌜var n⌝ = 1ⁿ0` (n ≥ 1, de Bruijn, +1 = innermost). Streams: `cons b r = λf. f b r`; bit `0` = `K = λx y. x`, +bit `1` = `F = λx y. y`. A self-interpreter is a closed `E` with + + E C (⌜M⌝ ++ N) =β C (λz. M) N + +for every closed `M` (including M without a normal form), with `C`, `N` +rigid. Size: λ and application cost 2 bits each, `var n` costs n+1 bits. +For a closed term `|M| = 2L + 4A + 2 + X` (L lambdas, A applications, +X = sum of 0-based indices over all variable occurrences). + +## The 165 (`data/self-interpreter/machines/int165.lam`; L 17, A 25, X 29) + + (\x. x x) (\x. (\intL. \cont. + (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) + +Anatomy (bits): knot + `intL = x x` let 22; `\cont`, `next` let, `\list` 8; +reader `list H S` 6; handler `\bit0. bit0 Z cont` 13; zero arm +`Z = \unused \r. r next` 14; skip `S = list list list` 10; NEXT header +`\bit1. intL (\exp. bit1 · ·)` 17; ABS 40 (cell `\zx \zy. zx arg (zy args)` 24); +APP 35 (lift `\args. exp args (exp2 args)` 19). + +How it runs. `E C s` with `s = cons b r`: `s H S = H b r S`, and +`S = s s s` is the stream after the first 0 of the whole stream +(`s s = K r'`). On a 0 tag, `S = r` and `H K r S = Z r S = r next = +next b2 r2`, which parses the body with continuation `\exp. b2 ABS APP`. +On a variable `1ⁿ0 ++ N`, `H F r S = cont r S = cont r N`: the variable's +value is its own remaining unary code `r`, and an environment cell +`e = \zx zy. zx arg (zy args)` performs lookup because +`r e = e b' r'' = b' arg (r'' args)`. Index sum by binder: cont 8 (three +uses at 0-based depth 3,2,3), cell 6, intL 5 (2,3), next 4, ABS/APP `exp`s 5, +bit1 1, all others 0. + +The 165 beat Palmer's 168 by two moves that the 168's module bound assumed +away: HOIST work several branches need to the point where one expression is +right for all of them (the whole-stream skip), and let a Scott structure's +OWN APPLICATION supply an argument (the stream hands `list1` to `cont`, +deleting VAR's return application). Lean proves the 165 correct +(`lean/Blc/Selfint165.lean`). + +## What is known (one-paragraph map; details in the docs) + +Unconditional (any interpreter): head normal form `λc s. c A B` or +`λc s. s A⃗`; ≥ 2 nonlinear binders in incomparable branches (Lean); +some subterm with 3 free variables, two live captures (Statman width); +handwritten global floor 34 bits, Lean floor 18; a β-normal interpreter +exists (204 bits), even a simply typable one (672); `E E ≠β E`. +Conditional (165's frame fixed): the reader `s H T` costs ≥ 43 for +`T ∈ {s s s, s, s s}` with independent rigid laws (so 165 is minimal there); +zero arm ≥ 14; APP lift ≥ 19; the 168's module grammar gives unique +module minima (knot 22, NEXT 17, ABS 40, APP 35, cell 24, lift 19) under +opaque-module assumptions. Open: other reader heads/operands, joint changes, +exploiting actual NEXT/parser behaviour, different NEXT protocols, the +reader diagonal `R Z →* next next` as a knot generator, and any +unconditional bound beyond small sizes. + +## How to work — this matters + +Reason first. Derive identities by hand, write proofs, design constructions +on paper, then check them. Light, targeted computation only: + +- `python3 tools/self-interpreter/battery.py FILE.lam` — exact contract on + 668 programs, ~2 s; prints `N bits ok=667 skip=1 fail=0` on success. + Lets are written as explicit redexes and compiled without optimizer, so the + printed size is exactly the term as written. `--max-bits 21` is a deeper + check (~20 s). +- `target/release/blam normalize ...`, small Python normalizers + (`tools/self-interpreter/lc.py`, `db.py`) for specific identities. +- A hole search over at most a few thousand fills, only when reasoning has + already narrowed the hole. + +NO long or blunt searches: no exhaustive sweeps, no single run longer than +about two minutes, at most 2 threads. The machine is a9's shared daily +driver. A lane that spends its time enumerating has failed its brief even +if it finds something. + +Lean (`lean/`, `lake build `) is welcome for a lemma whose statement +you have pinned down; keep new Lean files in your lane directory unless told +otherwise, and do not edit existing modules. + +Write files ONLY under your lane directory (given in your prompt). Never +modify tracked repository files. + +## Report + +End with a report (also saved as `REPORT.md` in your lane directory): + +1. Every complete interpreter you built: bits, exact battery line, one-line + idea. A sub-165 claim needs a `.lam` file and a passing battery line. +2. Every new exact identity, with its proof. +3. Every impossibility or lower-bound argument, with its proof, its exact + hypotheses, and whether it is handwritten, computer-checked or in Lean. +4. Your honest read of where a sub-165 could hide, or what the next proof + step is. + +Overclaiming is a failure; so is giving up without having tried the real +problem. The ceiling of what a model can do is far above trained-in modesty: +attempt the real version first. diff --git a/data/self-interpreter/reasoning_floor/README.md b/data/self-interpreter/reasoning_floor/README.md new file mode 100644 index 00000000..48687246 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/README.md @@ -0,0 +1,32 @@ +# Reasoning lanes on the 165: floors and fusions + +Twelve parallel reasoning lanes (2026-10-21) on a sub-165 BLC +self-interpreter or a proof that 165 is optimal, each told to reason first +and to run only light, targeted checks (`BRIEF.md` is the shared brief; each +directory keeps its own `PROMPT.md`). Codex ran `global`, `remainder`, `knot`, +`env`, `blind` and `scratch`; Claude ran `reader-proof`, `nextfuse`, +`dispatch` and `lean-floor`; `gemini` and `grok` are single consults from +those vendors. `verify/` holds the independent adversarial reviews. + +No lane found an interpreter below 165. What the record keeps: + +| lane | result | where it lives now | +|---|---|---| +| global | handwritten 37-bit global floor (34–36 excluded); literal continuation-headed source ≥ 70; remainder extractors ≥ 24 | `docs/classical/self-interpreter/global-floor.md`, `head-decomposition.md` | +| verify | two independent reviews of the 37 (Codex, Gemini) and one of the remainder 27 and the continuation-headed bound, all correct; the latter review combined them into ≥ 73 | `global-floor.md`, `head-decomposition.md` | +| remainder | remainder extractors ≥ 27; incomparable nonlinear binders, the transfer `|E| ≥ Rmin − 8`, the 45-bit tower reader, pending-source obligations, a 647-bit extractor with two nonlinear binders (all Lean) | `remainder.md`; `lean/Blc/SelfintRemainderChain`, `SelfintTower45`, `SelfintResidualControl`, `SelfintSharedS647`, `SelfintFixedResiduals` | +| knot | opaque fixed points cost ≥ 20 bits, so the 165's 31 bits of recursion overhead are minimal (Lean); the generic diagonal carrier ≥ 12; two reset bootstraps at 192 | `interpreter.md` §4, §6; `lean/Blc/SelfintKnot.lean` | +| lean-floor | kernel-checked `SelfintSizeBound 27` (from 18) | `structural-bounds.md`; `lean/Blc/SelfintFloor*.lean` | +| env | cell ≥ 24 and lift ≥ 19 with borrowed raw data, then under only the Boolean lookup laws (handwritten, unreviewed); a 171 with a curried cell | `interpreter.md` §5, §6 | +| reader-proof | handwritten theorem: with the 165's knot and NEXT fixed, every reader body costs ≥ 43, uniquely attained (under review when archived) | `reader-proof/REPORT.md` | +| nextfuse | a catalogue of second-bit dispatch placements (166–188) and a decomposition argument that NEXT is 92 under the 165's interfaces | `nextfuse/REPORT.md` | +| dispatch | forcing lemmas for the reader and a theorem that the second bit's state cannot ride in the continuation; a 176 without a `next` let | `dispatch/REPORT.md` | +| grok | a correct 168 passing NEXT as the reader's third operand (proposed as 164; miscounted) | `interpreter.md` §6 | +| blind, scratch, gemini | rediscoveries 166–214; an independent from-scratch design at 220 | `interpreter.md` §6 | + +The `.lean` files these lanes wrote now live in `lean/Blc/` under the +`Selfint*` names above, with renamed namespaces; the lane copies are not kept +here. The 37's checker moved to `tools/self-interpreter/theory/floor37/`. +Other scripts ran from the lanes' scratch directories and may need their +paths adjusted to rerun; several expect a frozen copy of +`target/release/blam` beside them. diff --git a/data/self-interpreter/reasoning_floor/blind/PROMPT.md b/data/self-interpreter/reasoning_floor/blind/PROMPT.md new file mode 100644 index 00000000..c00b8bb8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/PROMPT.md @@ -0,0 +1,16 @@ +Lane "blind": a fresh golf of the 165 without anchoring on the record. Your +lane directory is /Users/a9lim/Work/blam/tmp/overnight/blind/ (write only there). + +Read ONLY /Users/a9lim/Work/blam/tmp/overnight/BRIEF.md's sections "The +contract", "The 165" and "How to work" at first. Deliberately do NOT read +interpreter.md or the other docs until you have spent most of your effort: +earlier lanes that read the full record first tended to explore its own +neighbourhood. Think from first principles about how the 165 works, what +every bit of it pays for, and where the same work could be done once instead +of twice, or supplied by the application of an existing structure instead of +built. Build every idea you find promising and run the battery on it. + +Only when you have built and measured your own ideas, read +docs/classical/self-interpreter/interpreter.md §3, §5, §6 to check which of +them were already known, and say so honestly in your report. A sub-165 needs a +.lam file and a passing battery line (`ok=667 skip=1 fail=0`). diff --git a/data/self-interpreter/reasoning_floor/blind/REPORT.md b/data/self-interpreter/reasoning_floor/blind/REPORT.md new file mode 100644 index 00000000..b0e89d7e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/REPORT.md @@ -0,0 +1,103 @@ +# Blind lane verdict + +**No sub-165 interpreter found. No global optimality result.** + +Thirteen fresh constructions were built before reading the prior record. +All thirteen pass the default exact-normal-form battery, but their sizes +range from 166 to 214 bits. The starting 165 also passes. The nearest are: + +``` +166 bits ok=667 skip=1 fail=0 split_next.lam +166 bits ok=667 skip=1 fail=0 borrow_zero.lam +167 bits ok=667 skip=1 fail=0 parser_scope.lam +168 bits ok=667 skip=1 fail=0 beta1.lam +168 bits ok=667 skip=1 fail=0 parser_scope_under_tag.lam +169 bits ok=667 skip=1 fail=0 selected_operator.lam +``` + +The full table, derivations, and reproduction commands are in +[`blind-findings.md`](blind-findings.md), written before reading the record. +Every candidate is a `.lam` file in this directory. The actual battery output, +including timings and L/A/X counts, is in [`battery.log`](battery.log). + +## Independent reasoning and measured costs + +The 165's raw unary-code variable value couples the cell and variable branch: +the stream applies the environment to its bit and remaining unary code. +Reversing that application is viable, but the variable adapter plus the +alternative cell costs 181 bits. It does not make the cheaper Scott-style +environment extension free. + +Two smaller local ideas both reach 166: + +* `split_next.lam` moves the second-tag choice before the first expression's + binder. It removes one de Bruijn index bit but adds a lambda, costing one + net bit. +* `borrow_zero.lam` uses the known zero tag's K as the constant function in + the zero arm: `bit0 (lambda r.r next)`. It removes a lambda but adds an + application and variable; bringing next closer recovers only one bit. + +`selected_operator.lam` shares the first lambda of ABS's value and APP's +second-parse continuation, using `bit1 cont intL` as their common head. It +has one fewer lambda than the 165, but one extra application and two extra +index bits: 169. Moving the continuation outside both constructor branches +instead gives 174, and a common return after an optional second parse gives +176. Neither saves the machinery needed to distinguish ABS from APP. + +Moving the knot into the handler or NEXT gives 208 and 209. Specializing the +root to its guaranteed zero tag does not pay for the new recursive calling +convention. Taking the stream before the continuation similarly costs 214. + +## Comparison with the record, read afterward + +Only `interpreter.md` sections 3, 5, and 6 were read for this comparison. + +| Blind construction or result | Prior coverage | +|---|---| +| Split constructor continuation, 166 | Section 3 explicitly lists select-first at 166. Rediscovery. | +| Borrow bit0 as K, 166 | Section 3 gives the same expression and size. Exact conceptual rediscovery. | +| Move/in-line parser and NEXT lets, 167–170 | Section 3's let-structure search already covers this family; NEXT inlined at 170 is explicit. No new improvement. | +| Reversed lookup, 181 | Section 3 explicitly gives the function environment at 181, and section 6 describes this cell and value adapter. Rediscovery. | +| Select `bit1 cont intL`, 169 | Section 6 gives this operation merger at 172 against the 168, with the same change in lambda/application/index counts; the corresponding 165 version is 169. Rediscovery. | +| Common return with optional second parse, 176 | Section 3 gives a better 175-bit variant in the same family; section 6 also lists optional parsing. No improvement. | +| Thread the continuation after branch selection, 174 | Operation-merge territory already explored. This exact source/size is not explicitly identified in the sections read; it is not evidence of a novel successful approach. | +| Handler knot, 208 | Section 6 already lists handler recursion at 196/206 against the 168. This construction is worse. | +| NEXT knot with closed-root specialization, 209 | Section 6 already lists self-passing NEXT and a root shortcut. Same architectural family, with a different concrete adapter. | +| Stream-first parser, 214 | Section 6 lists stream-first variants at 201–208 against the 168. This construction is worse. | +| Zero-arm and skip holes | Sections 3 and 5 already give stronger searches and handwritten bounds. The blind checks only reproduce a restricted part. | +| Thunked remainder observation | Section 6 explicitly records the same four-bit apparent saving and the forcing/adapter cost. Rediscovery. | + +## Limited exclusions checked here + +`local_identities.py` checks only two reasoning-selected holes: + +* 412 terms through 14 bits, with q, the zero cell s, and bit0 in scope. + For rigid q and tail, and second bit K or F, only the current 14-bit zero + arm satisfies `Z r r =beta r q`. +* 27 terms through 10 bits, with only s in scope. On the five prefixes + `1^n 0`, n = 0..4, and rigid tail, only the current 10-bit `s s s` + returns the tail. + +Both runs have zero fuel exhaustions; see +[`local-identities.log`](local-identities.log). These checks exclude no +architecture outside their stated holes. In particular, treating q as +rigid excludes exploiting the actual NEXT/parser behavior. The eight capped +zero-arm cases reported by the wider prior search remain unresolved by this +lane; this narrower test does not adjudicate them. + +## Evidence boundary + +The default battery verifies the 667 normalizing probes and skips one. +It is not a proof of the universal contract, including non-normalizing +programs. No new Lean proof was attempted because no new general lemma or +smaller construction survived the blind phase. + +The useful outcome is an independent replication of the nearest local +tradeoffs, with explicit sources and small symbolic checks. It adds no +known size improvement and supplies no new evidence that 165 is globally +optimal. A subsequent search should not repeat these local transformations. + +All writes stayed in this lane. The battery adapter used the repository's +unmodified test collection and normalizer with two workers; each candidate +took under two seconds. No external consults, broad sweeps, or repository +modifications were performed. diff --git a/data/self-interpreter/reasoning_floor/blind/baseline165.lam b/data/self-interpreter/reasoning_floor/blind/baseline165.lam new file mode 100644 index 00000000..fccfd758 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/baseline165.lam @@ -0,0 +1,6 @@ +(\x. x x) (\x. (\p. \c. + (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) + (\b. p (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (p (\f. c (\e. a e (f e))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/blind/battery.log b/data/self-interpreter/reasoning_floor/blind/battery.log new file mode 100644 index 00000000..7c780679 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/battery.log @@ -0,0 +1,14 @@ +165 bits ok=667 skip=1 fail=0 baseline165.lam time=1.77s L,A,X=(17, 25, 29) +166 bits ok=667 skip=1 fail=0 split_next.lam time=1.78s L,A,X=(18, 25, 28) +176 bits ok=667 skip=1 fail=0 common_return.lam time=1.84s L,A,X=(18, 27, 30) +181 bits ok=667 skip=1 fail=0 reversed_lookup.lam time=1.86s L,A,X=(20, 27, 31) +174 bits ok=667 skip=1 fail=0 thread_cont.lam time=1.84s L,A,X=(19, 26, 30) +208 bits ok=667 skip=1 fail=0 handler_knot.lam time=1.89s L,A,X=(19, 30, 48) +209 bits ok=667 skip=1 fail=0 next_knot.lam time=1.87s L,A,X=(23, 30, 41) +168 bits ok=667 skip=1 fail=0 beta1.lam time=1.89s L,A,X=(16, 25, 34) +170 bits ok=667 skip=1 fail=0 beta2.lam time=1.89s L,A,X=(16, 24, 40) +166 bits ok=667 skip=1 fail=0 borrow_zero.lam time=1.80s L,A,X=(16, 26, 28) +169 bits ok=667 skip=1 fail=0 selected_operator.lam time=1.82s L,A,X=(16, 26, 31) +167 bits ok=667 skip=1 fail=0 parser_scope.lam time=1.82s L,A,X=(17, 25, 31) +168 bits ok=667 skip=1 fail=0 parser_scope_under_tag.lam time=1.81s L,A,X=(17, 25, 32) +214 bits ok=667 skip=1 fail=0 stream_first.lam time=1.83s L,A,X=(22, 30, 48) diff --git a/data/self-interpreter/reasoning_floor/blind/beta1.lam b/data/self-interpreter/reasoning_floor/blind/beta1.lam new file mode 100644 index 00000000..2d6c21c3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/beta1.lam @@ -0,0 +1 @@ +(\a.a a) (\a\b.(\c\d.d (\e.e (\f\g.g c) b) (d d d)) (\c.a a (\d.c (b (\e\f.d (\g\h.g f (h e)))) (a a (\e.b (\f.d f (e f))))))) diff --git a/data/self-interpreter/reasoning_floor/blind/beta2.lam b/data/self-interpreter/reasoning_floor/blind/beta2.lam new file mode 100644 index 00000000..4296acb4 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/beta2.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e.e (\f\g.g (\h.b (\i.h (c (\j\k.i (\l\m.l k (m j)))) (b (\j.c (\k.i k (j k))))))) c) (d d d)) (a a)) diff --git a/data/self-interpreter/reasoning_floor/blind/blind-findings.md b/data/self-interpreter/reasoning_floor/blind/blind-findings.md new file mode 100644 index 00000000..fb82f35f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/blind-findings.md @@ -0,0 +1,79 @@ +# Blind findings before reading the prior search record + +The permitted BRIEF sections and the compiler, normalizer, and battery source +were the only research inputs. The 165 source was also read; its comments +repeat the permitted brief. No interpreter record sections had been read +when these constructions and measurements were completed. + +No sub-165 candidate was found. Thirteen constructed variants and a lane-local +copy of the 165 all pass the default battery: `ok=667 skip=1 fail=0`. +All thirteen variants are larger. Each complete battery took 1.77–1.89 seconds +with exactly two worker threads. `battery.log` is the complete measurement log. + +| File | Bits | L | A | X | Construction | +|---|---:|---:|---:|---:|---| +| baseline165.lam | 165 | 17 | 25 | 29 | Starting machine | +| split_next.lam | 166 | 18 | 25 | 28 | Choose the constructor continuation before binding the first parsed expression | +| borrow_zero.lam | 166 | 16 | 26 | 28 | Use the known zero tag itself as K in the zero arm | +| parser_scope.lam | 167 | 17 | 25 | 31 | Bind the recursive parser only inside NEXT | +| beta1.lam | 168 | 16 | 25 | 34 | Inline the recursive parser let | +| parser_scope_under_tag.lam | 168 | 17 | 25 | 32 | Bind the recursive parser below the second tag | +| selected_operator.lam | 169 | 16 | 26 | 31 | Select c versus parser, merging the first binder of their arguments | +| beta2.lam | 170 | 16 | 24 | 40 | Inline NEXT into the zero arm | +| thread_cont.lam | 174 | 19 | 26 | 30 | Pass the output continuation once after selecting a constructor branch | +| common_return.lam | 176 | 18 | 27 | 30 | Identity parser in ABS versus recursive parser in APP; one common return | +| reversed_lookup.lam | 181 | 20 | 27 | 31 | Environment receives unary code; a cell dispatches to K v or old environment | +| handler_knot.lam | 208 | 19 | 30 | 48 | Carry recursion in the first-bit handler rather than the complete parser | +| next_knot.lam | 209 | 23 | 30 | 41 | Carry recursion in NEXT; specialize entry to a closed program's initial zero | +| stream_first.lam | 214 | 22 | 30 | 48 | Reverse parser argument order, with an external contract adapter | + +The nearest transformations pay a definite syntactic cost: + +* Splitting `lambda a. b X Y` into `b (lambda a.X) (lambda a.Y)` + saves one bit on b's index and adds a two-bit lambda: 166. +* In the zero arm, `b (lambda r.r q)` is valid because b is K there. + It replaces one lambda by an application plus a variable, and brings q + one binder closer: again 166. +* The selected-operator version rewrites `b (c A) (p D)` as + `b c p (lambda f. b A_body D_body)` when A and D both begin with a + lambda. It saves one lambda but adds an application and two index bits: + 169. This is a useful near-branch merger, not a size improvement. +* Reversing lookup changes a raw variable result from r to `lambda e.e r`. + The alternative cell is `lambda r.r (lambda b.b (lambda unused.v) e)`. + This is semantically viable, but adds 16 bits overall. + +Two small holes were then exhausted, after identifying their exact jobs. +`local_identities.py` records the checks and `local-identities.log` the results. + +1. The zero-arm replacement Z has only q, s, and the first bit in scope. + For each bit b in {K,F}, use rigid q and tail, set r = cons b tail, + s = cons K r, and require `Z r r =beta r q`. + All 412 terms of at most 14 bits in this context were checked. There + were no fuel exhaustions. The sole passing term is the existing + 14-bit `lambda unused r.r q`; no term through 13 bits passes. +2. The skip replacement has only s in scope. All 27 terms through 10 bits + were checked on `1^n 0 ++ tail`, n = 0..4, with rigid tail. There + were no fuel exhaustions. The sole passing term is `s s s` at 10 bits. + +These are limited, reproducible local exclusions. They do not establish a +global lower bound, exclude holes with additional variables, or replace a +general interpreter correctness proof. The battery also does not establish +the contract for all non-normalizing programs. + +Reasoned but not built: dropping the skip's last application would expose +`s s = K remainder`. A parser returning wrapped remainders then needs to +force them in the zero arm and before APP's recursive call, and unwrap the +final continuation argument. The first force alone consumes the saved four +bits. No concrete smaller architecture emerged from this observation. + +Reproduce from the repository root: + +``` +PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/blind/build.py +PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/blind/second_build.py +PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/blind/check.py .lam +PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/blind/local_identities.py +``` + +The adapter compiles without optimization and calls the repository battery's +`check(..., threads=2)`. All writes are confined to this lane. diff --git a/data/self-interpreter/reasoning_floor/blind/borrow_zero.lam b/data/self-interpreter/reasoning_floor/blind/borrow_zero.lam new file mode 100644 index 00000000..15fc13bc --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/borrow_zero.lam @@ -0,0 +1,6 @@ +(\x.x x) (\x.(\p. +\c. (\q. \s. s (\b. b (b (\r. r q)) c) (s s s)) +(\b. p (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (p (\f. c (\e. a e (f e)))))) +)(x x)) diff --git a/data/self-interpreter/reasoning_floor/blind/build.py b/data/self-interpreter/reasoning_floor/blind/build.py new file mode 100644 index 00000000..b2c6c4f3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/build.py @@ -0,0 +1,98 @@ +from check import * + +BASE = r''' +(\x. x x) (\x. (\p. \c. + (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) + (\b. p (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (p (\f. c (\e. a e (f e))))))) + (x x)) +''' + +def knot(body): + return r'(\x.x x) (\x.(\p.' + body + r')(x x))' + +write('baseline165', BASE) +write('split_next', BASE.replace(r'p (\a. b', r'p (b (\a.').replace( + r'(c (\e \v. a (\d \r. d v (r e))))', + r'(c (\e \v. a (\d \r. d v (r e))))) (\a.').replace( + r'(p (\f. c (\e. a e (f e)))))))', + r'(p (\f. c (\e. a e (f e))))))))')) + +# Make the continuation common after selecting a parser strategy. On 00, +# use the already parsed expression as the value for an identity parser; +# on 01, recursively parse the second expression. +write('common_return', knot(r''' +\c. (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) +(\b. p (\a. (b (\k. k a) p) + (\f. c (b + (\e \v. f (\d \r. d v (r e))) + (\e. a e (f e)))))) +''')) + +# Opposite environment application convention. Each raw variable stream +# becomes an environment query; the cell dispatches onto a value thunk or +# the previous environment and lets the stream supply its tail. +write('reversed_lookup', knot(r''' +\c. (\q. \s. + s (\b. b (\unused \r. r q) (\r. c (\e. e r))) (s s s)) +(\b. p (\a. b + (c (\e \v. a (\r. r (\d. d (\unused. v) e)))) + (p (\f. c (\e. a e (f e)))))) +''')) + +# Fold the continuation outside both constructor alternatives. +write('thread_cont', knot(r''' +\c. (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) +(\b. p (\a. b + (\k. k (\e \v. a (\d \r. d v (r e)))) + (\k. p (\f. k (\e. a e (f e)))) c)) +''')) + +# Parser state is carried by the handler. The incoming list gives it the +# first bit, remainder, and shared skip before it selects the operation. +write('handler_knot', r''' +(\h. \c \s. s (h h c) (s s s)) +(\h \c \b. b + (\unused \r. r (\b. + (\p. p (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (p (\f. c (\e. a e (f e)))))) + (\c \s. s (h h c) (s s s)))) + c) +''') + +# Expose the second-tag operation as the recursive state. The entry point +# exploits the fact that every closed BLC program starts in the zero arm. +write('next_knot', r''' +(\q. \c \s. s (\unused \r. r (q c))) +((\x.x x) (\x.(\q. \c \b. + (\p. p (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (p (\f. c (\e. a e (f e)))))) + (\c \s. s (\b. b (\unused \r. r (q c)) c) (s s s))) + (x x))) +''') + +def redexes(t, path=()): + if t[0] == 'A' and t[1][0] == 'L': + yield path + if t[0] in ('A', 'L'): + yield from redexes(t[1], path+(1,)) + if t[0] == 'A': + yield from redexes(t[2], path+(2,)) + +def at(t,p): + for i in p: t=t[i] + return t + +def replace(t,p,v): + if not p:return v + z=list(t); z[p[0]]=replace(z[p[0]],p[1:],v); return tuple(z) + +base=compile_src(BASE) +for i,path in enumerate(redexes(base)): + if not path:continue # do not unroll the fixed point + t=at(base,path) + reduced=replace(base,path,lc.beta(t[1],t[2])) + write(f'beta{i}',lc.show(reduced)) diff --git a/data/self-interpreter/reasoning_floor/blind/check.py b/data/self-interpreter/reasoning_floor/blind/check.py new file mode 100644 index 00000000..f9af7be5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/check.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +"""Lane-local battery adapter: raw compile, at most two workers, lane temp files.""" +import os +from pathlib import Path +import sys +import time + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +os.environ['TMPDIR'] = str(HERE) +os.environ['RAYON_NUM_THREADS'] = '2' +sys.dont_write_bytecode = True +sys.path[:0] = [str(ROOT / 'tools'), str(ROOT / 'tools/self-interpreter')] +import blcc +import battery +import lc + +def compile_src(src): + p = blcc.P(blcc.strip_comments(src)) + e = blcc.p_lc(p) + p.ws() + assert p.i == len(p.t), p.t[p.i:] + return blcc.to_db(e) + +def counts(t): + if t[0] == 'V': return (0, 0, t[1]) + if t[0] == 'L': + l, a, x = counts(t[1]); return l+1, a, x + u, v = counts(t[1]), counts(t[2]) + return u[0]+v[0], u[1]+v[1]+1, u[2]+v[2] + +def write(name, src): + p = HERE / (name + '.lam') + p.write_text(src.strip() + '\n') + t = compile_src(src) + print(f'{name}: {lc.size(t)} bits L,A,X={counts(t)}', flush=True) + return p + +if __name__ == '__main__': + args = sys.argv[1:] + max_bits = 18 + if '--max-bits' in args: + i = args.index('--max-bits'); max_bits = int(args[i+1]); del args[i:i+2] + for a in args: + p = HERE / a + t = compile_src(p.read_text()) + start = time.monotonic() + ok, skip, bad = battery.check(t, max_bits=max_bits, threads=2) + line = f'{lc.size(t)} bits ok={ok} skip={skip} fail={len(bad)} {p.name} time={time.monotonic()-start:.2f}s L,A,X={counts(t)}' + print(line, flush=True) + with (HERE / 'battery.log').open('a') as f: + print(line, file=f) + for item in bad[:5]: print(' ', *item, file=f) + for item in bad[:5]: print(' ', *item, flush=True) diff --git a/data/self-interpreter/reasoning_floor/blind/common_return.lam b/data/self-interpreter/reasoning_floor/blind/common_return.lam new file mode 100644 index 00000000..3f49258d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/common_return.lam @@ -0,0 +1,7 @@ +(\x.x x) (\x.(\p. +\c. (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) +(\b. p (\a. (b (\k. k a) p) + (\f. c (b + (\e \v. f (\d \r. d v (r e))) + (\e. a e (f e)))))) +)(x x)) diff --git a/data/self-interpreter/reasoning_floor/blind/handler_knot.lam b/data/self-interpreter/reasoning_floor/blind/handler_knot.lam new file mode 100644 index 00000000..1b7cd91a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/handler_knot.lam @@ -0,0 +1,8 @@ +(\h. \c \s. s (h h c) (s s s)) +(\h \c \b. b + (\unused \r. r (\b. + (\p. p (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (p (\f. c (\e. a e (f e)))))) + (\c \s. s (h h c) (s s s)))) + c) diff --git a/data/self-interpreter/reasoning_floor/blind/local-identities.log b/data/self-interpreter/reasoning_floor/blind/local-identities.log new file mode 100644 index 00000000..6d5e5c58 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/local-identities.log @@ -0,0 +1,4 @@ +zero-arm hole: checked=412; fuel_exhausted=0; max_bits=14; rigid q and tail; second bit K or F + 14: \d\e.e q +skip hole: checked=27; fuel_exhausted=0; max_bits=10; prefixes 1^n0 for n=0..4; rigid tail + 10: s s s diff --git a/data/self-interpreter/reasoning_floor/blind/local_identities.py b/data/self-interpreter/reasoning_floor/blind/local_identities.py new file mode 100644 index 00000000..843ce40d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/local_identities.py @@ -0,0 +1,65 @@ +"""Two deliberately narrow, symbolic holes derived in the blind analysis. + +No interpreter enumeration: the zero-arm hole has only q, s, bit0 in scope; +the skip hole has only s. Sizes and limits are written into the output. +""" +from functools import lru_cache +from check import * + +@lru_cache(None) +def terms(n, k): + out=[] + if 2 <= n <= k+1: out.append(('V', n-2)) + if n >= 4: out += [('L', x) for x in terms(n-2,k+1)] + for a in range(2,n-3): + out += [('A',f,x) for f in terms(a,k) for x in terms(n-2-a,k)] + return tuple(out) + +K = r'(\u \v.u)' +F = r'(\u \v.v)' + +def norm(src): + return lc.nf(compile_src(src), [500]) + +def zero_probe(z, bit): + return (r'\q \tail.(\r.(\s \bit0. (' + z + r') r r)' + + r'(\f.f ' + K + r' r) ' + K + r') (\f.f ' + bit + r' tail)') + +out=[] +checked=0 +fuel_exhausted=0 +for n in range(2,15): + for t in terms(n,3): + checked+=1 + z=lc.show(t,names=['bit0','s','q']) + try: + if all(norm(zero_probe(z,b)) == norm(r'\q \tail.q '+b+' tail') for b in (K,F)): + out.append((n,z)) + except lc.Fuel: + fuel_exhausted+=1 +print(f'zero-arm hole: checked={checked}; fuel_exhausted={fuel_exhausted}; max_bits=14; rigid q and tail; second bit K or F') +for n,z in out: print(f' {n}: {z}') +assert out and min(n for n,z in out)==14 +assert fuel_exhausted==0 + +def stream(bits): + s='tail' + for b in reversed(bits): + s=r'(\f.f '+(K if b=='0' else F)+' '+s+')' + return s + +checked=0; out=[]; fuel_exhausted=0 +want=norm(r'\tail.tail') +for n in range(2,11): + for t in terms(n,1): + checked+=1 + z=lc.show(t,names=['s']) + try: + if all(norm(r'\tail.(\s.'+z+') '+stream('1'*i+'0'))==want for i in range(5)): + out.append((n,z)) + except lc.Fuel: + fuel_exhausted+=1 +print(f'skip hole: checked={checked}; fuel_exhausted={fuel_exhausted}; max_bits=10; prefixes 1^n0 for n=0..4; rigid tail') +for n,z in out: print(f' {n}: {z}') +assert out and min(n for n,z in out)==10 +assert fuel_exhausted==0 diff --git a/data/self-interpreter/reasoning_floor/blind/next_knot.lam b/data/self-interpreter/reasoning_floor/blind/next_knot.lam new file mode 100644 index 00000000..b26148dd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/next_knot.lam @@ -0,0 +1,7 @@ +(\q. \c \s. s (\unused \r. r (q c))) +((\x.x x) (\x.(\q. \c \b. + (\p. p (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (p (\f. c (\e. a e (f e)))))) + (\c \s. s (\b. b (\unused \r. r (q c)) c) (s s s))) + (x x))) diff --git a/data/self-interpreter/reasoning_floor/blind/parser_scope.lam b/data/self-interpreter/reasoning_floor/blind/parser_scope.lam new file mode 100644 index 00000000..d5e6896f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/parser_scope.lam @@ -0,0 +1,6 @@ +(\x.x x) (\x. \c. + (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) + ((\p. \b. p (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (p (\f. c (\e. a e (f e)))))) + (x x))) diff --git a/data/self-interpreter/reasoning_floor/blind/parser_scope_under_tag.lam b/data/self-interpreter/reasoning_floor/blind/parser_scope_under_tag.lam new file mode 100644 index 00000000..3b62600b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/parser_scope_under_tag.lam @@ -0,0 +1,6 @@ +(\x.x x) (\x. \c. + (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) + (\b. (\p. p (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (p (\f. c (\e. a e (f e)))))) + (x x))) diff --git a/data/self-interpreter/reasoning_floor/blind/reversed_lookup.lam b/data/self-interpreter/reasoning_floor/blind/reversed_lookup.lam new file mode 100644 index 00000000..7f9bfe51 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/reversed_lookup.lam @@ -0,0 +1,7 @@ +(\x.x x) (\x.(\p. +\c. (\q. \s. + s (\b. b (\unused \r. r q) (\r. c (\e. e r))) (s s s)) +(\b. p (\a. b + (c (\e \v. a (\r. r (\d. d (\unused. v) e)))) + (p (\f. c (\e. a e (f e)))))) +)(x x)) diff --git a/data/self-interpreter/reasoning_floor/blind/second_build.py b/data/self-interpreter/reasoning_floor/blind/second_build.py new file mode 100644 index 00000000..676a918a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/second_build.py @@ -0,0 +1,48 @@ +from check import * + +def knot(body): + return r'(\x.x x) (\x.(\p.' + body + r')(x x))' + +write('borrow_zero', knot(r''' +\c. (\q. \s. s (\b. b (b (\r. r q)) c) (s s s)) +(\b. p (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (p (\f. c (\e. a e (f e)))))) +''')) + +write('selected_operator', knot(r''' +\c. (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) +(\b. p (\a. b c p (\f. b + (\v. a (\d \r. d v (r f))) + (c (\e. a e (f e)))))) +''')) + +write('parser_scope', r''' +(\x.x x) (\x. \c. + (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) + ((\p. \b. p (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (p (\f. c (\e. a e (f e)))))) + (x x))) +''') + +write('parser_scope_under_tag', r''' +(\x.x x) (\x. \c. + (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) + (\b. (\p. p (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (p (\f. c (\e. a e (f e)))))) + (x x))) +''') + +# Put stream before continuation throughout recursion. The public adapter +# restores the stipulated argument order. +write('stream_first', r''' +(\p. \c \s. p s c) +((\x.x x) (\x.(\p. \s \c. + (\q. s (\b. b (\unused \r. r q) c) (s s s)) + (\b \r. p r (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (\r. p r (\f. c (\e. a e (f e))))))) + (x x))) +''') diff --git a/data/self-interpreter/reasoning_floor/blind/selected_operator.lam b/data/self-interpreter/reasoning_floor/blind/selected_operator.lam new file mode 100644 index 00000000..6023bcc3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/selected_operator.lam @@ -0,0 +1,6 @@ +(\x.x x) (\x.(\p. +\c. (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) +(\b. p (\a. b c p (\f. b + (\v. a (\d \r. d v (r f))) + (c (\e. a e (f e)))))) +)(x x)) diff --git a/data/self-interpreter/reasoning_floor/blind/split_next.lam b/data/self-interpreter/reasoning_floor/blind/split_next.lam new file mode 100644 index 00000000..0e00ca98 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/split_next.lam @@ -0,0 +1,6 @@ +(\x. x x) (\x. (\p. \c. + (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) + (\b. p (b (\a. + (c (\e \v. a (\d \r. d v (r e))))) (\a. + (p (\f. c (\e. a e (f e)))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/blind/stream_first.lam b/data/self-interpreter/reasoning_floor/blind/stream_first.lam new file mode 100644 index 00000000..2fdf400f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/stream_first.lam @@ -0,0 +1,7 @@ +(\p. \c \s. p s c) +((\x.x x) (\x.(\p. \s \c. + (\q. s (\b. b (\unused \r. r q) c) (s s s)) + (\b \r. p r (\a. b + (c (\e \v. a (\d \r. d v (r e)))) + (\r. p r (\f. c (\e. a e (f e))))))) + (x x))) diff --git a/data/self-interpreter/reasoning_floor/blind/thread_cont.lam b/data/self-interpreter/reasoning_floor/blind/thread_cont.lam new file mode 100644 index 00000000..73fc8c1a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/blind/thread_cont.lam @@ -0,0 +1,6 @@ +(\x.x x) (\x.(\p. +\c. (\q. \s. s (\b. b (\unused \r. r q) c) (s s s)) +(\b. p (\a. b + (\k. k (\e \v. a (\d \r. d v (r e)))) + (\k. p (\f. k (\e. a e (f e)))) c)) +)(x x)) diff --git a/data/self-interpreter/reasoning_floor/dispatch/PROMPT.md b/data/self-interpreter/reasoning_floor/dispatch/PROMPT.md new file mode 100644 index 00000000..3e8d92dd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/dispatch/PROMPT.md @@ -0,0 +1,27 @@ +Lane "dispatch": decoding the tag tree differently. Your lane directory is +/Users/a9lim/Work/blam/tmp/overnight/dispatch/ (write only there). Read +/Users/a9lim/Work/blam/tmp/overnight/BRIEF.md first; it is the shared ground truth. + +The code tree has three tags: 00 (λ), 01 (application), 1ⁿ0 (variable). The +165 decodes the first bit in the reader, by applying the stream to a handler +(`s H S = H b r S`), and the second bit in NEXT (`r next = next b2 r2`, then +`bit1 ABS APP` after the first child is parsed). The variable index is never +decoded: the value is the unary code itself, and the environment cell walks +it. + +Your angle: change WHERE and HOW bits are decoded, using the stream algebra +(interpreter.md §2 and reasoning_165/algebra, reader, fresh): two cells +cross-apply as `cons b r (cons d t) = b d t r`; unary codes satisfy +`U_{i+1}(N) U_{j+1}(M) = U_j(M) U_i(N)`; `s (λx. x x)` is a conditional +predecessor; `s (s K)` switches arity between constructor and variable; +`R (K (K X)) = X`. Questions: Can the second tag bit be consumed by a stream +application that also does other work (e.g. supplies NEXT's arguments, or the +first parse's stream)? Can the variable case and the APP case share a +decoding step (both start ...1)? Is there a reader whose skip `S` or handler +does part of NEXT's job? Can the environment walk use the same decoder as the +tag dispatch? The record measured "read both tag bits before dispatch" (193) +and the failed arity switch (167); go beyond those. + +Goal: a complete interpreter ≤ 164 bits with a passing battery, or a clean +impossibility theorem for a delimited class, with proof. Report as the brief +says. diff --git a/data/self-interpreter/reasoning_floor/dispatch/REPORT.md b/data/self-interpreter/reasoning_floor/dispatch/REPORT.md new file mode 100644 index 00000000..1c5b070a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/dispatch/REPORT.md @@ -0,0 +1,258 @@ +# Lane "dispatch": decoding the tag tree differently — report + +(・_・) **No sub-165 interpreter.** The lane's conclusion is negative and, I +think, informative: every way of moving *where* or *how* a tag bit is decoded +either re-derives the 165's own structure or runs into one of three walls, +which are stated as theorems with proofs below. Three complete interpreters +were built along the way (180 → 176 after letopt, 191, 200); none approaches +165. + +Everything written by this lane is in +`/Users/a9lim/Work/blam/tmp/overnight/dispatch/`: `lab.py` (parser/normalizer +harness), `algebra_scan.py` (stream-algebra table), `variants1.py`, +`variants2.py` (size calibrations), and the three `.lam` files. No repository +file was touched by this lane (the modified `docs/` and `lean/` files in +`git status` belong to other lanes); no enumeration was run; every computation +was a battery (2 threads, ~2.5 s), a `polish.py` letopt pass (~10 s), or a +handful of symbolic normalizations. + +Notation: `K = λxy.x` is bit 0, `F = λxy.y` bit 1, `[b]t = cons b t`, `P` the +parser (`intL`), `C` the rigid root continuation, `N`/`R` rigid rests, +`ABSV[v] = λe a. v (cell a e)`, `LIFT[f,g] = λe. f e (g e)`. Sizes use +`λ = 2, application = 2, variable = 2 + (0-based index)`. + +## 1. Complete interpreters built + +| file | bits | battery | letopt (≤3 cuts) | idea | +|---|---:|---|---:|---| +| `dup_replay_180.lam` | 180 | `ok=667 skip=1 fail=0` | **176** | No `next` let. The zero arm keeps both copies of the tag-less stream `r`: `r (λv. P k)` drops the second tag bit and parses the body; the continuation `k = λexp. u bit0 ABS APP` re-reads that bit from the other copy `u`, using `bit0 = K` as the projection. Same idea class as the nextfuse lane's tag replay (188/189), rendered 8 bits smaller before letopt, 12 after. | +| `fake_var_second_parse.lam` | 191 | `ok=667 skip=1 fail=0` | 191 | Every constructor parses twice; ABS feeds the second parse the constant stream `λu v. cont ABSV rest`, which the reader returns unchanged (`R (K (K X)) = X`). Independently derived, but it is the fresh lane's recorded 191 in idea and size — not new. | +| `next_knot.lam` | 200 | `ok=667 skip=1 fail=0` | 200 | The knot produces NEXT (continuation, then second tag bit) and the parser is let-bound inside it with recursive calls `x x c`; the root uses "every closed program starts with 0" to enter NEXT directly (`E C s = s (λb r. r (NEXT_C))`). Shows the root shortcut costs ~21 bits and that the knot output must be the parser, not NEXT. | + +The 180 is the smallest known interpreter without a `next` binding. Its loss +against the 165 is entirely depth: NEXT's five references (`cont` ×3, `intL` +×2, counting the ones inside ABS/APP) sit four binders deeper when NEXT is +inlined into the zero arm, +16, against the 10 bits the `next` let and its use +cost; the explicit tag re-read `u bit0` adds the rest. + +## 2. Exact identities (all β, checked with rigid variables) + +Stream algebra on the four shapes (`r` = the stream after the two tag bits, +`N` = the rest after a unary code): + +| term | `00 r` (ABS) | `01 r` (APP) | `10 N` | `110 N` | +|---|---|---|---|---| +| `s s` | `K [0]r` | `K [1]r` | `K N` | `K N` | +| `s s X` (any X) | `[0]r` | `[1]r` | `N` | `N` | +| `s (s s)` | `K r` | `r r` | `N [0]N` | `N [1][0]N` | +| `s (s s s)` | `K [0]r` | `I` | `N F [0]N` | `N F [1][0]N` | +| `s s s s` | `K r` | `r F r` | `N [1][0]N` | `N [1][1][0]N` | +| `s (s s) s` | `r` | `r r [0][1]r` | `N [0]N [1][0]N` | … | + +Proofs are two or three Scott/Boolean steps each (e.g. `s (s s) = (s s) b r = +K q b r = q r` where `q = [b2]r`; then `q r = b2 b2 r r`). Two consequences +used below: (a) in the zero case `s s X →* q` *for every X*, and in the +variable case `s s X →* N` with X erased; (b) `s (s s s)` is a three-way +discriminator (`K q` / `I` / `N`-headed) — but its variable row applies the +rigid `N`, which is why no reader can use it. + +Reader on non-streams, with `R = λs. s (λb. b (λu r. r next) cont) (s s s)`: +`R K = λb. b (λu r. r next) cont` (the handler itself), `R I = λr. r next`, +`R F = F`. (The first two were implicit in the fresh lane's list; recorded +here because they are the only cheap ways the *parser* can yield NEXT-shaped +objects, and they do not help: `Z = λu. intL cont I` is circular — it unfolds +to itself through `Z` — and `R K` only reproduces the handler.) + +## 3. Impossibility / forcing arguments + +All handwritten (not Lean, not computer-checked beyond the spot checks named). +Hypotheses are stated with each. + +### 3.1 The zero arm receives the tag-less stream twice (forcing lemma) + +**Hypotheses.** The reader is `s H S` with the variable arm a bare continuation +(`H F r S →* cont r S`), and `S` is any application-only term over `s` that is +β-equal to `N` on every variable stream `1ⁿ0 ++ N`. + +**Claim.** On a constructor stream `s = [0]q`, `S →* q`; hence the zero arm is +always `Z q q` and must erase one copy or make both useful. + +**Proof.** By the table, the only application-only operands over `s` that +evaluate to `N` on all unary inputs are of the form `s s X` (and iterates such +as `(s s)(s s)`): any further argument after `s s X` applies the rigid `N`, and +`s (⋯)`-headed terms other than `s s …` apply `N` as well (rows 3–6). On +`[0]q`, `s s = K q` and `K q X = q`. ∎ + +The 165 pays 3 bits for the erasure (`λu λr. r next` = 14 against `λr. r next` += 11, which fails all 667 programs). The lemma says this is not a defect of the +165's skip but of *every* whole-stream skip: the first-zero computation is +right for the variable arm exactly because it stops at the tag's own zero. + +### 3.2 Trailing reader arguments reach the rigid continuation + +**Hypotheses.** The 165's NEXT/ABS/APP protocol: internal continuations are +`λexp. b₂ ABS APP` and `λexp₂. cont LIFT`, with `ABS = cont ABSV` (so a +constructor's return forwards every argument after `rest` to its parent's +continuation); the variable arm is a bare continuation selected by the tag bit. + +**Claim.** No reader of the form `s H S T₁ … Tₖ` with `k ≥ 1` is correct, +whatever `H`, `S`, `Tᵢ` are (in particular no choice of zero arm repairs the +158-bit `s (λb. b F cont) (s s s) next`). + +**Proof.** The variable arm yields `cont r S T⃗`. Take the program `λ.1`: the +root is a constructor, its body a variable with continuation +`k = λexp. K ABS APP`, so the body returns `k r N T⃗ →* ABS N T⃗ = C ABSV N T⃗`, +three or more arguments at the rigid `C`. β-reduction cannot remove arguments +from a rigid head, and the contract requires exactly two. ∎ + +Corollary: the 178-bit repair (`λv r u. C v r` in the variable arm) is the +cheapest possible *shape* of repair — the extra argument must be consumed by a +λ in the variable arm, since nothing downstream can eat it. + +### 3.3 The variable arm never meets `C`, and uniformity is still forced + +**Observation.** Every closed program starts with `0`, so at the root only the +zero arm fires; the variable arm's `cont` is always an *internal* continuation +(`λexp. b₂ ABS APP` or `λexp₂. cont LIFT`). Hence the variable arm's calling +convention is, a priori, free. + +**Claim.** Under the 165's NEXT/ABS/APP protocol the freedom is empty: the +variable arm must pass exactly `(value, rest)` with `rest =β` the real rest. + +**Proof.** The same internal continuation `k = λexp. b₂ ABS APP` receives a +variable child's call and a constructor child's return (`k v rest` via the +parser law), and forwards its second argument to its parent, which may be `C` +(program `λ.1` again gives `C ABSV S`, so `S =β N`). Any extra argument is +excluded by 3.2; a thunked rest `K N` reaches `C` unforced, and a pre-skip +rest `s` (`s s s = N`) reaches `C` as `s`. So the only way to exploit the +observation is a continuation that *discriminates* its callers, which costs a +Scott wrapper or the 37-bit discriminator of the values lane. ∎ + +This is the reason the handler-bound laws (`H K R R = R next`, `H F R T = cont +R T`) are not an assumption but a consequence of the root contract plus the +uniformity of internal continuations; the open door in the reader bound is only +"a different NEXT", not "a different variable arm". + +### 3.4 One reader for both tag bits, with the state in the continuation, is impossible + +This is the lane's main theorem. The 165 uses two readers: `s H S` for the +first bit and `r next` for the second. The natural fusion is one reader whose +zero arm re-enters *itself* with a transformed continuation, the automaton +state (first bit read / second bit read) being carried by the continuation. + +**Hypotheses.** `P` and `T` closed terms such that for all terms `k`: +1. (variable law) `P k (1ⁿ0 ++ R) =β k v R` for some value `v` (any + convention) and `n ≥ 1`; +2. (re-entry) `P k ([0] t) =β P (T k) t`; +3. (parametric correctness) `P k (⌜M⌝ ++ R) =β k V_M R` for every closed `M`, + with `V_M =β λz.M`. + +**Claim.** No such `P`, `T` exist. + +**Proof.** Fix `k = C` and `R` rigid. For closed `M`, hypotheses 2 and 3 give +`P C (00⌜M⌝R) = P (T(TC)) (⌜M⌝R) = T(TC) V_M R`, which by 3 must be +`C V_{λM} R` with `V_{λM} =β λz λx. M` (M closed, so `λ.M = λx.M`). For closed +`M, N`, the APP program gives `P C (01⌜M⌝⌜N⌝R) = P (TC) ([1] t) = TC t N'` +with `t = ⌜M⌝⌜N⌝R` and `N'` the variable law's rest for `[1]t`, which must +equal `C V_{MN} R`. + +Write `T k =β λt λj. G[k,t,j]` (the two laws apply `T k` to two arguments and +need a `C`-headed result without leading λ, so this hnf shape is forced). The +head of `G[k,t,j]` is `t`, `j`, or `k` — the only free variables; a leading +λ would survive into the result. + +*Head `j`.* The ABS law gives `T(TC) V R = R G⃗`, `R`-headed. ✗ + +*Head `t`* (the natural reader shape `λt j. t ⋯`). Then +`T(TC) V R = V A₁ … A_m` for fixed `m` (the `Aᵢ` may mention `V`, `R`, +`TC`). Take `M_n = λⁿ.1`, so `V_{M_n} =β λ^{n+1}.1`, the projection onto its +last argument. For `n ≥ m+1`, `V_{M_n} A₁ … A_m =β λ^{n+1-m}.1`, a +λ-abstraction, but the law requires the `C`-headed `C V_{λM_n} R`. ✗ + +*Head `k`.* By the APP law's shape, `G = k A₁ A₂` exactly. Then +`T(TC) V R = TC A₁' A₂' = C A₁[C,A₁',A₂'] A₂[C,A₁',A₂']` with +`Aᵢ' = Aᵢ[TC,V,R]`, so `A₁[C,A₁',A₂'] =β λx.V` and `A₂[C,A₁',A₂'] =β R`, +while from APP, `A₁[C,t,N'] =β V_{MN}` and `A₂[C,t,N'] =β R` for genuine +streams `t`. So `A₁` is a value extractor for application code and must read +`t`'s bits; its hnf is `λ^q. h B⃗` with `h ∈ {t, j, k, bound}`, and since +`V_{MN} =β λz. M N` is a λ-term that is neither `C`-headed nor +`z`-headed for `M N = (λ.1)(λ.1)`, we have `q = 1` and `h ∈ {t, j}`. + - `h = t`: `A₁[TC,V,R] = λz. V B⃗` with `|B⃗| = p`; for `V = λ^{n+1}.1` this is + `λ^{n+2-p}.1`, and then `A₁[C,A₁',A₂'] = λz. A₁' B⃗' = λ^{n+3-2p}.1`, which + must be `λx.V = λ^{n+2}.1`, forcing `p = ½`. ✗ + - `h = j`: `A₁[TC,V,R] = λz. R B⃗`, so `A₁[C,A₁',A₂'] = λz. A₂' B⃗'` with + `A₂' = A₂[TC,V,R]`; `A₂` must compute the rest from the stream, so its head + is `t` (→ `V ⋯`, a λ for large-arity `V`, not `R`), `j` (→ `R ⋯`, giving + `λz. R ⋯ B⃗'`, not `λx.V`), or `C` (→ `C ⋯`, not `λx.V`). ✗ +Hence no `T`. ∎ + +What the theorem says: the second tag bit needs a *second* decoding state, +and plain continuations cannot carry it. The state must live in a separate +object — the 165's `next` (a distinct λ-abstraction applied by the stream), the +166's `λb. b (P KA) (P KP)`, or an explicit mode flag (203–219). Each of these +pays at least one λ and one application beyond the first reader, and the +165's `λu λr. r next` + `λbit1. P (λexp. bit1 · ·)` is the cheapest +arrangement found; combined with 3.1 and the recorded handler bound this is why +the two-reader structure is locally rigid. + +### 3.5 Why the remaining "share a decoder" questions of the brief are closed + +- *Variable case and APP case sharing a step.* Both start with `…1`, but the + variable's `1` terminates with a `0` after which the stream must not be + touched (it is the rigid rest), while the APP's `1` is followed by two codes + that must be parsed. A shared step would have to apply the tail in the APP + case and not apply it in the variable case; by 3.3 the only discriminating + information is the first bit, which the handler already dispatches on. +- *The skip doing NEXT's job.* By 3.1 the skip is `s s X` with `X` erased on + every stream; it can carry no NEXT work (the 166–169 variants `s s next`, + `s s cont`, … change only off-stream behaviour). +- *The environment walk and the tag dispatch sharing a decoder.* Both already + use the bare Boolean as the decoder. The cell `λzx zy. zx arg (zy args)` puts + the tail inside its `F` branch (the walk must *apply* the tail to the outer + environment), the handler `λb. b Z cont` puts the tail after the dispatch + (the variable arm must *not* apply the tail). A handler of cell shape returns + `cont' b' r''` on a variable, which needs a 27-bit stream rebuild; a cell of + handler shape is the 25-bit K-repair cell (166). Sharing one selector + `λx y b. b x y` between them never pays: a call `W X Y` costs ≥ 8 bits, the + same as the inline `λb. b X Y`, plus the let. +- *Reading the second bit by a stream application that also supplies the + parse.* `r next` already does both. Any alternative must either bind `b₂` + (`λbit1 …`, the 165), use `b₂` as a selector of parser partials (166), use + it as the continuation (`r intL`, the recorded 164 that loses one component), + or recover it later from the duplicate copy (180/176 above, the depth tax). + +## 4. Honest read + +Within the 165's protocol (closures applied to environments, raw unary codes +as variable values, two-argument continuations, the real rest), I now believe +the control structure is forced module by module *and* at every two-module +seam I could name: the whole-stream skip forces the duplicate (3.1); trailing +arguments and alternative variable-arm conventions die at the rigid root +continuation (3.2, 3.3); carrying the second-bit state in the continuation is +impossible (3.4); and the depth tax makes every "inline NEXT and recover the +bit later" rendering lose by ≥ 11 bits (the 176 is the best of that family). + +Where a sub-165 could still hide, if anywhere: + +1. **Not in dispatch.** The brief's four questions for this lane have negative + answers with proofs or exact costs. I would not spend another lane here. +2. **A different value/continuation protocol at the root.** Every protocol I + tried was fine internally and failed only because `C` is rigid and binary. + A protocol that is *cheaper internally* and whose root adapter is *free* + (absorbed into the knot or into the always-zero first bit) would beat the + analysis above. The 200 shows the obvious root shortcut costs ~21 bits; the + question is whether a knot can hand the root a differently-typed entry at + no cost. That is the knot lane's seam (`R Z →* next next`), approached from + the protocol side. +3. **The index tax (29 bits).** `cont` costs 8 bits of depth, `intL` 5, + `next` 4. These are pure layout; letopt has exhausted let structures of the + 165's own core, but a core with fewer *references* (one `cont`, one `intL`) + would change what letopt can do. I found no such core — every attempt to + share the `cont` application between ABS and APP costs a λ. +4. **A proof.** 3.4 is the kind of statement that could go to Lean: it is a + finite case analysis over hnf heads with the projection programs + `λⁿ.1` as witnesses. Together with the handler bound, 3.1–3.3 and the + nextfuse obstructions, the conditional theorem "165 is minimal among + interpreters with the 165's NEXT/ABS/APP protocol and a stream-headed + reader" looks within reach as a handwritten result; the unconditional + question remains as open as the brief says. diff --git a/data/self-interpreter/reasoning_floor/dispatch/algebra_scan.py b/data/self-interpreter/reasoning_floor/dispatch/algebra_scan.py new file mode 100644 index 00000000..275ab5db --- /dev/null +++ b/data/self-interpreter/reasoning_floor/dispatch/algebra_scan.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Small symbolic scan: what do application-only terms over s (and K,F,I) +compute on the four stream shapes ABS=00r, APP=01r, V1=10N, V2=110N, with +rigid r / N? Light computation: a few thousand terms at most.""" +import itertools, sys +from lab import * + +RIG = ["r", "N", "X", "Y"] # rigid names, innermost first +# free indices: s is bound by an outer lambda, then rigid names follow. + +def shapes(): + r = ("V", 1); N = ("V", 2) # inside \s. body : s=0, r=1, N=2, X=3, Y=4 + # Actually we substitute s directly, so build terms with s at index 0. + return { + "ABS": bits("00", ("V", 0)), # r at index 0 after substitution + "APP": bits("01", ("V", 0)), + "V1": bits("10", ("V", 1)), + "V2": bits("110", ("V", 1)), + } + +def terms(n, leaves): + """All application trees with n leaves from `leaves` (names).""" + if n == 1: + for l in leaves: + yield l + return + for k in range(1, n): + for a in terms(k, leaves): + for b in terms(n - k, leaves): + yield ("A", a, b) + +def build(t, env): + if isinstance(t, str): + return env[t] + return ("A", build(t[1], env), build(t[2], env)) + +def showt(t): + if isinstance(t, str): + return t + l = showt(t[1]); r = showt(t[2]) + if not isinstance(t[2], str): r = "(" + r + ")" + return l + " " + r + +def main(): + maxleaves = int(sys.argv[1]) if len(sys.argv) > 1 else 4 + extra = sys.argv[2:] if len(sys.argv) > 2 else [] + names = ["s"] + extra + consts = {"K": K, "F": F, "I": I} + sh = shapes() + for n in range(1, maxleaves + 1): + for t in terms(n, names): + if "s" not in showt(t): + continue + row = [] + for name, s in sh.items(): + env = {"s": s} + for e in extra: + env[e] = consts[e] if e in consts else ("V", {"X": 2, "Y": 3}[e]) + v = nf(build(t, env), 2000) + row.append(None if v is None else pretty(v, ["r", "N", "X", "Y"])) + print(f"{showt(t):22s} | " + " | ".join("⊥" if x is None else x for x in row)) + +if __name__ == "__main__": + main() diff --git a/data/self-interpreter/reasoning_floor/dispatch/dup_replay_180.lam b/data/self-interpreter/reasoning_floor/dispatch/dup_replay_180.lam new file mode 100644 index 00000000..61302b27 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/dispatch/dup_replay_180.lam @@ -0,0 +1,12 @@ +-- 180: no `next` let. The zero arm keeps both copies of the tag-less stream: +-- one supplies the body stream through `r (\v. ...)` (the Scott application +-- drops the second tag bit), the other re-reads that bit after the body +-- parse as `u bit0` (bit0 = K in this arm). New algorithm, not sub-165. +(\x. x x) (\x. (\intL. \cont. \list. + list (\bit0. bit0 + (\u \r. r (\v. intL (\exp. u bit0 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + cont) + (list list list)) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/dispatch/fake_var_second_parse.lam b/data/self-interpreter/reasoning_floor/dispatch/fake_var_second_parse.lam new file mode 100644 index 00000000..8918fc48 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/dispatch/fake_var_second_parse.lam @@ -0,0 +1,8 @@ +-- Every constructor parses twice: ABS feeds the second parse a constant +-- stream that returns the completed ABS result (R (K (K X)) = X). +(\x. x x) (\x. (\intL. \cont. + (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp \rest. intL + (\exp2. cont (\args. exp args (exp2 args))) + (bit1 (\u \v. cont (\args \arg. exp (\zx \zy. zx arg (zy args))) rest) rest)))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/dispatch/lab.py b/data/self-interpreter/reasoning_floor/dispatch/lab.py new file mode 100644 index 00000000..969df813 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/dispatch/lab.py @@ -0,0 +1,216 @@ +#!/usr/bin/env python3 +"""Lane scratch harness: named-lambda parsing with rigid free names, a fuelled +normal-order normalizer, sizes, and the exact contract probe on one program. + + from lab import * + t = parse(r"\b. b Z c", free=["Z", "c"]) # free names become rigid + print(show(nf(t))) # named normal form + print(size(parse(SRC))) # BLC size of a closed term + probe(E_src, M_src) # contract check via blam +""" +import sys +from pathlib import Path + +ROOT = Path("/Users/a9lim/Work/blam") +sys.path.insert(0, str(ROOT / "tools")) +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +sys.setrecursionlimit(1000000) + +import blcc +import lc + +K = ("L", ("L", ("V", 1))) +F = ("L", ("L", ("V", 0))) +I = ("L", ("V", 0)) + + +def parse(src, free=()): + """Parse blcc .lam syntax; names in `free` (innermost first) become free + de Bruijn indices beyond the bound ones, i.e. rigid variables.""" + p = blcc.P(blcc.strip_comments(src)) + e = blcc.p_lc(p) + p.ws() + assert p.i == len(p.t), p.t[p.i:p.i + 40] + return blcc.to_db(e, tuple(free)) + + +def size(t): + return lc.size(t) + + +def enc(t): + return lc.enc(t) + + +def shift(d, c, t): + return lc.shift(d, c, t) + + +def nf(t, fuel=200000): + try: + return lc.nf(t, [fuel]) + except lc.Fuel: + return None + + +def whnf(t, fuel=200000): + f = [fuel] + while True: + if t[0] == "A": + h = whnf(t[1], f[0]) + if h is None: + return None + if h[0] == "L": + f[0] -= 1 + if f[0] < 0: + return None + t = lc.beta(h, t[2]) + continue + return ("A", h, t[2]) + return t + + +def show(t, free=()): + """Named display; free indices beyond the binders print as the given + names (innermost first), else #k.""" + names = list(free) + + def go(t, depth, prec): + if t[0] == "V": + i = t[1] + if i < depth: + return "v%d" % (depth - 1 - i) + j = i - depth + return names[j] if j < len(names) else "#%d" % j + if t[0] == "L": + vs = [] + b = t + while b[0] == "L": + vs.append("v%d" % (depth + len(vs))) + b = b[1] + s = "\\" + " ".join(vs) + ". " + go(b, depth + len(vs), 0) + return "(" + s + ")" if prec > 0 else s + s = go(t[1], depth, 1) + " " + go(t[2], depth, 2) + return "(" + s + ")" if prec > 1 else s + + return go(t, 0, 0) + + +def cons(b, r): + return ("L", ("A", ("A", ("V", 0), shift(1, 0, b)), shift(1, 0, r))) + + +def bits(s, tail): + """Scott stream of the bit string s (ASCII 0/1) ending in `tail`.""" + t = tail + for ch in reversed(s): + t = cons(K if ch == "0" else F, t) + return t + + +def code(t): + return lc.enc(t) + + +def app(*ts): + r = ts[0] + for x in ts[1:]: + r = ("A", r, x) + return r + + +def closed_size(src): + return size(parse(src)) + + +def eq(a, b, fuel=200000): + na, nb = nf(a, fuel), nf(b, fuel) + return na is not None and na == nb + + +def blam_nf(t, beta=1 << 20): + import subprocess + r = subprocess.run([str(ROOT / "target/release/blam"), "normalize", enc(t), + "--beta", str(beta)], capture_output=True, text=True) + out = r.stdout.split() + if r.returncode or not out or not set(out[0]) <= {"0", "1"}: + return None + return out[0] + + +def probe(E, M, beta=1 << 20): + """Exact contract on one program: \\c \\n. E c ( ++ n) vs \\c \\n. c (\\z.M) n.""" + want = ("L", ("L", ("A", ("A", ("V", 1), ("L", shift(3, 0, M))), ("V", 0)))) + got = ("L", ("L", ("A", ("A", shift(2, 0, E), ("V", 1)), + bits(code(M), ("V", 0))))) + w = blam_nf(want, 1 << 16) + g = blam_nf(got, beta) + if w is None: + return "skip" + if g is None: + return "fuel" + return "ok" if g == w else "WRONG" + + +def db(src): + """Parse Tromp 1-based de Bruijn notation.""" + import db as dbp + return dbp.parse(src) + + +if __name__ == "__main__": + for a in sys.argv[1:]: + t = parse(a) + print(size(t), show(t)) + + +def pretty(t, free=()): + """Like show, but prints Scott cons cells as [b]tail, K/F/I by name.""" + names = list(free) + + def is_cons(t, depth): + # \f. f B R with f = index 0 not free in B, R + if t[0] == "L" and t[1][0] == "A" and t[1][1][0] == "A" and t[1][1][1] == ("V", 0): + B, R = t[1][1][2], t[1][2] + if not occ(0, B) and not occ(0, R): + return shift(-1, 0, B), shift(-1, 0, R) + return None + + def occ(i, t): + if t[0] == "V": + return t[1] == i + if t[0] == "L": + return occ(i + 1, t[1]) + return occ(i, t[1]) or occ(i, t[2]) + + def go(t, depth, prec): + if t == K: + return "K" + if t == F: + return "F" + if t == I: + return "I" + c = is_cons(t, depth) + if c: + b, r = c + bs = go(b, depth, 2) + bs = {"K": "0", "F": "1"}.get(bs, bs) + return "[" + bs + "]" + go(r, depth, 2) + if t[0] == "V": + i = t[1] + if i < depth: + return "v%d" % (depth - 1 - i) + j = i - depth + return names[j] if j < len(names) else "#%d" % j + if t[0] == "L": + vs = [] + b = t + while b[0] == "L": + vs.append("v%d" % (depth + len(vs))) + b = b[1] + s = "\\" + " ".join(vs) + ". " + go(b, depth + len(vs), 0) + return "(" + s + ")" if prec > 0 else s + s = go(t[1], depth, 1) + " " + go(t[2], depth, 2) + return "(" + s + ")" if prec > 1 else s + + return go(t, 0, 0) diff --git a/data/self-interpreter/reasoning_floor/dispatch/next_knot.lam b/data/self-interpreter/reasoning_floor/dispatch/next_knot.lam new file mode 100644 index 00000000..0ed46498 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/dispatch/next_knot.lam @@ -0,0 +1,9 @@ +-- The knot produces NEXT (continuation, then second tag bit); the parser is +-- let-bound inside it with recursive calls `x x c`. The root uses the fact +-- that every closed program starts with 0: E C s = r (NEXT_C). +\c \s. s (\b \r. r ((\x. x x) (\x. \cont. \bit1. + (\intL. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args)))))) + (\c2 \s2. s2 (\b2. b2 (\u \r2. r2 (x x c2)) c2) (s2 s2 s2))) + c)) diff --git a/data/self-interpreter/reasoning_floor/dispatch/variants1.py b/data/self-interpreter/reasoning_floor/dispatch/variants1.py new file mode 100644 index 00000000..b122825f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/dispatch/variants1.py @@ -0,0 +1,13 @@ +from lab import * +ABS = r"(cont (\args \arg. exp (\zx \zy. zx arg (zy args))))" +APP = r"(intL (\exp2. cont (\args. exp args (exp2 args))))" +def knot(body): return rf"(\x. x x) (\x. (\intL. {body}) (x x))" +V = {} +V["165"] = knot(rf"\cont. (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) (\bit1. intL (\exp. bit1 {ABS} {APP}))") +V["next inlined"] = knot(rf"\cont. \list. list (\bit0. bit0 (\unused \r. r (\bit1. intL (\exp. bit1 {ABS} {APP}))) cont) (list list list)") +V["next=\\r\\u. r B, Z=next"] = knot(rf"\cont. (\next. \list. list (\bit0. bit0 next cont) (list list list)) (\r \u. r (\bit1. intL (\exp. bit1 {ABS} {APP})))") +V["next=\\l. l B, Z=\\u.next"] = knot(rf"\cont. (\next. \list. list (\bit0. bit0 (\u. next) cont) (list list list)) (\l. l (\bit1. intL (\exp. bit1 {ABS} {APP})))") +V["select-first"] = knot(rf"\cont. (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) (\bit1. intL (bit1 (\exp. {ABS}) (\exp. {APP})))") +for k, src in V.items(): + t = parse(src) + print(f"{size(t):4d} {k}") diff --git a/data/self-interpreter/reasoning_floor/dispatch/variants2.py b/data/self-interpreter/reasoning_floor/dispatch/variants2.py new file mode 100644 index 00000000..40e444a4 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/dispatch/variants2.py @@ -0,0 +1,17 @@ +from lab import * +import db as dbp +ABS = r"(cont (\args \arg. exp (\zx \zy. zx arg (zy args))))" +APP = r"(intL (\exp2. cont (\args. exp args (exp2 args))))" +def knot(body): return rf"(\x. x x) (\x. (\intL. {body}) (x x))" +V = {} +# zero arm reads b2 from the duplicate copy u via bit0 (=K), parses r2 via r (\v. ...) +V["dup-replay inline"] = knot(rf"\cont. \list. list (\bit0. bit0 (\u \r. r (\v. intL (\exp. u bit0 {ABS} {APP}))) cont) (list list list)") +# same but with the second copy used for r2 and the first for b2 +V["dup-replay inline 2"] = knot(rf"\cont. \list. list (\bit0. bit0 (\u \r. u (\v. intL (\exp. r bit0 {ABS} {APP}))) cont) (list list list)") +# let-bound next taking u and bit0 +V["dup-replay let"] = knot(rf"\cont. (\next. \list. list (\bit0. bit0 (\u \r. r (next u bit0)) cont) (list list list)) (\u \b0 \v. intL (\exp. u b0 {ABS} {APP}))") +progs = [r'\1', r'\\1', r'\\2', r'(\1 1)(\\1)', r'\\\1 2 3', r'\(\1 1) 1'] +for k, src in V.items(): + t = parse(src) + res = [probe(t, dbp.parse(p)) for p in progs] + print(f"{size(t):4d} {k} {res}") diff --git a/data/self-interpreter/reasoning_floor/env/PROMPT.md b/data/self-interpreter/reasoning_floor/env/PROMPT.md new file mode 100644 index 00000000..2f00c028 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/PROMPT.md @@ -0,0 +1,32 @@ +Lane "env": a cheaper value/environment protocol. Your lane directory is +/Users/a9lim/Work/blam/tmp/overnight/env/ (write only there). Read +/Users/a9lim/Work/blam/tmp/overnight/BRIEF.md first; it is the shared ground truth. + +The 165 spends ABS 40 (of which the cell `\zx \zy. zx arg (zy args)` is 24), +APP 35 (of which the lift `\args. exp args (exp2 args)` is 19), and VAR about +5 bits (just `cont` in the handler): VAR is nearly free because a variable's +value is its own remaining unary code `r`, and the environment cell performs +the lookup when applied as `r e = e b' r'' = b' arg (r'' args)`. Together +ABS + APP + VAR ≈ 80 bits, with 11 of the 29 index bits inside them. + +Goal: a value/environment protocol whose total interpreter is ≤ 164 bits — +either with the knot, reader and NEXT header unchanged and ABS+APP+VAR ≤ 79, +or with coordinated changes elsewhere whose exact sum is ≤ 164. Or, if you +become convinced none exists in a class you can delimit, a proof of that. + +Directions not yet exhausted (the record in interpreter.md §5–§6 lists what +was): (1) The input stream already contains Scott pairs `cons b r = λf. f b r` +for free; inside ABS the stream at hand is the code of the body. Can any +environment, closure or value structure be borrowed from cells the stream +supplies, instead of built? (2) The cell `zx arg (zy args)` and the lift +`exp args (exp2 args)` share the skeleton `a b (c d)`; a let costs ~32, but a +protocol where one is obtained from the other by *application* (not a let) +was not tried. (3) Values as functions of the environment is a choice: the +contract only fixes the root value `λz. M`. Any internal representation is +allowed if the root's is β-equal to `λz.M`, but §5's exclusions (cell/APP +alias, η-collapse, canonical closed values) constrain it — read them. (4) +Argument orders: λargs/λarg, zx/zy, and the bit convention interact; the index +sum is where small wins hide (X = 29; cont alone costs 8). + +Every constructed interpreter must be checked with the battery. Report as the +brief says. diff --git a/data/self-interpreter/reasoning_floor/env/REPORT.md b/data/self-interpreter/reasoning_floor/env/REPORT.md new file mode 100644 index 00000000..32749a1a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/REPORT.md @@ -0,0 +1,640 @@ +# Env lane: no sub-165 construction; a bound for borrowed raw data + +**No interpreter at or below 164 bits was found.** One new complete +construction passes at **171 bits**. The mathematical result is a +handwritten **24-bit cell / 19-bit lift bound even when raw input data are +available to borrow**, with precise rigid-law hypotheses below. It does not +exclude arbitrary changed value/environment protocols. + +## 1. Complete interpreter ledger + +| File | Exact battery line | Idea | +|---|---|---| +| `borrow_abs_tag.lam` | `171 bits ok=667 skip=1 fail=0 borrow_abs_tag.lam` | Use ABS's known-zero input tag as K in a curried environment cell. | +| `reference165.lam` | `165 bits ok=667 skip=1 fail=0 reference165.lam` | Unchanged attaining reference, copied for the comparison. | + +Both have `.blc` files. The new candidate has `(L,A,X)=(17,26,31)`, against +the reference's `(17,25,29)`. Every candidate constructed was battery-checked. +No additional failed complete interpreters were constructed. + +The new cell is + +``` +lambda b. b (bit1 arg) (lambda r.r args), +``` + +where `bit1=K` in ABS. Its module costs **30**, versus **24** for the original. +The lambda count is unchanged, one application is added, and index excess +increases by two: total **+6 bits**. The alternative literal-K curried cell +and the own-selector repair were already recorded; the new artifact uses +the captured input tag itself. + +The batteries used two workers and took 2.152 and 2.140 seconds. The 171 +also returned the exact rigid suffix on both Omega and lambda-Omega with a +tail-projecting continuation. Logs: `battery.log`, `checks.json`. Reproduce: + +``` +PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/env/check.py +PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/env/origin_arithmetic.py +``` + +`check.py` uses the lane's frozen binary and puts compilation temporaries in +the lane. No repository files were changed, no searches were run, and no +external consultations or Lean runs were performed. + +## 2. Exact identities and correctness + +For the proposed cell + +``` +C_tag(a,e) = lambda b.b (K a) (lambda r.r e), +``` + +the exact laws are + +``` +C_tag(a,e) K n ->* (K a) n -> a +C_tag(a,e) F r ->* (lambda q.q e) r -> r e. +``` + +The first uses K twice and never inspects n. The second selects the +continuation of the previous environment. They are precisely the two unary +lookup cases required by the unchanged raw variable values. Induction on +the variable index and then on source syntax therefore transfers the usual +parser correctness argument, including divergent source programs. This is +a handwritten transfer argument, supplemented by the battery, not a new +Lean proof. + +**The cell is not beta-equal to the canonical cell on arbitrary selectors.** +Its beta-normal form is + +``` +lambda b.b (lambda u.a) (lambda r.r e), +``` + +whereas the canonical form is + +``` +lambda b r.b a (r e). +``` + +The script confirms these normal forms differ. Only the Boolean selector +laws are claimed for the construction. + +Two existing skeleton identities were also rechecked, rather than claimed +as discoveries: + +``` +Cell(e,e) f g = f e (g e) +Cell(a,e) Cell(d,h) = lambda r.a d (r e h). +``` + +The first follows by the cell's two substitutions. For the second, +`Cell(a,e) Cell(d,h)` first gives +`lambda r.Cell(d,h) a (r e)`, then +`lambda r.a d ((r e) h)`. The diagonal identity needs an environment cell +with the *same complete environment in both fields*. The existing current +cell contains `(arg,args)` instead. Ordinary cell application does not +silently supply this diagonal. + +## 3. Lower bound with borrowed data + +Full proof: [`borrowed-data-bound.md`](borrowed-data-bound.md). + +The class permits any finite collection of supplied K/F bits and finite +Scott bit streams ending in fresh rigid tails, including a favorable fixed +body code. Candidate terms may use their actual reductions and contain +arbitrary beta redexes. Data are independent of semantic parameters and +local binders. Parsed closures and concrete parser/NEXT implementations are +outside the loan class. + +In the actual nearest-variable frames `[a,e,...]` and `[g,f,...]`, respectively, +the requirements are the rigid normal-form equations + +``` +C(a,e; loans) =beta lambda b r.b a (r e), +V(f,g; loans) =beta lambda e.f e (g e). +``` + +Then `|C|>=24` and `|V|>=19`. Thus retaining the other 122 source bits +cannot beat **165**, even with those extra raw-data loans. Additional +bindings or code needed to obtain the loans do not help this lower bound. + +The proof uses the following counted facts. + +* A quoted Scott application's right operand remains a Boolean or raw + suffix with no semantic parameters. Such applications cannot survive as + any of the three applications in either displayed target. +* Quotation binders cannot become the live capturing binders in those + targets. With only one code lambda, affine data cannot duplicate it + before it is consumed. Therefore the cell needs at least two original + code lambdas; the lift needs at least one. +* With at most three code applications, beta reduction cannot increase + their count. If a code-origin redex has body count u, argument count v, + and k uses, its change is `(k-1)v-1`, where `k<=u+1` and + `u+v+1<=3`. The only zero-change case is `(u,v,k)=(1,1,2)`. +* For a cell with exactly three applications, that compression case puts + both fresh parameters a,e in the one-application argument. Its two + available code-variable leaves are then a and e. All remaining code + binders are vacuous, so it cannot yield the target. Consequently the + cell's two live target binders retain source ancestry: a,e contribute + at least 2+3 index excess, and outer b below inner r contributes one. + This gives `2*2+4*3+2+6=24`. +* The only other potential sub-24 cell case has `(L,A,X)=(2,4,<=1)`. + The mandatory outer e reference consumes its entire index budget; no + loan reference can occur. Every lambda subterm is then closed in + isolation, a beta-invariant property incompatible with the target's + live captures. The larger L/A cases already cost 24 or more. +* For the lift, one surviving lambda must capture f,g, contributing + at least 2+1 index excess: `2+12+2+3=19`. Two lambdas and three + applications already cost 18, and f necessarily contributes at least + one excess bit. More applications are larger still. + +This is **handwritten**, not machine-checked. `origin_arithmetic.py` checks +only the finite arithmetic case split; `check.py` checks the attaining +module sizes and fixed beta identities. Neither checks the origin lemmas. + +**Material limitation:** this is not a lower bound for all cells satisfying +only `C K n=a` and `C F r=r e`. The curried cell used by the 171 witnesses +why those laws must not be conflated with beta equality to the canonical +cell. Nor does it price a joint representation in which a parsed exp lends +interpreter-origin code, or a common helper crosses module boundaries. + +## 4. Where a smaller interpreter could still hide + +The raw-input borrowing route has a concrete limit: unmodified quote cells +cannot donate the live captures required by the canonical environment cell +or the ordinary pointwise lift. Merely replacing a lambda by a borrowed +input Boolean is also not automatically a wire saving; the 171 measures +the index penalty directly. + +The remaining constructive distinction is **raw input data versus already +compiled closures**. A parsed `exp` contains interpreter-origin binders and +applications; the proof above does not make it passive. A body-dependent +ABS operation that consumes that structure, or a changed representation +that shares its operation with APP before an explicit cell is materialized, +could escape. Such a construction would need to preserve exact beta +distinctions and the rigid root suffix; the previously proved alias and +eta-collapse obstructions still apply. + +For proof work, the next meaningful extension is to the two Boolean lookup +laws, without assuming the canonical cell's entire off-Boolean normal form. +That would cover the curried/selector-repair family as well. This lane does +not establish that stronger bound, and I have no verified cheaper protocol +to hand off. + +## 5. Boolean-only cells, the actual frame, and actual-value APP + +**Result.** A uniform cell replacement costs **at least 24 bits under the +two Boolean lookup laws alone**. Arbitrary source beta redexes are allowed. The proof below also +allows the 165's concrete `intL` and `x` implementations, rather than treating +those two variables as opaque. The APP lift still costs **19 bits on the +165's actual values and canonical environments**; its proof does not assume +rigid `f,g` or the lift's entire off-domain normal form. + +These are handwritten proofs. The fixed checks in +[`check_boolean_bounds.py`](check_boolean_bounds.py) pass; their output is +[`boolean_checks.json`](boolean_checks.json). They check equations, costs, +and separating examples, **not the completeness of the arguments**. No +enumeration, new complete interpreter, battery, or polish run was needed: +there is no cheaper construction to submit. + +### Exact hypotheses and prices + +Write `K = lambda x y.x`, `F = lambda x y.y`, `I = lambda x.x`, and +`cons b r = lambda h.h b r`. All equations below are beta equations, not +beta-eta equations. Size is the original, unoptimized BLC source size: + +``` +size = 2 L + 4 A + 2 + X, +``` + +where `X` is the sum of zero-based de Bruijn indices. The actual ABS frame, +nearest binder first, is + +``` +[a, e, exp, bit1, cont, intL, x] + 0 1 2 3 4 5 6 . +``` + +The candidate `C` may use every variable in that frame. It must obey + +``` +C K n =beta a, C F r =beta r e +``` + +for independent rigid `a,e,n,r`. This is a **uniform cell interface**: the +laws must hold in particular when `exp` is the parsed value of the closed +identity, `cont` is a fresh root continuation, and `bit1=K`. In that +specialization `exp =beta K I =beta F`. The two recursive frame values +remain their actual 165 implementations throughout the proof below. +A body-dependent replacement exempted from these lookup laws when its body +ignores the environment is outside this statement. + +This quantifier is necessary. For a single favorable parsed body, let + +``` +Hcell = lambda u v b r.b u (r v), +exp = K Hcell, +Cspecial = exp a a e. +``` + +`Hcell` is closed, so `exp` is an actual closed-program value. `Cspecial` +costs **17 bits** in the stated frame and reduces to the canonical cell: +the first a is the discarded environment argument, and the next a,e feed +Hcell. It satisfies both lookup laws for that exp. It fails when `exp=F`. +Thus a claim quantifying over only `a,e,n,r` while fixing an arbitrary +helpful parsed exp is false. The theorem below concerns one replacement +that obeys the interface across bodies, not that pointwise claim. The +17-bit expression is a counterexample to an omitted hypothesis, not a +working interpreter replacement. + +There are two ways raw input borrowing is covered: + +* With the parser neighbors opaque, any auxiliary frame variables outside + `[a,e]` may instead hold K, F, or finite Scott bit streams ending in fresh + rigid tails. Their contents may be chosen favorably and used by reduction. +* With the concrete 165 frame, its `bit1` and the specialization `exp=F` + are available for use. Additional raw-data loans may be put outside that + frame. Their tails must be independent of `a,e,n,r` and the candidate's + binders. References are charged at their actual indices. Creating a new + cheap inner stream slot by changing the surrounding protocol requires + repricing that changed frame; it is not an extra free variable here. + +For APP the actual frame is `[g,f,bit1,cont,intL,x]`, with base indices +`0,1,2,3,4,5`. The required law is only + +``` +V(f,g) E =beta f E (g E) +``` + +on values, environments, and continuation contexts produced by the +**unchanged 165 value protocol**, including the root's arbitrary environment +parameter. In particular it includes closed operands, and the two variable +operands in `lambda a.a a`. It does not quantify over rigid `f,g`. This APP statement uses exactly the +six-variable frame; it does not add operand-dependent quotation bindings. + +### A. The raw-data Boolean-cell lemma + +First suppose all auxiliary neighbors are rigid or raw-data loans of the +specified kind. This lemma is also the case of the actual-frame proof in +which neither concrete recursive helper is referenced. + +**1. Two live source binders and two semantic leaves are necessary.** +A live binder means one with at least one bound occurrence. The lookup laws +imply + +``` +C K =beta lambda n.a, C F =beta lambda r.r e. +``` + +This implication does not use eta conversion. For example, since `r` is +fresh, a head reduction of `C F r` to `r e` must expose a lambda in `C F`; +substitution of the fresh rigid `r` into its body is just renaming. Thus +that body reduces to `r e` before the renaming too. The first implication +is similar: a rigid head cannot discard the final fresh argument `n`. + +The head normal form of `C` must have one or two leading lambdas and have +its first bound variable as head. With no leading lambda, a rigid head +keeps the test arguments. With more than two, a lambda remains in `C K n`. +With one or two, a different head either stays rigid, becomes the fresh +second argument on the K test, or cannot distinguish the tests. +Consequently the lambda accepting the Boolean is live and captures the +semantic parameters. The eventual lambda in `C F = lambda r.r e` is +another live capturing lambda, present after the first has been consumed. + +Neither of these can originate in raw quotation data. A Scott binder has +one head occurrence and fixed raw fields; K's remaining binder is erasing; +F's remaining binder is the closed identity. No such remaining live binder +can acquire a capture of the fresh semantic parameters. Substituting a +source term into a quoted handler can expose that source term's binders, +but does not change their origin. + +There must therefore be at least **two distinct live source binder origins**. +If only one live source binder existed, every other source binder would be +erasing and every data binder affine. Before the sole live source binder's +first contraction nothing could copy it: its own disjoint argument cannot +contain it, and no other binder duplicates. Its contraction would leave no +live source binder. That cannot both consume the Boolean receiver and +leave the live receiver in `lambda r.r e`. + +The source also needs occurrences of both free `a` and free `e`, because +no loan or test introduces either. An application/lambda syntax tree with +`A` applications has exactly `A+1` variable leaves. The two bound +occurrences and the two free occurrences therefore give + +``` +L >= 2, A >= 3. +``` + +**2. Exactly three applications leave no room for a loan.** +If `A=3`, its four leaves are exactly `a,e` and one occurrence of each of +two distinct source binders. All source binders are affine; there is no +auxiliary-variable reference. An affine beta contraction strictly decreases +its number of applications. But the reduced term still satisfies the same +lookup laws and hence still needs at least three applications by step 1. +Therefore a successful three-application source has **no beta redex**. +This removes arbitrary source redexes without assuming the desired normal +form in advance. + +Let its head normal form have `k` leading lambdas. + +* If `k=2`, both `a,e` are below both lambdas, and the head occurrence of + the first binder is below the second. Thus `X >= 2+3+1=6`, giving + `size >= 4+12+2+6 = 24`. +* If `k=1`, write it as `lambda b.b U1 ... Um`. The unique occurrence of + `b` is this head, so none of the `Ui` depends on `b`. Here `m<=3`. + For `m=0` or `1`, the F test cannot be `lambda r.r e`. + For `m=2`, the laws force, literally in this normal form, + `U1=lambda n.a` and `U2=lambda r.r e`. This curried cell costs **25**: + `(L,A,X)=(3,3,5)`. + For `m=3`, every `Ui` has zero applications. Then `C F=U2 U3` cannot + normalize to `lambda r.r e`: if its sole application contracts it + disappears, while if it does not, the expression has a rigid head and + no leading lambda. This case is impossible. + +This explicitly admits the Boolean-only curried protocol. It never +identifies that protocol with `lambda b r.b a (r e)`. + +**3. The only remaining sub-24 size is impossible.** +With `A>=4,L>=2`, the only possibility below 24 is +`L=2,A=4,X<=1`. The necessary free `e` occurrence consumes the entire +index budget. Every `a,e` occurrence is consequently outside all source +lambdas, every bound occurrence has index zero, and no auxiliary reference +fits. Every lambda subterm is closed in isolation. + +That property is preserved by beta reduction: substitution cannot enter a +closed nested lambda. It also holds of the test value F. Thus `C F` cannot +reduce to the open lambda `lambda r.r e`, contradicting step 1. All larger +`L,A` cases already cost at least 24. + +This proves the raw-data lemma, with equality attained by the ordinary +24-bit cell. + +### B. Concrete parser helpers do not evade the cell bound + +This is the additional case needed to permit the actual `intL,x` frame +values. Write `G` for the 165's right-hand fixed-point operand and `P=G G` +for `intL`. For an arbitrary recursive parameter `p`, define + +``` +J(p,c) = lambda bit1.p (lambda exp.bit1 + (c (lambda e a.exp (lambda b r.b a (r e)))) + (p (lambda g.c (lambda e.exp e (g e))))) +Z(p,c) = lambda u r.r J(p,c) +H(p,c) = lambda b.b Z(p,c) c +R(p,c,s) = s H(p,c) (s s s). +``` + +The actual source gives + +``` +P c s =beta R(P,c,s), G q c s =beta R(q q,c,s). +``` + +The following head equations hold for every `p,c`: + +``` +R(p,c,K) =beta H(p,c) +R(p,c,F) =beta F +R(p,c,I) =beta lambda r.r J(p,c). +``` + +`J(p,c)` always has a leading lambda, so it cannot be beta-equal to the +rigid `a`. A stream with rigid head stays that head with the reader's +arguments appended. These facts suffice; the recursive parser is never +unfolded deeper. + +Specialize `exp=F`, `bit1=K`, and `cont` to a rigid root continuation. +Suppose a source below 24 uses a helper `h` equal to P or G. The mandatory +`a,e` references and one helper contribute at least 6 index excess for P, +or 7 for G. Two helper references already cost at least 25. Four +applications with one helper already cost at least 24. Thus there is +exactly one helper reference, and only these cases remain: + +| Applications | Source lambdas | Other source leaves | +| --- | --- | --- | +| 2 | at most 3 | only `a,e,h` | +| 3 | 0 | `a,e,h` and one of `a,e,F,K`; the G case cannot afford K | +| 3 | 1 | the restricted lambda cases described below | + +No `cont` reference or additional outer loan fits in this table. + +**Two applications.** All source lambdas are vacuous. A source beta redex +erases `a`, `e`, or the only helper. The first two lose a necessary +parameter; the third leaves a term with no live source binder and no +helper, which fails part A. An exposed vacuous lambda ignores the Boolean +and cannot distinguish the lookup laws. After excluding these cases, the +head must be `h`, since a rigid `a/e` head retains the test arguments. + +With one supplied operand, `P U K n = n Z(P,U)` and `G U K n` has the +rigid stream head `n`. With two supplied operands, `G U V K n = n +Z(U U,V)`. None equals `a`. The remaining form is `P U V`, where U and V +are lambda chains over the separate leaves `a,e`. Write `V=lambda^j.q`. +Then its K test is + +``` +(lambda^j.q) H(P,U) (V V V) K n. +``` + +There are four supplied arguments but at most three source lambdas. +The result either retains an argument at rigid `q`, or has the wrong +rigid head. It cannot be bare `a`. + +**Three applications, no source lambda.** If a Boolean is the head, +two supplied operands erase a branch containing one of the unique leaves +`a,e,h`; losing the helper leaves no live source binder. One supplied +operand either ignores the Boolean test (head K) or yields I (head F). +Rigid `a/e` heads fail directly. It remains to inspect an h-headed spine +of length one, two, or three. + +The one-operand cases and G's two-operand cases have the rigid `n` heads +just calculated. For P with two operands, the stream is an atom or a +one-application expression. A rigid stream head stays rigid with too many +arguments; an atomic K/F gives `lambda r.r J` or `n` after the K test; +`F u=I` gives `J`; `K u` gives rigid `u` with arguments. For three +operands, `P u K v K n` has rigid head `v`, and `P u F v K n = K n`; +a rigid stream again keeps its arguments. For G with three operands, +stream K gives `lambda r.r J`, stream F gives `n`, and a rigid stream +stays rigid. Each result differs from bare `a`. This covers both binary +bracketings inside the operand of a shorter spine as well. + +**Three applications, one source lambda.** The index budget gives a +shorter structural list. For G, the lambda can only be I. For P it is +one of: + +``` +I; +lambda t.t u or lambda t.u t, u in {a,e,P}; +lambda t.u, with the fourth leaf a second a. +``` + +In the final case the lambda wraps a single leaf. The reason is numerical: +P leaves at most one excess bit beyond the mandatory indices 5 and 1; +G leaves none. A free leaf below the lambda uses one such bit. With a live +lambda, the fourth leaf is its sole bound occurrence. With a vacuous +lambda, the only affordable fourth free leaf is another `a`. + +Contracting an existing source redex removes this sole, affine lambda and +reduces to the already excluded no-lambda/two-application cases, or loses +an essential parameter/helper. We may therefore examine only a lambda +buried as an operand of h or a rigid head. Rigid heads fail directly. + +* I as a stream gives `lambda r.r J`; the K test returns J, or, if an + extra rigid operand precedes the test, leaves that operand as head. + Other positions reduce to the preceding helper cases. +* If `u=P` in the middle family, P is inside the lambda; the outer head + is rigid or there is an existing source redex. If `u=a/e`, the outer + tree has atoms `P`, the other rigid parameter, and that lambda. The + only new stream cases are `lambda t.t u` and `lambda t.u t`. + The reader sends them to `H u S = u Z c S` and `u H S`, respectively, + both rigid heads with arguments. A G head with only two supplied + operands already fails independently of those operands. +* For a vacuous wrapper `W=lambda t.u`, a W-headed stream reduces to a + rigid u; an atomic W stream returns `u S`. Both keep arguments. A + wrapper in a continuation changes none of the preceding stream-head + arguments. If it wraps P itself, the outer head is rigid or a source + redex exists. + +Thus every possible helper-containing source below 24 fails. Combining +this with part A proves **24 in the actual ABS frame**, under the stated +uniform Boolean interface. In particular the proof does not silently +replace the real parser by a rigid variable. + +### C. The lift remains 19 on the 165's actual inputs + +This argument uses two families of actual parsing contexts. + +1. At a root application of closed operands M,N, their values are + `f=beta K M`, `g=beta K N`, and `cont` is a rigid public continuation. + Changing M between I and K with N=I proves that a correct source V + must reference f. Changing N between I and K with M=I proves that + it must reference g. All other frame values can be kept fixed. +2. In the body application of `lambda a.a a`, put + + ``` + g0 = cons K N + f0 = cons K (cons F g0) + E0 = lambda b r.b a (r z). + ``` + + These are the **actual correlated variable values**, including the + first value's suffix containing the second variable's code. Here + `f0 E0 (g0 E0) =beta a a`, with fresh rigid `a,z,N`. The surrounding + continuation is beta-equal to + + ``` + lambda v.C (lambda z a.v (lambda b r.b a (r z))). + ``` + + All its binders are affine. The quoted values, the APP tag F, and the + canonical environment E0 also have only affine binders. + Only E0 contains the fresh free a, and contains it once. + +First exclude concrete parser-helper shortcuts below 19. A source +referencing `f,g` and a helper P/G needs at least two applications. Three +applications already cost at least `14+1+4=19`. At two applications its +three leaves are exactly `f,g,h`; every source lambda is vacuous. G fits +no lambda. P fits at most one, wrapping one atom. Thus these are precisely +the two binary application trees over those three atoms, optionally with +one atom replaced by `lambda u.atom`. + +On closed-operand values, a right-nested tree `u (v w)` loses one of M,N: +if u is a constant closure it discards the entire inner expression; +otherwise the inner application of the two constant closures discards +one operand before reaching h. A wrapped h discards both. + +For a left-nested tree `(u v) w`, a wrapped head again loses one operand. +An unwrapped f/g head discards v. If the other operand survives in w, +the only possibilities, including its optional wrapper, are + +``` +M (K^k N) E or N (K^k M) E, k = 1 or 2, +``` + +in place of `M N`. For the first expression use `(M,N)=(F,I)` when k=1, +and `(I,I)` when k=2. For the second use `(K,I)` for either k. These give +distinct beta normal forms. + +If h is the head, G's third argument is the rigid root environment E: +`G u v E` has head E with two reader arguments, not the required closed +result. For P, its stream is a constant closure (possibly wrapped once), +which discards H and therefore discards the continuation operand entirely: + +``` +P c (K N) =beta N ((K N) (K N) (K N)). +``` + +Wrapping that stream once still discards c. One of M,N is lost. This +excludes every helper case below 19 using only actual closed operands. + +Now suppose V does not reference P/G. Apply it in context 2. If every +source binder were affine, the entire instance would be affine and could +not increase the number of free a occurrences from one to two. A correct +V therefore has a **nonlinear source binder**, with at least two bound +occurrences. Together with the necessary f and g references this forces + +``` +L >= 1, A >= 3. +``` + +Two lambdas and three applications cost at least `18+1=19`, because f's +base index is 1. Four applications and one lambda cost at least 20. +Consequently a source below 19 must have exactly one lambda and three +applications. Its four leaves are exactly `t,t,f,g`, where t belongs to +that lambda. If f and g are both below it, their excess indices are 2 and +1, giving the attained cost **19** immediately. + +If one or both are outside, the sole nonlinear lambda is consumed or +erased **before E0 is supplied**, as follows. + +* If its body contains one of f,g, call the lambda T and the other + variable k. The whole source is `T k` or `k T`. The former consumes + T on a quoted value. The latter becomes `T K Rk`, since the actual + variable quote k starts with K, and consumes T on K. +* If its body contains neither, it is `D=lambda t.t t`. The whole + source is a two-application tree over D,f,g. If D occurs in function + position, contract it before supplying E0. If it is the immediate + argument of f or g, that Scott cell sends it K and consumes it. + The only other position is `(f g) D` or `(g f) D`. But for any + `f=cons K Rf`, `g=cons K Rg`, + + ``` + f g =beta K Rf, g f =beta K Rg, + ``` + + so D is erased. + +After this reduction every remaining binder is affine. Supplying E0 can +therefore never produce the two free occurrences in `a a`. These are all +positions of the single lambda, so the sub-19 assumption is impossible. +The ordinary `lambda e.f e (g e)` attains **19**. + +This proof establishes 19 using actual closed values, the actual correlated +variable pair, and the actual surrounding continuations. Rigid f,g are not +an assumption. + +### Boundary and verification + +The Boolean cell result strictly strengthens the previous canonical-form +result. The normal curried alternative is 25 bits; the previous 171-bit +interpreter used the farther-away ABS tag to implement its constant arm, +which made that cell 30. Neither is required to be beta-equal to the +canonical cell off Boolean inputs. + +The APP result is for the **unchanged 165 value/environment protocol**. +It does not establish a 19-bit floor jointly with every alternative +Boolean-correct cell. Such a cell may contain nonlinear binders or behave +differently when given a non-Boolean value; the affine-environment witness +would then need a new argument. Nor do these local bounds forbid a +body-dependent cell, a changed VAR representation, moved binders, or shared +work that changes the two interfaces. Consequently I do not infer an +unconditional 165-bit lower bound, or a joint changed-cell/changed-lift +optimum, from them. + +The fixed check run took 0.122 s. It verified 15 beta equalities, 6 beta +inequalities, and the module sizes 24/25/27/17/19 in their actual frames. It +includes the reader's K/F/I equations, an actual-G check, the constant-stream +loss of the continuation, the correlated variable witness, the helper +counterexamples, and the 17-bit expression's dependence on its favorable body. No lower-bound argument here is in Lean or independently +reviewed. diff --git a/data/self-interpreter/reasoning_floor/env/battery.log b/data/self-interpreter/reasoning_floor/env/battery.log new file mode 100644 index 00000000..ee1b7fb0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/battery.log @@ -0,0 +1,2 @@ +165 bits ok=667 skip=1 fail=0 reference165.lam +171 bits ok=667 skip=1 fail=0 borrow_abs_tag.lam diff --git a/data/self-interpreter/reasoning_floor/env/boolean-section.md b/data/self-interpreter/reasoning_floor/env/boolean-section.md new file mode 100644 index 00000000..b4e4a9ed --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/boolean-section.md @@ -0,0 +1,455 @@ +## 5. Boolean-only cells, the actual frame, and actual-value APP + +**Result.** A uniform cell replacement costs **at least 24 bits under the +two Boolean lookup laws alone**. Arbitrary source beta redexes are allowed. The proof below also +allows the 165's concrete `intL` and `x` implementations, rather than treating +those two variables as opaque. The APP lift still costs **19 bits on the +165's actual values and canonical environments**; its proof does not assume +rigid `f,g` or the lift's entire off-domain normal form. + +These are handwritten proofs. The fixed checks in +[`check_boolean_bounds.py`](check_boolean_bounds.py) pass; their output is +[`boolean_checks.json`](boolean_checks.json). They check equations, costs, +and separating examples, **not the completeness of the arguments**. No +enumeration, new complete interpreter, battery, or polish run was needed: +there is no cheaper construction to submit. + +### Exact hypotheses and prices + +Write `K = lambda x y.x`, `F = lambda x y.y`, `I = lambda x.x`, and +`cons b r = lambda h.h b r`. All equations below are beta equations, not +beta-eta equations. Size is the original, unoptimized BLC source size: + +``` +size = 2 L + 4 A + 2 + X, +``` + +where `X` is the sum of zero-based de Bruijn indices. The actual ABS frame, +nearest binder first, is + +``` +[a, e, exp, bit1, cont, intL, x] + 0 1 2 3 4 5 6 . +``` + +The candidate `C` may use every variable in that frame. It must obey + +``` +C K n =beta a, C F r =beta r e +``` + +for independent rigid `a,e,n,r`. This is a **uniform cell interface**: the +laws must hold in particular when `exp` is the parsed value of the closed +identity, `cont` is a fresh root continuation, and `bit1=K`. In that +specialization `exp =beta K I =beta F`. The two recursive frame values +remain their actual 165 implementations throughout the proof below. +A body-dependent replacement exempted from these lookup laws when its body +ignores the environment is outside this statement. + +This quantifier is necessary. For a single favorable parsed body, let + +``` +Hcell = lambda u v b r.b u (r v), +exp = K Hcell, +Cspecial = exp a a e. +``` + +`Hcell` is closed, so `exp` is an actual closed-program value. `Cspecial` +costs **17 bits** in the stated frame and reduces to the canonical cell: +the first a is the discarded environment argument, and the next a,e feed +Hcell. It satisfies both lookup laws for that exp. It fails when `exp=F`. +Thus a claim quantifying over only `a,e,n,r` while fixing an arbitrary +helpful parsed exp is false. The theorem below concerns one replacement +that obeys the interface across bodies, not that pointwise claim. The +17-bit expression is a counterexample to an omitted hypothesis, not a +working interpreter replacement. + +There are two ways raw input borrowing is covered: + +* With the parser neighbors opaque, any auxiliary frame variables outside + `[a,e]` may instead hold K, F, or finite Scott bit streams ending in fresh + rigid tails. Their contents may be chosen favorably and used by reduction. +* With the concrete 165 frame, its `bit1` and the specialization `exp=F` + are available for use. Additional raw-data loans may be put outside that + frame. Their tails must be independent of `a,e,n,r` and the candidate's + binders. References are charged at their actual indices. Creating a new + cheap inner stream slot by changing the surrounding protocol requires + repricing that changed frame; it is not an extra free variable here. + +For APP the actual frame is `[g,f,bit1,cont,intL,x]`, with base indices +`0,1,2,3,4,5`. The required law is only + +``` +V(f,g) E =beta f E (g E) +``` + +on values, environments, and continuation contexts produced by the +**unchanged 165 value protocol**, including the root's arbitrary environment +parameter. In particular it includes closed operands, and the two variable +operands in `lambda a.a a`. It does not quantify over rigid `f,g`. This APP statement uses exactly the +six-variable frame; it does not add operand-dependent quotation bindings. + +### A. The raw-data Boolean-cell lemma + +First suppose all auxiliary neighbors are rigid or raw-data loans of the +specified kind. This lemma is also the case of the actual-frame proof in +which neither concrete recursive helper is referenced. + +**1. Two live source binders and two semantic leaves are necessary.** +A live binder means one with at least one bound occurrence. The lookup laws +imply + +``` +C K =beta lambda n.a, C F =beta lambda r.r e. +``` + +This implication does not use eta conversion. For example, since `r` is +fresh, a head reduction of `C F r` to `r e` must expose a lambda in `C F`; +substitution of the fresh rigid `r` into its body is just renaming. Thus +that body reduces to `r e` before the renaming too. The first implication +is similar: a rigid head cannot discard the final fresh argument `n`. + +The head normal form of `C` must have one or two leading lambdas and have +its first bound variable as head. With no leading lambda, a rigid head +keeps the test arguments. With more than two, a lambda remains in `C K n`. +With one or two, a different head either stays rigid, becomes the fresh +second argument on the K test, or cannot distinguish the tests. +Consequently the lambda accepting the Boolean is live and captures the +semantic parameters. The eventual lambda in `C F = lambda r.r e` is +another live capturing lambda, present after the first has been consumed. + +Neither of these can originate in raw quotation data. A Scott binder has +one head occurrence and fixed raw fields; K's remaining binder is erasing; +F's remaining binder is the closed identity. No such remaining live binder +can acquire a capture of the fresh semantic parameters. Substituting a +source term into a quoted handler can expose that source term's binders, +but does not change their origin. + +There must therefore be at least **two distinct live source binder origins**. +If only one live source binder existed, every other source binder would be +erasing and every data binder affine. Before the sole live source binder's +first contraction nothing could copy it: its own disjoint argument cannot +contain it, and no other binder duplicates. Its contraction would leave no +live source binder. That cannot both consume the Boolean receiver and +leave the live receiver in `lambda r.r e`. + +The source also needs occurrences of both free `a` and free `e`, because +no loan or test introduces either. An application/lambda syntax tree with +`A` applications has exactly `A+1` variable leaves. The two bound +occurrences and the two free occurrences therefore give + +``` +L >= 2, A >= 3. +``` + +**2. Exactly three applications leave no room for a loan.** +If `A=3`, its four leaves are exactly `a,e` and one occurrence of each of +two distinct source binders. All source binders are affine; there is no +auxiliary-variable reference. An affine beta contraction strictly decreases +its number of applications. But the reduced term still satisfies the same +lookup laws and hence still needs at least three applications by step 1. +Therefore a successful three-application source has **no beta redex**. +This removes arbitrary source redexes without assuming the desired normal +form in advance. + +Let its head normal form have `k` leading lambdas. + +* If `k=2`, both `a,e` are below both lambdas, and the head occurrence of + the first binder is below the second. Thus `X >= 2+3+1=6`, giving + `size >= 4+12+2+6 = 24`. +* If `k=1`, write it as `lambda b.b U1 ... Um`. The unique occurrence of + `b` is this head, so none of the `Ui` depends on `b`. Here `m<=3`. + For `m=0` or `1`, the F test cannot be `lambda r.r e`. + For `m=2`, the laws force, literally in this normal form, + `U1=lambda n.a` and `U2=lambda r.r e`. This curried cell costs **25**: + `(L,A,X)=(3,3,5)`. + For `m=3`, every `Ui` has zero applications. Then `C F=U2 U3` cannot + normalize to `lambda r.r e`: if its sole application contracts it + disappears, while if it does not, the expression has a rigid head and + no leading lambda. This case is impossible. + +This explicitly admits the Boolean-only curried protocol. It never +identifies that protocol with `lambda b r.b a (r e)`. + +**3. The only remaining sub-24 size is impossible.** +With `A>=4,L>=2`, the only possibility below 24 is +`L=2,A=4,X<=1`. The necessary free `e` occurrence consumes the entire +index budget. Every `a,e` occurrence is consequently outside all source +lambdas, every bound occurrence has index zero, and no auxiliary reference +fits. Every lambda subterm is closed in isolation. + +That property is preserved by beta reduction: substitution cannot enter a +closed nested lambda. It also holds of the test value F. Thus `C F` cannot +reduce to the open lambda `lambda r.r e`, contradicting step 1. All larger +`L,A` cases already cost at least 24. + +This proves the raw-data lemma, with equality attained by the ordinary +24-bit cell. + +### B. Concrete parser helpers do not evade the cell bound + +This is the additional case needed to permit the actual `intL,x` frame +values. Write `G` for the 165's right-hand fixed-point operand and `P=G G` +for `intL`. For an arbitrary recursive parameter `p`, define + +``` +J(p,c) = lambda bit1.p (lambda exp.bit1 + (c (lambda e a.exp (lambda b r.b a (r e)))) + (p (lambda g.c (lambda e.exp e (g e))))) +Z(p,c) = lambda u r.r J(p,c) +H(p,c) = lambda b.b Z(p,c) c +R(p,c,s) = s H(p,c) (s s s). +``` + +The actual source gives + +``` +P c s =beta R(P,c,s), G q c s =beta R(q q,c,s). +``` + +The following head equations hold for every `p,c`: + +``` +R(p,c,K) =beta H(p,c) +R(p,c,F) =beta F +R(p,c,I) =beta lambda r.r J(p,c). +``` + +`J(p,c)` always has a leading lambda, so it cannot be beta-equal to the +rigid `a`. A stream with rigid head stays that head with the reader's +arguments appended. These facts suffice; the recursive parser is never +unfolded deeper. + +Specialize `exp=F`, `bit1=K`, and `cont` to a rigid root continuation. +Suppose a source below 24 uses a helper `h` equal to P or G. The mandatory +`a,e` references and one helper contribute at least 6 index excess for P, +or 7 for G. Two helper references already cost at least 25. Four +applications with one helper already cost at least 24. Thus there is +exactly one helper reference, and only these cases remain: + +| Applications | Source lambdas | Other source leaves | +| --- | --- | --- | +| 2 | at most 3 | only `a,e,h` | +| 3 | 0 | `a,e,h` and one of `a,e,F,K`; the G case cannot afford K | +| 3 | 1 | the restricted lambda cases described below | + +No `cont` reference or additional outer loan fits in this table. + +**Two applications.** All source lambdas are vacuous. A source beta redex +erases `a`, `e`, or the only helper. The first two lose a necessary +parameter; the third leaves a term with no live source binder and no +helper, which fails part A. An exposed vacuous lambda ignores the Boolean +and cannot distinguish the lookup laws. After excluding these cases, the +head must be `h`, since a rigid `a/e` head retains the test arguments. + +With one supplied operand, `P U K n = n Z(P,U)` and `G U K n` has the +rigid stream head `n`. With two supplied operands, `G U V K n = n +Z(U U,V)`. None equals `a`. The remaining form is `P U V`, where U and V +are lambda chains over the separate leaves `a,e`. Write `V=lambda^j.q`. +Then its K test is + +``` +(lambda^j.q) H(P,U) (V V V) K n. +``` + +There are four supplied arguments but at most three source lambdas. +The result either retains an argument at rigid `q`, or has the wrong +rigid head. It cannot be bare `a`. + +**Three applications, no source lambda.** If a Boolean is the head, +two supplied operands erase a branch containing one of the unique leaves +`a,e,h`; losing the helper leaves no live source binder. One supplied +operand either ignores the Boolean test (head K) or yields I (head F). +Rigid `a/e` heads fail directly. It remains to inspect an h-headed spine +of length one, two, or three. + +The one-operand cases and G's two-operand cases have the rigid `n` heads +just calculated. For P with two operands, the stream is an atom or a +one-application expression. A rigid stream head stays rigid with too many +arguments; an atomic K/F gives `lambda r.r J` or `n` after the K test; +`F u=I` gives `J`; `K u` gives rigid `u` with arguments. For three +operands, `P u K v K n` has rigid head `v`, and `P u F v K n = K n`; +a rigid stream again keeps its arguments. For G with three operands, +stream K gives `lambda r.r J`, stream F gives `n`, and a rigid stream +stays rigid. Each result differs from bare `a`. This covers both binary +bracketings inside the operand of a shorter spine as well. + +**Three applications, one source lambda.** The index budget gives a +shorter structural list. For G, the lambda can only be I. For P it is +one of: + +``` +I; +lambda t.t u or lambda t.u t, u in {a,e,P}; +lambda t.u, with the fourth leaf a second a. +``` + +In the final case the lambda wraps a single leaf. The reason is numerical: +P leaves at most one excess bit beyond the mandatory indices 5 and 1; +G leaves none. A free leaf below the lambda uses one such bit. With a live +lambda, the fourth leaf is its sole bound occurrence. With a vacuous +lambda, the only affordable fourth free leaf is another `a`. + +Contracting an existing source redex removes this sole, affine lambda and +reduces to the already excluded no-lambda/two-application cases, or loses +an essential parameter/helper. We may therefore examine only a lambda +buried as an operand of h or a rigid head. Rigid heads fail directly. + +* I as a stream gives `lambda r.r J`; the K test returns J, or, if an + extra rigid operand precedes the test, leaves that operand as head. + Other positions reduce to the preceding helper cases. +* If `u=P` in the middle family, P is inside the lambda; the outer head + is rigid or there is an existing source redex. If `u=a/e`, the outer + tree has atoms `P`, the other rigid parameter, and that lambda. The + only new stream cases are `lambda t.t u` and `lambda t.u t`. + The reader sends them to `H u S = u Z c S` and `u H S`, respectively, + both rigid heads with arguments. A G head with only two supplied + operands already fails independently of those operands. +* For a vacuous wrapper `W=lambda t.u`, a W-headed stream reduces to a + rigid u; an atomic W stream returns `u S`. Both keep arguments. A + wrapper in a continuation changes none of the preceding stream-head + arguments. If it wraps P itself, the outer head is rigid or a source + redex exists. + +Thus every possible helper-containing source below 24 fails. Combining +this with part A proves **24 in the actual ABS frame**, under the stated +uniform Boolean interface. In particular the proof does not silently +replace the real parser by a rigid variable. + +### C. The lift remains 19 on the 165's actual inputs + +This argument uses two families of actual parsing contexts. + +1. At a root application of closed operands M,N, their values are + `f=beta K M`, `g=beta K N`, and `cont` is a rigid public continuation. + Changing M between I and K with N=I proves that a correct source V + must reference f. Changing N between I and K with M=I proves that + it must reference g. All other frame values can be kept fixed. +2. In the body application of `lambda a.a a`, put + + ``` + g0 = cons K N + f0 = cons K (cons F g0) + E0 = lambda b r.b a (r z). + ``` + + These are the **actual correlated variable values**, including the + first value's suffix containing the second variable's code. Here + `f0 E0 (g0 E0) =beta a a`, with fresh rigid `a,z,N`. The surrounding + continuation is beta-equal to + + ``` + lambda v.C (lambda z a.v (lambda b r.b a (r z))). + ``` + + All its binders are affine. The quoted values, the APP tag F, and the + canonical environment E0 also have only affine binders. + Only E0 contains the fresh free a, and contains it once. + +First exclude concrete parser-helper shortcuts below 19. A source +referencing `f,g` and a helper P/G needs at least two applications. Three +applications already cost at least `14+1+4=19`. At two applications its +three leaves are exactly `f,g,h`; every source lambda is vacuous. G fits +no lambda. P fits at most one, wrapping one atom. Thus these are precisely +the two binary application trees over those three atoms, optionally with +one atom replaced by `lambda u.atom`. + +On closed-operand values, a right-nested tree `u (v w)` loses one of M,N: +if u is a constant closure it discards the entire inner expression; +otherwise the inner application of the two constant closures discards +one operand before reaching h. A wrapped h discards both. + +For a left-nested tree `(u v) w`, a wrapped head again loses one operand. +An unwrapped f/g head discards v. If the other operand survives in w, +the only possibilities, including its optional wrapper, are + +``` +M (K^k N) E or N (K^k M) E, k = 1 or 2, +``` + +in place of `M N`. For the first expression use `(M,N)=(F,I)` when k=1, +and `(I,I)` when k=2. For the second use `(K,I)` for either k. These give +distinct beta normal forms. + +If h is the head, G's third argument is the rigid root environment E: +`G u v E` has head E with two reader arguments, not the required closed +result. For P, its stream is a constant closure (possibly wrapped once), +which discards H and therefore discards the continuation operand entirely: + +``` +P c (K N) =beta N ((K N) (K N) (K N)). +``` + +Wrapping that stream once still discards c. One of M,N is lost. This +excludes every helper case below 19 using only actual closed operands. + +Now suppose V does not reference P/G. Apply it in context 2. If every +source binder were affine, the entire instance would be affine and could +not increase the number of free a occurrences from one to two. A correct +V therefore has a **nonlinear source binder**, with at least two bound +occurrences. Together with the necessary f and g references this forces + +``` +L >= 1, A >= 3. +``` + +Two lambdas and three applications cost at least `18+1=19`, because f's +base index is 1. Four applications and one lambda cost at least 20. +Consequently a source below 19 must have exactly one lambda and three +applications. Its four leaves are exactly `t,t,f,g`, where t belongs to +that lambda. If f and g are both below it, their excess indices are 2 and +1, giving the attained cost **19** immediately. + +If one or both are outside, the sole nonlinear lambda is consumed or +erased **before E0 is supplied**, as follows. + +* If its body contains one of f,g, call the lambda T and the other + variable k. The whole source is `T k` or `k T`. The former consumes + T on a quoted value. The latter becomes `T K Rk`, since the actual + variable quote k starts with K, and consumes T on K. +* If its body contains neither, it is `D=lambda t.t t`. The whole + source is a two-application tree over D,f,g. If D occurs in function + position, contract it before supplying E0. If it is the immediate + argument of f or g, that Scott cell sends it K and consumes it. + The only other position is `(f g) D` or `(g f) D`. But for any + `f=cons K Rf`, `g=cons K Rg`, + + ``` + f g =beta K Rf, g f =beta K Rg, + ``` + + so D is erased. + +After this reduction every remaining binder is affine. Supplying E0 can +therefore never produce the two free occurrences in `a a`. These are all +positions of the single lambda, so the sub-19 assumption is impossible. +The ordinary `lambda e.f e (g e)` attains **19**. + +This proof establishes 19 using actual closed values, the actual correlated +variable pair, and the actual surrounding continuations. Rigid f,g are not +an assumption. + +### Boundary and verification + +The Boolean cell result strictly strengthens the previous canonical-form +result. The normal curried alternative is 25 bits; the previous 171-bit +interpreter used the farther-away ABS tag to implement its constant arm, +which made that cell 30. Neither is required to be beta-equal to the +canonical cell off Boolean inputs. + +The APP result is for the **unchanged 165 value/environment protocol**. +It does not establish a 19-bit floor jointly with every alternative +Boolean-correct cell. Such a cell may contain nonlinear binders or behave +differently when given a non-Boolean value; the affine-environment witness +would then need a new argument. Nor do these local bounds forbid a +body-dependent cell, a changed VAR representation, moved binders, or shared +work that changes the two interfaces. Consequently I do not infer an +unconditional 165-bit lower bound, or a joint changed-cell/changed-lift +optimum, from them. + +The fixed check run took 0.122 s. It verified 15 beta equalities, 6 beta +inequalities, and the module sizes 24/25/27/17/19 in their actual frames. It +includes the reader's K/F/I equations, an actual-G check, the constant-stream +loss of the continuation, the correlated variable witness, the helper +counterexamples, and the 17-bit expression's dependence on its favorable body. No lower-bound argument here is in Lean or independently +reviewed. diff --git a/data/self-interpreter/reasoning_floor/env/boolean_checks.json b/data/self-interpreter/reasoning_floor/env/boolean_checks.json new file mode 100644 index 00000000..e4f1a416 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/boolean_checks.json @@ -0,0 +1,37 @@ +{ + "enumeration_performed": false, + "machine_checked_lower_bound": false, + "module_bits": { + "canonical_cell": 24, + "curried_cell": 25, + "post_applied_cell": 27, + "nonuniform_parsed_helper_cell": 17, + "actual_frame_lift": 19 + }, + "fixed_beta_equalities": [ + "canonical_K", + "canonical_F", + "curried_K", + "curried_F", + "post_applied_K", + "post_applied_F", + "reader_on_K", + "reader_on_F", + "reader_on_I", + "reader_on_constant_stream", + "raw_cells_cross_apply", + "nonuniform_parsed_helper_K", + "nonuniform_parsed_helper_F", + "actual_variable_APP_witness", + "actual_G_on_F" + ], + "fixed_beta_inequalities": [ + "nonuniform_parsed_helper_fails_other_body", + "head_f_unwrapped_g", + "head_f_wrapped_g", + "head_g_unwrapped_f", + "head_g_wrapped_f", + "curried_vs_canonical" + ], + "seconds": 0.122 +} diff --git a/data/self-interpreter/reasoning_floor/env/borrow_abs_tag.blc b/data/self-interpreter/reasoning_floor/env/borrow_abs_tag.blc new file mode 100644 index 00000000..cd9002e9 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/borrow_abs_tag.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000010110011111101100001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/env/borrow_abs_tag.lam b/data/self-interpreter/reasoning_floor/env/borrow_abs_tag.lam new file mode 100644 index 00000000..f8c3d587 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/borrow_abs_tag.lam @@ -0,0 +1,8 @@ +-- Borrow ABS's known-zero tag as K. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx. zx (bit1 arg) (\zy. zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/env/borrowed-data-bound.md b/data/self-interpreter/reasoning_floor/env/borrowed-data-bound.md new file mode 100644 index 00000000..e799a8af --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/borrowed-data-bound.md @@ -0,0 +1,222 @@ +# A scoped bound for borrowing input data + +This is a handwritten origin-and-size argument, not a Lean theorem. It +extends the rigid cell/lift bounds by permitting actual supplied Scott input +data inside the candidate. It does **not** identify all correct environment +protocols with these rigid laws. + +## Exact class and conclusion + +Write + +``` +K = lambda x y.x +F = lambda x y.y +cons b r = lambda h.h b r +Cell(a,e) = lambda b r.b a (r e) +Lift(f,g) = lambda e.f e (g e). +``` + +A *data loan* is K, F, or a finite Scott bit stream with a fresh rigid tail. +Any finite collection of such loans may be made available as ambient +variables. Their bits and lengths may be chosen favorably for the proposed +construction; they need not be treated as opaque. Their tails, however, are +independent of the semantic parameters and the locally bound variables. +Inlining a literal lambda term in the candidate is ordinary source code, +not a loan. A parsed closure, parser, or NEXT implementation is not a loan. + +Price the candidate's own BLC source, with loans priced as ordinary ambient +variable references. The cell's frame starts `[a,e,...]`, innermost first; +the lift's frame starts `[g,f,...]`. Loan variables and any additional rigid +ambient variables occur farther out. These are the 165's actual respective +frames after ignoring unused ambient binders; restoring those binders can +only increase costs. + +**Cell theorem.** If a candidate C satisfies, for fresh rigid a,e and the +chosen loans, + +``` +C(a,e; loans) =beta lambda b r.b a (r e), +``` + +then its source costs at least **24 bits**. + +**Lift theorem.** If a candidate V satisfies, for fresh rigid f,g, + +``` +V(f,g; loans) =beta lambda e.f e (g e), +``` + +then its source costs at least **19 bits**. + +The bounds allow arbitrary source beta redexes. They are attained by the +ordinary cell and lift without loans. With the other 122 bits of the 165's +frame retained, borrowing input data while preserving these two exact laws +cannot yield a sub-165 interpreter. + +The cell hypothesis is deliberately stronger than Boolean lookup alone. +For example, + +``` +Curried(a,e) = lambda b.b (K a) (lambda r.r e) +``` + +satisfies `Curried(a,e) K n = a` and `Curried(a,e) F r = r e`, but is not +beta-equal to `Cell(a,e)` for a rigid non-Boolean b. It lies outside the cell +theorem. The complete 171-bit candidate in this lane uses this distinction. +In particular, this note proves neither a lower bound for every lookup cell +nor a lower bound for every changed value representation. + +## Origin facts + +Expand the data loans and color every original candidate lambda, +application, and variable occurrence *code*. Color the inserted data *data*. +Origins are retained under substitution, copying, and reduction. + +1. Every data-origin application has an argument which is an unchanged + Boolean or unchanged suffix of a loan (up to lifting beneath binders). + These arguments contain no code-origin occurrences. Indeed the only + applications in the inserted data are `h b` and `(h b) r`; neither b nor + r contains h or any surrounding source binder. Their only possible free + tail is rigid and independent. Subsequent substitutions therefore cannot + insert code into those right operands. + +2. Data-origin binders remain affine. A Scott binder has its one head + occurrence and unchanged fields. K's outer binder has one occurrence; + its remaining binder is erasing even if a source term is substituted + into the body. F's remaining binder is the closed identity. In + particular, no data-origin lambda can become a live lambda capturing + fresh semantic parameters or a local code binder. + +3. In any subtree, if it contains k occurrences of a particular code-bound + variable, it has at least k-1 code-origin applications. More generally, + the number of code-variable leaves is at most one plus its code-origin + application count. Data applications have a code-free right child by + fact 1, so they contribute only unary edges to the tree connecting code + leaves. Lambdas also contribute unary edges. Only code applications can + join two such branches. This proves the leaf inequality directly at + every reduction state. + +4. With at most one code lambda in the initial source, there can never be + two surviving code lambdas. Data binders cannot duplicate it. Before + its first contraction it is the sole occurrence and therefore cannot + also occur in the disjoint argument of that contraction. Contracting it + removes the last code lambda. This is a one-lambda observation, not a + general assertion that beta reduction cannot copy lambdas. + +The displayed normal forms of Cell and Lift contain no data-origin +application: every one of their application arguments mentions fresh +semantic parameters or local code binders. Their live capturing lambdas +cannot be data-origin either. Consequently Cell requires three surviving +code applications and two surviving code lambdas; Lift requires three +code applications and one surviving code lambda. + +## Three-application conservation + +Let A count current code-origin applications. As long as A <= 3, a beta +step cannot increase A. + +For a code-origin redex with a code lambda, let u be the body's code +application count, v the argument's count, and k the bound-variable +occurrence count. The count changes by + +``` +(k - 1) v - 1, with u + v + 1 <= 3 and k <= u + 1. +``` + +The change is at most zero. Equality requires exactly + +``` +u = 1, v = 1, k = 2, +``` + +and the redex uses all three code applications. A code-origin redex whose +lambda is data-origin strictly decreases A, because that binder is affine. +A data-origin redex cannot increase A: its argument contains no code by +origin fact 1. This proves the conservation claim. In particular, a source +with at most two code applications cannot produce either target. + +There is an additional restriction for the cell's three-application case. +Suppose a reduction starts with A=3 and reaches Cell. It must keep A=3 +throughout. Consider a hypothetical first contraction at a code-origin +application. It must be the equality case above. The body has exactly two +code-variable leaves, both the variable being substituted; the context has +no code applications and cannot contain another code-variable branch. +All surviving occurrences of the independent free parameters a,e must +therefore be in the argument. That argument has one code application and +at most two code-variable leaves, so its two leaves are a and e. Every +remaining code lambda in body, argument, or context is vacuous: there is no +leaf left for its own bound variable. Copying this argument therefore +cannot produce a live code lambda. Data lambdas cannot supply the target's +live captures either. This contradicts the cell target. + +Thus in a successful three-application cell construction **no code-origin +application is contracted**. Data-origin contractions may consume a code +lambda on raw data, but cannot copy code or move an a/e-containing payload +under a new code binder. Every target code binder and every a/e occurrence +retains its original source ancestry, possibly with intervening ancestors +removed. + +## Cell accounting + +The open-source size identity is still + +``` +size = 2L + 4A + 2 + X, +``` + +with zero-based indices measured in the displayed ambient frame. + +Origin facts 2 and 4 force L >= 2. Three-application conservation forces +A >= 3. + +* If A=3, the preceding argument excludes all code-application + contractions. The target's a and e occurrences must already have been + beneath its two surviving code lambdas in the source. They contribute + index excess at least 2 and 3 respectively. The occurrence of outer + target binder b beneath inner target binder r contributes at least one + more. Thus X >= 6 and the size is at least + `2*2 + 4*3 + 2 + 6 = 24`. + +* If A>=4 and L>=3, the size is at least `6+16+2=24` immediately. + +* The only remaining possible sub-24 case has L=2, A=4, X<=1. + The required free occurrence of e consumes at least one excess bit. + It must therefore occur outside every source lambda. So must every a + occurrence, and no more distant ambient variable can occur. All bound + occurrences have index zero. Every lambda subterm is consequently closed + in isolation. This property is preserved by beta reduction: an outer + substitution cannot enter a closed nested lambda. It rules out the + target's open capturing lambda subterms. There are no loan references in + this case, since their base indices are at least two. + +* A>=5 with L>=2 already costs at least 26. + +These cases exhaust every source below 24 bits. + +## Lift accounting + +Here L>=1 and A>=3 by the same origin and application-count facts. + +* If L=1, the sole code lambda must survive; contracting it would leave + none, since the data cannot duplicate it beforehand. Both required free + occurrences f,g must already lie under this surviving binder. In frame + `[g,f,...]` they contribute index excess at least 1+2=3. Thus the size is + at least `2+12+2+3=19`. +* If L>=2 and A>=3, the syntax costs at least 18 and the required free f + occurrence contributes at least one excess bit. The size is at least 19. +* If A>=4 and L>=1, syntax alone costs at least 20. + +This proves the claimed 19-bit bound. + +## Verification boundary + +`check.py` checks the attained module costs, seven fixed beta identities, +the non-equality of the curried and canonical cells, two full two-worker +batteries, and suffix extraction on Omega and lambda-Omega. It does not +implement an origin calculus or machine-check this lower-bound proof. + +The origin lemmas and the equality case of the three-application argument +are the parts to formalize or independently review before promoting this +handwritten bound to an authoritative repository theorem. No exhaustive +search, external consult, or Lean run was performed in this lane. diff --git a/data/self-interpreter/reasoning_floor/env/check.py b/data/self-interpreter/reasoning_floor/env/check.py new file mode 100644 index 00000000..3ab59266 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/check.py @@ -0,0 +1,163 @@ +#!/usr/bin/env python3 +"""Fixed env-lane constructions and symbolic checks. No candidate search. + +All writes, including compilation temporaries, stay in this lane. The Rust +normalizer is frozen, and the exact battery runs with only two workers. +""" +from pathlib import Path +import json +import sys +import tempfile +import time + +sys.dont_write_bytecode = True +LANE = Path(__file__).resolve().parent +ROOT = LANE.parents[2] +tempfile.tempdir = str(LANE) +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery as b +import lc + +b.BLAM = str(LANE / "blam-frozen") + +K = r"(\x\y.x)" +F = r"(\x\y.y)" +I = r"(\x.x)" + + +def compile_source(source): + return b.compile_lam(source) + + +def normalize(source): + ans = b.normalize(b.enc(compile_source(source)), 1 << 16) + assert ans is not None, source + return ans + + +def counts(t): + if t[0] == "V": + return 0, 0, t[1] + if t[0] == "L": + l, a, x = counts(t[1]) + return l + 1, a, x + u, v = counts(t[1]), counts(t[2]) + return u[0] + v[0], u[1] + v[1] + 1, u[2] + v[2] + + +def cell(a, e): + return rf"(\b\r.b ({a}) (r ({e})))" + + +def scott(bit, tail): + return rf"(\h.h {bit} ({tail}))" + + +def main(): + start = time.monotonic() + reference = (ROOT / "data/self-interpreter/machines/int165.lam").read_text() + # The ABS tag is exactly K, so it can supply the head's constant + # wrapper in the curried cell. This replaces a source lambda by a + # borrowed Boolean application, but the tag's de Bruijn index is costly. + borrowed = reference.replace( + r"\zx \zy. zx arg (zy args)", + r"\zx. zx (bit1 arg) (\zy. zy args)", + ) + assert borrowed != reference + candidates = [ + ("reference165", reference), + ("borrow_abs_tag", "-- Borrow ABS's known-zero tag as K.\n" + borrowed[borrowed.index("(\\x."):]), + ] + + reports = [] + lines = [] + for name, source in candidates: + path = LANE / f"{name}.lam" + path.write_text(source) + term = compile_source(source) + wire = b.enc(term) + (LANE / f"{name}.blc").write_text(wire + "\n") + began = time.monotonic() + ok, skip, bad = b.check(term, threads=2) + line = f"{len(wire)} bits ok={ok} skip={skip} fail={len(bad)} {name}.lam" + print(line, flush=True) + lines.append(line) + reports.append({ + "name": name, + "bits": len(wire), + "L_A_X": counts(term), + "battery_line": line, + "failures": bad, + "seconds": round(time.monotonic() - began, 3), + }) + + borrowed_open = rf"(\b.b ({K} a) (\r.r e))" + equations = [ + ("borrowed_K_cell_head", rf"\e\a\n.{borrowed_open} {K} n", + r"\e\a\n.a"), + ("borrowed_K_cell_tail", rf"\e\a\r.{borrowed_open} {F} r", + r"\e\a\r.r e"), + ("literal_ABS_tag", r"\e\a.(\tag.\b.b (tag a) (\r.r e)) " + K, + rf"\e\a.{borrowed_open}"), + # The two selector equations establish the extension protocol. + ("head_lookup", rf"\a\e\n.({scott(K, 'n')}) {cell('a', 'e')}", + r"\a\e\n.a"), + ("tail_lookup", rf"\a\e\r.({scott(F, 'r')}) {cell('a', 'e')}", + r"\a\e\r.r e"), + # Exact cross-cell / diagonal relationships motivating the lane. + ("diagonal_cell_gives_lift", rf"\f\g\e.{cell('e', 'e')} f g", + r"\f\g\e.f e (g e)"), + ("cross_cell", rf"\a\e\d\h.{cell('a', 'e')} {cell('d', 'h')}", + r"\a\e\d\h.\r.a d (r e h)"), + ] + checked = [] + for name, left, right in equations: + assert normalize(left) == normalize(right), name + checked.append(name) + # The curried cell is only selector-equivalent to the standard one. + # It is not beta-equal on an arbitrary rigid non-Boolean first input. + assert normalize(rf"\e\a.{borrowed_open}") != normalize(rf"\e\a.{cell('a', 'e')}") + + # Costs in the actual free-variable frames. Peel only these surrounding + # binders: they establish indices but are not part of the priced module. + local_cell = compile_source(r"\e\a.\b\r.b a (r e)")[1][1] + local_lift = compile_source(r"\f\g.\e.f e (g e)")[1][1] + borrowed_cell = compile_source( + r"\tag\f\e\a.\b.b (tag a) (\r.r e)" + )[1][1][1][1] + assert lc.size(local_cell) == 24 + assert lc.size(local_lift) == 19 + assert lc.size(borrowed_cell) == 30 + + # Validate the algebraic claim even on divergent source programs by + # checking their suffix projections separately. This is supplementary + # evidence; the tag identity transfers the full structural proof. + omega = r"(\u.u u) (\u.u u)" + suffix_checks = [] + borrowed_term = compile_source(borrowed) + for label, program in [("Omega", omega), ("lambda_Omega", rf"\u.{omega}")]: + m = compile_source(program) + # lambda n. E (lambda value tail.tail) (code(M) ++ n) + got = ("L", ("A", ("A", b.shift(borrowed_term, 1), b.FALSE), + b.bitlist(b.enc(m), ("V", 0)))) + result = b.normalize(b.enc(got), 1 << 16) + assert result == b.enc(compile_source(I)), label + suffix_checks.append(label) + + report = { + "search_performed": False, + "battery_threads": 2, + "candidates": reports, + "equations": checked, + "distinct_normal_forms": ["borrowed_cell_vs_canonical_cell"], + "module_bits": {"cell": 24, "lift": 19, "borrowed_tag_cell": 30}, + "suffix_checks": suffix_checks, + "seconds": round(time.monotonic() - start, 3), + } + (LANE / "battery.log").write_text("\n".join(lines) + "\n") + (LANE / "checks.json").write_text(json.dumps(report, indent=2) + "\n") + print(json.dumps(report, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/data/self-interpreter/reasoning_floor/env/check_boolean_bounds.py b/data/self-interpreter/reasoning_floor/env/check_boolean_bounds.py new file mode 100644 index 00000000..b6dd3a75 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/check_boolean_bounds.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python3 +"""Fixed equations and witnesses for the Boolean/actual-value bounds. + +No term enumeration, candidate generation, battery, or repository writes. +""" +from pathlib import Path +import json +import sys +import tempfile +import time + +sys.dont_write_bytecode = True +LANE = Path(__file__).resolve().parent +ROOT = LANE.parents[2] +tempfile.tempdir = str(LANE) +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery as b +import lc + +b.BLAM = str(LANE / "blam-frozen") +K = r"(\x\y.x)" +F = r"(\x\y.y)" +I = r"(\x.x)" + + +def term(source): + return b.compile_lam(source) + + +def nf(source): + answer = b.normalize(b.enc(term(source)), 1 << 16) + assert answer is not None, source + return answer + + +def peel(t, count): + for _ in range(count): + assert t[0] == "L" + t = t[1] + return t + + +def cell(a, e): + return rf"(\b\r.b ({a}) (r ({e})))" + + +def cons(bit, tail): + return rf"(\h.h ({bit}) ({tail}))" + + +def next_value(p, c): + return rf"(\b.({p}) (\v.b (({c}) (\e\a.v {cell('a', 'e')})) (({p}) (\w.({c}) (\e.v e (w e))))))" + + +def reader(p, c, s): + j = next_value(p, c) + return rf"({s}) (\b.b (\u\r.r ({j})) ({c})) (({s}) ({s}) ({s}))" + + +def main(): + started = time.monotonic() + sizes = { + "canonical_cell": (r"\x\p\c\tag\v\e\a.\b\r.b a (r e)", 7, 24), + "curried_cell": (r"\x\p\c\tag\v\e\a.\b.b (\n.a) (\r.r e)", 7, 25), + "post_applied_cell": (r"\x\p\c\tag\v\e\a.\b\r.b (\n.a) r e", 7, 27), + "nonuniform_parsed_helper_cell": (r"\x\p\c\tag\v\e\a.v a a e", 7, 17), + "actual_frame_lift": (r"\x\p\c\tag\f\g.\e.f e (g e)", 6, 19), + } + measured = {} + for name, (source, depth, expected) in sizes.items(): + measured[name] = lc.size(peel(term(source), depth)) + assert measured[name] == expected, (name, measured[name]) + + equations = [ + ("canonical_K", rf"\e\a\n.{cell('a', 'e')} {K} n", r"\e\a\n.a"), + ("canonical_F", rf"\e\a\r.{cell('a', 'e')} {F} r", r"\e\a\r.r e"), + ("curried_K", rf"\e\a\n.(\b.b (\n.a) (\r.r e)) {K} n", r"\e\a\n.a"), + ("curried_F", rf"\e\a\r.(\b.b (\n.a) (\r.r e)) {F} r", r"\e\a\r.r e"), + ("post_applied_K", rf"\e\a\n.(\b\r.b (\n.a) r e) {K} n", r"\e\a\n.a"), + ("post_applied_F", rf"\e\a\r.(\b\r.b (\n.a) r e) {F} r", r"\e\a\r.r e"), + ("reader_on_K", rf"\p\c.{reader('p', 'c', K)}", rf"\p\c.\b.b (\u\r.r {next_value('p', 'c')}) c"), + ("reader_on_F", rf"\p\c.{reader('p', 'c', F)}", rf"\p\c.{F}"), + ("reader_on_I", rf"\p\c.{reader('p', 'c', I)}", rf"\p\c.\r.r {next_value('p', 'c')}"), + ("reader_on_constant_stream", rf"\p\c\m.{reader('p', 'c', r'(\z.m)')}", r"\p\c\m.m (m (\z.m))"), + ("raw_cells_cross_apply", rf"\r\s.{cons(K, 'r')} {cons(K, 's')}", rf"\r\s.{K} r"), + ("nonuniform_parsed_helper_K", rf"\e\a\n.({K} (\u\v\b\r.b u (r v))) a a e {K} n", r"\e\a\n.a"), + ("nonuniform_parsed_helper_F", rf"\e\a\r.({K} (\u\v\b\r.b u (r v))) a a e {F} r", r"\e\a\r.r e"), + ] + tail = "n" + g = cons(K, tail) + f = cons(K, cons(F, g)) + env = cell("a", "z") + equations.append(("actual_variable_APP_witness", + rf"\n\z\a.(\f\g\e.f e (g e)) ({f}) ({g}) ({env})", + r"\n\z\a.a a")) + passed = [] + for name, left, right in equations: + assert nf(left) == nf(right), name + passed.append(name) + + # These three closed-program probes distinguish the helper-case forms. + # They are specified witnesses, not a candidate sweep. + counterexamples = [ + ("nonuniform_parsed_helper_fails_other_body", rf"\e\a\n.{F} a a e {K} n", r"\e\a\n.a"), + ("head_f_unwrapped_g", rf"\e.{F} ({K} {I}) e", rf"\e.{F} {I}"), + ("head_f_wrapped_g", rf"\e.{I} ({K} ({K} {I})) e", rf"\e.{I} {I}"), + ("head_g_unwrapped_f", rf"\e.{I} ({K} {K}) e", rf"\e.{K} {I}"), + ("head_g_wrapped_f", rf"\e.{I} ({K} ({K} {K})) e", rf"\e.{K} {I}"), + ] + separated = [] + for name, left, right in counterexamples: + assert nf(left) != nf(right), name + separated.append(name) + + assert nf(r"\e\a.\b.b (\n.a) (\r.r e)") != nf(r"\e\a.\b\r.b a (r e)") + # Read the actual G from the frozen source, rather than substitute a + # separately written recursive combinator. + source = (LANE / "reference165.lam").read_text() + machine = term(source) + assert machine[0] == "A" + G = machine[2] + app = lambda u, v: ("A", u, v) + k, ff, ii = term(K), term(F), term(I) + # G q c F = F; choosing q=c=I keeps this a tiny exact check. + actual = app(app(app(G, ii), ii), ff) + assert b.normalize(b.enc(actual), 1 << 16) == b.enc(ff) + passed.append("actual_G_on_F") + + result = { + "enumeration_performed": False, + "machine_checked_lower_bound": False, + "module_bits": measured, + "fixed_beta_equalities": passed, + "fixed_beta_inequalities": separated + ["curried_vs_canonical"], + "seconds": round(time.monotonic() - started, 3), + } + (LANE / "boolean_checks.json").write_text(json.dumps(result, indent=2) + "\n") + print(json.dumps(result, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/data/self-interpreter/reasoning_floor/env/checks.json b/data/self-interpreter/reasoning_floor/env/checks.json new file mode 100644 index 00000000..34926994 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/checks.json @@ -0,0 +1,52 @@ +{ + "search_performed": false, + "battery_threads": 2, + "candidates": [ + { + "name": "reference165", + "bits": 165, + "L_A_X": [ + 17, + 25, + 29 + ], + "battery_line": "165 bits ok=667 skip=1 fail=0 reference165.lam", + "failures": [], + "seconds": 2.152 + }, + { + "name": "borrow_abs_tag", + "bits": 171, + "L_A_X": [ + 17, + 26, + 31 + ], + "battery_line": "171 bits ok=667 skip=1 fail=0 borrow_abs_tag.lam", + "failures": [], + "seconds": 2.14 + } + ], + "equations": [ + "borrowed_K_cell_head", + "borrowed_K_cell_tail", + "literal_ABS_tag", + "head_lookup", + "tail_lookup", + "diagonal_cell_gives_lift", + "cross_cell" + ], + "distinct_normal_forms": [ + "borrowed_cell_vs_canonical_cell" + ], + "module_bits": { + "cell": 24, + "lift": 19, + "borrowed_tag_cell": 30 + }, + "suffix_checks": [ + "Omega", + "lambda_Omega" + ], + "seconds": 4.352 +} diff --git a/data/self-interpreter/reasoning_floor/env/followup.md b/data/self-interpreter/reasoning_floor/env/followup.md new file mode 100644 index 00000000..67cdbdb8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/followup.md @@ -0,0 +1,19 @@ +Follow-up (coordinating Claude seat). Your borrowed-data bound assumes the cell +is β-equal to the canonical normal form `λb r. b a (r e)`. Your 171 shows real +interpreters can use cells that satisfy only the Boolean lookup laws. Please +prove the stronger statement you named as next: + +In the ABS frame (a = arg, e = args, then exp, bit1, cont, intL, x — use the +165's actual frame and indices), any term C (arbitrary β-redexes allowed, +any frame variable usable, raw K/F/stream data borrowable if you can keep +that) satisfying, for independent rigid n, r and a, e, + + C K n =β a C F r =β r e + +costs at least 24 bits; or find a cheaper one (then build the interpreter +and run the battery and `python3 tmp/overnight/self/polish.py FILE.lam`). +Also state what the same method gives for the lift `V` under only the APP +law it must satisfy on actual values, if that differs from your 19-bit +statement. Handwritten proof with exact hypotheses; small fixed checks fine; +no enumeration runs. Append to your REPORT.md under a new heading and return +the new section. diff --git a/data/self-interpreter/reasoning_floor/env/origin_arithmetic.json b/data/self-interpreter/reasoning_floor/env/origin_arithmetic.json new file mode 100644 index 00000000..006f7568 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/origin_arithmetic.json @@ -0,0 +1,109 @@ +{ + "scope": "Finite count inequality only; origin lemmas are handwritten.", + "cases": [ + { + "body_apps": 0, + "argument_apps": 0, + "uses": 0, + "change": -1 + }, + { + "body_apps": 0, + "argument_apps": 0, + "uses": 1, + "change": -1 + }, + { + "body_apps": 0, + "argument_apps": 1, + "uses": 0, + "change": -2 + }, + { + "body_apps": 0, + "argument_apps": 1, + "uses": 1, + "change": -1 + }, + { + "body_apps": 0, + "argument_apps": 2, + "uses": 0, + "change": -3 + }, + { + "body_apps": 0, + "argument_apps": 2, + "uses": 1, + "change": -1 + }, + { + "body_apps": 1, + "argument_apps": 0, + "uses": 0, + "change": -1 + }, + { + "body_apps": 1, + "argument_apps": 0, + "uses": 1, + "change": -1 + }, + { + "body_apps": 1, + "argument_apps": 0, + "uses": 2, + "change": -1 + }, + { + "body_apps": 1, + "argument_apps": 1, + "uses": 0, + "change": -2 + }, + { + "body_apps": 1, + "argument_apps": 1, + "uses": 1, + "change": -1 + }, + { + "body_apps": 1, + "argument_apps": 1, + "uses": 2, + "change": 0 + }, + { + "body_apps": 2, + "argument_apps": 0, + "uses": 0, + "change": -1 + }, + { + "body_apps": 2, + "argument_apps": 0, + "uses": 1, + "change": -1 + }, + { + "body_apps": 2, + "argument_apps": 0, + "uses": 2, + "change": -1 + }, + { + "body_apps": 2, + "argument_apps": 0, + "uses": 3, + "change": -1 + } + ], + "zero_change_cases": [ + { + "body_apps": 1, + "argument_apps": 1, + "uses": 2, + "change": 0 + } + ] +} diff --git a/data/self-interpreter/reasoning_floor/env/origin_arithmetic.py b/data/self-interpreter/reasoning_floor/env/origin_arithmetic.py new file mode 100644 index 00000000..633f1bda --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/origin_arithmetic.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +"""Check the finite arithmetic in borrowed-data-bound.md, not its origin lemmas.""" +import json +from pathlib import Path + +cases = [] +for body_apps in range(3): + for arg_apps in range(3 - body_apps): + for uses in range(body_apps + 2): + change = (uses - 1) * arg_apps - 1 + assert change <= 0 + if change == 0: + assert (body_apps, arg_apps, uses) == (1, 1, 2) + cases.append({ + "body_apps": body_apps, + "argument_apps": arg_apps, + "uses": uses, + "change": change, + }) + +path = Path(__file__).with_suffix(".json") +path.write_text(json.dumps({ + "scope": "Finite count inequality only; origin lemmas are handwritten.", + "cases": cases, + "zero_change_cases": [x for x in cases if x["change"] == 0], +}, indent=2) + "\n") +print(f"{len(cases)} arithmetic cases checked; unique zero-change case (1,1,2).") diff --git a/data/self-interpreter/reasoning_floor/env/reference165.blc b/data/self-interpreter/reasoning_floor/env/reference165.blc new file mode 100644 index 00000000..5c37eb3e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/reference165.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/env/reference165.lam b/data/self-interpreter/reasoning_floor/env/reference165.lam new file mode 100644 index 00000000..2861fca0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/env/reference165.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/gemini/PROMPT.md b/data/self-interpreter/reasoning_floor/gemini/PROMPT.md new file mode 100644 index 00000000..ee10e3a3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/gemini/PROMPT.md @@ -0,0 +1,23 @@ +You are consulted for an independent, uncorrelated read on a hard golf problem. +Read /Users/a9lim/Work/blam/tmp/overnight/BRIEF.md (contract, the 165-bit BLC +self-interpreter, how it works, what is known). You cannot run code; reason on +paper. Your task: find a closed lambda term E that is a self-interpreter under +that exact contract and costs at most 164 bits — or, failing that, the most +promising concrete structural idea for one, worked out as far as you can. + +The 165 beat the previous record (168) by (1) hoisting a computation two +dispatch branches both need to a point where one expression is right for both, +and (2) letting a Scott structure's own application supply an argument (the +stream `cons b r = λf. f b r` hands `r` to the continuation for free). Look +for another move of that kind. Before proposing, check your idea against +docs/classical/self-interpreter/interpreter.md §5 and §6 in the same repo +(proved impossibilities and ~120 already-measured variants) — say honestly if +it is already listed. + +For every candidate, give: the exact term in the same named-lambda syntax as +the 165 (backslash binders, application by juxtaposition, parenthesized), its +size computed by |M| = 2L + 4A + 2 + X (show L, A, X), and a hand derivation +of the parser law on the three tag cases (00 abstraction, 01 application, +1^n0 variable) including the exact remainder. I will run the exact battery on +anything you propose. Overclaiming wastes everyone's time; a precise near-miss +with the reason it fails is valuable. diff --git a/data/self-interpreter/reasoning_floor/gemini/consult.md b/data/self-interpreter/reasoning_floor/gemini/consult.md new file mode 100644 index 00000000..b66f0577 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/gemini/consult.md @@ -0,0 +1,136 @@ +### Verdict + +**No valid self-interpreter $\le 164$ bits was found.** +Below are: +1. **The strongest new structural angle investigated** — eliminating the 11-bit `next` let + 8-bit zero-arm wrapper (`\unused \r. r next`) by inlining `NEXT` directly into the zero slot of `H = \bit0. bit0 NEXT cont` (which sits at depth 2 below `\cont`, giving a **154-bit baseline** before zero-arm spine adaptation). +2. **Concrete near-miss candidates at 162, 164, 166, and 168 bits**, with exact named-lambda syntax, `(L, A, X)` size calculations via $|M| = 2L + 4A + 2 + X$, and hand derivations of all three tag cases (`00` abstraction, `01` application, `1^n0` variable). +3. **A new handwritten impossibility/obstruction argument** (*Spine-Arity Conservation vs. Index Gravity for Inlined `NEXT`*) proving why the 11-bit savings from removing the `next` let and `\unused \r` are necessarily eaten back up to $\ge 165$ bits under the standard `intL` continuation interface. + +--- + +### 1. The Structural Angle: Index Gravity of the `next` Let + +In [int165.lam](file:///Users/a9lim/Work/blam/data/self-interpreter/machines/int165.lam), `next` is let-bound outside `\list` even though `next` is referenced **only once**: +```text +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +``` +Why does a linear let `(\next. ...) NEXT` pay for itself in the 165? +- `NEXT` contains **4 free variable occurrences** (`intL` twice, `cont` twice). Every binder placed between `\cont` and `NEXT` taxes `NEXT` by $+4$ index bits. +- In the 165, the single use of `next` inside `Z = \unused \r. r next` sits under **4 binders** below `\cont` (`\list`, `\bit0`, `\unused`, `\r`). Inlining `NEXT` there costs $4 \times 4 = 16$ index bits, whereas the `next` let costs $11$ bits ($1L + 1A = 6$ for the let, $X(\text{next}) = 4$, and $+1$ on `cont` inside `H`), so inlining loses $16 - 11 = +5$ bits (`170` bits, listed in [merges.py](file:///Users/a9lim/Work/blam/tools/self-interpreter/merges.py#L63-L65)). +- However, at the zero-arm slot `Z` of `H = \bit0. bit0 Z cont`, there are only **2 binders** below `\cont` (`\list` and `\bit0`), and inside `Z` on the zero branch: + 1. `bit0` (index `0`) is guaranteed to be $K = \lambda x y.\, x$, + 2. `list` (index `1`) is guaranteed to be $\operatorname{cons} K\ \text{list}_1$, and + 3. Both trailing arguments supplied to `Z` (`list1` and $S = \text{list}\ \text{list}\ \text{list}$) reduce to $\text{list}_1 = \operatorname{cons} \text{bit}_1\ \text{list}_2$. + +If `NEXT` is placed directly at `Z` without the `next` let and without `\unused`: +- Removing `(\next. ...)` saves $1L + 1A = 6$ bits, removes the `next` leaf ($X = 4$), and shifts `cont` in `H` up by 1 ($-1$ bit) $\implies -11$ bits. +- Each binder removed from `Z = \unused \r. r ·` saves $1L$ ($2$ bits) plus $4$ index bits on `NEXT`'s 4 free references ($6$ bits per binder!). + +--- + +### 2. Concrete Candidates and Hand Derivations + +#### Candidate A: 164-bit Inlined Single-Binder Zero Arm (Near-Miss; not listed in `merges.py`) + +Removing both the `next` let and `\unused` from the 165 gives a 164-bit term (whereas [merges.py](file:///Users/a9lim/Work/blam/tools/self-interpreter/merges.py#L49-L50) tested the 162-bit version with the `next` let retained, and the 170-bit inlined version with `\unused` retained): + +```text +(\x. x x) (\x. (\intL. \cont. \list. + list (\bit0. bit0 (\r. r (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) cont) + (list list list)) + (x x)) +``` + +- **Size calculation ($|M| = 2L + 4A + 2 + X$):** + - $L = 15$: `\x`(1), `\x`(1), `\intL`(1), `\cont`(1), `\list`(1), `\bit0`(1), `\r`(1), `\bit1`(1), `\exp`(1), `\args \arg`(2), `\zx \zy`(2), `\exp2`(1), `\args`(1). + - $A = 24$: knot + `intL` let (4), reader `list H S` (2), skip `list list list` (2), `bit0 Z cont` (2), `r NEXT` (1), `intL (\exp...)` (1), `bit1 ABS APP` (2), ABS (5), APP (5). + - $X = 36$: + - Knot `x`: $0+0+0+0 = 0$ + - `list` (4×) and `bit0` (2×) and `r` (1×): $0$ + - `cont` in `H` (frame `[bit0, list, cont, intL, x]`): $2$ + - `intL` in `NEXT` (frame `[bit1, r, bit0, list, cont, intL, x]`): $5$ + - `bit1`: $1$ + - `cont` in ABS (frame `[exp, bit1, r, bit0, list, cont, ...]`): $5$ + - `exp` in ABS: $2$; cell `zx arg (zy args)`: $1 + 2 + 0 + 3 = 6$ + - `intL` in APP: $6$; `cont` in APP: $6$; lift `exp args (exp2 args)`: $2 + 0 + 1 + 0 = 3$ + - Sum: $X = 2 + 5 + 1 + 5 + 2 + 6 + 6 + 6 + 3 = 36$. + - **Total:** $2(15) + 4(24) + 2 + 36 = 30 + 96 + 2 + 36 = \mathbf{164\text{ bits}}$. + +- **Hand derivation on the three tag cases** (let $P = \text{intL}$, $s = \text{list}$): + 1. **Variable (`1^n0 ++ N`, $n \ge 1$):** + $s = \operatorname{cons} F\ r$ where $r = \mathtt{1}^{n-1}\mathtt{0} \mathbin{++} N$, and $S = s\ s\ s \to^* N$. + $$P\ C\ s \to s\ H\ S \to H\ F\ r\ N \to F\ Z\ C\ r\ N \to C\ r\ N.$$ + Exact remainder is $N$ (passes). + 2. **Abstraction (`00 ++ ⌜M1⌝ ++ N`):** + $s = \operatorname{cons} K\ r_1$ where $r_1 = \operatorname{cons} K\ s_2$ and $s_2 = \ulcorner M_1 \urcorner \mathbin{++} N$. Here $S = s\ s\ s \to^* r_1$. + $$P\ C\ s \to H\ K\ r_1\ r_1 \to Z\ r_1\ r_1 \to (r_1\ \text{NEXT})\ r_1 \to (\text{NEXT}\ K\ s_2)\ r_1 \to (P\ (\lambda \text{exp}.\, K\ \text{ABS}\ \text{APP})\ s_2)\ r_1.$$ + If $P\ k\ s_2 \to^* k\ v_1\ N$, this reduces to $(\text{ABS}\ N)\ r_1 = C\ (\lambda \text{args}\ \text{arg}.\, v_1\ (\text{cell}\ \text{arg}\ \text{args}))\ N\ r_1$. + 3. **Application (`01 ++ ⌜M1⌝ ++ ⌜M2⌝ ++ N`):** + $s = \operatorname{cons} K\ r_1$ where $r_1 = \operatorname{cons} F\ s_2$ and $s_2 = \ulcorner M_1 \urcorner \mathbin{++} \ulcorner M_2 \urcorner \mathbin{++} N$, $S \to^* r_1$. + $$P\ C\ s \to^* (P\ (\lambda \text{exp}.\, F\ \text{ABS}\ \text{APP})\ s_2)\ r_1.$$ + Under the 2-argument continuation hypothesis this reduces to $C\ (\lambda \text{args}.\, v_1\ \text{args}\ (v_2\ \text{args}))\ N\ r_1$. + - **Why it fails:** The unconsumed second copy of $r_1$ ($S = s\ s\ s$) sits outside $(r_1\ \text{NEXT})\ r_1$ and is appended after the remainder $N$, delivering **3 arguments** (`val`, `N`, `r1`) to the rigid continuation $C$. + +--- + +#### Candidate B: Using `bit0` ($= K$) to Eat the Duplicate Copy with Inlined `NEXT` (168 bits; passes) + +Since `bit0` is bound at index `0` and equals $K = \lambda x y.\, x$ in the zero branch, wrapping `Z` as `bit0 (\r. r NEXT)` uses `bit0`'s own two lambdas to discard the first `r1` and apply `\r. r NEXT` to $S = r_1$, without placing `NEXT` under a second lambda `\unused`: + +```text +(\x. x x) (\x. (\intL. \cont. \list. + list (\bit0. bit0 (bit0 (\r. r (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args)))))))) cont) + (list list list)) + (x x)) +``` + +- **Size calculation:** + Compared to Candidate A ($L=15, A=24, X=36$, 164 bits), `bit0 (...)` adds $1A$ ($+4$ bits) and one reference to `bit0` at index $0$ ($X = 0$): + - $L = 15$, $A = 25$, $X = 36 \implies 2(15) + 4(25) + 2 + 36 = \mathbf{168\text{ bits}}$ (2 bits smaller than the 170-bit inlined-`next` variant in [merges.py](file:///Users/a9lim/Work/blam/tools/self-interpreter/merges.py#L63-L65), and 2 bits larger than the 166-bit `next`-let version in [merges.py](file:///Users/a9lim/Work/blam/tools/self-interpreter/merges.py#L53-L54)). +- **Hand derivation:** + - **Variable (`1^n0 ++ N`):** $H\ F\ r\ N \to F\ (F\ (\lambda r.\, r\ \text{NEXT}))\ C\ r\ N \to C\ r\ N$. + - **Abstraction (`00 ++ ⌜M1⌝ ++ N`):** $H\ K\ r_1\ r_1 \to K\ (K\ (\lambda r.\, r\ \text{NEXT}))\ C\ r_1\ r_1 \to K\ (\lambda r.\, r\ \text{NEXT})\ r_1\ r_1 \to (\lambda r.\, r\ \text{NEXT})\ r_1 \to r_1\ \text{NEXT} \to^* C\ V_{\text{abs}}\ N$. + - **Application (`01 ++ ⌜M1⌝ ++ ⌜M2⌝ ++ N`):** $H\ K\ r_1\ r_1 \to^* r_1\ \text{NEXT} \to^* C\ V_{\text{app}}\ N$. + +--- + +### 3. New Obstruction: Why Inlining `NEXT` Cannot Close the 154 $\to$ 165 Gap + +**Proposition (Spine-Arity vs. Index Gravity for Inlined `NEXT`).** +Consider any reader of the form `\list. list (\bit0. bit0 Z cont) (list list list)` where `NEXT` is inlined inside `Z` (eliminating the `next` let) and `NEXT = \bit1. intL (\exp. bit1 ABS APP)` retains its 4 free references to `cont` and `intL`. Then $|E| \ge 166$. + +*Proof.* +On any constructor stream `list = cons K r1` with `r1 = cons bit1 list2`, the skip $S = \text{list}\ \text{list}\ \text{list}$ reduces to $r_1$, and the reader reduces to: +$$Z[\text{bit}_0 := K,\ \text{list} := \operatorname{cons} K\ r_1]\ r_1\ r_1.$$ +To reach $\text{intL}\ (\lambda \text{exp}.\, \text{bit}_1\ \text{ABS}\ \text{APP})\ \text{list}_2$ (which has exact continuation arity 2 at $C$): +1. Both external arguments $r_1, r_1$ must be consumed (if only one is consumed, the second remains on the spine outside `intL (...) list2`, yielding $C\ V\ N\ r_1$ as in Candidate A). +2. Inside $Z$, `bit1` and `list2` exist only inside $r_1 = \lambda f.\, f\ \text{bit}_1\ \text{list}_2$ (and inside $\text{list} = \lambda f.\, f\ K\ r_1$). Extracting $\text{bit}_1$ into `\bit1` requires applying $r_1$ to `\bit1. ...`. +3. Even though $\text{list}\ \text{list}\ X \to^* r_1$ and $\text{list}\ (\text{bit}_0\ X) \to^* X\ r_1$ allow $Z$ to put $r_1$ into function position using the already-bound `list` (with zero new lambdas above `NEXT`), doing so does **not** consume the two external arguments $r_1, r_1$ on the spine of $Z\ r_1\ r_1$. +4. Consuming the two external arguments $r_1, r_1$ requires either: + - Two lambdas in $Z$ (`\unused \r. r NEXT`), which puts `NEXT` under 4 binders (`\list \bit0 \unused \r`), taxing `NEXT`'s 4 free variables by $+16$ bits and yielding **170 bits**; or + - Using $\text{bit}_0 = K$ to supply one lambda outside `\r` (`bit0 (\r. r NEXT)`), which puts `NEXT` under 3 binders (`\list \bit0 \r`), taxing `NEXT`'s 4 free variables by $+12$ bits plus $4$ bits for the `bit0` application and yielding **168 bits** (Candidate B); or + - Keeping the `next` let outside `\list`, where `\unused \r. r next` costs **165 bits** and `bit0 (\r. r next)` costs **166 bits**. $\blacksquare$ + +--- + +### 4. Where a Sub-165 Could Still Hide + +Because: +- `letopt` and `component` exclude pure let/$\beta\eta$ rearrangements of the 165's core, +- `searches_165.json` excludes all `(H, S)` pairs in `\list. list H S` up to 164 bits (modulo 4.05M capped pairs) and all `(cell, lift)` pairs up to 164 bits, and +- the proposition above excludes inlining `NEXT` into `Z` under the unchanged 4-reference `NEXT` body, + +any genuine $\le 164$-bit interpreter must do one of the following: +1. **Reduce the free-variable weight of `NEXT` below 4** (currently `intL` $\times 2$, `cont` $\times 2$): if `NEXT` had only 2 free references to `[cont, intL]`, each enclosing binder would cost $+2$ bits instead of $+4$, making an inlined `NEXT` without a `next` let competitive. +2. **Use one of the unproved application-only skip operands $T \in \{j, c\}$ (`next` or `cont`)** from [protocol-obstructions.md](file:///Users/a9lim/Work/blam/docs/classical/self-interpreter/protocol-obstructions.md#L208-L237) among the capped candidates of `searches_165.json`, or a reader head not of the form `list H S`. +[gaslamp] FAILED (exit 0) · job: gm-20261021-013505-9675 · session: 15658e2b-1ecf-44ee-bb04-cb203704bdf9 · thread: overnight-gemini · resume: gaslamp gemini --thread overnight-gemini · model: gemini-4-argon · tok: 1847k→127k · log: /Users/a9lim/.gaslamp/jobs/gm-20261021-013505-9675/stderr.log diff --git a/data/self-interpreter/reasoning_floor/global/PROJECTIONS.md b/data/self-interpreter/reasoning_floor/global/PROJECTIONS.md new file mode 100644 index 00000000..c23bc6bf --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/PROJECTIONS.md @@ -0,0 +1,206 @@ +# Size-priced semantic projections + +These are handwritten consequences of the exact contracts. They assume no +165/168 parser frame. The first is a whole-program lower bound for exact +remainder extraction; the second is a disjoint-subterm decomposition only +when the self-interpreter is **already** continuation-headed in its source. + +## 1. Every exact remainder extractor costs at least 24 bits + +Let closed `R` satisfy + +``` +R (stream(M,N)) =beta N +``` + +for every closed source `M` and every closed suffix `N`. Then **|R|>=24**. +The stronger open-source/all-suffix extractor contract is included. This +does not assert 24 is attainable; the existing construction costs 70. + +The proof uses the kernel-checked theorems +`SelfintZero.remainder_two_nonlinear` and +`SelfintZero.remainder_body_two_nonlinear`, together with source minimality +and elementary syntax classification. It is not a new Lean theorem. + +Choose a shortest extractor; `rem70` establishes existence. Suppose it +costs at most 23. The wire inequality gives exactly two nonlinear binders: +three would cost at least 28. If `L,V,X` are the usual counts, the only +possible `(L,V)` are + +``` +(2,4), (2,5), (3,4), (4,4). +``` + +A literal leading lambda is impossible: + +* If it is nonlinear, its body has only one nonlinear binder, contrary to + the body theorem. +* If it is vacuous, the output ignores the input, contradicting the two + distinct normal suffixes `I,K` for a fixed source `I`. +* If it is live affine, the other two nonlinear binders require four + more leaves and two more lambdas: `L>=3,V>=5`, already 24 bits. + +Follow the source function spine to its first redex. Its contractor cannot +be vacuous, since a shrinking beta reduct would still be an extractor. +There are no live affine binders in this small inventory (the same +`L>=3,V>=5` count rules them out). Thus this is one nonlinear binder. +Its argument is closed and must contain a live binder, necessarily the +other nonlinear binder. The two are therefore incomparable. + +Every leaf belongs to these two binders. No leaf is left for a pending +spine argument or another outside component. The source is `D1 D2`, where +each `Di` is closed with one nonlinear live binder. There are at most two +additional vacuous lambdas in total. Each `Di` is beta-normal: an internal +redex would have a vacuous contractor, since its sole live binder is at +its root. `D1` itself cannot start with a vacuous lambda, since it is applied. + +Use the following notation, with literal vacuous boxes: + +``` +Delta = lambda x.x x (8 bits) +deltaK = lambda x.x (K x) (11 bits) +V = lambda x u.x x (12 bits) +D3 = lambda x.x (x x) or lambda x.x x x (12 bits) +``` + +With four leaves, each live binder occurs twice. With no vacuous lambda +the source is `Delta Delta`, which diverges. With one vacuous lambda, the +only normal possibilities, respecting D1's nonvacuous root, are + +``` +Delta (K Delta), deltaK Delta, Delta deltaK, +V Delta, Delta V. +``` + +The first three reduce to `Delta`, `Delta`, and `deltaK` respectively, so +their reduct has just one nonlinear binder and cannot be an extractor. +`V Delta -> K Omega`, so every input returns Omega and fails suffix I. +`Delta V -> V V -> K (V V)`. For an input ending in suffix Omega, applying +this term reaches `V V` and then an outer lambda; it cannot beta-join +Omega, whose every reduct is Omega. + +With two vacuous lambdas, the bit budget leaves `X<=1`. A vacuous lambda +around both occurrences of a live variable would already cost two index +units. Apart from closed outer wrappers, at most one leaf may be boxed. +The complete remaining normal sources are + +``` +Delta (K (K Delta)), Delta (K deltaK), deltaK (K Delta). +``` + +They reduce respectively to `K Delta`, `deltaK`, and `Delta`. Again each +reduct has only one nonlinear binder. A wrapper above D1 would be an +erasing source redex, and every other placement either adds two index +units or creates such a redex. + +With five leaves there can only be two lambdas, so one binder has three +occurrences and the other has two. Thus the source is `D3 Delta` or +`Delta D3`, with either application tree for D3. These head-diverge. +More generally, an application tree with at least two leaves, each a +closed combinator `lambda x.T(x,...,x)` using x at least twice, stays such +an application tree after every head contraction. Its head contractor +always has an argument supplied inside the tree. It never exposes a +lambda to consume a later input, and the number of leaves never falls +below two. This proves divergence, independently of any clock bound. + +All size-at-most-23 cases are excluded. Therefore every exact extractor +costs at least 24 bits. Its syntax must carry more than the smallest +two-binder self-application gadget, even though the task's output is +only an unchanged suffix. + +## 2. A continuation-headed interpreter costs at least 70 bits + +Suppose the *literal source* is + +``` +H = lambda c s.c A(c,s) B(c,s). +``` + +Then the disjoint source payloads satisfy + +``` +|A| >= 37, |B| >= 22, +|H| = 11 + |A| + |B| >= 70. +``` + +No redex-free, opaque-module, or independent-reader assumption is used. +The existing `SelfintProjections` theorems establish the exact projection +contracts, the stream occurrence in both payloads, and B's two nonlinear +binders. B therefore costs at least 22 by +`10 nonlinear + 4 freeLeaves <= wire + 2`. + +For A there is a stronger argument than merely counting two nonlinear +binders. + +**A contains two incomparable nonlinear binders.** Substitute the affine +quotation of Omega for s and keep c and the tail rigid. If A's nonlinear +binders were on one chain, affine substitution and full beta reduction +would preserve that property (`SelfintNonlinearChain`). But its required +value `lambda z.Omega` reduces only to itself and has two incomparable +nonlinear binders. The beta join is impossible. + +**Some A-subterm has three free variables bound internally to A.** Use +source S, close the two public variables with affine closed terms +(`c:=K`, `s:=stream(S,I)`), and apply the resulting value to I. This +closed term is beta-convertible to S. Its inserted arguments all have +width one. Statman's theorem therefore supplies a width-three subterm +descending from A, whose free variables cannot be the replaced public +variables c,s. Thus its three ancestor binders lie inside A. + +The three live binders on this chain cannot contain both incomparable +nonlinear binders. Hence A contains at least four live internal binders, +six leaves bound by them, and index tax at least `2+1+0=3` on selected +internal occurrences. It additionally contains a free occurrence of s, +on a distinct leaf, because its value must depend on the input source. +Therefore + +``` +L(A)>=4, V(A)>=7, X(A)>=3, +|A|>=2*4 + 4*7 - 2 + 3 = 37. +``` + +The two interface lambdas, the two root applications, and the continuation +leaf cost 11 bits, giving 70. This improves the existing 55-bit literal +continuation-headed floor by pricing the value projection's internal +binding structure. + +### Exactly what is, and is not, decomposed + +The theorem charges two disjoint subtrees of the *displayed source* once +each, so it does not double count. A source that beta-expands into this +head form can share code between A and B before the expansion. The 165 is +stream-headed and can fuse reading, variable return, and skip; it is not +in the displayed class. No 70-bit floor for an arbitrary pre-head-normal +source follows from this theorem. + +The whole-extractor 24-bit theorem also must not be added to A's 37-bit +payload cost as if B were a separately closed extractor: closing B adds +a stream binder, and may require eliminating continuation occurrences. +The correct literal-source accounting above charges the open B body at +22, not a second copy of its surrounding interface. + +## 3. Why the requested semantic directions do not yet give 165 + +* Unbounded unary reading alone has the very small stream diagonal + `s s s`. It uses the input's own cells and shares the variable's value + representation. A syntactically separate fixed point is not necessary; + the 204 and 672 normal witnesses rule that out directly. +* The existing exact-remainder growth theorem proves repeated source-code + growth, not merely one self-application. It is a sound necessity, but + an argument must price the *source that produces that growth*, rather + than count expanding residual copies as distinct modules. +* Arbitrary output abstractions/applications impose the internal width and + incomparability requirements used above. They do not require distinct + original binders for each role; the shared-S translation in + `structural-bounds.md` explicitly defeats that stronger conclusion. +* The Omega probes enforce correctness independently of evaluating source + normal forms. All new deductions above preserve beta joinability on + divergent sources. No claim is inferred from the battery's skipped + Omega test. + +The missing quantitative theorem would bound the least *original* BLC +syntax capable of sharing one active code package across (i) a complete +syntax traversal with exact remainder and (ii) beta-exact reconstruction +of arbitrary binding/application structure. Neither residual-origin +counts nor separate minima for familiar implementation modules currently +supply such a theorem. diff --git a/data/self-interpreter/reasoning_floor/global/PROMPT.md b/data/self-interpreter/reasoning_floor/global/PROMPT.md new file mode 100644 index 00000000..6632bea3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/PROMPT.md @@ -0,0 +1,40 @@ +Lane "global": toward an unconditional optimality proof. Your lane directory is +/Users/a9lim/Work/blam/tmp/overnight/global/ (write only there). Read +/Users/a9lim/Work/blam/tmp/overnight/BRIEF.md first, then structural-bounds.md, +capture-width.md, head-decomposition.md and remainder.md in +docs/classical/self-interpreter/, and skim the Lean modules they cite in +lean/Blc/ (Selfint*.lean). + +Unconditionally, the best known global floor is 34 bits (handwritten) and 18 +(Lean); the best interpreter is 165. Purely structural counts (nonlinear +binders, width, captures) are attained by ~33-bit non-interpreters, so they +cannot go much further. A comprehensive proof needs SEMANTIC necessities +priced in syntax, with an account of sharing (the 165 itself shows that the +natural module decomposition is false: its reader fuses dispatch, VAR and +skip). + +Your job, in order of value: +1. Prove the strongest unconditional lower bound you can, rigorously. Ideas + to evaluate: (i) the interpreter must read unboundedly long unary indices + and stop at their 0 — any term doing this needs a self-application of + something stream-derived or a fixed point; (ii) it must distinguish three + constructors and return an exact remainder (remainder.md: an exact + remainder extractor is ≥ ? and must grow code); (iii) it must build + output abstractions whose bodies depend on input, and output applications; + (iv) it must preserve sharing-free correctness on divergent sources. Turn + any of these into a size-priced lemma, then combine without double + counting. Test every candidate invariant against the known correct + interpreters (165, 168, 170, 204 β-normal, 584/742 two-nonlinear, 672 + typed — all in data/self-interpreter/machines/) and against near-miss + non-interpreters before relying on it. +2. A decomposition theorem: a statement of the form "every interpreter + contains disjoint (or accountably shared) subterms realizing roles X, Y, Z + with costs ≥ a, b, c", even if you can prove only part of it. Say precisely + what is proved and what is conjectured. +3. If you conclude that a comprehensive proof is out of reach by any known + method, say exactly why and what tool would be needed (e.g. a sound + demand-driven search with which pruning theorems, and its estimated size). + +Lean is welcome for statements you have pinned down (keep new files in your +lane directory or a scratch copy; do not edit existing modules). Report as the +brief says. diff --git a/data/self-interpreter/reasoning_floor/global/PROOF37.md b/data/self-interpreter/reasoning_floor/global/PROOF37.md new file mode 100644 index 00000000..6b171ab8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/PROOF37.md @@ -0,0 +1,556 @@ +# A handwritten unconditional 37-bit lower bound + +**Claim.** Every closed interpreter for the repository's beta-exact, +closed-source contract has BLC length at least **37**. + +The classification and its use of Statman's width theorem are handwritten. +`FiniteChecks.lean` kernel-checks 144 fixed head-reduction clauses supporting +the case analysis, including the loop clauses and sample instances of the +six parametric divergence invariants. It does **not** prove the full +37-bit theorem. The parametric invariants are proved below; no fuel cap is +used as a refutation. + +This extends the repository's existing handwritten 34-bit bound. The +extension uses semantic consequences of the exact contract (head arity, +internal width, internal nonlinearity, and exact identity-source outputs) +to exclude the remaining tiny syntax families. It is not an additive +parser-module argument and does not approach a proof of 165-bit optimality. + +## 1. Dependencies and conventions + +Write `L,V,X` for the number of abstractions, variable leaves, and total +zero-based de Bruijn index. Then + +``` +|E| = 2L + 4V - 2 + X. +``` + +The following established consequences are used. + +1. `width(E) >= 3`. Here width is the maximum number of distinct variables + free relative to a source subterm. This uses Statman's theorem that a + closed term beta-convertible to `S` has width at least three, applied to + `E K (stream(S,I)) I`. I inspected the publisher's two-page preview, + printed p. 406, during this run. The interface argument is in + `docs/classical/self-interpreter/capture-width.md`. +2. Two nonlinear binders of `E` are incomparable in the source ancestor + order. This is `SelfintNonlinearChain.selfInterpreter_not_chain`. +3. An interpreter has head normal form with exactly two leading lambdas. + If its head is the continuation, that head has exactly two arguments. + A beta reduct with three leading lambdas is already impossible, whether + or not its body head-normalizes. See `head-decomposition.md`. +4. An interpreter literally `lambda c s.B` has two nonlinear binders in + `B`, and a subterm of `B` with three free variables bound **inside B**. + The first is kernel-checked; the second is the internal form of (1). + A literal interface costs at least 46 bits. +5. Every beta reduct of a closed interpreter is an interpreter. Hence + every redex of a globally minimum interpreter is nonshrinking. In + particular no source redex erases its argument, and a linear redex + whose argument has at most one free occurrence strictly shrinks. + These follow from the exact formula in `SelfintWireCost`: + + ``` + delta_bits = (k-1)|A| + (f-1)D - 2k - 4 - g. + ``` + +6. No interpreter has length at most 33. The repository already proves + this by counting and the twelve-layout equality-case exclusion in + `capture-width.md`. The present proof retains that dependency. + +All uses of reduction here are beta reduction. Some of the inherited +33-bit exclusions use beta-eta confluence to prove impossibility, as the +existing document explicitly explains; that does not change the beta-exact +contract. + +For every divergence argument below, defined global weak-head steps +survive capture-avoiding substitution for the free placeholders: the +contracted lambda and its application remain on the same head spine. +Thus an infinite symbolic head trace with a placeholder stream remains +an infinite head trace when that placeholder is replaced by `stream(I,N)`. +This contradicts the exact contract on the normal source I. It is not +necessary to assert correctness on an arbitrary rigid object supplied +as the stream. + +Let `Delta = lambda x.x x`, and write `K T` as shorthand for the literal +vacuous abstraction `lambda u.T` with fresh `u`. Thus a displayed box `K T` +is already a lambda term, not an extra application of an inlined K. + +## 2. The inventory below 37 bits + +Assume a minimum interpreter has size at most 36. A width witness supplies +three distinct live binders on a chain, called `a,b,c` from outside to +inside. The incomparable nonlinear pair needs a fourth live binder. +There are at least six leaves and index sum at least three. Consequently + +``` +(L,V) = (4,6) or (5,6), X <= 6 or X <= 4 respectively. +``` + +In either case exactly four binders are live. Exactly two are nonlinear, +each used twice; the other two are used once. For `L=5` the additional +binder is vacuous. One nonlinear binder is on the width chain and the +other, called `d`, is incomparable with it. + +The `d` abstraction cannot contain any of `a,b,c`: that would make it an +ancestor of the nonlinear binder on their chain. Nor can it capture a +chain variable. Its possible enclosing chain binders are affine, and +their sole occurrences are already needed in the width witness outside +`d`. Thus `d` is closed in isolation, with precisely two own occurrences +and at most the one vacuous binder. + +There are at most one leading source lambda: two are ruled out by the +46-bit literal-interface bound, and three by head arity. If there is one, +call it `y`. It is live (otherwise the supplied rigid continuation could +never occur in the output), affine (a nonlinear root would be comparable +with all binders), and one of the width-chain binders. Follow the function +spine, under this possible lambda, to its first source redex. A neutral +head here would already be an impossible zero/one-lambda head normal form. + +Write this redex `(lambda x.B) A`. An affine `x` would shrink: the only +possible free variable of its argument is `y`, used at most once globally. +A vacuous `x` also shrinks. Therefore `x` is one of the two nonlinear +binders. + +### The width-chain binder cannot be this contractor + +If `x` is on the three-binder chain, the width witness lies in `B`, as do +all nonleading binders on that chain. All four chain-bound leaves lie in +`B`: its nonlinear variable's two occurrences, and the two affine +variables' required occurrences. The argument must be closed, since a +possible `y` occurrence is already used in that witness. Its only possible +live binder is `d`; an argument with only vacuous binders and no free +variables is impossible. Thus the argument contains all of `d` and its +two leaves. There are no leaves available for a pending spine argument. + +The argument is closed and has width one: its only live variable is `d`. +Contracting substitutes copies of this closed width-one term and removes +one of the three chain binders. Every remaining source subterm therefore +has at most two distinct free variables. Vacuous binders supply no free +variable. The reduct has width at most two, contradicting (1), since it +is still an interpreter. + +This observation strengthens the earlier small-case argument: the +contractor is excluded by **loss of necessary width**, regardless of +whether this particular contraction grows its wire length. + +### The source has one of two diagonal forms + +The first contractor is consequently `d`. All nonleading chain binders +and their four leaves belong to its argument; a pending argument would +have no possible leaf. Up to the possible leading `y`, + +``` +E = D N, or E = lambda y.D A(y). +``` + +`D` is closed, contains the nonlinear binder `d`, and has exactly two +leaves. `N`, or `A` with `y` counted as the outermost chain variable, has +three live variables on a chain and exactly four leaves. At most one +vacuous lambda occurs in the two operands together. + +Both operands are beta-normal. For the four-leaf argument, a redex with +a live contractor used `k` times has at least `k+2` body leaves: the `k` +own occurrences and the other two variables required by the width witness. +At most `2-k` leaves remain for its argument. `k=2` is impossible; `k=1` +leaves at most one free argument occurrence and would shrink. A vacuous +redex shrinks. The same conclusion is immediate for the two-leaf `D`. + +## 3. No extra vacuous binder: all four-lambda cases + +Here `D=Delta`. A normal four-leaf term with three live binders on one +chain has the following exhaustive six shapes. `T3(a,b,c)` ranges over +the twelve linear application trees on its three displayed leaves; +`T4` ranges over the sixty trees on the displayed multiset. + +| Duplicated variable and location of its extra occurrence | Closed argument N | X | +|---|---|---:| +| outer, before the middle binder | `lambda a.a (lambda b c.T3(a,b,c))` | 3 | +| outer, between the middle and inner binders | `lambda a b.a (lambda c.T3(a,b,c))` | 4 | +| outer, below all three binders | `lambda a b c.T4(a,a,b,c)` | 5 | +| middle, before the inner binder | `lambda a b.b (lambda c.T3(a,b,c))` | 3 | +| middle, below the inner binder | `lambda a b c.T4(a,b,b,c)` | 4 | +| inner | `lambda a b c.T4(a,b,c,c)` | 3 | + +Proof of completeness: one occurrence of each variable lies below all +three binders and costs indices `2+1+0`. The only remaining leaf repeats +one of them. If it is above a later lambda block, normality forces that +leaf to be the function and the block its argument; the reverse orientation +would be a redex. Otherwise all four leaves are below the last binder. +This also shows `X<=5`; an alleged four-lambda minimum with `X=6` has no +possible shape. + +The open argument `A(y)` has only the latter three shapes, with `a=y` +and the `a` lambda omitted: `y` is affine, so it cannot be the repeated +variable. + +The `X=3` closed cases, and the open middle-before-inner case, are already +excluded by the established 33-bit bound. The open inner case also reduces +to a literal two-lambda interface with at most one nonlinear binder inside +the body. +The closed middle-below-inner case also has only one internal nonlinear +binder after `N N -> lambda b c.T4(N,b,b,c)`. + +For the open middle-below-inner case, + +``` +lambda y.A A -> lambda y c.T4(y,A,A,c). +``` + +The body contains two copies of `A`, each with only two internal binders; +`y,c` are public. No subterm has three free variables bound inside the +body. This contradicts (4). Thus only the second and third closed rows +need new finite analysis. + +### 3a. The twelve 34-bit layouts + +Let + +``` +N = lambda a b.a (lambda c.T3(a,b,c)), +J(a,b) = lambda c.T3(a,b,c), +B = J(J(N,b),d). +``` + +Four head steps, including `Delta N -> N N`, give + +``` +Delta N ->* lambda b d.T3(N,b,B). +``` + +The twelve possibilities are: + +| T3 | Refutation | +|---|---| +| `(a b) c` | Head form has two lambdas, continuation with one argument. | +| `a (b c)` | A reduct has three leading lambdas. | +| `(a c) b` | Advancing-wrapper divergence invariant below. | +| `a (c b)` | A reduct has three leading lambdas. | +| `(b a) c` | Continuation's first payload is fixed normal `N`, not `K I`. | +| `b (a c)` | Continuation has one argument. | +| `(b c) a` | Continuation's second payload is fixed normal `N`, not the rigid suffix. | +| `b (c a)` | Continuation has one argument. | +| `(c a) b` | Pair-pumping divergence invariant below. | +| `c (a b)` | Continuation has one argument. | +| `(c b) a` | Continuation has three arguments. | +| `c (b a)` | Continuation's first payload is fixed normal `N`, not `K I`. | + +For `(a c) b`, put + +``` +J_t(X) = lambda u.X u t, +N = lambda a b.a (J_b(a)). +``` + +A nonempty wrapper word `W=J_t1(...J_tk(N))` satisfies + +``` +W U ->* N U tk ... t1. +N W P rest... ->* N (J_P(W)) tk ... t1 rest.... +``` + +Every macro consists of head contractions. The new wrapper word is +nonempty and there is still at least one pending argument. Starting +`N N C S ->* N (J_C(N)) S` reaches this invariant. It gives infinitely +many weak-head contractions, never a head normal form. This is a proof +for all finite wrapper lengths, not a conclusion from the capped trace. + +For `(c a) b`, put `P(X,Y)=lambda u.u X Y` and +`N=lambda a b.a P(a,b)`. With `W=P(N,C)` and `L=N W S`, + +``` +N N C S ->* L, +L ->^4 L C. +``` + +Iterating the four head contractions, in their growing application +contexts, proves weak-head divergence. + +### 3b. The sixty 35-bit layouts + +Now `N=lambda a b c.T4(a,a,b,c)`, and + +``` +Delta N ->^2 lambda b c.T4(N,N,b,c). +``` + +The multiset has twelve distinct orders and five application trees. +Separate by the leftmost/head leaf of `T4`. + +**Thirty a-headed layouts.** Twenty-four have a reduct with at least +three leading lambdas (the four non-left-spine shapes for each ordering +of the other three leaves). Of the six remaining left spines: + +| T4 | Refutation | +|---|---| +| `a a b c` | Exact head cycle, period three after a two-step prefix. | +| `a a c b` | Exact head cycle, period six after a two-step prefix. | +| `a b a c` | Two leading lambdas, continuation with three arguments. | +| `a b c a` | Same. | +| `a c a b` | On source `I`, the rigid continuation has four arguments. | +| `a c b a` | On source `I`, the result is `C K stream(I,Ntail)`, with wrong value and remainder. | + +For the first two cycles one can also inspect directly the equations +`N N B C ->* N N B C` and `N N B C ->* N N C B ->* N N B C`. + +**Fifteen b-headed layouts.** Nine have one or three arguments at the +continuation. The six two-argument cases give respectively + +``` +C N (N S), C (N N) S, C N (S N), +C (N S) N, C S (N N), C (S N) N, +``` + +with `S=stream(I,Ntail)`. The first or second payload visibly disagrees +with `K I` or the rigid `Ntail`: `N` is a fixed closed normal three-lambda +term, and `S` is a nonempty normal Scott stream. No normalization of +`N N` is needed. + +**Fifteen c-headed layouts.** Direct identity-source head reduction gives: + +| T4 | Result obstruction on source I | +|---|---| +| `c (a (a b))` | `C` has one argument. | +| `c ((a a) b)` | An extra leading lambda. | +| `(c a) (a b)` | `C` has three arguments. | +| `(c (a a)) b` | Rigid suffix, rather than `C`, is the head. | +| `c a a b` | An extra leading lambda. | +| `c (a (b a))` | `C` has four arguments. | +| `c ((a b) a)` | Result `C N C`, with the wrong rigid remainder. | +| `(c a) (b a)` | `C` has three arguments. | +| `(c (a b)) a` | `C` has five arguments. | +| `c a b a` | `C` has four arguments. | +| `c (b (a a))` | `C` has three arguments. | +| `c ((b a) a)` | `C` has four arguments. | +| `(c b) (a a)` | `C` has three arguments. | +| `(c (b a)) a` | `C` has four arguments. | +| `c b a a` | `C` has four arguments. | + +All these finite reductions are among the kernel-checked clauses. + +## 4. One extra vacuous lambda: the five-lambda cases + +Here `X<=4`. First suppose the vacuous lambda belongs to `D`. Its two +own `d` leaves already have index zero. Placing the vacuous lambda around +both would spend two index units, leaving fewer than the required three +for the width witness. Placing it above `d` makes `D` vacuous-headed, +contrary to source minimality. Placing it around one leaf gives either +an erasing source redex or the single normal possibility + +``` +D = deltaK = lambda d.d (K d), |D|=11. +``` + +This uses the one available index unit beyond the width witness. Its +four-leaf argument is consequently one of the `X=3` shapes in section 3. +Since `deltaK A -> A (K A)`, these fail uniformly: + +| Argument | Consequence | +|---|---| +| closed outer-duplicate-before-middle | `A (K A) ->* A`, a strictly smaller interpreter if it worked. | +| closed middle-duplicate-before-inner | One-lambda head normal form. | +| closed inner duplicate | Two-lambda interface with only one internal nonlinear binder. | +| open middle duplicate | `lambda y.A (K A) ->* lambda y.A`; its body has no internal nonlinear binder after the interface lambdas. | +| open inner duplicate | Two-lambda interface with only one internal nonlinear binder. | + +### If the vacuous lambda belongs to the four-leaf argument + +Then `D=Delta`. Delete the vacuous lambda, decrementing the affected +indices, to obtain `N0` or `A0`. Deleting a vacuous lambda from a normal +term preserves normality: it was not in function position of an +application, since that would already be a redex. It also preserves the +width-three witness and all live-binder occurrence counts. + +Reinserting the lambda around a subterm `U` costs exactly + +``` +2 + freeLeaves(U). +``` + +The base diagonal has at least 33 bits. Thus at size at most 36 there +are only two possibilities: + +* A zero-free-leaf insertion into a base of 33 or 34 bits. The only closed + subterm of a closed four-leaf argument in the six-shape classification + is the whole argument. An open argument has none. Therefore this gives + `A=K N0`, and `Delta A -> A A -> N0`, contradicting minimality. +* A one-free-leaf insertion into a 33-bit base. A subterm with one free + occurrence is either a variable leaf or the block containing the two + innermost live binders and the single free occurrence of the outer one. + There is no other possibility in these normal four-leaf trees. + +Inserting around that two-binder block gives, for the closed arguments, + +``` +lambda a.a (lambda u b c.T3(a,b,c)), +lambda a u b.b (lambda c.T3(a,b,c)), +lambda a u b c.T4(a,b,c,c). +``` + +After diagonal application the first has two interface lambdas with +only one internal nonlinear binder; the second ignores its public +continuation; the third leaves three leading lambdas. In the open forms, +the corresponding reduction gives either zero internal nonlinear binders +or three leading lambdas. + +For insertion at a variable leaf, boxing the exposed duplicate before its +lambda block creates an erasing source redex. Boxing any leaf inside the +block leaves the closed middle family with one-lambda head form, and the +inner families with one internal nonlinear binder. A vacuous box introduces +no nonlinearity and does not duplicate the one inserted copy in the inner +families. The open middle family needs its own analysis in section 4b: +its diagonal can create more than one residual copy of the argument. + +The remaining closed family is **outer-duplicate-before-middle**: + +``` +N = lambda a.a (lambda b c.T3(a,b,c) with one leaf boxed). +``` + +The exposed outer `a` cannot be boxed: that is an erasing source redex. +Inside `T3`, a box cannot be the function of an application. Exactly +eighteen normal layouts remain. + +### 4a. The eighteen normal boxed layouts at 36 bits + +The following table writes `Kx` for the literal box `lambda u.x`. + +| Boxed body | Refutation of `Delta N` | +|---|---| +| `(a Kb) c` | Two-lambda head form with zero arguments at C. | +| `(a b) Kc` | Forward-wrapper divergence below. | +| `a (b Kc)` | First payload is `K S`, not `K I`, on source I. | +| `(a c) Kb` | One-lambda head form. | +| `(a Kc) b` | One-lambda head form. | +| `a (c Kb)` | One-lambda head form. | +| `(b Ka) c` | One-lambda head form. | +| `(b a) Kc` | Reverse-wrapper divergence below. | +| `b (a Kc)` | Two-lambda head form with one argument at C. | +| `(b c) Ka` | One-lambda head form. | +| `(b Kc) a` | One-lambda head form. | +| `b (c Ka)` | Fixed normal first payload `lambda u v.v (lambda p q.p (q (K v)))`, not K I. | +| `(c Ka) b` | One-lambda head form. | +| `(c a) Kb` | One-lambda head form. | +| `c (a Kb)` | One-lambda head form. | +| `(c b) Ka` | One-lambda head form. | +| `(c Kb) a` | One-lambda head form. | +| `c (b Ka)` | One-lambda head form. | + +For the forward case put + +``` +F(X) = lambda b c.X b (K c), +N = lambda a.a (F(a)). +``` + +Induction on `k` gives, for `k>=1`, + +``` +F^k(N) U V ->* N U (K^k V), +N F^k(N) P ->* N F^(k+1)(N) (K^k P). +``` + +Each macro is a nonempty finite head-reduction sequence. Starting +`N N C S` reaches `N F^2(N) (K C) S`. The displayed invariant gives +infinitely many weak-head contractions with `S` still pending. + +For the reverse case put + +``` +G(X) = lambda b c.b X (K c), +N = lambda a.a (G(a)), +Y = N G(N). +``` + +Then `N N -> Y`, and the exact head macro is + +``` +Y P ->^5 Y (K (K P)). +``` + +Again the invariant iterates indefinitely. These arguments work for +arbitrary rigid public arguments; in particular they fail on quoted I. + +### 4b. The eighteen open middle-duplicate boxed layouts + +The second family is + +``` +E = lambda a.Delta A_a, +A_a = lambda b.b (lambda c.T3(a,b,c) with one leaf boxed). +``` + +It has the same eighteen normal boxed bodies listed in section 4a. +For **sixteen**, the head normal form of E has exactly one leading lambda; +the exact finite reductions are in `g36open_*` in `FiniteChecks.lean`. +The only exceptions are `(b c) Ka` and `(c b) Ka`. Their nontermination +does not rely on the capped exploratory traces. + +For `(b c) Ka`, fix the outer parameter a and put + +``` +T = K a, +J(X) = lambda c.X c T, +A = lambda b.b J(b). +``` + +For every `k>=1`, + +``` +J^k(A) U ->* A U T ... T (k pending copies of T), +A J^k(A) ->* A J^(k+1)(A) T ... T. +``` + +The second identity uses `1+k` head contractions. `A A -> A J(A)` +enters this invariant. The active recursive argument always precedes +every pending T and the eventual stream argument, so neither reaches +the head. This proves weak-head divergence for each rigid a. + +For `(c b) Ka`, put + +``` +T = K a, +P(X) = lambda c.c X T, +A = lambda b.b P(b), +L = A P(A). +``` + +Then `A A -> L` and + +``` +L ->^3 L T T. +``` + +This is another head-pumping invariant. Both exceptions are excluded, +completing the vacuous-lambda case split. + +## 5. Conclusion and checking boundary + +Every minimum interpreter of at most 36 bits would have one of the two +inventories in section 2. Sections 3 and 4 exclude both. Since the known +165 supplies existence, well-ordering gives a minimum; therefore every +interpreter has at least **37 bits**. + +`verify.py` checks exactly 108 residual layouts (12+60+18+18), and never +treats a cap as a result. It produces exact repeated-state certificates +for the two 35-bit loops. The six growing families have the handwritten +parametric invariants above; their fixed macro clauses are additionally +checked in Python and Lean. All 144 global finite head-step equalities +(plus eight remainder-extractor clauses) passed Lean 4.32.2. The global syntax classification, width argument, +and infinitary invariants remain handwritten. + +The live 165, exact pinned 168, 170 inlined-NEXT variant, 204 normal, +584 two-nonlinear, 672 typed-normal, and 742 two-nonlinear-normal +references satisfy the used structural constraints. Their checks are in +`verified.json`; no syntactic-redex or untypability assumption is made. + +The next inventory is qualitatively more permissive: seven leaves can +support a third nonlinear binder, or allow the off-chain nonlinear binder +to capture a variable whose other occurrence lies in the width witness. +The closed width-one operand argument above then stops applying. This +proof establishes 37, not a claim that a few more leaf counts will bridge +the gap to 165. + +Source for the external theorem: Rick Statman, *Two Variables Are Not +Enough*, ICTCS 2005, printed pp. 406-409, +https://doi.org/10.1007/11560586_32 . The inspected preview is saved as +`statman-preview.pdf`, with extracted text beside it. diff --git a/data/self-interpreter/reasoning_floor/global/REPORT.md b/data/self-interpreter/reasoning_floor/global/REPORT.md new file mode 100644 index 00000000..d653b845 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/REPORT.md @@ -0,0 +1,231 @@ +# Global lane report + +**New handwritten bounds: 37 bits globally for self-interpreters; 24 bits +globally for exact remainder extractors; 70 bits for self-interpreters +whose literal source is continuation-headed.** No sub-165 interpreter was +found or claimed. The complete optimality problem remains open. + +All files written by this lane are in `tmp/overnight/global/`. + +## 1. Complete interpreters built + +Only one complete control construction was instantiated; its construction +was already described in the repository: + +| Artifact | Bits | Exact battery line | Idea | +|---|---:|---|---| +| `control366.lam`, `control366.blc` | 366 | `366 bits ok=667 skip=1 fail=0` | `lambda c s.c (E K s) (E F s)`, with the literal 165 in both E positions. | + +Its all-source correctness follows directly from the existing E contract: +the two payloads beta-join `lambda z.M` and the unchanged suffix, +respectively, including for divergent M. This is an attaining control for +the **shape** of the projection theorem, not its numeric bound: its actual +payloads cost 178 and 177. `projection-control.json` records the check. + +I also rechecked the seven requested correct references: 165, the exact +Lean-pinned 168, the existing 170 inlined-NEXT variant, 204 beta-normal, +584 two-nonlinear, 672 typed-normal, and 742 two-nonlinear-normal. All seven +returned `ok=667 skip=1 fail=0`; exact lines are in `batteries.txt`. +The upstream named `ref/AIT/ait/int.lam` is a 220-bit pre-optimization +source, so the final 168 check uses `Selfint.lean`'s exact `intLWire`. + +The relevant structural invariants were checked on each reference: + +| Bits | Lambdas | Leaves | Index sum | Width | Nonlinear binders | Beta-normal | +|---:|---:|---:|---:|---:|---:|---| +| 165 | 17 | 26 | 29 | 4 | 7 | no | +| 168 | 16 | 27 | 30 | 4 | 7 | no | +| 170 | 16 | 25 | 40 | 4 | 7 | no | +| 204 | 21 | 30 | 44 | 4 | 9 | yes | +| 584 | 69 | 68 | 176 | 7 | 2 | no | +| 672 | 29 | 85 | 276 | 6 | 10 | yes | +| 742 | 64 | 62 | 368 | 10 | 2 | yes | + +All have incomparable nonlinear binders. No candidate invariant assumes +a syntactic beta redex, untypability, more than two nonlinear binders, +or several distinct original binders for the output's different roles. + +## 2. Strongest global result: 37 bits + +Full proof: **`PROOF37.md`**. + +The proof retains the established 34-bit bound as a dependency and closes +34, 35, and 36 analytically. It uses the exact closed-source contract, +Statman's width obstruction, the kernel-checked incomparable-binder +theorem, the head decomposition, internal-interface necessities, and +minimum-source beta wire accounting. + +The key reduction is small and explicit. A minimum interpreter below 37 +would have exactly four live binders, six leaves, and at most one vacuous +binder. The width witness uses three live binders on a chain, while the +fourth nonlinear binder is closed in isolation. If the first head redex +contracts one of the width-chain binders, its closed width-one argument +removes the necessary third variable from every subterm; the reduct has +width at most two and cannot be an interpreter. Thus the source must be +a small diagonal `D N` or `lambda y.D A(y)`. + +The four-leaf argument is normal by minimum-source wire accounting. Its +six possible binder/duplicate placements reduce the remaining cases to +12 layouts at 34 bits, 60 at 35 bits, and two families of 18 boxed layouts +at 36 bits. Head arity or exact identity-source payloads refute 100 of +the 108 layouts by finite observations; two more have exact repeated head +states. The six remaining growing layouts have explicit head-pumping or +advancing-wrapper invariants, proved for arbitrary iteration length in +the proof file. Capped exploratory traces are not used as exclusions. + +The remaining placements of the vacuous binder are excluded uniformly: +they erase the continuation, retain an extra leading lambda, lose the +required internal width/nonlinearity, or reduce to a shorter purported +interpreter. + +**Evidence level:** handwritten global theorem, with **144** supporting +finite reduction clauses checked by Lean. This does not change the +repository's fully formalized global numerical theorem by itself. The +classification, use of Statman, and six parametric infinite invariants are +not formalized here. Independent review should precede promoting this +handwritten bound to the canonical documentation. + +## 3. Semantic lower bounds and a partial decomposition + +Full proofs: **`PROJECTIONS.md`**. + +**Exact remainder extractor: at least 24 bits, unconditionally.** The +hypotheses need only closed-source, closed-suffix beta-join correctness. +The existing two-nonlinear and interior-two-nonlinear theorems rule out +a leading lambda in any minimum extractor below 24. Source minimality +then forces an application of two closed one-live-binder terms. The +entire small inventory is Delta, a ternary diagonal, or Delta with one or +two vacuous boxes. Each either reduces to a term with one nonlinear +binder, head-diverges before consuming its input, returns Omega for all +inputs, or exposes a lambda when the exact suffix is Omega. This is a +handwritten theorem; eight fixed reduction clauses are additionally +kernel-checked. + +The syntax lower bound is not an upper bound: the natural 24-bit near miss +`lambda s.s Delta Delta` returns `K Delta` on source I with suffix I. +The known correct remainder extractor remains 70 bits. + +**Literal continuation-headed interpreter: at least 70 bits.** If the +source itself is `lambda c s.c A B`, the value payload A must contain an +internal width-three witness and two incomparable nonlinear binders. +Therefore it has at least four live internal binders, six internally +bound leaves, one additional stream occurrence, and three index units: +`|A|>=37`. The exact remainder theorem already gives `|B|>=22` for this +open body. The displayed interface costs 11, so `|H|>=11+37+22=70`. + +This is a genuine disjoint-subterm decomposition at the displayed source +form. It permits arbitrary redexes, whole-stream access, and continuation +occurrences in either payload. It does not price a smaller source that +expands into that form, and it does not apply to the 165's stream-headed +reader. In particular I do not add 24 for a separately closed remainder +extractor while also charging the shared public stream binder. + +## 4. New exact identities + +The six divergence invariants are new exact identities for the forced +small layouts. Their definitions, substitution-safe derivations, and +iteration proofs are in `PROOF37.md` sections 3a, 4a, and 4b: + +1. An append-wrapper word around the 34-bit generator advances to a longer + word and leaves its old labels as pending arguments. +2. The 34-bit pair generator has `L ->^4 L C`. +3. The closed 36-bit forward generator has + `N F^k(N) P ->* N F^(k+1)(N) (K^k P)`. +4. The closed 36-bit reverse generator has `Y P ->^5 Y (K (K P))`. +5. The open 36-bit append generator has + `A J^k(A) ->^(k+1) A J^(k+1)(A) T ... T`, with k pending copies of T. +6. The open 36-bit pair generator has `L ->^3 L T T`. + +These are identities of the written lambda terms; the divergence +conclusions additionally use the stated invariant that the active +recursive argument remains ahead of all pending data arguments. + +The remainder proof's small identities include +`Delta deltaK ->* deltaK`, `deltaK Delta ->* Delta`, and +`Delta (K (K Delta)) ->* K Delta`, with literal boxes and +`deltaK=lambda x.x (K x)`. They are part of the eight extra Lean clauses. + +## 5. What a comprehensive proof still needs + +I do not have an unconditional source decomposition near 165. The new +37-bit proof exhausts a very constrained inventory. At seven leaves, +an off-chain nonlinear binder can capture an ancestor whose other use +lies in the width witness; the closed width-one operand argument then +fails. Counting the reader's expanding residual copies as separate code +would be unsound, and the correct 584/742 witnesses still forbid a larger +unconditional nonlinear-binder count. + +The semantic directions in the prompt are useful but not independently +additive. Unary skip can use `s s s`; a normal or typed interpreter can +have its knot activated by the quotation; output roles can share a single +original binder; and the 165 really fuses reading, variable return, and +skip. The existing remainder-growth theorem establishes persistent code +growth, but does not assign a source bit cost to the shared machinery +that creates it. + +A plausible next proof tool is a **proof-producing demand-driven search +with shared open terms**, rather than a flat term census. Its missing +theorems would have to support all of the following: + +* exact residual-origin/binding provenance while the same original code + serves both remainder traversal and value reconstruction; +* compositional lower bounds for completing a partially exposed handler, + preserving actual input/selector/suffix correlations; +* minimum-source pruning with the exact wire delta, including index + movement under binders (plain affine normalization is not size-safe); +* certified loop/pumping exclusions and rigid-context distinctions, + retaining all resource-capped branches as unresolved; +* a compact proof that every smaller source lies in a covered search + region, including source terms whose head forms are much larger. + +There are exactly + +``` +28,884,801,049,237,501,100,398,528,001,139,900,247,359,718 +``` + +closed terms below 165 bits, about **2.89e43**. This run computed the count +by the syntax recurrence in `count_search_space.py` in 0.036 seconds; it +generated no terms. The existing interpreter document reports a prior +prototype demand-driven tree estimate around `1e34` nodes from scratch, +or `1e12` with the old frame fixed. Those are repository-reported estimates, +not reproduced measurements here. Thus current structural pruning alone +does not supply a feasible global certificate; a quantitative theorem +about **shared semantic roles in original syntax** is the missing step. + +For construction, the still-live region is the one the 165 itself +demonstrated: another shared computation whose result is right for two +roles, especially quotation-activated recursion/control. None of the +new lower bounds excludes a sub-165 in that region. + +## 6. Verification and files + +* `PROOF37.md`: complete handwritten 37-bit proof and all case splits. +* `PROJECTIONS.md`: complete 24-bit remainder and 70-bit literal-head proofs. +* `verify.py`, `verified.json`: 108 forced layouts, macro identities, + near misses, and seven reference structural checks; no census search. +* `FiniteChecks.lean`, `lean-check.log`: **152** finite head-step clauses, + Lean 4.32.2 exit 0, **1.218 seconds** on the final run. Two sample + axiom audits report only `propext`. The entire theorem is not claimed + as kernel-checked. +* `batteries.txt`: the seven reference batteries, run with two workers in + 15.949 seconds, plus the separate 366-bit control. +* `projection_control.py`, `projection-control.json`, `control366.*`: + complete literal-head control and its passing battery. +* `count_search_space.py`, `search-count.json`: exact grammar counts. +* `statman-preview.pdf`, `statman-preview.txt`: inspected primary-source + preview containing the width theorem on printed page 406. + +Reproduction from the repository root: + +``` +python3 -B tmp/overnight/global/verify.py --battery +python3 -B tmp/overnight/global/projection_control.py +python3 -B tmp/overnight/global/count_search_space.py +``` + +For the Lean file, from `lean/`, set `LEAN_PATH` to that directory's +`.lake/build/lib/lean`, then run the installed `lean -j 1` on the absolute +path to `tmp/overnight/global/FiniteChecks.lean`. The exact command is in +`lean-check.log`. No existing Lean module or tracked repository file was +edited, and no consult was made from this lane. diff --git a/data/self-interpreter/reasoning_floor/global/batteries.txt b/data/self-interpreter/reasoning_floor/global/batteries.txt new file mode 100644 index 00000000..1b776ff9 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/batteries.txt @@ -0,0 +1,18 @@ +Observed reference battery run, two workers, frozen release binary: + +int165: 165 bits ok=667 skip=1 fail=0 +int168 (exact Lean-pinned wire): 168 bits ok=667 skip=1 fail=0 +int170 (existing inlined-NEXT variant): 170 bits ok=667 skip=1 fail=0 +int204: 204 bits ok=667 skip=1 fail=0 +int584: 584 bits ok=667 skip=1 fail=0 +int672: 672 bits ok=667 skip=1 fail=0 +int742: 742 bits ok=667 skip=1 fail=0 + +The seven-reference run took 15.949 seconds including fixed checks. + +Separate literal continuation-headed control: +control366: 366 bits ok=667 skip=1 fail=0 + +These finite batteries are supplementary checks. They do not prove the +all-source contracts or any lower bound. The single skipped source is not +used to infer success on divergent programs. diff --git a/data/self-interpreter/reasoning_floor/global/check34.json b/data/self-interpreter/reasoning_floor/global/check34.json new file mode 100644 index 00000000..e8f2296e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/check34.json @@ -0,0 +1,134 @@ +[ + { + "tree": "(a b) c", + "n": "\\a\\b.a (\\c.(a b) c)", + "source_bits": "0100011010000001110000101111011010", + "head_status": "hnf", + "head_steps": 6, + "head_result": "\\a\\b.a (\\c.a (\\d.(\\e.(\\f\\g.f (\\h.f g h)) a e) b d) c)", + "I_status": "hnf", + "I_steps": 8, + "I_result": "\\a\\b.a (\\c.a (\\d.(\\e.(\\f\\g.f (\\h.f g h)) a e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) d) c)" + }, + { + "tree": "a (b c)", + "n": "\\a\\b.a (\\c.a (b c))", + "source_bits": "0100011010000001110000111100111010", + "head_status": "hnf", + "head_steps": 5, + "head_result": "\\a\\b\\c.a (\\d.(\\e.(\\f\\g.f (\\h.f (g h))) (a e)) (b d)) (\\d.a (\\e.(\\f.(\\g\\h.g (\\i.g (h i))) (a f)) (b e)) (c d))", + "I_status": "hnf", + "I_steps": 7, + "I_result": "\\a\\b\\c.a (\\d.(\\e.(\\f\\g.f (\\h.f (g h))) (a e)) ((\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) d)) (\\d.a (\\e.(\\f.(\\g\\h.g (\\i.g (h i))) (a f)) ((\\f.f (\\g\\h.g) (\\g.g (\\h\\i.h) (\\h.h (\\i\\j.j) (\\i.i (\\j\\k.j) b)))) e)) (c d))" + }, + { + "tree": "(a c) b", + "n": "\\a\\b.a (\\c.(a c) b)", + "source_bits": "0100011010000001110000101111010110", + "head_status": "cap", + "head_steps": 100, + "head_result": "\\a\\b.(\\c.(\\d.(\\e.(\\f\\g.f (\\h.f h g)) e a) d b) c a) (\\c.(\\d.(\\e.(\\f.(\\g.(\\h.(\\i.(\\j.(\\k.(\\l.(\\m.(\\n.(\\o.(\\p\\q.p (\\r.p r q)) o a) n b) m a) l a) k a) j a) i a) h a) g a) f a) e a) d a) c a) a a a a a a a a a b a a a a a a a a a b a a a a a a a a b a a a a a a a b a a a a a a b a a a a a b a a a a b a a a b a a b a b", + "I_status": "cap", + "I_steps": 100, + "I_result": "\\a\\b.(\\c.(\\d.(\\e.(\\f.(\\g.(\\h\\i.h (\\j.h j i)) g a) f (\\g.g (\\h\\i.h) (\\h.h (\\i\\j.i) (\\i.i (\\j\\k.k) (\\j.j (\\k\\l.k) b))))) e a) d a) c a) (\\c.(\\d.(\\e.(\\f.(\\g.(\\h.(\\i.(\\j.(\\k.(\\l.(\\m.(\\n.(\\o.(\\p\\q.p (\\r.p r q)) o a) n (\\o.o (\\p\\q.p) (\\p.p (\\q\\r.q) (\\q.q (\\r\\s.s) (\\r.r (\\s\\t.s) b))))) m a) l a) k a) j a) i a) h a) g a) f a) e a) d a) c a) a a a a a a a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) a a a a a a a a a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) a a a a a a a a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) a a a a a a a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) a a a a a a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) a a a a a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) a a a a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) a a a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) a a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e" + }, + { + "tree": "a (c b)", + "n": "\\a\\b.a (\\c.a (c b))", + "source_bits": "0100011010000001110000111100110110", + "head_status": "hnf", + "head_steps": 9, + "head_result": "\\a\\b\\c.a b a (\\d.a b a (d (\\e.(\\f.(\\g.(\\h\\i.h (\\j.h (j i))) (g a)) (f b)) a (e c))))", + "I_status": "hnf", + "I_steps": 11, + "I_result": "\\a\\b\\c.a (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) a (\\d.a (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) a (d (\\e.(\\f.(\\g.(\\h\\i.h (\\j.h (j i))) (g a)) (f (\\g.g (\\h\\i.h) (\\h.h (\\i\\j.i) (\\i.i (\\j\\k.k) (\\j.j (\\k\\l.k) b)))))) a (e c))))" + }, + { + "tree": "(b a) c", + "n": "\\a\\b.a (\\c.(b a) c)", + "source_bits": "0100011010000001110000101110111010", + "head_status": "hnf", + "head_steps": 4, + "head_result": "\\a\\b.a (\\c\\d.c (\\e.d c e)) (\\c.b (\\d.a (\\e\\f.e (\\g.f e g)) d) c)", + "I_status": "hnf", + "I_steps": 6, + "I_result": "\\a\\b.a (\\c\\d.c (\\e.d c e)) (\\c.(\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) (\\d.a (\\e\\f.e (\\g.f e g)) d) c)" + }, + { + "tree": "b (a c)", + "n": "\\a\\b.a (\\c.b (a c))", + "source_bits": "0100011010000001110000111001111010", + "head_status": "hnf", + "head_steps": 4, + "head_result": "\\a\\b.a ((\\c\\d.c (\\e.d (c e))) (\\c.b ((\\d.a ((\\e\\f.e (\\g.f (e g))) d)) c)))", + "I_status": "hnf", + "I_steps": 6, + "I_result": "\\a\\b.a ((\\c\\d.c (\\e.d (c e))) (\\c.(\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) ((\\d.a ((\\e\\f.e (\\g.f (e g))) d)) c)))" + }, + { + "tree": "(b c) a", + "n": "\\a\\b.a (\\c.(b c) a)", + "source_bits": "0100011010000001110000101110101110", + "head_status": "hnf", + "head_steps": 4, + "head_result": "\\a\\b.a (\\c.b c (\\d.a d (\\e\\f.e (\\g.f g e)))) (\\c\\d.c (\\e.d e c))", + "I_status": "hnf", + "I_steps": 6, + "I_result": "\\a\\b.a (\\c.(\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) c (\\d.a d (\\e\\f.e (\\g.f g e)))) (\\c\\d.c (\\e.d e c))" + }, + { + "tree": "b (c a)", + "n": "\\a\\b.a (\\c.b (c a))", + "source_bits": "0100011010000001110000111001101110", + "head_status": "hnf", + "head_steps": 4, + "head_result": "\\a\\b.a ((\\c.b (c (\\d.a (d (\\e\\f.e (\\g.f (g e))))))) (\\c\\d.c (\\e.d (e c))))", + "I_status": "hnf", + "I_steps": 6, + "I_result": "\\a\\b.a ((\\c.(\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) (c (\\d.a (d (\\e\\f.e (\\g.f (g e))))))) (\\c\\d.c (\\e.d (e c))))" + }, + { + "tree": "(c a) b", + "n": "\\a\\b.a (\\c.(c a) b)", + "source_bits": "0100011010000001110000101101110110", + "head_status": "cap", + "head_steps": 100, + "head_result": "\\a\\b.(\\c.c (\\d.d (\\e\\f.e (\\g.g e f)) a) b) (\\c\\d.c (\\e.e c d)) a a a a a a a a a a a a a a a a a a a a a a a a a", + "I_status": "cap", + "I_steps": 100, + "I_result": "\\a\\b.(\\c.(\\d.d (\\e\\f.e (\\g.g e f)) a) (\\d.d (\\e.e (\\f\\g.f (\\h.h f g)) a) c)) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) a a a a a a a a a a a a a a a a a a a a a a a a" + }, + { + "tree": "c (a b)", + "n": "\\a\\b.a (\\c.c (a b))", + "source_bits": "0100011010000001110000110011110110", + "head_status": "hnf", + "head_steps": 7, + "head_result": "\\a\\b.a (\\c.c (a ((\\d.d ((\\e\\f.e (\\g.g (e f))) a)) b)))", + "I_status": "hnf", + "I_steps": 9, + "I_result": "\\a\\b.a (\\c.c (a ((\\d.d ((\\e\\f.e (\\g.g (e f))) a)) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))))))" + }, + { + "tree": "(c b) a", + "n": "\\a\\b.a (\\c.(c b) a)", + "source_bits": "0100011010000001110000101101101110", + "head_status": "hnf", + "head_steps": 5, + "head_result": "\\a\\b.a b (\\c.c a (\\d\\e.d (\\f.f e d))) (\\c\\d.c (\\e.e d c))", + "I_status": "hnf", + "I_steps": 7, + "I_result": "\\a\\b.a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) (\\c.c a (\\d\\e.d (\\f.f e d))) (\\c\\d.c (\\e.e d c))" + }, + { + "tree": "c (b a)", + "n": "\\a\\b.a (\\c.c (b a))", + "source_bits": "0100011010000001110000110011101110", + "head_status": "hnf", + "head_steps": 5, + "head_result": "\\a\\b.a (\\c\\d.c (\\e.e (d c))) (b (\\c.c (a (\\d\\e.d (\\f.f (e d))))))", + "I_status": "hnf", + "I_steps": 7, + "I_result": "\\a\\b.a (\\c\\d.c (\\e.e (d c))) ((\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) (\\c.c (a (\\d\\e.d (\\f.f (e d))))))" + } +] diff --git a/data/self-interpreter/reasoning_floor/global/check34.py b/data/self-interpreter/reasoning_floor/global/check34.py new file mode 100644 index 00000000..99344716 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/check34.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""The twelve residual 34-bit layouts, after the handwritten reduction. + +No closed-term census. No modification of repository files. +""" +import sys +sys.dont_write_bytecode = True +from pathlib import Path +import itertools +import json + +ROOT = Path(__file__).resolve().parents[3] +sys.path.insert(0, str(ROOT / "tools")) +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import blcc +import lc + +def parse(src): + parser = blcc.P(blcc.strip_comments(src)) + tree = blcc.p_lc(parser) + parser.ws() + assert parser.i == len(parser.t) + return blcc.to_db(tree) + +def head_step(t): + if t[0] == 'L': + u = head_step(t[1]) + return None if u is None else ('L', u) + if t[0] == 'A': + if t[1][0] == 'L': + return lc.beta(t[1], t[2]) + u = head_step(t[1]) + return None if u is None else ('A', u, t[2]) + return None + +def head_trace(t, cap=100): + seen = {t:0} + for n in range(cap): + u = head_step(t) + if u is None: + return 'hnf', n, t + if u in seen: + return 'loop', (seen[u],n+1), u + seen[u] = n+1 + t = u + if lc.size(t) > 100000: + return 'size', n+1, t + return 'cap',cap,t + +def invoke(e, m): + return ('L',('L',('A',('A',lc.shift(2,0,e),('V',1)), + lc.bitlist(lc.enc(m),('V',0))))) + +def main(): + rows = [] + delta = parse('\\x.x x') + ident = parse('\\x.x') + for (a,b,c) in itertools.permutations('abc'): + for tree in (f'({a} {b}) {c}', f'{a} ({b} {c})'): + nsrc = '\\a\\b.a (\\c.' + tree + ')' + n = parse(nsrc) + e = ('A',delta,n) + assert lc.size(e) == 34 + status, steps, hnf = head_trace(e) + pstatus,psteps,phnf = head_trace(invoke(e,ident)) + row = dict(tree=tree, n=nsrc, source_bits=lc.enc(e), + head_status=status, head_steps=steps, + head_result=lc.show(hnf)[:1000], + I_status=pstatus,I_steps=psteps, + I_result=lc.show(phnf)[:1000]) + rows.append(row) + print(json.dumps(row)) + (Path(__file__).parent/'check34.json').write_text(json.dumps(rows,indent=2)+'\n') + +if __name__ == '__main__': + main() diff --git a/data/self-interpreter/reasoning_floor/global/check35.json b/data/self-interpreter/reasoning_floor/global/check35.json new file mode 100644 index 00000000..8687e149 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/check35.json @@ -0,0 +1,966 @@ +[ + { + "body": "(a (a (b c)))", + "bits": "01000110100000000111100111100111010", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 5, + "head": "('V', 4)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 7, + "I_binders": 5, + "I_head": "('V', 4)", + "I_arguments": 2, + "hnf": "\\a\\b\\c\\d\\e.a b (a b ((\\f\\g\\h.f (f (g h))) (a b) (c d) e))", + "I_hnf": "\\a\\b\\c\\d\\e.a (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.h) (\\h.h (\\i\\j.j) (\\i.i (\\j\\k.j) b)))) (a (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.h) (\\h.h (\\i\\j.j) (\\i.i (\\j\\k.j) b)))) ((\\f\\g\\h.f (f (g h))) (a (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.h) (\\h.h (\\i\\j.j) (\\i.i (\\j\\k.j) b))))) (c d) e))" + }, + { + "body": "(a ((a b) c))", + "bits": "01000110100000000111100101111011010", + "head_status": "hnf", + "head_steps": 6, + "head_binders": 4, + "head": "('V', 3)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 8, + "I_binders": 4, + "I_head": "('V', 3)", + "I_arguments": 1, + "hnf": "\\a\\b\\c\\d.a (a b ((\\e\\f\\g.e (e f g)) a b c d))", + "I_hnf": "\\a\\b\\c\\d.a (a (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) ((\\e\\f\\g.e (e f g)) a (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) c d))" + }, + { + "body": "((a a) (b c))", + "bits": "01000110100000000101111011100111010", + "head_status": "cap", + "head_steps": 48, + "head_binders": 25, + "head": "('L', ('L', ('L', ('A', ('A', ('V', 2), ('V', 2)), ('A', ('V', 1), ('V', 0))))))", + "head_arguments": 2, + "I_status": "cap", + "I_steps": 48, + "I_binders": 24, + "I_head": "('L', ('L', ('L', ('A', ('A', ('V', 2), ('V', 2)), ('A', ('V', 1), ('V', 0))))))", + "I_arguments": 2 + }, + { + "body": "((a (a b)) c)", + "bits": "01000110100000000101111001111011010", + "head_status": "hnf", + "head_steps": 7, + "head_binders": 3, + "head": "('V', 2)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 9, + "I_binders": 3, + "I_head": "('V', 2)", + "I_arguments": 2, + "hnf": "\\a\\b\\c.a (a ((\\d\\e\\f.d (d e) f) a b)) c", + "I_hnf": "\\a\\b\\c.a (a ((\\d\\e\\f.d (d e) f) a (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))))) c" + }, + { + "body": "(((a a) b) c)", + "bits": "01000110100000000101011110111011010", + "head_status": "loop", + "head_steps": [ + 2, + 5 + ], + "head_binders": 2, + "head": "('L', ('L', ('L', ('A', ('A', ('A', ('V', 2), ('V', 2)), ('V', 1)), ('V', 0)))))", + "head_arguments": 3, + "I_status": "loop", + "I_steps": [ + 1, + 4 + ], + "I_binders": 2, + "I_head": "('L', ('L', ('L', ('A', ('A', ('A', ('V', 2), ('V', 2)), ('V', 1)), ('V', 0)))))", + "I_arguments": 3 + }, + { + "body": "(a (a (c b)))", + "bits": "01000110100000000111100111100110110", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 5, + "head": "('V', 3)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 8, + "I_binders": 5, + "I_head": "('V', 4)", + "I_arguments": 3, + "hnf": "\\a\\b\\c\\d\\e.b a (b a (e ((\\f\\g\\h.f (f (h g))) (b a) (d c))))", + "I_hnf": "\\a\\b\\c\\d\\e.a (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b))) ((\\f.f (\\g\\h.g) (\\g.g (\\h\\i.h) (\\h.h (\\i\\j.j) (\\i.i (\\j\\k.j) b)))) a (e ((\\f\\g\\h.f (f (h g))) ((\\f.f (\\g\\h.g) (\\g.g (\\h\\i.h) (\\h.h (\\i\\j.j) (\\i.i (\\j\\k.j) b)))) a) (d c))))" + }, + { + "body": "(a ((a c) b))", + "bits": "01000110100000000111100101111010110", + "head_status": "hnf", + "head_steps": 6, + "head_binders": 4, + "head": "('V', 2)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 15, + "I_binders": 4, + "I_head": "('V', 0)", + "I_arguments": 11, + "hnf": "\\a\\b\\c\\d.b (b ((\\e\\f\\g.e (e g f)) b a d c) a)", + "I_hnf": "\\a\\b\\c\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b))) a (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b))) c (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b))) a (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))" + }, + { + "body": "((a a) (c b))", + "bits": "01000110100000000101111011100110110", + "head_status": "cap", + "head_steps": 48, + "head_binders": 25, + "head": "('L', ('L', ('L', ('A', ('A', ('V', 2), ('V', 2)), ('A', ('V', 0), ('V', 1))))))", + "head_arguments": 2, + "I_status": "cap", + "I_steps": 48, + "I_binders": 24, + "I_head": "('L', ('L', ('L', ('A', ('A', ('V', 2), ('V', 2)), ('A', ('V', 0), ('V', 1))))))", + "I_arguments": 2 + }, + { + "body": "((a (a c)) b)", + "bits": "01000110100000000101111001111010110", + "head_status": "hnf", + "head_steps": 7, + "head_binders": 3, + "head": "('V', 1)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 11, + "I_binders": 3, + "I_head": "('V', 2)", + "I_arguments": 5, + "hnf": "\\a\\b\\c.b (b a) ((\\d\\e\\f.d (d f) e) b c)", + "I_hnf": "\\a\\b\\c.a (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))) (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))) ((\\d\\e\\f.d (d f) e) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) c)" + }, + { + "body": "(((a a) c) b)", + "bits": "01000110100000000101011110111010110", + "head_status": "loop", + "head_steps": [ + 2, + 8 + ], + "head_binders": 2, + "head": "('L', ('L', ('L', ('A', ('A', ('A', ('V', 2), ('V', 2)), ('V', 0)), ('V', 1)))))", + "head_arguments": 3, + "I_status": "loop", + "I_steps": [ + 1, + 7 + ], + "I_binders": 2, + "I_head": "('L', ('L', ('L', ('A', ('A', ('A', ('V', 2), ('V', 2)), ('V', 0)), ('V', 1)))))", + "I_arguments": 3 + }, + { + "body": "(a (b (a c)))", + "bits": "01000110100000000111100111001111010", + "head_status": "hnf", + "head_steps": 3, + "head_binders": 4, + "head": "('V', 3)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 4, + "I_head": "('V', 3)", + "I_arguments": 2, + "hnf": "\\a\\b\\c\\d.a ((\\e\\f\\g.e (f (e g))) b) (c (a ((\\e\\f\\g.e (f (e g))) b) d))", + "I_hnf": "\\a\\b\\c\\d.a ((\\e\\f\\g.e (f (e g))) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b))))) (c (a ((\\e\\f\\g.e (f (e g))) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b))))) d))" + }, + { + "body": "(a ((b a) c))", + "bits": "01000110100000000111100101110111010", + "head_status": "hnf", + "head_steps": 3, + "head_binders": 4, + "head": "('V', 3)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 4, + "I_head": "('V', 3)", + "I_arguments": 3, + "hnf": "\\a\\b\\c\\d.a (\\e\\f\\g.e (f e g)) b (c (a (\\e\\f\\g.e (f e g)) b) d)", + "I_hnf": "\\a\\b\\c\\d.a (\\e\\f\\g.e (f e g)) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) (c (a (\\e\\f\\g.e (f e g)) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b))))) d)" + }, + { + "body": "((a b) (a c))", + "bits": "01000110100000000101111011001111010", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 3, + "head": "('V', 2)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 6, + "I_binders": 3, + "I_head": "('V', 2)", + "I_arguments": 2, + "hnf": "\\a\\b\\c.a ((\\d\\e\\f.d e (d f)) b) (a c)", + "I_hnf": "\\a\\b\\c.a ((\\d\\e\\f.d e (d f)) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b))))) (a c)" + }, + { + "body": "((a (b a)) c)", + "bits": "01000110100000000101111001110111010", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 3, + "head": "('V', 2)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 6, + "I_binders": 3, + "I_head": "('V', 2)", + "I_arguments": 3, + "hnf": "\\a\\b\\c.a (\\d\\e\\f.d (e d) f) (b (a (\\d\\e\\f.d (e d) f))) c", + "I_hnf": "\\a\\b\\c.a (\\d\\e\\f.d (e d) f) ((\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) (a (\\d\\e\\f.d (e d) f))) c" + }, + { + "body": "(((a b) a) c)", + "bits": "01000110100000000101011110110111010", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 7, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a\\b.a (\\c\\d\\e.c d c e) a b", + "I_hnf": "\\a\\b.a (\\c\\d\\e.c d c e) a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(a (b (c a)))", + "bits": "01000110100000000111100111001101110", + "head_status": "hnf", + "head_steps": 3, + "head_binders": 4, + "head": "('V', 3)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 4, + "I_head": "('V', 3)", + "I_arguments": 2, + "hnf": "\\a\\b\\c\\d.a (b (\\e\\f\\g.e (f (g e)))) (c (d (a (b (\\e\\f\\g.e (f (g e)))))))", + "I_hnf": "\\a\\b\\c\\d.a ((\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) (\\e\\f\\g.e (f (g e)))) (c (d (a ((\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) (\\e\\f\\g.e (f (g e)))))))" + }, + { + "body": "(a ((b c) a))", + "bits": "01000110100000000111100101110101110", + "head_status": "hnf", + "head_steps": 3, + "head_binders": 4, + "head": "('V', 3)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 4, + "I_head": "('V', 3)", + "I_arguments": 3, + "hnf": "\\a\\b\\c\\d.a b (\\e\\f\\g.e (f g e)) (c d (a b (\\e\\f\\g.e (f g e))))", + "I_hnf": "\\a\\b\\c\\d.a (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) (\\e\\f\\g.e (f g e)) (c d (a (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) (\\e\\f\\g.e (f g e))))" + }, + { + "body": "((a b) (c a))", + "bits": "01000110100000000101111011001101110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 3, + "head": "('V', 2)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 6, + "I_binders": 3, + "I_head": "('V', 2)", + "I_arguments": 2, + "hnf": "\\a\\b\\c.a (b (\\d\\e\\f.d e (f d))) (c a)", + "I_hnf": "\\a\\b\\c.a ((\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) (\\d\\e\\f.d e (f d))) (c a)" + }, + { + "body": "((a (b c)) a)", + "bits": "01000110100000000101111001110101110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 3, + "head": "('V', 2)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 6, + "I_binders": 3, + "I_head": "('V', 2)", + "I_arguments": 3, + "hnf": "\\a\\b\\c.a b ((\\d\\e\\f.d (e f) d) c) (a b)", + "I_hnf": "\\a\\b\\c.a (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) ((\\d\\e\\f.d (e f) d) c) (a (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))))" + }, + { + "body": "(((a b) c) a)", + "bits": "01000110100000000101011110110101110", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 7, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a\\b.a b (\\c\\d\\e.c d e c) a", + "I_hnf": "\\a\\b.a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) (\\c\\d\\e.c d e c) a" + }, + { + "body": "(a (c (a b)))", + "bits": "01000110100000000111100110011110110", + "head_status": "hnf", + "head_steps": 3, + "head_binders": 4, + "head": "('V', 2)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 9, + "I_binders": 4, + "I_head": "('V', 3)", + "I_arguments": 2, + "hnf": "\\a\\b\\c\\d.b ((\\e\\f\\g.e (g (e f))) a) (d (b ((\\e\\f\\g.e (g (e f))) a) c))", + "I_hnf": "\\a\\b\\c\\d.a ((\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b))) (a (\\e\\f.e))) (d ((\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) ((\\e\\f\\g.e (g (e f))) a) c))" + }, + { + "body": "(a ((c a) b))", + "bits": "01000110100000000111100101101110110", + "head_status": "hnf", + "head_steps": 3, + "head_binders": 4, + "head": "('V', 2)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 11, + "I_binders": 4, + "I_head": "('V', 3)", + "I_arguments": 2, + "hnf": "\\a\\b\\c\\d.b (\\e\\f\\g.e (g e f)) a (d (b (\\e\\f\\g.e (g e f)) a) c)", + "I_hnf": "\\a\\b\\c\\d.a (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))" + }, + { + "body": "((a c) (a b))", + "bits": "01000110100000000101111010011110110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 3, + "head": "('V', 1)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 7, + "I_binders": 3, + "I_head": "('V', 0)", + "I_arguments": 3, + "hnf": "\\a\\b\\c.b c (b ((\\d\\e\\f.d f (d e)) a))", + "I_hnf": "\\a\\b\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))) ((\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) ((\\d\\e\\f.d f (d e)) a))" + }, + { + "body": "((a (c a)) b)", + "bits": "01000110100000000101111001101110110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 3, + "head": "('V', 1)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 12, + "I_binders": 3, + "I_head": "('V', 0)", + "I_arguments": 3, + "hnf": "\\a\\b\\c.b (\\d\\e\\f.d (f d) e) (c (b (\\d\\e\\f.d (f d) e))) a", + "I_hnf": "\\a\\b\\c.c ((\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) (\\d\\e\\f.d (f d) e)) (\\d\\e.d) a" + }, + { + "body": "(((a c) a) b)", + "bits": "01000110100000000101011110101110110", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 8, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 4, + "hnf": "\\a\\b.b a b (\\c\\d\\e.c e c d)", + "I_hnf": "\\a\\b.a (\\c\\d.c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.f) (\\e.e (\\f\\g.f) b))) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) (\\c\\d\\e.c e c d)" + }, + { + "body": "(a (c (b a)))", + "bits": "01000110100000000111100110011101110", + "head_status": "hnf", + "head_steps": 3, + "head_binders": 4, + "head": "('V', 2)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 6, + "I_binders": 4, + "I_head": "('V', 3)", + "I_arguments": 4, + "hnf": "\\a\\b\\c\\d.b (a (\\e\\f\\g.e (g (f e)))) (d (c (b (a (\\e\\f\\g.e (g (f e)))))))", + "I_hnf": "\\a\\b\\c\\d.a (\\e\\f\\g.e (g (f e))) (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b))) (d (c ((\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) (a (\\e\\f\\g.e (g (f e)))))))" + }, + { + "body": "(a ((c b) a))", + "bits": "01000110100000000111100101101101110", + "head_status": "hnf", + "head_steps": 3, + "head_binders": 4, + "head": "('V', 2)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 6, + "I_binders": 4, + "I_head": "('V', 3)", + "I_arguments": 4, + "hnf": "\\a\\b\\c\\d.b a (\\e\\f\\g.e (g f e)) (d c (b a (\\e\\f\\g.e (g f e))))", + "I_hnf": "\\a\\b\\c\\d.a (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b))) (\\e\\f\\g.e (g f e)) (d c ((\\e.e (\\f\\g.f) (\\f.f (\\g\\h.g) (\\g.g (\\h\\i.i) (\\h.h (\\i\\j.i) b)))) a (\\e\\f\\g.e (g f e))))" + }, + { + "body": "((a c) (b a))", + "bits": "01000110100000000101111010011101110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 3, + "head": "('V', 1)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 7, + "I_binders": 3, + "I_head": "('V', 0)", + "I_arguments": 3, + "hnf": "\\a\\b\\c.b c (a (\\d\\e\\f.d f (e d)) b)", + "I_hnf": "\\a\\b\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))) (a (\\d\\e\\f.d f (e d)) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))))" + }, + { + "body": "((a (c b)) a)", + "bits": "01000110100000000101111001101101110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 3, + "head": "('V', 1)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 7, + "I_binders": 3, + "I_head": "('V', 2)", + "I_arguments": 4, + "hnf": "\\a\\b\\c.b a (c (\\d\\e\\f.d (f e) d)) (b a)", + "I_hnf": "\\a\\b\\c.a (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))) (c (\\d\\e\\f.d (f e) d)) ((\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) a)" + }, + { + "body": "(((a c) b) a)", + "bits": "01000110100000000101011110101101110", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 13, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a\\b.b (\\c\\d\\e.c e d c) a b", + "I_hnf": "\\a\\b.a (\\c\\d.c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(b (a (a c)))", + "bits": "01000110100000000111001111001111010", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 1, + "hnf": "\\a\\b.a ((\\c\\d\\e.d (c (c e))) ((\\c\\d\\e.d (c (c e))) b))", + "I_hnf": "\\a\\b.a ((\\c\\d\\e.d (c (c e))) ((\\c\\d\\e.d (c (c e))) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))))" + }, + { + "body": "(b ((a a) c))", + "bits": "01000110100000000111001011110111010", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 1, + "hnf": "\\a\\b.a ((\\c\\d\\e.d (c c e)) (\\c\\d\\e.d (c c e)) b)", + "I_hnf": "\\a\\b.a ((\\c\\d\\e.d (c c e)) (\\c\\d\\e.d (c c e)) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))))" + }, + { + "body": "((b a) (a c))", + "bits": "01000110100000000101110111001111010", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a\\b.a (\\c\\d\\e.d c (c e)) ((\\c\\d\\e.d c (c e)) b)", + "I_hnf": "\\a\\b.a (\\c\\d\\e.d c (c e)) ((\\c\\d\\e.d c (c e)) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))))" + }, + { + "body": "((b (a a)) c)", + "bits": "01000110100000000101110011110111010", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a\\b.a ((\\c\\d\\e.d (c c) e) (\\c\\d\\e.d (c c) e)) b", + "I_hnf": "\\a\\b.a ((\\c\\d\\e.d (c c) e) (\\c\\d\\e.d (c c) e)) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(((b a) a) c)", + "bits": "01000110100000000101011101110111010", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a\\b.a (\\c\\d\\e.d c c e) (\\c\\d\\e.d c c e) b", + "I_hnf": "\\a\\b.a (\\c\\d\\e.d c c e) (\\c\\d\\e.d c c e) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(b (a (c a)))", + "bits": "01000110100000000111001111001101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 1, + "hnf": "\\a\\b.a ((\\c\\d\\e.d (c (e c))) (b (\\c\\d\\e.d (c (e c)))))", + "I_hnf": "\\a\\b.a ((\\c\\d\\e.d (c (e c))) ((\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) (\\c\\d\\e.d (c (e c)))))" + }, + { + "body": "(b ((a c) a))", + "bits": "01000110100000000111001011110101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 1, + "hnf": "\\a\\b.a ((\\c\\d\\e.d (c e c)) b (\\c\\d\\e.d (c e c)))", + "I_hnf": "\\a\\b.a ((\\c\\d\\e.d (c e c)) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) (\\c\\d\\e.d (c e c)))" + }, + { + "body": "((b a) (c a))", + "bits": "01000110100000000101110111001101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a\\b.a (\\c\\d\\e.d c (e c)) (b (\\c\\d\\e.d c (e c)))", + "I_hnf": "\\a\\b.a (\\c\\d\\e.d c (e c)) ((\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) (\\c\\d\\e.d c (e c)))" + }, + { + "body": "((b (a c)) a)", + "bits": "01000110100000000101110011110101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a\\b.a ((\\c\\d\\e.d (c e) c) b) (\\c\\d\\e.d (c e) c)", + "I_hnf": "\\a\\b.a ((\\c\\d\\e.d (c e) c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))) (\\c\\d\\e.d (c e) c)" + }, + { + "body": "(((b a) c) a)", + "bits": "01000110100000000101011101110101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a\\b.a (\\c\\d\\e.d c e c) b (\\c\\d\\e.d c e c)", + "I_hnf": "\\a\\b.a (\\c\\d\\e.d c e c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) (\\c\\d\\e.d c e c)" + }, + { + "body": "(b (c (a a)))", + "bits": "01000110100000000111001100111101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 1, + "hnf": "\\a\\b.a (b ((\\c\\d\\e.d (e (c c))) (\\c\\d\\e.d (e (c c)))))", + "I_hnf": "\\a\\b.a ((\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) ((\\c\\d\\e.d (e (c c))) (\\c\\d\\e.d (e (c c)))))" + }, + { + "body": "(b ((c a) a))", + "bits": "01000110100000000111001011011101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 1, + "hnf": "\\a\\b.a (b (\\c\\d\\e.d (e c c)) (\\c\\d\\e.d (e c c)))", + "I_hnf": "\\a\\b.a ((\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) (\\c\\d\\e.d (e c c)) (\\c\\d\\e.d (e c c)))" + }, + { + "body": "((b c) (a a))", + "bits": "01000110100000000101110100111101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a\\b.a b ((\\c\\d\\e.d e (c c)) (\\c\\d\\e.d e (c c)))", + "I_hnf": "\\a\\b.a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) ((\\c\\d\\e.d e (c c)) (\\c\\d\\e.d e (c c)))" + }, + { + "body": "((b (c a)) a)", + "bits": "01000110100000000101110011011101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a\\b.a (b (\\c\\d\\e.d (e c) c)) (\\c\\d\\e.d (e c) c)", + "I_hnf": "\\a\\b.a ((\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) (\\c\\d\\e.d (e c) c)) (\\c\\d\\e.d (e c) c)" + }, + { + "body": "(((b c) a) a)", + "bits": "01000110100000000101011101011101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 4, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a\\b.a b (\\c\\d\\e.d e c c) (\\c\\d\\e.d e c c)", + "I_hnf": "\\a\\b.a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) (\\c\\d\\e.d e c c) (\\c\\d\\e.d e c c)" + }, + { + "body": "(c (a (a b)))", + "bits": "01000110100000000110011110011110110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 14, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 1, + "hnf": "\\a\\b.b ((\\c\\d\\e.e (c (c d))) ((\\c\\d\\e.e (c (c d))) a))", + "I_hnf": "\\a\\b.a (a ((\\c\\d\\e.e (c (c d))) a (\\c\\d.c)))" + }, + { + "body": "(c ((a a) b))", + "bits": "01000110100000000110010111101110110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 12, + "I_binders": 3, + "I_head": "('V', 0)", + "I_arguments": 1, + "hnf": "\\a\\b.b ((\\c\\d\\e.e (c c d)) (\\c\\d\\e.e (c c d)) a)", + "I_hnf": "\\a\\b\\c.c ((\\d\\e\\f.f (d d e)) (\\d\\e\\f.f (d d e)) a)" + }, + { + "body": "((c a) (a b))", + "bits": "01000110100000000101101110011110110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 14, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a\\b.b (\\c\\d\\e.e c (c d)) ((\\c\\d\\e.e c (c d)) a)", + "I_hnf": "\\a\\b.a (\\c\\d.c) (\\c\\d.c) (\\c.c (\\d\\e.e) (\\d.d (\\e\\f.e) b))" + }, + { + "body": "((c (a a)) b)", + "bits": "01000110100000000101100111101110110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 20, + "I_binders": 2, + "I_head": "('V', 0)", + "I_arguments": 6, + "hnf": "\\a\\b.b ((\\c\\d\\e.e (c c) d) (\\c\\d\\e.e (c c) d)) a", + "I_hnf": "\\a\\b.b ((\\c\\d\\e.e (c c) d) (\\c\\d\\e.e (c c) d)) (\\c\\d.c) (\\c\\d.d) (\\c\\d.c) (\\c\\d.c) a" + }, + { + "body": "(((c a) a) b)", + "bits": "01000110100000000101011011101110110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 17, + "I_binders": 3, + "I_head": "('V', 2)", + "I_arguments": 0, + "hnf": "\\a\\b.b (\\c\\d\\e.e c c d) (\\c\\d\\e.e c c d) a", + "I_hnf": "\\a\\b\\c.a" + }, + { + "body": "(c (a (b a)))", + "bits": "01000110100000000110011110011101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 9, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 4, + "hnf": "\\a\\b.b ((\\c\\d\\e.e (c (d c))) (a (\\c\\d\\e.e (c (d c)))))", + "I_hnf": "\\a\\b.a (\\c\\d\\e.e (c (d c))) ((\\c\\d.c) (a (\\c\\d\\e.e (c (d c))))) (\\c\\d.c) (\\c.c (\\d\\e.e) (\\d.d (\\e\\f.e) b))" + }, + { + "body": "(c ((a b) a))", + "bits": "01000110100000000110010111101101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 10, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a\\b.b ((\\c\\d\\e.e (c d c)) a (\\c\\d\\e.e (c d c)))", + "I_hnf": "\\a\\b.a (\\c\\d\\e.e (c d c)) a" + }, + { + "body": "((c a) (b a))", + "bits": "01000110100000000101101110011101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 8, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a\\b.b (\\c\\d\\e.e c (d c)) (a (\\c\\d\\e.e c (d c)))", + "I_hnf": "\\a\\b.a (\\c\\d\\e.e c (d c)) (\\c\\d.c) ((\\c.c (\\d\\e.d) (\\d.d (\\e\\f.f) (\\e.e (\\f\\g.f) b))) (\\c\\d.c))" + }, + { + "body": "((c (a b)) a)", + "bits": "01000110100000000101100111101101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 9, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 5, + "hnf": "\\a\\b.b ((\\c\\d\\e.e (c d) c) a) (\\c\\d\\e.e (c d) c)", + "I_hnf": "\\a\\b.a (\\c\\d.c) (\\c\\d.c) (\\c.c (\\d\\e.e) (\\d.d (\\e\\f.e) b)) a (\\c\\d\\e.e (c d) c)" + }, + { + "body": "(((c a) b) a)", + "bits": "01000110100000000101011011101101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 8, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 4, + "hnf": "\\a\\b.b (\\c\\d\\e.e c d c) a (\\c\\d\\e.e c d c)", + "I_hnf": "\\a\\b.a (\\c\\d.c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.f) (\\e.e (\\f\\g.f) b))) (\\c\\d.c) (\\c\\d\\e.e c d c)" + }, + { + "body": "(c (b (a a)))", + "bits": "01000110100000000110011100111101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a\\b.b (a ((\\c\\d\\e.e (d (c c))) (\\c\\d\\e.e (d (c c)))))", + "I_hnf": "\\a\\b.a ((\\c\\d\\e.e (d (c c))) (\\c\\d\\e.e (d (c c)))) (\\c\\d.c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.f) (\\e.e (\\f\\g.f) b)))" + }, + { + "body": "(c ((b a) a))", + "bits": "01000110100000000110010111011101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 4, + "hnf": "\\a\\b.b (a (\\c\\d\\e.e (d c c)) (\\c\\d\\e.e (d c c)))", + "I_hnf": "\\a\\b.a (\\c\\d\\e.e (d c c)) (\\c\\d\\e.e (d c c)) (\\c\\d.c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.f) (\\e.e (\\f\\g.f) b)))" + }, + { + "body": "((c b) (a a))", + "bits": "01000110100000000101101100111101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a\\b.b a ((\\c\\d\\e.e d (c c)) (\\c\\d\\e.e d (c c)))", + "I_hnf": "\\a\\b.a (\\c\\d.c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.f) (\\e.e (\\f\\g.f) b))) ((\\c\\d\\e.e d (c c)) (\\c\\d\\e.e d (c c)))" + }, + { + "body": "((c (b a)) a)", + "bits": "01000110100000000101100111011101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 4, + "hnf": "\\a\\b.b (a (\\c\\d\\e.e (d c) c)) (\\c\\d\\e.e (d c) c)", + "I_hnf": "\\a\\b.a (\\c\\d\\e.e (d c) c) (\\c\\d.c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.f) (\\e.e (\\f\\g.f) b))) (\\c\\d\\e.e (d c) c)" + }, + { + "body": "(((c b) a) a)", + "bits": "01000110100000000101011011011101110", + "head_status": "hnf", + "head_steps": 2, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 3, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 4, + "hnf": "\\a\\b.b a (\\c\\d\\e.e d c c) (\\c\\d\\e.e d c c)", + "I_hnf": "\\a\\b.a (\\c\\d.c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.f) (\\e.e (\\f\\g.f) b))) (\\c\\d\\e.e d c c) (\\c\\d\\e.e d c c)" + } +] diff --git a/data/self-interpreter/reasoning_floor/global/check35.py b/data/self-interpreter/reasoning_floor/global/check35.py new file mode 100644 index 00000000..31b7249f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/check35.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +"""Sixty four-leaf layouts forced by the 35-bit, four-lambda allocation.""" +import sys +sys.dont_write_bytecode = True +import itertools +import json +from pathlib import Path +from check34 import parse, head_trace, invoke, lc + +def trees(xs): + if len(xs) == 1: + yield xs[0] + for k in range(1,len(xs)): + for f in trees(xs[:k]): + for a in trees(xs[k:]): + yield f'({f} {a})' + +def spine(t): + binders=0 + while t[0]=='L': + binders+=1 + t=t[1] + args=[] + while t[0]=='A': + args.append(t[2]); t=t[1] + return binders,t,list(reversed(args)) + +def main(): + delta=parse('\\x.x x') + ident=parse('\\x.x') + rows=[] + for p in sorted(set(itertools.permutations('aabc'))): + for body in trees(p): + n=parse('\\a\\b\\c.'+body) + e=('A',delta,n) + assert lc.size(e)==35 + status,steps,h=head_trace(e,48) + ps,pn,ph=head_trace(invoke(e,ident),48) + bs,hd,args=spine(h) + pb,px,pa=spine(ph) + row=dict(body=body,bits=lc.enc(e),head_status=status,head_steps=steps, + head_binders=bs,head=repr(hd),head_arguments=len(args), + I_status=ps,I_steps=pn,I_binders=pb,I_head=repr(px), + I_arguments=len(pa)) + if status=='hnf':row['hnf']=lc.show(h)[:600] + if ps=='hnf':row['I_hnf']=lc.show(ph)[:600] + rows.append(row) + print(body,status,steps,(bs,hd,len(args)),ps,pn,(pb,px,len(pa))) + assert len(rows)==60 + (Path(__file__).parent/'check35.json').write_text(json.dumps(rows,indent=2)+'\n') + +if __name__=='__main__':main() diff --git a/data/self-interpreter/reasoning_floor/global/check36.json b/data/self-interpreter/reasoning_floor/global/check36.json new file mode 100644 index 00000000..8ec55b57 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/check36.json @@ -0,0 +1,602 @@ +[ + { + "body": "((\\u.a) b) c", + "n": "\\a.a (\\b\\c.((\\u.a) b) c)", + "bits": "010001101000011000000101001111011010", + "head_status": "hnf", + "head_steps": 6, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 7, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a.a (\\b\\c.(\\d.a) b c)", + "I_hnf": "\\a\\b.a (\\c\\d.(\\e.a) c d) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(a (\\u.b)) c", + "n": "\\a.a (\\b\\c.(a (\\u.b)) c)", + "bits": "010001101000011000000101111000111010", + "head_status": "hnf", + "head_steps": 12, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 0, + "I_status": "hnf", + "I_steps": 14, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 0, + "hnf": "\\a\\b.a", + "I_hnf": "\\a\\b.a" + }, + { + "body": "(a b) (\\u.c)", + "n": "\\a.a (\\b\\c.(a b) (\\u.c))", + "bits": "010001101000011000000101111011000110", + "head_status": "cap", + "head_steps": 60, + "head_binders": 1, + "head": "('L', ('L', ('A', ('A', ('L', ('L', ('A', ('A', ('L', ('A', ('V', 0), ('L', ('L', ('A', ('A', ('V', 2), ('V', 1)), ('L', ('V', 1))))))), ('V', 1)), ('L', ('V', 1))))), ('V', 1)), ('L', ('V', 1)))))", + "head_arguments": 2, + "I_status": "cap", + "I_steps": 60, + "I_binders": 2, + "I_head": "('L', ('A', ('A', ('L', ('L', ('A', ('A', ('L', ('L', ('A', ('A', ('L', ('A', ('V', 0), ('L', ('L', ('A', ('A', ('V', 2), ('V', 1)), ('L', ('V', 1))))))), ('V', 1)), ('L', ('V', 1))))), ('V', 1)), ('L', ('V', 1))))), ('L', ('L', ('A', ('A', ('L', ('L', ('A', ('A', ('L', ('L', ('A', ('A', ('L', ('L', ('A', ('A', ('L', ('L', ('A', ('A', ('L', ('L', ('A', ('A', ('L', ('L', ('A', ('A', ('L', ('L', ('A', ('A', ('L', ('A', ('V', 0), ('L', ('L', ('A', ('A', ('V', 2), ('V', 1)), ('L', ('V', 1))))))), ('V', 1)), ('L', ('V', 1))))), ('V', 1)), ('L', ('V', 1))))), ('V', 1)), ('L', ('V', 1))))), ('V', 1)), ('L', ('V', 1))))), ('V', 1)), ('L', ('V', 1))))), ('V', 1)), ('L', ('V', 1))))), ('V', 1)), ('L', ('V', 1))))), ('V', 1)), ('L', ('V', 1)))))), ('L', ('V', 1))))", + "I_arguments": 2 + }, + { + "body": "(\\u.a) (b c)", + "n": "\\a.a (\\b\\c.(\\u.a) (b c))", + "bits": "010001101000011000000100111100111010", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 11, + "I_binders": 3, + "I_head": "('V', 0)", + "I_arguments": 2, + "hnf": "\\a\\b.b (\\c\\d.(\\e.b) (c d))", + "I_hnf": "\\a\\b\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))" + }, + { + "body": "a ((\\u.b) c)", + "n": "\\a.a (\\b\\c.a ((\\u.b) c))", + "bits": "010001101000011000000111100100111010", + "head_status": "cap", + "head_steps": 60, + "head_binders": 18, + "head": "('L', ('L', ('A', ('A', ('L', ('L', ('L', ('A', ('L', ('L', ('A', ('L', ('A', ('V', 0), ('L', ('L', ('A', ('V', 2), ('A', ('L', ('V', 2)), ('V', 0))))))), ('A', ('L', ('V', 2)), ('V', 0))))), ('A', ('L', ('V', 2)), ('V', 0)))))), ('V', 19)), ('A', ('L', ('V', 2)), ('V', 0)))))", + "head_arguments": 1, + "I_status": "cap", + "I_steps": 60, + "I_binders": 18, + "I_head": "('L', ('A', ('L', ('L', ('L', ('A', ('A', ('L', ('L', ('L', ('A', ('L', ('L', ('A', ('L', ('A', ('V', 0), ('L', ('L', ('A', ('V', 2), ('A', ('L', ('V', 2)), ('V', 0))))))), ('A', ('L', ('V', 2)), ('V', 0))))), ('A', ('L', ('V', 2)), ('V', 0)))))), ('V', 21)), ('A', ('L', ('V', 2)), ('V', 0)))))), ('L', ('A', ('A', ('V', 0), ('L', ('L', ('V', 1)))), ('L', ('A', ('A', ('V', 0), ('L', ('L', ('V', 1)))), ('L', ('A', ('A', ('V', 0), ('L', ('L', ('V', 0)))), ('L', ('A', ('A', ('V', 0), ('L', ('L', ('V', 1)))), ('V', 21)))))))))))", + "I_arguments": 2 + }, + { + "body": "a (b (\\u.c))", + "n": "\\a.a (\\b\\c.a (b (\\u.c)))", + "bits": "010001101000011000000111100111000110", + "head_status": "hnf", + "head_steps": 10, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 12, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a\\b.a (\\c.b) (\\c\\d.(\\e.a) (\\e\\f\\g.(\\h\\i.(\\j\\k.(\\l.l (\\m\\n.l (m (\\o.n)))) (j (\\l.k))) (h (\\j.i))) (\\h.a) (f (\\h.g))) (\\e.b) (c (\\e.d)))", + "I_hnf": "\\a\\b.a (\\c\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) (\\c\\d.(\\e.a) (\\e\\f\\g.(\\h\\i.(\\j\\k.(\\l.l (\\m\\n.l (m (\\o.n)))) (j (\\l.k))) (h (\\j.i))) (\\h.a) (f (\\h.g))) (\\e\\f.f (\\g\\h.g) (\\g.g (\\h\\i.h) (\\h.h (\\i\\j.j) (\\i.i (\\j\\k.j) b)))) (c (\\e.d)))" + }, + { + "body": "((\\u.a) c) b", + "n": "\\a.a (\\b\\c.((\\u.a) c) b)", + "bits": "010001101000011000000101001111010110", + "head_status": "cap", + "head_steps": 60, + "head_binders": 26, + "head": "('L', ('L', ('L', ('A', ('A', ('L', ('L', ('L', ('A', ('A', ('L', ('L', ('A', ('V', 0), ('L', ('L', ('A', ('A', ('L', ('V', 3)), ('V', 0)), ('V', 1))))))), ('V', 0)), ('V', 1))))), ('V', 0)), ('V', 1)))))", + "head_arguments": 2, + "I_status": "cap", + "I_steps": 60, + "I_binders": 25, + "I_head": "('L', ('L', ('L', ('A', ('A', ('L', ('L', ('L', ('A', ('A', ('L', ('L', ('L', ('A', ('A', ('L', ('L', ('A', ('V', 0), ('L', ('L', ('A', ('A', ('L', ('V', 3)), ('V', 0)), ('V', 1))))))), ('V', 0)), ('V', 1))))), ('V', 0)), ('V', 1))))), ('V', 0)), ('V', 1)))))", + "I_arguments": 2 + }, + { + "body": "(a c) (\\u.b)", + "n": "\\a.a (\\b\\c.(a c) (\\u.b))", + "bits": "010001101000011000000101111010001110", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 6, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a.a (\\b\\c.a c (\\d.b)) (\\b\\c\\d.(\\e\\f.(\\g.g (\\h\\i.g i (\\j.h))) f (\\g.e)) d (\\e.c))", + "I_hnf": "\\a\\b.a (\\c\\d.a d (\\e.c)) (\\c\\d\\e.(\\f\\g.(\\h.h (\\i\\j.h j (\\k.i))) g (\\h.f)) e (\\f.d)) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(a (\\u.c)) b", + "n": "\\a.a (\\b\\c.(a (\\u.c)) b)", + "bits": "010001101000011000000101111000110110", + "head_status": "hnf", + "head_steps": 6, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 7, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a.a (\\b\\c.(\\d\\e.(\\f.f (\\g\\h.f (\\i.h) g)) (\\f.e) d) (\\d.c) b)", + "I_hnf": "\\a\\b.a (\\c\\d.(\\e\\f.(\\g.g (\\h\\i.g (\\j.i) h)) (\\g.f) e) (\\e.d) c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(\\u.a) (c b)", + "n": "\\a.a (\\b\\c.(\\u.a) (c b))", + "bits": "010001101000011000000100111100110110", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 2, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 11, + "I_binders": 3, + "I_head": "('V', 0)", + "I_arguments": 2, + "hnf": "\\a\\b.b (\\c\\d.(\\e.b) (d c))", + "I_hnf": "\\a\\b\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))" + }, + { + "body": "a (c (\\u.b))", + "n": "\\a.a (\\b\\c.a (c (\\u.b)))", + "bits": "010001101000011000000111100110001110", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 6, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a.a (\\b\\c\\d.(\\e\\f.(\\g.g (\\h\\i.g (i (\\j.h)))) (f (\\g.e))) (d (\\e.c))) (\\b\\c.a (\\d\\e\\f.(\\g\\h.(\\i.i (\\j\\k.i (k (\\l.j)))) (h (\\i.g))) (f (\\g.e))) (c (\\d.b)))", + "I_hnf": "\\a\\b.a (\\c\\d\\e.(\\f\\g.(\\h.h (\\i\\j.h (j (\\k.i)))) (g (\\h.f))) (e (\\f.d))) (\\c\\d.a (\\e\\f\\g.(\\h\\i.(\\j.j (\\k\\l.j (l (\\m.k)))) (i (\\j.h))) (g (\\h.f))) (d (\\e.c))) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "a ((\\u.c) b)", + "n": "\\a.a (\\b\\c.a ((\\u.c) b))", + "bits": "010001101000011000000111100100110110", + "head_status": "hnf", + "head_steps": 6, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 7, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a.a (\\b\\c.(\\d.a) (\\d\\e.(\\f\\g.(\\h.h (\\i\\j.h ((\\k.j) i))) ((\\h.g) f)) ((\\f.e) d)) ((\\d.c) b))", + "I_hnf": "\\a\\b.a (\\c\\d.(\\e.a) (\\e\\f.(\\g\\h.(\\i.i (\\j\\k.i ((\\l.k) j))) ((\\i.h) g)) ((\\g.f) e)) ((\\e.d) c)) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(b (\\u.a)) c", + "n": "\\a.a (\\b\\c.(b (\\u.a)) c)", + "bits": "010001101000011000000101110001111010", + "head_status": "hnf", + "head_steps": 8, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 9, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a.a (\\b\\c.b (\\d.a) c)", + "I_hnf": "\\a\\b.a (\\c\\d.c (\\e.a) d) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "((\\u.b) a) c", + "n": "\\a.a (\\b\\c.((\\u.b) a) c)", + "bits": "010001101000011000000101001110111010", + "head_status": "hnf", + "head_steps": 7, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 9, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 1, + "hnf": "\\a\\b.a b", + "I_hnf": "\\a\\b.a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(b a) (\\u.c)", + "n": "\\a.a (\\b\\c.(b a) (\\u.c))", + "bits": "010001101000011000000101110111000110", + "head_status": "cap", + "head_steps": 60, + "head_binders": 1, + "head": "('L', ('A', ('A', ('L', ('A', ('V', 0), ('L', ('L', ('A', ('A', ('V', 1), ('V', 2)), ('L', ('V', 1))))))), ('L', ('L', ('A', ('A', ('V', 1), ('L', ('A', ('V', 0), ('L', ('L', ('A', ('A', ('V', 1), ('V', 2)), ('L', ('V', 1)))))))), ('L', ('V', 1)))))), ('L', ('V', 1))))", + "head_arguments": 1, + "I_status": "cap", + "I_steps": 60, + "I_binders": 2, + "I_head": "('L', ('L', ('A', ('A', ('V', 1), ('L', ('L', ('A', ('A', ('V', 1), ('L', ('A', ('V', 0), ('L', ('L', ('A', ('A', ('V', 1), ('V', 2)), ('L', ('V', 1)))))))), ('L', ('V', 1)))))), ('L', ('V', 1)))))", + "I_arguments": 3 + }, + { + "body": "b ((\\u.a) c)", + "n": "\\a.a (\\b\\c.b ((\\u.a) c))", + "bits": "010001101000011000000111001001111010", + "head_status": "cap", + "head_steps": 60, + "head_binders": 15, + "head": "('L', ('L', ('A', ('V', 1), ('A', ('L', ('A', ('L', ('A', ('L', ('A', ('L', ('A', ('L', ('A', ('L', ('A', ('L', ('A', ('L', ('L', ('L', ('A', ('V', 1), ('A', ('L', ('L', ('A', ('V', 0), ('L', ('L', ('A', ('V', 1), ('A', ('L', ('V', 3)), ('V', 0)))))))), ('V', 0)))))), ('V', 22))), ('V', 19))), ('V', 16))), ('V', 13))), ('V', 10))), ('V', 7))), ('V', 4))), ('V', 0)))))", + "head_arguments": 1, + "I_status": "cap", + "I_steps": 60, + "I_binders": 14, + "I_head": "('L', ('L', ('L', ('A', ('V', 1), ('A', ('L', ('L', ('A', ('V', 0), ('L', ('L', ('A', ('V', 1), ('A', ('L', ('V', 3)), ('V', 0)))))))), ('V', 0))))))", + "I_arguments": 2 + }, + { + "body": "(\\u.b) (a c)", + "n": "\\a.a (\\b\\c.(\\u.b) (a c))", + "bits": "010001101000011000000100111001111010", + "head_status": "hnf", + "head_steps": 6, + "head_binders": 3, + "head": "('V', 1)", + "head_arguments": 0, + "I_status": "hnf", + "I_steps": 8, + "I_binders": 4, + "I_head": "('V', 0)", + "I_arguments": 2, + "hnf": "\\a\\b\\c.b", + "I_hnf": "\\a\\b\\c\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))" + }, + { + "body": "b (a (\\u.c))", + "n": "\\a.a (\\b\\c.b (a (\\u.c)))", + "bits": "010001101000011000000111001111000110", + "head_status": "hnf", + "head_steps": 7, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 9, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 1, + "hnf": "\\a\\b.a ((\\c\\d.c ((\\e.e (\\f\\g.f (e (\\h.g)))) (\\e.d))) (\\c.b))", + "I_hnf": "\\a\\b.a ((\\c\\d.c ((\\e.e (\\f\\g.f (e (\\h.g)))) (\\e.d))) (\\c\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))))" + }, + { + "body": "(b c) (\\u.a)", + "n": "\\a.a (\\b\\c.(b c) (\\u.a))", + "bits": "010001101000011000000101110100011110", + "head_status": "hnf", + "head_steps": 6, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 7, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a.a (\\b\\c.c (\\d\\e.d e (\\f.c))) (\\b\\c\\d.c d (\\e\\f.f (\\g\\h.g h (\\i.f))))", + "I_hnf": "\\a\\b.a (\\c\\d.d (\\e\\f.e f (\\g.d))) (\\c\\d\\e.d e (\\f\\g.g (\\h\\i.h i (\\j.g)))) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "((\\u.b) c) a", + "n": "\\a.a (\\b\\c.((\\u.b) c) a)", + "bits": "010001101000011000000101001110101110", + "head_status": "cap", + "head_steps": 60, + "head_binders": 23, + "head": "('L', ('L', ('A', ('A', ('L', ('V', 2)), ('V', 0)), ('L', ('L', ('A', ('A', ('L', ('V', 2)), ('V', 0)), ('L', ('A', ('V', 0), ('L', ('L', ('A', ('A', ('L', ('V', 2)), ('V', 0)), ('V', 2))))))))))))", + "head_arguments": 1, + "I_status": "cap", + "I_steps": 60, + "I_binders": 22, + "I_head": "('L', ('L', ('A', ('A', ('L', ('V', 2)), ('V', 0)), ('L', ('A', ('V', 0), ('L', ('L', ('A', ('A', ('L', ('V', 2)), ('V', 0)), ('V', 2)))))))))", + "I_arguments": 1 + }, + { + "body": "(b (\\u.c)) a", + "n": "\\a.a (\\b\\c.(b (\\u.c)) a)", + "bits": "010001101000011000000101110001101110", + "head_status": "hnf", + "head_steps": 7, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 8, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a.a (\\b\\c.b (\\d.c) (\\d.d (\\e\\f.e (\\g.f) d)))", + "I_hnf": "\\a\\b.a (\\c\\d.c (\\e.d) (\\e.e (\\f\\g.f (\\h.g) e))) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "b (c (\\u.a))", + "n": "\\a.a (\\b\\c.b (c (\\u.a)))", + "bits": "010001101000011000000111001100011110", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 7, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a\\b.a (\\c\\d.d (\\e\\f.e (f (\\g.d)))) (b (\\c\\d\\e.d (e (\\f\\g.g (\\h\\i.h (i (\\j.g)))))))", + "I_hnf": "\\a\\b.a (\\c\\d.d (\\e\\f.e (f (\\g.d)))) ((\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b)))) (\\c\\d\\e.d (e (\\f\\g.g (\\h\\i.h (i (\\j.g)))))))" + }, + { + "body": "(\\u.b) (c a)", + "n": "\\a.a (\\b\\c.(\\u.b) (c a))", + "bits": "010001101000011000000100111001101110", + "head_status": "hnf", + "head_steps": 6, + "head_binders": 3, + "head": "('V', 1)", + "head_arguments": 0, + "I_status": "hnf", + "I_steps": 8, + "I_binders": 4, + "I_head": "('V', 0)", + "I_arguments": 2, + "hnf": "\\a\\b\\c.b", + "I_hnf": "\\a\\b\\c\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))" + }, + { + "body": "b ((\\u.c) a)", + "n": "\\a.a (\\b\\c.b ((\\u.c) a))", + "bits": "010001101000011000000111001001101110", + "head_status": "hnf", + "head_steps": 6, + "head_binders": 2, + "head": "('V', 1)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 8, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 1, + "hnf": "\\a\\b.a ((\\c.b) (\\c\\d.c ((\\e.d) (\\e.e (\\f\\g.f ((\\h.g) e))))))", + "I_hnf": "\\a\\b.a ((\\c\\d.d (\\e\\f.e) (\\e.e (\\f\\g.f) (\\f.f (\\g\\h.h) (\\g.g (\\h\\i.h) b)))) (\\c\\d.c ((\\e.d) (\\e.e (\\f\\g.f ((\\h.g) e))))))" + }, + { + "body": "(c (\\u.a)) b", + "n": "\\a.a (\\b\\c.(c (\\u.a)) b)", + "bits": "010001101000011000000101100011110110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a.a (\\b\\c.c (\\d\\e.e (\\f.c) d)) (\\b\\c.c (\\d\\e\\f.f (\\g\\h.h (\\i\\j.j (\\k.h) i)) e) b)", + "I_hnf": "\\a\\b.a (\\c\\d.d (\\e\\f.f (\\g.d) e)) (\\c\\d.d (\\e\\f\\g.g (\\h\\i.i (\\j\\k.k (\\l.i) j)) f) c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(c a) (\\u.b)", + "n": "\\a.a (\\b\\c.(c a) (\\u.b))", + "bits": "010001101000011000000101101110001110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a.a (\\b.b (\\c\\d.d b (\\e.c))) (\\b\\c\\d.d (\\e\\f.f (\\g.g (\\h\\i.i g (\\j.h))) (\\g.e)) (\\e.c))", + "I_hnf": "\\a\\b.a (\\c.c (\\d\\e.e c (\\f.d))) (\\c\\d\\e.e (\\f\\g.g (\\h.h (\\i\\j.j h (\\k.i))) (\\h.f)) (\\f.d)) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "((\\u.c) a) b", + "n": "\\a.a (\\b\\c.((\\u.c) a) b)", + "bits": "010001101000011000000101001101110110", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 6, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a.a (\\b\\c.(\\d.c) (\\d\\e.(\\f.e) (\\f.f (\\g\\h.(\\i.h) f g)) d) b)", + "I_hnf": "\\a\\b.a (\\c\\d.(\\e.d) (\\e\\f.(\\g.f) (\\g.g (\\h\\i.(\\j.i) g h)) e) c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "c ((\\u.a) b)", + "n": "\\a.a (\\b\\c.c ((\\u.a) b))", + "bits": "010001101000011000000110010011110110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a.a ((\\b\\c.c (\\d\\e.e ((\\f.c) d))) (\\b\\c.c ((\\d\\e\\f.f ((\\g\\h.h (\\i\\j.j ((\\k.h) i))) e)) b)))", + "I_hnf": "\\a\\b.a ((\\c\\d.d (\\e\\f.f ((\\g.d) e))) (\\c\\d.d ((\\e\\f\\g.g ((\\h\\i.i (\\j\\k.k ((\\l.i) j))) f)) c))) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "c (a (\\u.b))", + "n": "\\a.a (\\b\\c.c (a (\\u.b)))", + "bits": "010001101000011000000110011110001110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a.a ((\\b.b (\\c\\d.d (b (\\e.c)))) (\\b\\c\\d.d ((\\e\\f.f ((\\g.g (\\h\\i.i (g (\\j.h)))) (\\g.e))) (\\e.c))))", + "I_hnf": "\\a\\b.a ((\\c.c (\\d\\e.e (c (\\f.d)))) (\\c\\d\\e.e ((\\f\\g.g ((\\h.h (\\i\\j.j (h (\\k.i)))) (\\h.f))) (\\f.d)))) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(\\u.c) (a b)", + "n": "\\a.a (\\b\\c.(\\u.c) (a b))", + "bits": "010001101000011000000100110011110110", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 0, + "I_status": "hnf", + "I_steps": 6, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 1, + "hnf": "\\a.a", + "I_hnf": "\\a\\b.a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(c b) (\\u.a)", + "n": "\\a.a (\\b\\c.(c b) (\\u.a))", + "bits": "010001101000011000000101101100011110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a.a (\\b\\c.c b (\\d\\e\\f.f e (\\g\\h.h (\\i\\j.j i (\\k.h))))) (\\b\\c.c (\\d\\e.e d (\\f.c)))", + "I_hnf": "\\a\\b.a (\\c\\d.d c (\\e\\f\\g.g f (\\h\\i.i (\\j\\k.k j (\\l.i))))) (\\c\\d.d (\\e\\f.f e (\\g.d))) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(c (\\u.b)) a", + "n": "\\a.a (\\b\\c.(c (\\u.b)) a)", + "bits": "010001101000011000000101100011101110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 2, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 3, + "hnf": "\\a.a (\\b\\c\\d.d (\\e.c) (\\e\\f.f (\\g.e) (\\g.g (\\h\\i.i (\\j.h) g)))) (\\b.b (\\c\\d.d (\\e.c) b))", + "I_hnf": "\\a\\b.a (\\c\\d\\e.e (\\f.d) (\\f\\g.g (\\h.f) (\\h.h (\\i\\j.j (\\k.i) h)))) (\\c.c (\\d\\e.e (\\f.d) c)) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "((\\u.c) b) a", + "n": "\\a.a (\\b\\c.((\\u.c) b) a)", + "bits": "010001101000011000000101001101101110", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 6, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a.a (\\b.b (\\c\\d.(\\e.d) c b))", + "I_hnf": "\\a\\b.a (\\c.c (\\d\\e.(\\f.e) d c)) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "c (b (\\u.a))", + "n": "\\a.a (\\b\\c.c (b (\\u.a)))", + "bits": "010001101000011000000110011100011110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a.a ((\\b\\c.c (b (\\d\\e\\f.f (e (\\g\\h.h (\\i\\j.j (i (\\k.h)))))))) (\\b\\c.c (\\d\\e.e (d (\\f.c)))))", + "I_hnf": "\\a\\b.a ((\\c\\d.d (c (\\e\\f\\g.g (f (\\h\\i.i (\\j\\k.k (j (\\l.i)))))))) (\\c\\d.d (\\e\\f.f (e (\\g.d))))) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "c ((\\u.b) a)", + "n": "\\a.a (\\b\\c.c ((\\u.b) a))", + "bits": "010001101000011000000110010011101110", + "head_status": "hnf", + "head_steps": 4, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 1, + "I_status": "hnf", + "I_steps": 5, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 2, + "hnf": "\\a.a ((\\b\\c\\d.d ((\\e.c) (\\e\\f.f ((\\g.e) (\\g.g (\\h\\i.i ((\\j.h) g))))))) (\\b.b (\\c\\d.d ((\\e.c) b))))", + "I_hnf": "\\a\\b.a ((\\c\\d\\e.e ((\\f.d) (\\f\\g.g ((\\h.f) (\\h.h (\\i\\j.j ((\\k.i) h))))))) (\\c.c (\\d\\e.e ((\\f.d) c)))) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + }, + { + "body": "(\\u.c) (b a)", + "n": "\\a.a (\\b\\c.(\\u.c) (b a))", + "bits": "010001101000011000000100110011101110", + "head_status": "hnf", + "head_steps": 5, + "head_binders": 1, + "head": "('V', 0)", + "head_arguments": 0, + "I_status": "hnf", + "I_steps": 6, + "I_binders": 2, + "I_head": "('V', 1)", + "I_arguments": 1, + "hnf": "\\a.a", + "I_hnf": "\\a\\b.a (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) b))))" + } +] diff --git a/data/self-interpreter/reasoning_floor/global/check36.py b/data/self-interpreter/reasoning_floor/global/check36.py new file mode 100644 index 00000000..d8507ac8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/check36.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +"""Thirty-six single-leaf boxes in the last four-live-binder family.""" +import sys +sys.dont_write_bytecode = True +import itertools +import json +from pathlib import Path +from check34 import parse, head_trace, invoke, lc +from check35 import spine + +def main(): + delta=parse('\\x.x x'); ident=parse('\\x.x') + rows=[] + for p in itertools.permutations('abc'): + for assoc in (0,1): + for box in 'abc': + q=[f'(\\u.{x})' if x==box else x for x in p] + body=f'({q[0]} {q[1]}) {q[2]}' if assoc==0 else f'{q[0]} ({q[1]} {q[2]})' + src='\\a.a (\\b\\c.'+body+')' + n=parse(src); e=('A',delta,n) + assert lc.size(e)==36 + hs,hn,h=head_trace(e,60); ps,pn,ph=head_trace(invoke(e,ident),60) + hb,hv,ha=spine(h);pb,pv,pa=spine(ph) + row=dict(body=body,n=src,bits=lc.enc(e),head_status=hs,head_steps=hn, + head_binders=hb,head=repr(hv),head_arguments=len(ha), + I_status=ps,I_steps=pn,I_binders=pb,I_head=repr(pv),I_arguments=len(pa)) + if hs=='hnf':row['hnf']=lc.show(h)[:800] + if ps=='hnf':row['I_hnf']=lc.show(ph)[:800] + rows.append(row) + print(body,hs,hn,(hb,hv,len(ha)),ps,pn,(pb,pv,len(pa))) + assert len(rows)==36 + (Path(__file__).parent/'check36.json').write_text(json.dumps(rows,indent=2)+'\n') +if __name__=='__main__':main() diff --git a/data/self-interpreter/reasoning_floor/global/check36open.json b/data/self-interpreter/reasoning_floor/global/check36open.json new file mode 100644 index 00000000..ee67fbc3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/check36open.json @@ -0,0 +1,162 @@ +[ + { + "body": "(a (\\u.b)) c", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + "hnf": "\\a.a (\\b\\c.c (\\d.a (\\e.c) d)) (\\b.a (\\c\\d.a (\\e\\f.f (\\g.a (\\h.f) g)) d) b)" + }, + { + "body": "(a b) (\\u.c)", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + "hnf": "\\a.a (\\b.b (\\c.a b (\\d.c))) (\\b\\c.a (\\d.a (\\e.e (\\f.a e (\\g.f))) (\\e.d)) (\\d.c))" + }, + { + "body": "a (b (\\u.c))", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + "hnf": "\\a.a ((\\b.b (\\c.a (b (\\d.c)))) (\\b\\c.a ((\\d.a ((\\e.e (\\f.a (e (\\g.f)))) (\\e.d))) (\\d.c))))" + }, + { + "body": "(a c) (\\u.b)", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + "hnf": "\\a.a (\\b.a b (\\c\\d.a d (\\e\\f.f (\\g.a g (\\h.f))))) (\\b\\c.c (\\d.a d (\\e.c)))" + }, + { + "body": "(a (\\u.c)) b", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + "hnf": "\\a.a (\\b\\c.a (\\d.c) (\\d.a (\\e.d) (\\e.e (\\f.a (\\g.f) e)))) (\\b.b (\\c.a (\\d.c) b))" + }, + { + "body": "a (c (\\u.b))", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + "hnf": "\\a.a ((\\b.a (b (\\c\\d.a (d (\\e\\f.f (\\g.a (g (\\h.f)))))))) (\\b\\c.c (\\d.a (d (\\e.c)))))" + }, + { + "body": "(b (\\u.a)) c", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 6 + }, + "hnf": "\\a.a (\\b.(\\c.(\\d.d (\\e.d (\\f.a) e)) (\\d.a) c) (\\c.a) b)" + }, + { + "body": "(b a) (\\u.c)", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + "hnf": "\\a.a (\\b.a a (\\c.b)) (\\b\\c.(\\d.(\\e.e (\\f.e a (\\g.f))) a (\\e.d)) a (\\d.c))" + }, + { + "body": "b (a (\\u.c))", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + "hnf": "\\a.a (\\b\\c.(\\d.(\\e.e (\\f.e (a (\\g.f)))) (a (\\e.d))) (a (\\d.c))) (\\b.a (\\c\\d.(\\e.(\\f.f (\\g.f (a (\\h.g)))) (a (\\f.e))) (a (\\e.d))) (a (\\c.b)))" + }, + { + "body": "(b c) (\\u.a)", + "result": { + "kind": "unresolved", + "error": "('open36_9', 'needs a handwritten invariant')" + }, + "hnf": "\\a.(\\b.(\\c.(\\d.(\\e.(\\f.(\\g.(\\h.(\\i.(\\j.j (\\k.j k (\\l.a))) i (\\j.a)) h (\\i.a)) g (\\h.a)) f (\\g.a)) e (\\f.a)) d (\\e.a)) c (\\d.a)) b (\\c.a)) (\\b.(\\c.(\\d.(\\e.(\\f.(\\g.(\\h.(\\i.(\\j.(\\k.(\\l.l (\\m.l m (\\n.a))) k (\\l.a)) j (\\k.a)) i (\\j.a)) h (\\i.a)) g (\\h.a)) f (\\g.a)) e (\\f.a)) d (\\e.a)) c (\\d.a)) b (\\c.a)) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a)" + }, + { + "body": "(b (\\u.c)) a", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 11 + }, + "hnf": "\\a.a a" + }, + { + "body": "b (c (\\u.a))", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 9 + }, + "hnf": "\\a.a (\\b.a) (\\b.(\\c.a) (\\c.a) (\\c.a) (b (\\c.a))) (\\b.(\\c.(\\d.(\\e.e (\\f.e (f (\\g.a)))) (d (\\e.a))) (c (\\d.a))) (\\c.a) (b (\\c.a)))" + }, + { + "body": "(c (\\u.a)) b", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 6 + }, + "hnf": "\\a.a (\\b.b (\\c.a) (\\c.c (\\d.d (\\e.a) c))) (\\b.b (\\c.c (\\d.a) b))" + }, + { + "body": "(c a) (\\u.b)", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + "hnf": "\\a.a a (\\b\\c.c a (\\d\\e.e (\\f.f a (\\g.e)))) (\\b\\c.c (\\d.d a (\\e.c)))" + }, + { + "body": "c (a (\\u.b))", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + "hnf": "\\a.a (\\b\\c.c (\\d.d (a (\\e.c)))) (a (\\b\\c.c (a (\\d\\e.e (\\f.f (a (\\g.e)))))))" + }, + { + "body": "(c b) (\\u.a)", + "result": { + "kind": "unresolved", + "error": "('open36_15', 'needs a handwritten invariant')" + }, + "hnf": "\\a.(\\b.b (\\c.c (\\d.d c (\\e.a))) (\\c.a)) (\\b.b (\\c.c (\\d.d (\\e.e d (\\f.a))) (\\d.a)) (\\c.a)) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a) (\\b.a)" + }, + { + "body": "(c (\\u.b)) a", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 7 + }, + "hnf": "\\a.a (\\b.b (\\c.a) a) a" + }, + { + "body": "c (b (\\u.a))", + "result": { + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 7 + }, + "hnf": "\\a.a ((\\b.b ((\\c.c (\\d.d (c (\\e.a)))) (\\c.a))) (\\b.a))" + } +] diff --git a/data/self-interpreter/reasoning_floor/global/control366.blc b/data/self-interpreter/reasoning_floor/global/control366.blc new file mode 100644 index 00000000..a12dced6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/control366.blc @@ -0,0 +1 @@ +000001011100101010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010000011010010101000110100001000001000001011000010110000001101111101111001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001101000001010 diff --git a/data/self-interpreter/reasoning_floor/global/control366.lam b/data/self-interpreter/reasoning_floor/global/control366.lam new file mode 100644 index 00000000..7c847a14 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/control366.lam @@ -0,0 +1 @@ +\a\b.a ((\c.c c) (\c.(\d\e.(\f\g.g (\h.h (\i\j.j f) e) (g g g)) (\f.d (\g.f (e (\h\i.g (\j\k.j i (k h)))) (d (\h.e (\i.g i (h i))))))) (c c)) (\c\d.c) b) ((\c.c c) (\c.(\d\e.(\f\g.g (\h.h (\i\j.j f) e) (g g g)) (\f.d (\g.f (e (\h\i.g (\j\k.j i (k h)))) (d (\h.e (\i.g i (h i))))))) (c c)) (\c\d.d) b) diff --git a/data/self-interpreter/reasoning_floor/global/count_search_space.py b/data/self-interpreter/reasoning_floor/global/count_search_space.py new file mode 100644 index 00000000..21ba9f95 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/count_search_space.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +"""Exact grammar counts; no lambda-term candidates are constructed.""" +from functools import cache +from pathlib import Path +import json +import time + +@cache +def count(n,d): + if n<2:return 0 + value=int(n-2=4:value+=count(n-2,d+1) + for i in range(2,n-3):value+=count(i,d)*count(n-2-i,d) + return value + +if __name__=='__main__': + start=time.monotonic() + report=dict(closed_exact_164=count(164,0), + closed_below_165=sum(count(n,0) for n in range(4,165)), + closed_exact_167=count(167,0),dp_states=count.cache_info().currsize, + seconds=round(time.monotonic()-start,4), + method='Grammar counting only; no candidate terms generated.') + Path(__file__).with_name('search-count.json').write_text(json.dumps(report,indent=2)+'\n') + print(json.dumps(report,indent=2)) diff --git a/data/self-interpreter/reasoning_floor/global/lean-check.log b/data/self-interpreter/reasoning_floor/global/lean-check.log new file mode 100644 index 00000000..dfeb496c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/lean-check.log @@ -0,0 +1,5 @@ +Command: /Users/a9lim/.elan/bin/lean -j 1 /Users/a9lim/Work/blam/tmp/overnight/global/FiniteChecks.lean +'Blc.Global37Checks.macro34_pair_pump' depends on axioms: [propext] +'Blc.Global37Checks.macro36_reverse_pump' depends on axioms: [propext] +Exit: 0 +Seconds: 1.218 diff --git a/data/self-interpreter/reasoning_floor/global/projection-control.json b/data/self-interpreter/reasoning_floor/global/projection-control.json new file mode 100644 index 00000000..2519e9de --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/projection-control.json @@ -0,0 +1,9 @@ +{ + "idea": "Literal continuation-headed decoder with two projections of int165", + "value_bits": 178, + "remainder_bits": 177, + "source_bits": 366, + "battery": "366 bits ok=667 skip=1 fail=0", + "value_nonlinear": 7, + "remainder_nonlinear": 7 +} diff --git a/data/self-interpreter/reasoning_floor/global/projection_control.py b/data/self-interpreter/reasoning_floor/global/projection_control.py new file mode 100644 index 00000000..07b1a6b9 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/projection_control.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +"""One existing semantic construction, used as a literal-head control.""" +import sys +sys.dont_write_bytecode=True +import json +from pathlib import Path +from verify import ROOT,HERE,parse,lc,V,L,A,counts,nonlinear,width,chain +import battery + +def main(): + e=parse((ROOT/'data/self-interpreter/machines/int165.lam').read_text()) + k=L(L(V(1)));f=L(L(V(0))) + value=A(A(e,k),V(0)) + remainder=A(A(e,f),V(0)) + h=L(L(A(A(V(1),value),remainder))) + assert lc.size(h)==366 + assert lc.size(value)==178 and lc.size(remainder)==177 + assert not chain(value) and not chain(remainder) + src=lc.show(h)+'\n' + assert parse(src)==h + (HERE/'control366.lam').write_text(src) + (HERE/'control366.blc').write_text(lc.enc(h)+'\n') + battery.BLAM=str(HERE/'blam-frozen') + ok,skip,fail=battery.check(h,threads=2) + assert (ok,skip,len(fail))==(667,1,0) + line=f'{lc.size(h)} bits ok={ok} skip={skip} fail={len(fail)}' + report=dict(idea='Literal continuation-headed decoder with two projections of int165', + value_bits=lc.size(value),remainder_bits=lc.size(remainder), + source_bits=lc.size(h),battery=line, + value_nonlinear=nonlinear(value),remainder_nonlinear=nonlinear(remainder)) + (HERE/'projection-control.json').write_text(json.dumps(report,indent=2)+'\n') + print(line) + print(json.dumps(report)) + +if __name__=='__main__':main() diff --git a/data/self-interpreter/reasoning_floor/global/search-count.json b/data/self-interpreter/reasoning_floor/global/search-count.json new file mode 100644 index 00000000..be76a73c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/search-count.json @@ -0,0 +1,8 @@ +{ + "closed_exact_164": 13991609123374908354231883755854230238733345, + "closed_below_165": 28884801049237501100398528001139900247359718, + "closed_exact_167": 102151234585895315868212377352385423280481831, + "dp_states": 6807, + "seconds": 0.0361, + "method": "Grammar counting only; no candidate terms generated." +} diff --git a/data/self-interpreter/reasoning_floor/global/verified.json b/data/self-interpreter/reasoning_floor/global/verified.json new file mode 100644 index 00000000..34d3aebd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/verified.json @@ -0,0 +1,851 @@ +{ + "layouts": [ + { + "group": 34, + "body": "(a b) c", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 6 + }, + { + "group": 34, + "body": "a (b c)", + "kind": "at_least_three_lambdas", + "steps": 5 + }, + { + "group": 34, + "body": "(a c) b", + "kind": "handwritten_growth_invariant", + "family": "(a c) b" + }, + { + "group": 34, + "body": "a (c b)", + "kind": "at_least_three_lambdas", + "steps": 5 + }, + { + "group": 34, + "body": "(b a) c", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b.a (\\c.b a c)", + "steps": 6 + }, + { + "group": 34, + "body": "b (a c)", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 4 + }, + { + "group": 34, + "body": "(b c) a", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a.a (\\b\\c.b) (\\b.b (\\c\\d.c) (\\c.c (\\d\\e.e) (\\d.d (\\e\\f.e) #4))) (\\b.#3 b (\\c\\d.c (\\e.d e c)))", + "steps": 6 + }, + { + "group": 34, + "body": "b (c a)", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 4 + }, + { + "group": 34, + "body": "(c a) b", + "kind": "handwritten_growth_invariant", + "family": "(c a) b" + }, + { + "group": 34, + "body": "c (a b)", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 7 + }, + { + "group": 34, + "body": "(c b) a", + "kind": "wrong_continuation_spine", + "arity": 3, + "steps": 5 + }, + { + "group": 34, + "body": "c (b a)", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b.a (\\c.c (b a))", + "steps": 7 + }, + { + "group": 35, + "body": "(a (a (b c)))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "(a ((a b) c))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "((a a) (b c))", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "((a (a b)) c)", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "(((a a) b) c)", + "kind": "exact_head_cycle", + "prefix": 2, + "period": 3 + }, + { + "group": 35, + "body": "(a (a (c b)))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "(a ((a c) b))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "((a a) (c b))", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "((a (a c)) b)", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "(((a a) c) b)", + "kind": "exact_head_cycle", + "prefix": 2, + "period": 6 + }, + { + "group": 35, + "body": "(a (b (a c)))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "(a ((b a) c))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "((a b) (a c))", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "((a (b a)) c)", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "(((a b) a) c)", + "kind": "wrong_continuation_spine", + "arity": 3, + "steps": 5 + }, + { + "group": 35, + "body": "(a (b (c a)))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "(a ((b c) a))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "((a b) (c a))", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "((a (b c)) a)", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "(((a b) c) a)", + "kind": "wrong_continuation_spine", + "arity": 3, + "steps": 5 + }, + { + "group": 35, + "body": "(a (c (a b)))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "(a ((c a) b))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "((a c) (a b))", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "((a (c a)) b)", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "(((a c) a) b)", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 4, + "steps": 8 + }, + { + "group": 35, + "body": "(a (c (b a)))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "(a ((c b) a))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "((a c) (b a))", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "((a (c b)) a)", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "(((a c) b) a)", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b.a", + "steps": 13 + }, + { + "group": 35, + "body": "(b (a (a c)))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 2 + }, + { + "group": 35, + "body": "(b ((a a) c))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 2 + }, + { + "group": 35, + "body": "((b a) (a c))", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b\\c.b a (a c)", + "steps": 4 + }, + { + "group": 35, + "body": "((b (a a)) c)", + "kind": "identity_wrong_payload", + "payload": 1, + "normal_form": "\\a.a (\\b\\c.b) (\\b.b (\\c\\d.c) (\\c.c (\\d\\e.e) (\\d.d (\\e\\f.e) #4)))", + "steps": 4 + }, + { + "group": 35, + "body": "(((b a) a) c)", + "kind": "wrong_continuation_spine", + "arity": 3, + "steps": 2 + }, + { + "group": 35, + "body": "(b (a (c a)))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 2 + }, + { + "group": 35, + "body": "(b ((a c) a))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 2 + }, + { + "group": 35, + "body": "((b a) (c a))", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b\\c.b a (c a)", + "steps": 4 + }, + { + "group": 35, + "body": "((b (a c)) a)", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b.a (b (\\c\\d.c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.f) (\\e.e (\\f\\g.f) #5)))) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) #6))))", + "steps": 4 + }, + { + "group": 35, + "body": "(((b a) c) a)", + "kind": "wrong_continuation_spine", + "arity": 3, + "steps": 2 + }, + { + "group": 35, + "body": "(b (c (a a)))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 2 + }, + { + "group": 35, + "body": "(b ((c a) a))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 2 + }, + { + "group": 35, + "body": "((b c) (a a))", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a.a (\\b\\c.b) (\\b.b (\\c\\d.c) (\\c.c (\\d\\e.e) (\\d.d (\\e\\f.e) #4)))", + "steps": 4 + }, + { + "group": 35, + "body": "((b (c a)) a)", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a.a (\\b\\c.b) (\\b\\c.b) (\\b.b (\\c\\d.d) (\\c.c (\\d\\e.d) #3)) (\\b\\c.b)", + "steps": 4 + }, + { + "group": 35, + "body": "(((b c) a) a)", + "kind": "wrong_continuation_spine", + "arity": 3, + "steps": 2 + }, + { + "group": 35, + "body": "(c (a (a b)))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 1, + "steps": 14 + }, + { + "group": 35, + "body": "(c ((a a) b))", + "kind": "identity_extra_lambda", + "steps": 12 + }, + { + "group": 35, + "body": "((c a) (a b))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 3, + "steps": 14 + }, + { + "group": 35, + "body": "((c (a a)) b)", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 0)", + "arity": 6, + "steps": 20 + }, + { + "group": 35, + "body": "(((c a) a) b)", + "kind": "identity_extra_lambda", + "steps": 17 + }, + { + "group": 35, + "body": "(c (a (b a)))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 4, + "steps": 9 + }, + { + "group": 35, + "body": "(c ((a b) a))", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b\\c.c (a b a)", + "steps": 10 + }, + { + "group": 35, + "body": "((c a) (b a))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 3, + "steps": 8 + }, + { + "group": 35, + "body": "((c (a b)) a)", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 5, + "steps": 9 + }, + { + "group": 35, + "body": "(((c a) b) a)", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 4, + "steps": 8 + }, + { + "group": 35, + "body": "(c (b (a a)))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 3, + "steps": 5 + }, + { + "group": 35, + "body": "(c ((b a) a))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 4, + "steps": 5 + }, + { + "group": 35, + "body": "((c b) (a a))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 3, + "steps": 5 + }, + { + "group": 35, + "body": "((c (b a)) a)", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 4, + "steps": 5 + }, + { + "group": 35, + "body": "(((c b) a) a)", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 4, + "steps": 5 + }, + { + "group": 36, + "body": "(a (\\u.b)) c", + "kind": "wrong_continuation_spine", + "arity": 0, + "steps": 12 + }, + { + "group": 36, + "body": "(a b) (\\u.c)", + "kind": "handwritten_growth_invariant", + "family": "(a b) (\\u.c)" + }, + { + "group": 36, + "body": "a (b (\\u.c))", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b.b (\\c\\d.c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.f) (\\e.e (\\f\\g.f) #5)))", + "steps": 12 + }, + { + "group": 36, + "body": "(a c) (\\u.b)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + { + "group": 36, + "body": "(a (\\u.c)) b", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 6 + }, + { + "group": 36, + "body": "a (c (\\u.b))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + { + "group": 36, + "body": "(b (\\u.a)) c", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 8 + }, + { + "group": 36, + "body": "(b a) (\\u.c)", + "kind": "handwritten_growth_invariant", + "family": "(b a) (\\u.c)" + }, + { + "group": 36, + "body": "b (a (\\u.c))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 7 + }, + { + "group": 36, + "body": "(b c) (\\u.a)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 6 + }, + { + "group": 36, + "body": "(b (\\u.c)) a", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 7 + }, + { + "group": 36, + "body": "b (c (\\u.a))", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b.b (\\c\\d.c (d (\\e.b)))", + "steps": 7 + }, + { + "group": 36, + "body": "(c (\\u.a)) b", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": 36, + "body": "(c a) (\\u.b)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": 36, + "body": "c (a (\\u.b))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": 36, + "body": "(c b) (\\u.a)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": 36, + "body": "(c (\\u.b)) a", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": 36, + "body": "c (b (\\u.a))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "(a (\\u.b)) c", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "(a b) (\\u.c)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "a (b (\\u.c))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "(a c) (\\u.b)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "(a (\\u.c)) b", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "a (c (\\u.b))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "(b (\\u.a)) c", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 6 + }, + { + "group": "36open", + "body": "(b a) (\\u.c)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + { + "group": "36open", + "body": "b (a (\\u.c))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + { + "group": "36open", + "body": "(b c) (\\u.a)", + "kind": "handwritten_growth_invariant", + "family": "(b c) (\\u.a)" + }, + { + "group": "36open", + "body": "(b (\\u.c)) a", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 11 + }, + { + "group": "36open", + "body": "b (c (\\u.a))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 9 + }, + { + "group": "36open", + "body": "(c (\\u.a)) b", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 6 + }, + { + "group": "36open", + "body": "(c a) (\\u.b)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + { + "group": "36open", + "body": "c (a (\\u.b))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + { + "group": "36open", + "body": "(c b) (\\u.a)", + "kind": "handwritten_growth_invariant", + "family": "(c b) (\\u.a)" + }, + { + "group": "36open", + "body": "(c (\\u.b)) a", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 7 + }, + { + "group": "36open", + "body": "c (b (\\u.a))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 7 + } + ], + "reference_checks": [ + { + "name": "int165", + "bits": 165, + "lambdas": 17, + "leaves": 26, + "index_sum": 29, + "width": 4, + "nonlinear": 7, + "normal": false, + "incomparable_nonlinear": true + }, + { + "name": "int204", + "bits": 204, + "lambdas": 21, + "leaves": 30, + "index_sum": 44, + "width": 4, + "nonlinear": 9, + "normal": true, + "incomparable_nonlinear": true + }, + { + "name": "int584", + "bits": 584, + "lambdas": 69, + "leaves": 68, + "index_sum": 176, + "width": 7, + "nonlinear": 2, + "normal": false, + "incomparable_nonlinear": true + }, + { + "name": "int672", + "bits": 672, + "lambdas": 29, + "leaves": 85, + "index_sum": 276, + "width": 6, + "nonlinear": 10, + "normal": true, + "incomparable_nonlinear": true + }, + { + "name": "int742", + "bits": 742, + "lambdas": 64, + "leaves": 62, + "index_sum": 368, + "width": 10, + "nonlinear": 2, + "normal": true, + "incomparable_nonlinear": true + }, + { + "name": "int168", + "bits": 168, + "lambdas": 16, + "leaves": 27, + "index_sum": 30, + "width": 4, + "nonlinear": 7, + "normal": false, + "incomparable_nonlinear": true + }, + { + "name": "int170", + "bits": 170, + "lambdas": 16, + "leaves": 25, + "index_sum": 40, + "width": 4, + "nonlinear": 7, + "normal": false, + "incomparable_nonlinear": true + } + ], + "remainder_checks": { + "near_miss_bits": 24, + "identity_suffix_I_nf": "\\a\\b.b b", + "finite_clauses": 8 + }, + "lean_clauses": 152, + "seconds": 0.026 +} diff --git a/data/self-interpreter/reasoning_floor/global/verify.py b/data/self-interpreter/reasoning_floor/global/verify.py new file mode 100644 index 00000000..92a2073a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/global/verify.py @@ -0,0 +1,321 @@ +#!/usr/bin/env python3 +"""Fixed witnesses for the handwritten 37-bit theorem. + +The only finite layout families are 12 + 60 + 18 + 18 analytically forced +application trees. Caps are never refutations. Six infinite families have +separate handwritten invariants; this checks their finite macro identities. +All writes stay in this directory, including optional Lean certificates. +""" +import sys +sys.dont_write_bytecode = True +from pathlib import Path +import itertools +import json +import time +import re +from check34 import parse, head_step, invoke, lc, ROOT +from check35 import trees, spine + +HERE=Path(__file__).resolve().parent +V=lambda n:('V',n) +L=lambda b:('L',b) +A=lambda f,a:('A',f,a) +I=L(V(0)) +KI=L(I) +DELTA=parse('\\x.x x') +CERTS=[] + +def steps(t,n): + for _ in range(n): + u=head_step(t) + assert u is not None + t=u + return t + +def normal(t): + if t[0]=='V':return True + if t[0]=='L':return normal(t[1]) + return t[1][0]!='L' and normal(t[1]) and normal(t[2]) + +def occ(t,n=0): + if t[0]=='V':return int(t[1]==n) + if t[0]=='L':return occ(t[1],n+1) + return occ(t[1],n)+occ(t[2],n) + +def nonlinear(t): + if t[0]=='V':return 0 + if t[0]=='L':return (occ(t[1])>1)+nonlinear(t[1]) + return nonlinear(t[1])+nonlinear(t[2]) + +def free(t,d=0): + if t[0]=='V':return {t[1]-d} if t[1]>=d else set() + if t[0]=='L':return free(t[1],d+1) + return free(t[1],d)|free(t[2],d) + +def width(t): + if t[0]=='V':return 1 + if t[0]=='L':return max(len(free(t)),width(t[1])) + return max(len(free(t)),width(t[1]),width(t[2])) + +def chain(t): + if t[0]=='V':return True + if t[0]=='L':return chain(t[1]) + return chain(t[1]) and chain(t[2]) and (nonlinear(t[1])==0 or nonlinear(t[2])==0) + +def counts(t): + if t[0]=='V':return 0,1,t[1] + if t[0]=='L': + a,b,c=counts(t[1]); return a+1,b,c + return tuple(x+y for x,y in zip(counts(t[1]),counts(t[2]))) + +def certify(label,t,n,u): + assert steps(t,n)==u,label + CERTS.append((label,t,n,u)) + +def finite_refute(label,e): + """Find only a proved finite wrong shape or an exact repeated head state.""" + seen={} + t=e + for n in range(80): + b,h,args=spine(t) + if b>=3: + certify(label,e,n,t) + return dict(kind='at_least_three_lambdas',steps=n) + if t in seen: + k=seen[t] + certify(label+'_prefix',e,k,t) + certify(label+'_cycle',t,n-k,t) + return dict(kind='exact_head_cycle',prefix=k,period=n-k) + seen[t]=n + u=head_step(t) + if u is None: + certify(label,e,n,t) + if b!=2: + return dict(kind='wrong_interface_arity',arity=b,steps=n) + if h==V(1) and len(args)!=2: + return dict(kind='wrong_continuation_spine',arity=len(args),steps=n) + break + t=u + else: + raise AssertionError((label,'needs a handwritten invariant')) + + # Only the identity source is needed for all remaining finite cases. + q=invoke(e,I);t=q + for n in range(80): + b,h,args=spine(t) + if b>=3: + certify(label+'_I',q,n,t) + return dict(kind='identity_extra_lambda',steps=n) + u=head_step(t) + if u is None: + certify(label+'_I',q,n,t) + if (b,h,len(args))!=(2,V(1),2): + return dict(kind='identity_wrong_spine',binders=b,head=repr(h),arity=len(args),steps=n) + for i,(arg,want) in enumerate(zip(args,(KI,V(0)))): + # A bounded normalization is positive evidence only: it must + # finish, and the resulting normal form must differ. + try:r=lc.nf(arg,[1000]) + except lc.Fuel:continue + if r!=want: + assert normal(r) + return dict(kind='identity_wrong_payload',payload=i, + normal_form=lc.show(r),steps=n) + raise AssertionError((label,'no refutation')) + t=u + raise AssertionError((label,'unresolved identity probe')) + +def case_families(): + rows=[] + for p in itertools.permutations('abc'): + for assoc in (0,1): + a,b,c=p + body=f'({a} {b}) {c}' if assoc==0 else f'{a} ({b} {c})' + n=parse('\\a\\b.a (\\c.'+body+')');e=A(DELTA,n) + label=f'g34_{len(rows)}' + assert lc.size(e)==34 + if body in ('(a c) b','(c a) b'): + result=dict(kind='handwritten_growth_invariant',family=body) + else:result=finite_refute(label,e) + rows.append(dict(group=34,body=body,**result)) + + for p in sorted(set(itertools.permutations('aabc'))): + for body in trees(p): + n=parse('\\a\\b\\c.'+body);e=A(DELTA,n) + assert lc.size(e)==35 + result=finite_refute(f'g35_{len(rows)}',e) + rows.append(dict(group=35,body=body,**result)) + + for p in itertools.permutations('abc'): + for assoc in (0,1): + for box in 'abc': + q=[f'(\\u.{x})' if x==box else x for x in p] + body=f'({q[0]} {q[1]}) {q[2]}' if assoc==0 else f'{q[0]} ({q[1]} {q[2]})' + n=parse('\\a.a (\\b\\c.'+body+')') + if not normal(n):continue + e=A(DELTA,n);assert lc.size(e)==36 + label=f'g36_{len(rows)}' + if body in ('(a b) (\\u.c)','(b a) (\\u.c)'): + result=dict(kind='handwritten_growth_invariant',family=body) + else:result=finite_refute(label,e) + rows.append(dict(group=36,body=body,**result)) + for p in itertools.permutations('abc'): + for assoc in (0,1): + for box in 'abc': + q=[f'(\\u.{x})' if x==box else x for x in p] + body=f'({q[0]} {q[1]}) {q[2]}' if assoc==0 else f'{q[0]} ({q[1]} {q[2]})' + if not normal(parse('\\a\\b.b (\\c.'+body+')')):continue + e=parse('\\a.(\\x.x x) (\\b.b (\\c.'+body+'))') + assert lc.size(e)==36 + label=f'g36open_{len(rows)}' + if body in ('(b c) (\\u.a)','(c b) (\\u.a)'): + result=dict(kind='handwritten_growth_invariant',family=body) + else:result=finite_refute(label,e) + rows.append(dict(group='36open',body=body,**result)) + assert len(rows)==108 + assert sum(r['kind']=='handwritten_growth_invariant' for r in rows)==6 + return rows + +def macro_checks(): + # All C,S,P are rigid in these fixed checks. The report proves the + # invariants for arbitrary finite wrapper words, not only these samples. + n1=parse('\\a\\b.a (\\c.a c b)') + n2=parse('\\a\\b.a (\\c.c a b)') + n3=parse('\\a.a (\\b\\c.a b (\\u.c))') + n4=parse('\\a.a (\\b\\c.b a (\\u.c))') + rigid=V(0) + def j(x,t):return L(A(A(lc.shift(1,0,x),V(0)),lc.shift(1,0,t))) + def pair(x,y):return L(A(A(V(0),lc.shift(1,0,x)),lc.shift(1,0,y))) + def k(x):return L(lc.shift(1,0,x)) + def f(x):return L(L(A(A(lc.shift(2,0,x),V(1)),k(V(0))))) + def g(x):return L(L(A(A(V(1),lc.shift(2,0,x)),k(V(0))))) + for length in (1,2,3): + # W=J_t1(...J_tk(N)); use distinct rigid labels to check ordering. + w=n1 + ts=[V(i+1) for i in range(length)] + for t in reversed(ts):w=j(w,t) + start=A(A(n1,w),rigid) + out=A(n1,j(w,rigid)) + for t in reversed(ts):out=A(out,t) + certify(f'macro34_chain_{length}',start,2+length,out) + w=pair(n2,V(0));ell=A(A(n2,w),V(1)) + certify('macro34_pair_pump',ell,4,A(ell,V(0))) + for power in (1,2,3): + w=n3 + for _ in range(power):w=f(w) + kp=rigid + for _ in range(power):kp=k(kp) + certify(f'macro36_forward_{power}',A(A(n3,w),rigid),1+2*power,A(A(n3,f(w)),kp)) + y=A(n4,g(n4)) + certify('macro36_reverse_pump',A(y,rigid),5,A(y,k(k(rigid)))) + # The open middle-duplicate case: a rigid outer a is boxed, and stays + # permanently behind the active recursive argument. + n5=parse('\\a\\b.b (\\c.b c (\\u.a))')[1] + n6=parse('\\a\\b.b (\\c.c b (\\u.a))')[1] + tail=k(rigid) + w=n5 + for power in (1,2,3): + w=j(w,tail) + out=A(n5,j(w,tail)) + for _ in range(power):out=A(out,tail) + certify(f'macro36_open_chain_{power}',A(n5,w),1+power,out) + def p(x):return L(A(A(V(0),lc.shift(1,0,x)),lc.shift(1,0,tail))) + ell=A(n6,p(n6)) + certify('macro36_open_pair_pump',ell,3,A(A(ell,tail),tail)) + +def remainder_checks(): + k=lambda t:L(lc.shift(1,0,t)) + delta_k=parse('\\x.x (\\u.x)') + vee=parse('\\x\\u.x x') + cases=[ + ('rem_d_kd',A(DELTA,k(DELTA)),2,DELTA), + ('rem_dk_d',A(delta_k,DELTA),3,DELTA), + ('rem_d_dk',A(DELTA,delta_k),4,delta_k), + ('rem_d_kkd',A(DELTA,k(k(DELTA))),2,k(DELTA)), + ('rem_d_kdk',A(DELTA,k(delta_k)),2,delta_k), + ('rem_dk_kd',A(delta_k,k(DELTA)),2,DELTA), + ('rem_v_d',A(vee,DELTA),1,k(A(DELTA,DELTA))), + ('rem_d_v',A(DELTA,vee),2,k(A(vee,vee))), + ] + for label,t,n,u in cases: + assert lc.size(t)<=23 + certify(label,t,n,u) + # Near-minimum syntax attains the 24-bit open-body counting bound but + # fails actual exact-remainder extraction even on source I / suffix I. + r=parse('\\s.s (\\x.x x) (\\x.x x)') + assert lc.size(r)==24 + got=lc.nf(A(r,lc.bitlist(lc.enc(I),I)),[100]) + assert normal(got) and got!=I + return dict(near_miss_bits=24,identity_suffix_I_nf=lc.show(got), + finite_clauses=len(cases)) + +def lean(t): + if t[0]=='V':return f'(.var {t[1]})' + if t[0]=='L':return f'(.lam {lean(t[1])})' + return f'(.app {lean(t[1])} {lean(t[2])})' + +def write_lean(): + out=['/- Fixed reduction clauses supporting the handwritten 37-bit bound.', + ' This file does not assert the complete size theorem. -/', + 'import Blc.Step','namespace Blc.Global37Checks','open Term', + 'set_option maxRecDepth 100000','set_option maxHeartbeats 4000000'] + for label,t,n,u in CERTS: + out += [f'theorem {label} : headSteps {n} {lean(t)} = some {lean(u)} := by decide'] + out+=['#print axioms macro34_pair_pump','#print axioms macro36_reverse_pump', + 'end Blc.Global37Checks'] + (HERE/'FiniteChecks.lean').write_text('\n\n'.join(out)+'\n') + +def references(run_battery=False): + import merges + srcs={ + 'int165':ROOT/'data/self-interpreter/machines/int165.lam', + 'int204':ROOT/'data/self-interpreter/machines/int204_normal.lam', + 'int584':ROOT/'data/self-interpreter/machines/int584_two_nonlinear.lam', + 'int672':ROOT/'data/self-interpreter/machines/int672_typed_normal.lam', + 'int742':ROOT/'data/self-interpreter/machines/int742_two_nonlinear_normal.lam', + } + terms={k:parse(p.read_text()) for k,p in srcs.items()} + # The upstream named source is a 220-bit pre-optimization term. Use the + # exact 168-bit wire that the existing Lean theorem pins, not its source. + proof=(ROOT/'lean/Blc/Selfint.lean').read_text() + wire=re.search(r'def intLWire : List Bool := \[([^]]+)\]',proof)[1] + bits=''.join('1' if x.strip()=='true' else '0' for x in wire.split(',')) + assert len(bits)==168 + terms['int168'],end=lc.decode(bits) + assert end==168 + row=next(v for v in merges.VARIANTS if v[0]=='165, next inlined') + terms['int170']=parse(row[1]) + assert lc.size(terms['int170'])==170 + output=[] + if run_battery: + import battery,shutil + frozen=HERE/'blam-frozen' + if frozen.exists():frozen.unlink() + shutil.copy2(ROOT/'target/release/blam',frozen) + battery.BLAM=str(frozen) + for name,t in terms.items(): + nl=nonlinear(t);w=width(t);l,v,x=counts(t) + assert not free(t) and w>=3 and nl>=2 and not chain(t) + assert lc.size(t)==2*l+4*v-2+x and lc.size(t)>=37 + r=dict(name=name,bits=lc.size(t),lambdas=l,leaves=v,index_sum=x, + width=w,nonlinear=nl,normal=normal(t),incomparable_nonlinear=True) + if run_battery: + ok,skip,fail=battery.check(t,threads=2) + assert (ok,skip,len(fail))==(667,1,0),(name,ok,skip,fail[:3]) + r['battery']=f'{lc.size(t)} bits ok={ok} skip={skip} fail={len(fail)}' + print(name,r['battery'],flush=True) + output.append(r) + return output + +def main(): + start=time.monotonic() + rows=case_families() + macro_checks() + rem=remainder_checks() + write_lean() + refs=references('--battery' in sys.argv) + report=dict(layouts=rows,reference_checks=refs,remainder_checks=rem,lean_clauses=len(CERTS), + seconds=round(time.monotonic()-start,3)) + (HERE/'verified.json').write_text(json.dumps(report,indent=2)+'\n') + print(json.dumps({k:v for k,v in report.items() if k!='layouts'},indent=2)) + +if __name__=='__main__':main() diff --git a/data/self-interpreter/reasoning_floor/grok/PROMPT.md b/data/self-interpreter/reasoning_floor/grok/PROMPT.md new file mode 100644 index 00000000..ee10e3a3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/grok/PROMPT.md @@ -0,0 +1,23 @@ +You are consulted for an independent, uncorrelated read on a hard golf problem. +Read /Users/a9lim/Work/blam/tmp/overnight/BRIEF.md (contract, the 165-bit BLC +self-interpreter, how it works, what is known). You cannot run code; reason on +paper. Your task: find a closed lambda term E that is a self-interpreter under +that exact contract and costs at most 164 bits — or, failing that, the most +promising concrete structural idea for one, worked out as far as you can. + +The 165 beat the previous record (168) by (1) hoisting a computation two +dispatch branches both need to a point where one expression is right for both, +and (2) letting a Scott structure's own application supply an argument (the +stream `cons b r = λf. f b r` hands `r` to the continuation for free). Look +for another move of that kind. Before proposing, check your idea against +docs/classical/self-interpreter/interpreter.md §5 and §6 in the same repo +(proved impossibilities and ~120 already-measured variants) — say honestly if +it is already listed. + +For every candidate, give: the exact term in the same named-lambda syntax as +the 165 (backslash binders, application by juxtaposition, parenthesized), its +size computed by |M| = 2L + 4A + 2 + X (show L, A, X), and a hand derivation +of the parser law on the three tag cases (00 abstraction, 01 application, +1^n0 variable) including the exact remainder. I will run the exact battery on +anything you propose. Overclaiming wastes everyone's time; a precise near-miss +with the reason it fails is valuable. diff --git a/data/self-interpreter/reasoning_floor/grok/consult1.md b/data/self-interpreter/reasoning_floor/grok/consult1.md new file mode 100644 index 00000000..2d5fedfa --- /dev/null +++ b/data/self-interpreter/reasoning_floor/grok/consult1.md @@ -0,0 +1,151 @@ +**Verdict:** one closed 164-bit candidate, paper-derived, not in §5/§6. Parser equations on the three tags match the 165’s. Battery not run. + +## Candidate (164) + +``` +(\x. x x) (\x. (\intL. \cont. \list. + list (\bit0 \r. bit0 r (\t. cont r (r r t))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +``` + +Association is the 165’s: `bit0 r (\t. …)` means `(bit0 r) (\t. …)`, and `r r t` means `(r r) t`. + +**L=16, A=24, X=34, |M| = 2·16 + 4·24 + 2 + 34 = 164.** + +Lambdas (16): knot `x`,`x`; `intL`; `cont`; `list`; `bit0`; `r`; `t`; `bit1`; `exp`; ABS `args`,`arg`,`zx`,`zy`; APP `exp2`,`args`. One fewer than the 165 (`next` gone; `t` replaces `unused`). + +Applications (24): knot/`x x`/intL-let/`(x x)` (4); reader `list H T` (2); handler `bit0 r`, `(bit0 r)(λt.…)`, `cont r`, `r r`, `(r r) t` (5); first parse + `bit1 ABS APP` (3); ABS 5; APP 5. The 165’s next-let (1), skip (2) and `r next` (1) are gone; the variable arm adds three apps. Net −1. + +Index sum (34): + +| occurrence | 0-based index | +|---|---:| +| `list` | 0 | +| `bit0` in `bit0 r` | 1 | +| `r` in `bit0 r` | 0 | +| handler `cont` (`t`,`r`,`bit0`,`list`,`cont`) | 4 | +| `r` in `cont r`; two `r`s in `r r`; `t` | 1+1+1+0 | +| first `intL` (`bit1`,`list`,`cont`,`intL`) | 3 | +| `bit1` | 1 | +| ABS `cont` (`exp`,`bit1`,`list`,`cont`) | 3 | +| ABS `exp`; cell `zx`,`arg`,`zy`,`args` | 2 + 1+2+0+3 | +| second `intL` (`exp`,`bit1`,`list`,`cont`,`intL`) | 4 | +| APP `cont` (`exp2`,`exp`,`bit1`,`list`,`cont`) | 4 | +| APP `exp`,`args`,`exp2`,`args` | 2+0+1+0 | +| knot `x`s | 0 | + +Sum 1+4+3+3+1+3+2+6+4+4+3 = 34. + +De Bruijn (0-based) of the same tree: + +``` +(λ. 0 0) (λ. (λ. (λ. (λ. + 0 + (λ. λ. 1 0 (λ. 4 1 (1 1 0))) + (λ. 3 (λ. 1 + (3 (λ. λ. 2 (λ. λ. 1 2 (0 3)))) + (4 (λ. 4 (λ. 2 0 (1 0))))))) + ) (0 0)) +``` + +Against the 165 (17, 25, 29): Δ = 2(−1)+4(−1)+(34−29) = −1. + +## The move + +The 165’s third reader argument is the hoisted skip `s s s`. Here it is the NEXT body: + +``` +T = \bit1. intL (\exp. bit1 ABS APP) +``` + +Handler: `\bit0 \r. bit0 r (\t. cont r (r r t))`. + +1. **0-tag Scott supply.** `H K r T = r T`, and `r = cons b2 r2`, so `r T = T b2 r2`, the 165’s `r next`. +2. **Unary skip erases T.** For any `U = 1^k 0 ++ N` (including k=0), `U U = K N`, hence `(U U) T = N`. The variable tail `r` is such a unary, so `r r T = N` and T is not evaluated on that arm. + +NEXT sits where one expression is right for both arms: used as the 0-arm continuation, erased as the variable-arm skip dummy. Skip `list list list` and the `next` let both go. + +**Not in §5 or §6.** Closest listed neighbours: + +| listed | bits | difference | +|---|---:|---| +| next inlined into Z, skip still `s s s` | 170 | NEXT under `\unused \r`, extra depth +4 | +| `next = \l. l B`, zero arm `\u. next` | 168 | skip still `s s s` | +| `next = \u \r. r B` | 171 | skip still `s s s` | +| skip `list list next` | 166 | skip still a 3-combinator; Z still `\u \r. r next` | +| spine3 `s (λb. b b C) (s s s) P` | 158 fail / 178 | extra outer P | +| Palmer 168 | 168 | reader `s H`, skip rebuilt from `list1` | + +§5’s reader bound assumes a skip with the stop-at-first-zero law and rigid `next`. Here `T` is the actual NEXT body, so that bound does not apply. The joint handler×skip search through 164 only fills small `S` in the reader frame (H+S ≤ 36 bits); NEXT is ~90 bits and was not a fill of that hole. + +## Parser law + +After the knot, `P[C] s = s H_C T_C` with + +``` +H_C = \bit0 \r. bit0 r (\t. C r (r r t)) +T_C = \bit1. P[\exp. bit1 A_C(exp) B_C(exp)] +A_C(f) = C (\args \arg. f (\zx \zy. zx arg (zy args))) +B_C(f) = P[\exp2. C (\args. f args (exp2 args))] +``` + +`P[C] (cons b r) = b r (\t. C r (r r t)) T_C`. Cell and APP lift are the 165’s. Claim: `P[C] (⌜M⌝ ++ N) =β C [M] N` with the 165’s values (`[var n]` = unary tail, ABS/APP closures as in the 165) and remainder exactly `N`. Closed `M` then gives the contract. + +**Variable `1^n 0 ++ N` (n ≥ 1).** `s = cons F r`, `r = 1^{n-1} 0 ++ N`. + +``` +P[C] s = (\t. C r (r r t)) T_C = C r ((r r) T_C) +``` + +`r` is a unary (a 0-tag stream when n=1), so `r r = K N` and `(r r) T_C = N`. Value `r`, remainder `N`. Lookup unchanged: `r cell = b' arg (r' args)`. + +**Abstraction `00 ⌜M⌝ ++ N`.** `s = cons K r`, `r = cons K (⌜M⌝ ++ N)`. + +``` +P[C] s = r T_C = T_C K (⌜M⌝ ++ N) = P[\exp. A_C(exp)] (⌜M⌝ ++ N) +``` + +By induction: `A_C([M]) N = C (λargs λarg. [M] (cell arg args)) N`. Remainder `N`. This is the 165’s ABS return. + +**Application `01 ⌜M⌝ ⌜K⌝ ++ N`.** `s = cons K r`, `r = cons F (⌜M⌝ ++ ⌜K⌝ ++ N)`. + +``` +P[C] s = r T_C = T_C F (⌜M⌝ ++ ⌜K⌝ ++ N) = P[\exp. B_C(exp)] (⌜M⌝ ++ ⌜K⌝ ++ N) +``` + +Induction on the first child, then the second: `C (λargs. [M] args ([K] args)) N`. Remainder `N`. This is the 165’s APP return. + +Knot, cell, and APP lift are untouched, so the 165’s induction transfers, including divergent sources: remainders come from `(r r) T = N` or from an inductive call that already returns its suffix. + +## Near-miss (same handler, `next` let-bound, 168) + +``` +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0 \r. bit0 r (\t. cont r (r r t))) next) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +``` + +L=17, A=25, X=32, size 168. Same equations with `T = next`. NEXTBODY is outside `\list`, so its `intL`/`cont` depths match the 165; the let costs λ+app+the `next` leaf (index 1). Inlining under `\list` only adds +1 depth to four NEXT occurrences (+4) and drops the handler’s `next` binder (−1) and the `next` leaf (−1): net X +2, −1 λ, −1 app, 168−4=164. + +This 168 is not Palmer’s term. It is the same fusion with NEXT as a variable rather than inlined. + +## Rejected (already listed, or larger) + +- Zero arm `\r. r next` (162): extra `S` at rigid `C`. §3, fails all 667. +- `bit0` as `K` dropping unused (166): listed. +- Reader `s H` with `H = \b \r. b (r next) (cont r (r r next))`: correct, L=16 A=26 X=33 = 171. +- `H = \b. b (\r. r) (\r \t. cont r (r r t))`: splits the shared `\r`; extra λ. +- `H = \b \r. b r (cont r (r r r))` plus extra T: variable arm is `C r N T`. Spine3-bare shape. +- Cell/APP alias, mode-free builder, `r intL` selected component, arity switch, reader/handler knots, thunked rest: §5/§6. + +If the 164 fails constructors, ABS/APP were mis-copied (they are the 165’s, with unused `list` in scope). If it fails variables only, `(r r) t` is not `N` on some unary; `U U = K N` is in interpreter.md §2. If arity fails at rigid `C`, `t` is not consuming T; λt is there for that. + +Not a passing-battery claim. It is a 164-bit closed term whose three-tag equations are the 165’s, by a fusion §3 and §6 did not measure: NEXT is the reader’s third argument. +[gaslamp] job: gk-20261021-013506-95f8 · session: 01a15cf4-c2e1-72f2-9ea9-288800cbe355 · thread: overnight-grok · resume: gaslamp grok --thread overnight-grok · model: grok-4.6 (billed grok-4.6-build) · tok: 574k→49k · $0.75 diff --git a/data/self-interpreter/reasoning_floor/grok/consult2.md b/data/self-interpreter/reasoning_floor/grok/consult2.md new file mode 100644 index 00000000..6ffcfa59 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/grok/consult2.md @@ -0,0 +1,158 @@ +The 4 missing bits are one application: forcing `r r = K N` inside `C`’s argument. Dropping it gives a 164 that is not a self-interpreter. Below are exact siblings, each with L, A, X counted juxtaposition-by-juxtaposition. + +## Why this shape sits at 168 + +The working var arm is `\t. cont r (r r t)` — four applications: + +1. `cont r` +2. `r r` +3. `(r r) t` +4. `(cont r) ((r r) t)` + +`r r = K N` on every unary tail, so (3) is the force `(K N) t = N`. The closed-term size treats one application as 4 bits (`4A`). That force is exactly the gap from a 164 thunk to the working 168. + +The other +4 is unused-`λlist` tax on four NEXT refs (`intL`, `intL`, `cont`, `cont`). Moving NEXTBODY outside `λlist` requires a let, which is +1 λ +1 app. Letopt already said that let structure bottoms at 168: the let costs as much as the tax it removes. + +So this exact idea does not have a 4-bit working shrink. The siblings below are the pushes; several are 164/158 on the wire and fail the contract in a precise way. + +## 1. Thunked remainder — 164, expected fail + +``` +(\x. x x) (\x. (\intL. \cont. \list. + list (\bit0 \r. bit0 r (\t. cont r (r r))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +``` + +**L=16, A=24, X=34, |M|=2·16+4·24+2+34=164.** + +Same as the 168 with application (3) deleted. `t` is unused (absorbs T). Handler apps are now 5: `bit0 r`; `(bit0 r)(λt.…)`; `cont r`; `r r`; `(cont r)(r r)`. + +| case | reduction | remainder | +|---|---|---| +| 00 / 01 | `K r VAR T = r T = T b2 r2` | same as 165/168 constructors | +| `1^n0++N` | `(λt. C r (r r)) T = C r (K N)` | **`K N`, not `N`** | + +Fails the contract: `C` must receive `N`. This is the “rest as thunk” obstacle in §6 (listed there at 202 with a force adapter). Here the missing force is a single app, so the term is 164 and wrong. Not listed at this size. + +## 2. Drop `λt` as well — 158, expected fail + +``` +(\x. x x) (\x. (\intL. \cont. \list. + list (\bit0 \r. bit0 r (cont r (r r))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +``` + +**L=15, A=24, X=30, |M|=2·15+4·24+2+30=158.** + +Handler (stack `r=0,bit0=1,list=2,cont=3`): `bit0=1`, `r=0`, `cont=3`, three `r`s at 0. Handler X=4, NEXT under `λlist` X=26, total 30. + +0-tag: `r T` still holds. Variable: `(C r (K N)) T = C r (K N) T` — three arguments at rigid `C`, and a thunk. Same failure mode as spine3-bare (158). Not a new size class. + +## 3. `I` as 0-arm, `r` Scott-supplied — 169, should pass + +``` +(\x. x x) (\x. (\intL. \cont. \list. + list (\bit0. bit0 (\z. z) (\v \t. cont v (v v t))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +``` + +**L=17, A=25, X=33, |M|=2·17+4·25+2+33=169.** + +`s H T = b I VAR r T`. + +- 00/01: `I r T = r T = T b2 r2` (168’s 0-tag). +- Variable: `VAR r T = C r (r r T) = C r N`. + +Apps (25): knot 4; reader 2; `bit0 I`, `(bit0 I) VAR` (2); `cont v`, `v v`, `(v v) t`, `(cont v)(…)` (4); NEXT 3; ABS 5; APP 5. + +X: `bit0=0`, `z=0`; wrap `cont=4,v=1,v=1,v=1,t=0` (7); NEXT under `λlist` (26). + +This is the 168 with `r` not shared: K-as-return-r is replaced by `I r T`. Extra `λz` (+2), `bit0` at 0 instead of 1 (−1). Net +1. Should pass. Not in §6. + +## 4. NEXT let (shallow NEXT) — 172, should pass + +``` +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0 \r. bit0 r (\t. cont r (r r t))) next) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +``` + +**L=17, A=26, X=32, |M|=2·17+4·26+2+32=172.** + +Same equations as the 168 with `T = next`. NEXTBODY is outside `λlist` (165 depths, −4 X), plus `next` as a leaf at 1 (+1) and `next` in the handler stack (`cont` at 5 instead of 4, +1). Letopt of the 168 already implied this is worse. Not listed (the listed “next inlined” is 170 with skip `s s s`). + +## 5. Hoisted skip + T together — 177, should pass + +``` +(\x. x x) (\x. (\intL. \cont. \list. + list (\bit0 \r. bit0 (\s. s) (\s \t. cont r s)) + (list list list) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +``` + +**L=18, A=26, X=35, |M|=2·18+4·26+2+35=177.** + +`s H S T = b I VAR S T`, `S = s s s`. + +- 00/01: `I S T = S T = r T`. +- Variable: `(λs t. C r s) S T = C r N` (`t` absorbs T; skip is already `N`). + +Apps (26): knot 4; reader 3; skip 2; `bit0 I`, `(bit0 I) VAR` (2); `cont r`, `(cont r) s` (2); NEXT 3; ABS 5; APP 5. + +X: `bit0=1`; I `s=0`; var `cont=5,r=2,s=1` (8); skip 0; NEXT under `λlist` (26). Total 35. + +The 165 already Scott-supplies `(r, N)` to bare `cont`. Adding T as a fourth argument forces `I` + `λs λt` + an extra reader app, which costs more than the 27-bit var arm it replaces. Should pass. Not in §6. + +## 6. Both arms mention `next` (no `λt`) — 171, should pass + +``` +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0 \r. bit0 (r next) (cont r (r r next)))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +``` + +**L=16, A=26, X=33, |M|=2·16+4·26+2+33=171.** + +Reader is `s H` (one arg). `T` is a free `next`, used twice, so the let is shallow-NEXT and pays. + +- 00/01: `r next = next b2 r2`. +- Variable: `C r (r r next) = C r N`. + +Handler apps (7): `r next`; `bit0 (r next)`; `cont r`; `r r`; `(r r) next`; `(cont r)(…)`; `(bit0 (r next)) VAR`. Plus next-let (1), reader (1). + +Handler stack `r=0,bit0=1,list=2,next=3,cont=4`: X_H=1+0+3+4+0+0+0+3=11; NEXTBODY shallow X=22. Total 33. + +This is Palmer’s 168 with skip leaf `next` instead of `list1`. Worse by 3. Should pass. Not listed (Palmer uses `list1 list1 list1`). + +## What would actually be 164 + +Palmer is `(16, 26, 30)`. This idea is `(16, 25, 34)`. The mixed pair `(16, 25, 30)` is 164: Palmer’s shallow NEXT with this idea’s missing let-application. That mix is exactly the let-bound term above, which reintroduces the application and lands at 172. + +A working 164 in this family needs one of: + +- a 3-application var arm whose fourth leaf is already `N` (no 1-app form of `N` exists among `t,r,bit0,list,cont`), or +- a dummy force that is not an extra application (the 165’s Scott-supplied skip is that dummy; putting NEXT in that slot is what made the var arm expensive), or +- a use of NEXT that also does existing 0-arm work without a new application — the 166 `list list next` is the one-bit version of that, and dropping `λunused` from it reintroduces an extra argument at `C` or at NEXT (listed 162 / the 166 swap). + +I do not have a working term ≤ 164. The thunked 164 and the 158 are the exact size claims to run first; they should fail in the ways above. The 169 is the cheapest correct sibling of the 168. +[gaslamp] job: gk-20261021-015625-1853 · session: 01a15cf4-c2e1-72f2-9ea9-288800cbe355 · thread: overnight-grok · resume: gaslamp grok --thread overnight-grok · model: grok-4.6 (billed grok-4.6-build) · tok: 297k→87k · $1.11 diff --git a/data/self-interpreter/reasoning_floor/grok/followup.md b/data/self-interpreter/reasoning_floor/grok/followup.md new file mode 100644 index 00000000..ff2011e7 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/grok/followup.md @@ -0,0 +1,17 @@ +Exact check of your candidate (I ran it): it is a correct self-interpreter — +`168 bits ok=667 skip=1 fail=0` — but 168, not 164. The miscount is in the +handler: `cont r (r r t)` is FOUR applications (cont r; (cont r)(…); r r; +(r r) t), so the handler has 6 applications, A = 25, and with L = 16, +X = 34 the size is 2·16 + 4·25 + 2 + 34 = 168. Its optimal let structure +(blam golf letopt, ≤ 3 cuts) is also 168. + +The idea is new and valid: NEXT as the reader's third operand, used by the +0-tag arm (`r T` = `T b2 r2`) and erased on variables by `r r t`. Against the +165 it saves the zero arm and the `next` let but pays 27 bits for the variable +arm `\t. cont r (r r t)` and +4 index bits for NEXT under `\list`. + +Can you push this idea (or a sibling) 4+ bits further? For instance: a +variable arm that absorbs T more cheaply, a hoisted whole-stream skip that +coexists with T, or NEXT placed so its references do not deepen. Count +L, A, X carefully (every juxtaposition is one application). Give exact terms; +I will run them. diff --git a/data/self-interpreter/reasoning_floor/knot/PROMPT.md b/data/self-interpreter/reasoning_floor/knot/PROMPT.md new file mode 100644 index 00000000..0c2e7049 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/PROMPT.md @@ -0,0 +1,31 @@ +Lane "knot": the cost of recursion and of deep references. Your lane directory +is /Users/a9lim/Work/blam/tmp/overnight/knot/ (write only there). Read +/Users/a9lim/Work/blam/tmp/overnight/BRIEF.md first; it is the shared ground truth. + +Attributable to recursion in the 165: the knot block +`(\x. x x) (\x. (\intL. BODY) (x x))` is 22 bits, and the two references to +`intL` (0-based depths 2 and 3) cost 9 more: about 31 bits. The deep +references are the other tax: `cont` is used three times at 0-based depths 3, +2, 3 (8 index bits), `next` once at depth 4. A sub-165 needs +2L + 4A + X ≤ 162 (now 34 + 100 + 29 = 163): for example one application +fewer with at most 3 bits of λ/index added, or the same L and A with X ≤ 28. + +Your angle: recursion and binder placement. Questions to attack: +(a) Can the second parse (APP) or the first parse (NEXT header) obtain the +parser from somewhere other than `intL` more cheaply — from the continuation, +the stream, `next`, or a value — so the `intL` let or one of its references +disappears? (b) The reader already self-applies the stream (`list list`), and +`R Z_t →* t t`, `H R →* next next cont` (interpreter.md §2): the 165 contains +the self-application a knot needs. Earlier constructions that used this cost +192–199 because of carriers; find the cheapest carrier, or prove a lower +bound on any carrier in a delimited class. (c) Binder order: is there a +rearrangement of λcont / the next let / λlist / the knot (with a matching +protocol tweak) that shortens the deep references by more than it costs? +The let structure of the 165's own core is already optimal (letopt), so a +win needs a protocol change, e.g. a different argument order somewhere. +(d) A lower bound: what is the least total recursion overhead (knot + all +references to the recursive parser) for an interpreter that recurses twice +(once per child of an application) through a fixed point? A clean theorem +here, even conditional, is valuable. + +Report as the brief says; every complete interpreter needs a battery line. diff --git a/data/self-interpreter/reasoning_floor/knot/REPORT.md b/data/self-interpreter/reasoning_floor/knot/REPORT.md new file mode 100644 index 00000000..a58a3a85 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/REPORT.md @@ -0,0 +1,370 @@ +# Knot lane: exact opaque-knot bound, carrier bounds, and two reset bootstraps + +No sub-165 interpreter was found. The main result is a **Lean-checked exact +20-bit minimum for an opaque fixed-point context**, giving **31 bits for the +knot, parser binder, and two recursive references in the 165's frame**. This +does not assume Curry's knot syntax or a bounded search. A separate handwritten +argument explains why sinking the shared diagonal cannot save bits when there +are exactly two recursive uses. + +The generic reader-diagonal carrier has a sharp 12-bit minimum. Within the +existing independent-carrier bootstrap template, this gives a sharp 192-bit +minimum. Two new constructions escape that carrier's independence hypothesis +by changing the erased skip operand; both still cost 192 bits. + +All files written by this lane are under this directory. The live brief, +interpreter record, STATUS, proof-boundary documents, and nine earlier lane +summaries were read. No external consult or subagent was used. + +## 1. Complete interpreters and checks + +The first two entries are unchanged controls, copied to the lane to verify +the attaining examples. The last two are new complete constructions. + +| File | Exact battery line | L, A, X | Idea | +|---|---|---|---| +| `reference165.lam` | `165 bits ok=667 skip=1 fail=0` | 17, 25, 29 | Existing 165; attains the ordinary 31-bit recursion accounting. | +| `reference192.lam` | `192 bits ok=667 skip=1 fail=0` | 21, 29, 32 | Existing independent zero-arm carrier; attains the restricted carrier-template bound. | +| `reset_cont192.lam` | `192 bits ok=667 skip=1 fail=0` | 21, 29, 32 | Put the continuation in the erased skip operand; bootstrap through input F. | +| `reset_generator192.lam` | `192 bits ok=667 skip=1 fail=0` | 20, 29, 34 | Put the generator in the erased skip operand; bootstrap through input F. | + +Each has its exact `.blc` encoding. `battery.json` records the full outcomes, +including no failures and approximately 1.88–1.94 seconds per battery with +two workers. All four also return the rigid suffix exactly on both Omega and +lambda.Omega under the suffix-projecting continuation. These finite checks +are not universal correctness proofs. The two new terms have the handwritten +unfolding and structural-parser arguments below, not new Lean interpreter +proofs. + +Reproduce: + +```sh +PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/knot/build_and_check.py +PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/knot/identity_check.py +PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/knot/checks.py carriers +``` + +The scripts import the existing battery and compiler, compile without +optimization, use at most two workers, and direct any temporary files to the +lane. The only finite hole check contains 71 terms, as detailed below. + +## 2. An exact 20-bit opaque-knot theorem + +**Status: kernel-checked in `KnotBound.lean`.** The final check is recorded in +`lean_check.log`. Its reported axioms are `propext` and `Quot.sound`; there is +no `sorryAx`. The attaining knot's unfolding uses no axioms. + +Let T be a lambda term containing a distinguished free rigid variable h. +Price every lambda and application at two bits, every bound occurrence at its +ordinary BLC cost, and every occurrence of the opaque hole h at zero bits. +Call this source cost ghostCost(T). In the intended one-hole interpretation, +T has no other free variable and h occurs once. The formal theorem actually +permits multiple free holes, all priced at zero. + +**Theorem.** If + +```text +T =beta h T, +``` + +then `ghostCost(T) >= 20`. More precisely, if k is the total number of free +hole occurrences, then + +```text +ghostCost(T) >= 18 + 2k. +``` + +No source-normality assumption, particular knot shape, reduction-cycle +criterion, or bound on reduction length is imposed. Equality is beta +joinability, not eta equality. + +**Proof.** T cannot have a beta-normal form n. Otherwise confluence and the +displayed equation give `n = h n`, impossible for finite syntax. The existing +kernel-checked theorem `SelfintLowerBound.one_nonlinear_normalizes` says every +term with at most one nonlinear binder has a beta-normal form. Hence T has at +least two nonlinear binders. It must also contain h: reduction cannot create +an absent free variable, while every reduct of `h T` retains its h head. + +Let m be the number of nonlinear binders, L the number of lambdas, A the +number of applications, and V the number of bound variable leaves. Distinct +binders own disjoint occurrences, so `L >= m` and `V >= 2m`. A unary/binary +syntax tree has `A+1 = V+k` leaves. Dropping the nonnegative index tax gives + +```text +ghostCost(T) >= 2L + 2A + 2V + >= 2m + 2(2m+k-1) + 4m + = 10m + 2k - 2 + >= 18 + 2k >= 20. +``` + +The Lean proof uses equivalent node/free-leaf inequalities, proves that the +hole is present, and proves the no-normal-form step from confluence. + +**Attainment.** With `Delta = lambda x.x x`, + +```text +T = Delta (lambda x.h (x x)) +``` + +has ghost cost 20 and one hole. Put `G = lambda x.h (x x)`. Then T reduces to +`G G` and then `h (G G)`, while `h T` reduces to `h (G G)`. The exact term, +cost, scope, one-hole count, and unfolding are all checked in Lean. + +**Two-call consequence.** Insert a closed body `H = lambda p.M` into a +single opaque body hole. Charge the parser-parameter lambda and the two +occurrences of p as recursion overhead. If their zero-based depths relative +to that lambda are d1 and d2, then the exact minimum is + +```text +20 + 2 + (d1+2) + (d2+2) = 26+d1+d2. +``` + +The call applications themselves already belong to M and are not charged +twice. At the 165's depths 2 and 3, this gives **31**, attained by its +existing knot. `two_call_overhead`, `current_frame_thirty_one`, and +`current_frame_attains` check these statements in Lean. + +This supplies an analytic and formal version of the opaque-knot minimum. +It does **not** imply that every interpreter has 31 separately chargeable +recursion bits. Using the parser body or stream as part of the knot violates +the opaque-hole premise. Changing the two call depths also changes the +numerical consequence. + +To reproduce without writing build products outside the lane, from `lean/`: + +```sh +LEAN_PATH=/Users/a9lim/Work/blam/lean/.lake/build/lib/lean \ + lean -j2 /Users/a9lim/Work/blam/tmp/overnight/knot/KnotBound.lean +``` + +## 3. Why sinking a twice-used diagonal does not help + +**Status: handwritten exact wire accounting.** This is an explanation of +the existing letopt neighborhood, not a proposal to repeat its search. + +Assume a generator binds x and shares `p = x x`; its body is closed apart +from p, so x has no other occurrence in that body. Suppose all r occurrences +of p remain in one subtree, and sink that let through an intervening lambda +`lambda a` into the subtree. Let m count the occurrences of a in the region +newly enclosed by the p binder. Then the size change is exactly + +```text +Delta bits = 2 - r + m. +``` + +The two x occurrences in the diagonal's right-hand side each become one +index deeper, adding two bits. The r p occurrences each become one index +shallower, subtracting r bits. The m captured a occurrences each become one +index deeper, adding m bits. Other references keep their index, and the +lambda/application inventory is unchanged. Application edges crossed by the +move add no index cost under the stated no-other-x condition. + +For **r=2**, each crossed lambda therefore contributes **m >= 0**. Sinking +the shared recursive parser cannot reduce total size, even though its two +use sites become cheaper. The argument extends over arbitrarily many such +moves by summing their nonnegative capture taxes. + +For the 165, moving the binding just inside the whole continuation body +charges its three continuation references, giving +3. Restricting the let to +NEXT before its bit binder charges only NEXT's two continuation references, +giving +2. Moving it further under that bit binder adds the bit occurrence, +giving +3. These agree with the recorded absence of a better let layout. + +Inlining the diagonal has a separate exact formula. At r use depths d_i, +let D be their sum. Shared overhead inside the generator is `10+2r+D`; +the inlined `x x` copies cost `6r+2D`. Thus inlining changes the size by +`4r+D-10`. For r=2 and D=5, it costs three extra bits. + +Finally, a pure exchange of adjacent parser/continuation lambda binders, +with matching argument-order changes, decreases the two parser indices by +one but increases the three continuation indices by one: **+1 bit even +before any calling-convention adapter**. A win needs a changed use pattern, +not just that exchange. These claims do not cover a body that already uses x +in another semantic role, or a different continuation/value protocol. + +## 4. The generic diagonal carrier is exactly 12 bits + +Write + +```text +Z_t = lambda u r.r t +T_t = lambda r.r t +H(q,c) = lambda b.b Z_q c +R(q,c) = lambda s.s H(q,c) (s s s). +``` + +Consider carriers S(t) whose **only possible free variable is t**, in frame +`[t]`, satisfying + +```text +R(q,c) S(t) =beta t t +``` + +for independent rigid q,c,t. S may contain arbitrary beta redexes. + +**Theorem.** `|S| >= 12`, with the unique 12-bit source `Z_t`, up to alpha +renaming. This is a handwritten proof, supported by the complete 71-term +check in `carrier_check.json`; it is not a Lean theorem. + +The attaining equation is the recorded diagonal identity: + +```text +Z_t H -> T_t, Z_t Z_t Z_t -> T_t, +R(q,c) Z_t -> T_t T_t -> t t. +``` + +Here is a small analytic exclusion, including non-normal source terms. +Any candidate at most 12 bits has at most two applications, since +`|S|=2L+4A+2+X`. A term without t is impossible by absence preservation. + +If a supported candidate is non-normal and has one application, its redex +body and argument are application-free and its binder is affine. Contracting +it strictly reduces size. If it has two applications, its only possible +lambda count is one and its index sum is zero. Every t occurrence is then +outside the sole lambda. The sole redex contracts either an identity or a +closed duplicator on application-only t syntax, again strictly reducing size. +Thus every supported non-normal source in this range reduces to a smaller +normal source. It suffices to classify normal sources: + +* With no applications, they are `t`, `K t`, `K(K t)`, and `K(K(K t))`. + The reader returns respectively a two-argument t spine, `t(t S)`, t, + and a lambda. None is `t t`. +* A normal source with no leading lambda has rigid head t and at least one + existing argument. The reader adds two more, so it fails by rigid arity. +* With one leading lambda and one application, a t head retains two + arguments after reading. A bound head can contain t only as the direct + operand (`T_t`) or as `K t`. The first obeys + `R T_t -> t Z_q c (t t T_t)`, with three arguments at t. The second + makes `H (K t) -> t c`, retaining two arguments after reading. +* Two leading lambdas and one application already cost ten bits before + indices. The required t occurrence contributes two. The only choices + within 12 are `lambda u v.v t` and `lambda u v.t v`. The first is Z_t; + the second gives `t(t S)`. +* With two applications, a leading lambda plus an occurrence of free t + would cost at least 13 bits. The remaining normal cases have head t. + +There are 39 terms below 12 bits and 32 at 12 in this one-free-variable +frame. Thirty are excluded because t is absent; all 41 supported terms +normalize in the check, with zero capped cases. Only Z_t passes. + +**Bootstrap-template corollary.** Keep the 165's body and write, literally, + +```text +W = lambda x.x A x S(x) +G = lambda x.(lambda p.B(p)) (W x) +E = (lambda w.w (lambda x.(lambda p.B(p)) (w x))) W. +``` + +Here A is closed and S has the independent diagonal law above. Any closed A +costs at least four bits; the driver shell costs 12, and S costs at least 12. +Thus `|W| >= 28`. Exact source accounting gives `|E| = 164+|W|`, hence +**192 is optimal in this template**, attained by `A=I`, `S=Z_x`. Both the +template restriction and the independent carrier law matter. + +## 5. Exact erased-operand identities and the new constructions + +For a fixed erased operand a, define + +```text +R_a(q,c) = lambda s.s H(q,c) (s s a). +``` + +Two exact identities are + +```text +R_a(q,c) F ->* a, +R_a(q,c) Z_t ->* a t t. +``` + +Proof of the first: `F H (F F a) -> F F a -> a`. For the second, +`Z_t H -> T_t` and `Z_t Z_t a -> a t`, so the result is +`T_t(a t) -> a t t`. No q or c is evaluated. If the erased operand depends +on the stream, substitute F or Z_t into that operand in these laws. +The fixed rigid equations are checked in `identity_check.py`. + +On a genuine input prefix, `s s ->* K remainder`, so replacing the erased +operand preserves the original parser equation, even if the replacement +diverges. This is the already-established erased-operand freedom; the two +bootstraps below use its reset behavior to close the recursion loop. + +Let `B_c(p)` be the 165's body with skip `s s c`. It satisfies +`B_c(p) c F ->* c` for every provisional p. Set + +```text +W_c = lambda x.x I x F x -- 26 bits +G = lambda x.B_c(W_c x) +E = W_c G. +``` + +Then + +```text +E -> G I G F G + -> B_c(W_c I) G F G + -> G G + -> B_c(W_c G) = B_c(E). +``` + +The provisional recursion is erased during the reset. This proves the +needed finite unfolding; the ordinary structural parser induction then +applies, including source terms without normal forms. The driver is two +bits smaller than the old 28-bit driver, while the continuation skip costs +two more index bits. The complete source remains **192**. Its only syntactic +self-application is the reader's `list list`, as in the older 192. + +For the generator reset, let `B_x(p)` use skip `s s x`. Put + +```text +W_g = lambda x.x x x F x -- 24 bits +G = lambda x.B_x(W_g x) +E = W_g G. +``` + +Here + +```text +E -> G G G F G + -> B_G(E) G F G + -> G G + -> B_G(E). +``` + +This also supplies the required unfolding and unchanged genuine-stream +parser equations. Its driver saves four bits and its deeper erased operand +costs four, again giving **192**. This variant does contain an explicit +syntactic self-application in its driver. + +`identity_check.py` additionally verifies both finite unfoldings with an +arbitrary rigid NEXT-constructor Q, by comparing the resulting weak-head +terms. The two sides take respectively 11/1 and 13/2 beta steps. Those +fixed symbolic checks supplement the paper reductions; no search is used. + +## 6. Remaining boundary and practical next step + +The 31-bit theorem closes replacement of the opaque knot by a cleverer +fixed-point combinator in the same call frame. The sinking formula closes +ordinary inward movement of the twice-used shared diagonal. The carrier +theorem prices the existing independent-carrier bootstrap exactly. + +It remains possible to save by removing a recursive reference or by using +the concrete parser body as part of the knot. The reset constructions show +why the independent 12-bit carrier bound must not be applied indiscriminately: +F, at six bits, becomes a useful carrier after changing the skip protocol. +In the two fully worked constructions, the surrounding code pays back the +saving exactly. + +The specific live seam is still a NEXT/control object whose ordinary Boolean +cases perform parsing and whose non-Boolean case generates recursion, with +the two behaviors sharing source syntax. A useful next lower-bound target +would price those coupled cases together, rather than assume NEXT independent +and rigid. A constructive win would need the carrier to perform an already +required semantic operation or eliminate a call-head occurrence; neither +reset construction does that. + +I also inspected the previously unresolved 189-bit one-binder-carrier +attempt. A bounded head trace reached 131,002 bits at iteration 80 and was +stopped after 2.56 seconds. No repeated head prefix was certified. It remains +unresolved; this is not a refutation and is not a new complete-interpreter +claim. `probe189.py` reproduces that bounded probe. + +There is no global optimality result at 165 in this lane. diff --git a/data/self-interpreter/reasoning_floor/knot/battery.json b/data/self-interpreter/reasoning_floor/knot/battery.json new file mode 100644 index 00000000..dd279990 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/battery.json @@ -0,0 +1,74 @@ +[ + { + "file": "reference165.lam", + "bits": 165, + "LAX": [ + 17, + 25, + 29 + ], + "ok": 667, + "skip": 1, + "fail": 0, + "failures": [], + "elapsed_seconds": 1.9286193750012899, + "divergent_suffix_probes": [ + "Omega: ok", + "lambda.Omega: ok" + ] + }, + { + "file": "reference192.lam", + "bits": 192, + "LAX": [ + 21, + 29, + 32 + ], + "ok": 667, + "skip": 1, + "fail": 0, + "failures": [], + "elapsed_seconds": 1.9341274999969755, + "divergent_suffix_probes": [ + "Omega: ok", + "lambda.Omega: ok" + ] + }, + { + "file": "reset_cont192.lam", + "bits": 192, + "LAX": [ + 21, + 29, + 32 + ], + "ok": 667, + "skip": 1, + "fail": 0, + "failures": [], + "elapsed_seconds": 1.929413249999925, + "divergent_suffix_probes": [ + "Omega: ok", + "lambda.Omega: ok" + ] + }, + { + "file": "reset_generator192.lam", + "bits": 192, + "LAX": [ + 20, + 29, + 34 + ], + "ok": 667, + "skip": 1, + "fail": 0, + "failures": [], + "elapsed_seconds": 1.8824390000008862, + "divergent_suffix_probes": [ + "Omega: ok", + "lambda.Omega: ok" + ] + } +] diff --git a/data/self-interpreter/reasoning_floor/knot/build_and_check.py b/data/self-interpreter/reasoning_floor/knot/build_and_check.py new file mode 100644 index 00000000..0c69ba6b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/build_and_check.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""Two derived reset knots plus two explicit controls; no candidate sweep.""" +from checks import * + +ABS = r'(cont (\args.\arg.exp (\zx.\zy.zx arg (zy args))))' +APP = r'(intL (\exp2.cont (\args.exp args (exp2 args))))' + + +def body(skip): + return rf'''\cont. + (\next.\list. + list (\bit0.bit0 (\unused.\r.r next) cont) (list list {skip})) + (\bit1.intL (\exp.bit1 {ABS} {APP}))''' + + +def make_reset(skip, driver): + return rf'''-- Reader reset bootstrap; source compiled without optimization. +(\w. + w (\x.(\intL.{body(skip)}) (w x))) +({driver}) +''' + + +def suffix_probe(term, program): + # Free variable 0 is the rigid suffix. The continuation discards the + # semantic value, so even a divergent source must return that suffix. + cont = parse(r'\v.\r.r') + probe = ('A', ('A', term, cont), lc.bitlist(lc.enc(program), ('V', 0))) + got = battery.normalize(lc.enc(('L', probe)), 1 << 20) + assert got == '0010', (got, '0010') + + +def run(): + files = { + 'reference165.lam': (ROOT / 'data/self-interpreter/machines/int165.lam').read_text(), + 'reference192.lam': (ROOT / 'data/self-interpreter/reasoning_165/knot/reader_knot.lam').read_text(), + 'reset_cont192.lam': make_reset('cont', r'\x.x (\u.u) x (\a.\b.b) x'), + 'reset_generator192.lam': make_reset('x', r'\x.x x x (\a.\b.b) x'), + } + records = [] + omega = parse(r'(\x.x x) (\x.x x)') + for name, src in files.items(): + path = HERE / name + path.write_text(src) + record = compile_and_check(path) + term = parse(src) + suffix_probe(term, omega) + suffix_probe(term, ('L', omega)) + record['divergent_suffix_probes'] = ['Omega: ok', 'lambda.Omega: ok'] + records.append(record) + (HERE / 'battery.json').write_text(json.dumps(records, indent=2)+'\n') + + +if __name__ == '__main__': + run() diff --git a/data/self-interpreter/reasoning_floor/knot/carrier_check.json b/data/self-interpreter/reasoning_floor/knot/carrier_check.json new file mode 100644 index 00000000..c0d9b0f3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/carrier_check.json @@ -0,0 +1,81 @@ +[ + { + "bits": 2, + "count": 1, + "rejected_absent_t": 0, + "winners": [], + "capped": [] + }, + { + "bits": 3, + "count": 0, + "rejected_absent_t": 0, + "winners": [], + "capped": [] + }, + { + "bits": 4, + "count": 1, + "rejected_absent_t": 1, + "winners": [], + "capped": [] + }, + { + "bits": 5, + "count": 1, + "rejected_absent_t": 0, + "winners": [], + "capped": [] + }, + { + "bits": 6, + "count": 2, + "rejected_absent_t": 1, + "winners": [], + "capped": [] + }, + { + "bits": 7, + "count": 1, + "rejected_absent_t": 1, + "winners": [], + "capped": [] + }, + { + "bits": 8, + "count": 5, + "rejected_absent_t": 2, + "winners": [], + "capped": [] + }, + { + "bits": 9, + "count": 5, + "rejected_absent_t": 1, + "winners": [], + "capped": [] + }, + { + "bits": 10, + "count": 11, + "rejected_absent_t": 6, + "winners": [], + "capped": [] + }, + { + "bits": 11, + "count": 12, + "rejected_absent_t": 5, + "winners": [], + "capped": [] + }, + { + "bits": 12, + "count": 32, + "rejected_absent_t": 13, + "winners": [ + "\\b\\c.c t" + ], + "capped": [] + } +] diff --git a/data/self-interpreter/reasoning_floor/knot/checks.py b/data/self-interpreter/reasoning_floor/knot/checks.py new file mode 100644 index 00000000..350ebbe7 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/checks.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python3 +"""Targeted, single-threaded symbolic checks for the overnight knot lane.""" +from pathlib import Path +import json +import os +import sys +import time + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +sys.dont_write_bytecode = True +os.environ['TMPDIR'] = str(HERE) +os.environ['RAYON_NUM_THREADS'] = '2' +sys.path[:0] = [str(ROOT / 'tools'), str(ROOT / 'tools/self-interpreter')] +import blcc +import lc +import battery + + +def parse(src, free=()): + p = blcc.P(blcc.strip_comments(src)) + named = blcc.p_lc(p) + p.ws() + assert p.i == len(p.t) + return blcc.to_db(named, tuple(free)) + + +def counters(t): + if t[0] == 'V': + return 0, 0, t[1] + if t[0] == 'L': + l, a, x = counters(t[1]) + return l + 1, a, x + l, a, x = counters(t[1]) + m, b, y = counters(t[2]) + return l + m, a + b + 1, x + y + + +def normal(t, cap=10000): + return lc.nf(t, [cap]) + + +def equation(lhs, rhs, free): + got, want = normal(parse(lhs, free)), normal(parse(rhs, free)) + assert got == want, (lhs, lc.show(got), rhs, lc.show(want)) + + +def compile_and_check(path, max_bits=18): + src = path.read_text() + term = parse(src) + bits = lc.enc(term) + path.with_suffix('.blc').write_text(bits + '\n') + before = time.monotonic() + ok, skip, bad = battery.check(term, threads=2, max_bits=max_bits) + record = dict(file=path.name, bits=len(bits), LAX=counters(term), ok=ok, + skip=skip, fail=len(bad), failures=bad, + elapsed_seconds=time.monotonic()-before) + print(f"{len(bits)} bits ok={ok} skip={skip} fail={len(bad)} {path.name}", flush=True) + return record + + +def small_carriers(): + # All terms in the single-free-variable frame [t], through the proposed + # 12-bit optimum. Exactly this delimited small hole, not interpreter search. + reader = parse(r'\q.\c.\s.s (\b.b (\u.\r.r q) c) (s s s)') + t, q, c = ('V', 0), ('V', 1), ('V', 2) + want = ('A', t, t) + reports = [] + for size in range(2, 13): + count = 0 + winners = [] + capped = [] + absent = 0 + for carrier in battery.closed_terms(size, 1): + count += 1 + if not blcc.occurs(0, carrier): + # Neither reader nor carrier then contains rigid t; beta + # reduction cannot introduce it. This is a refutation, + # independent of whether the probe normalizes. + absent += 1 + continue + probe = ('A', ('A', ('A', reader, q), c), carrier) + try: + got = normal(probe, cap=1000) + except lc.Fuel: + capped.append(lc.show(carrier, names=['t'])) + continue + if got == want: + winners.append(lc.show(carrier, names=['t'])) + reports.append(dict(bits=size, count=count, rejected_absent_t=absent, + winners=winners, capped=capped)) + (HERE / 'carrier_check.json').write_text(json.dumps(reports, indent=2)+'\n') + print(json.dumps(reports, indent=2)) + + +if __name__ == '__main__': + if sys.argv[1:] == ['carriers']: + small_carriers() + else: + records = [compile_and_check(HERE / f) for f in sys.argv[1:]] + (HERE / 'battery.json').write_text(json.dumps(records, indent=2)+'\n') diff --git a/data/self-interpreter/reasoning_floor/knot/identities.json b/data/self-interpreter/reasoning_floor/knot/identities.json new file mode 100644 index 00000000..268987cd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/identities.json @@ -0,0 +1,15 @@ +{ + "rigid_equations": 3, + "bootstrap_cont_steps": [ + 11, + 1 + ], + "bootstrap_generator_steps": [ + 13, + 2 + ], + "diagonal_carrier_bits": 12, + "original_driver_bits": 28, + "reset_cont_driver_bits": 26, + "reset_generator_driver_bits": 24 +} diff --git a/data/self-interpreter/reasoning_floor/knot/identity_check.py b/data/self-interpreter/reasoning_floor/knot/identity_check.py new file mode 100644 index 00000000..d3174c6b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/identity_check.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +"""Fixed equations and two bootstrap unfoldings, with rigid Q; no search.""" +from checks import * + + +def whnf(t): + steps = 0 + def head(t): + nonlocal steps + if t[0] != 'A': + return t + f = head(t[1]) + if f[0] != 'L': + return ('A', f, t[2]) + steps += 1 + assert steps <= 200 + return head(lc.beta(f, t[2])) + return head(t), steps + + +def run(): + free = ['t', 'q', 'c', 'a'] + r = r'(\s.s (\b.b (\u.\r.r q) c) (s s s))' + ra = r'(\s.s (\b.b (\u.\r.r q) c) (s s a))' + z = r'(\u.\r.r t)' + f = r'(\u.\v.v)' + equations = [ + (f'{r} {z}', 't t'), + (f'{ra} {z}', 'a t t'), + (f'{ra} {f}', 'a'), + ] + for lhs, rhs in equations: + equation(lhs, rhs, free) + + # Q is an arbitrary rigid constructor of NEXT from parser and continuation. + b = r'(\p.\c.\s.s (\b.b (\u.\r.r (q p c)) c) (s s c))' + w = r'(\x.x (\u.u) x (\a.\b.b) x)' + g = rf'(\x.{b} ({w} x))' + e = rf'({w} {g})' + lhs, sl = whnf(parse(e, ['q'])) + rhs, sr = whnf(parse(f'{b} {e}', ['q'])) + assert lhs == rhs + + bx = r'(\x.\p.\c.\s.s (\b.b (\u.\r.r (q p c)) c) (s s x))' + wx = r'(\x.x x x (\a.\b.b) x)' + gx = rf'(\x.{bx} x ({wx} x))' + ex = rf'({wx} {gx})' + lhsx, slx = whnf(parse(ex, ['q'])) + rhsx, srx = whnf(parse(f'{bx} {gx} {ex}', ['q'])) + assert lhsx == rhsx + + out = dict( + rigid_equations=len(equations), + bootstrap_cont_steps=[sl, sr], + bootstrap_generator_steps=[slx, srx], + diagonal_carrier_bits=lc.size(parse(z, ['t'])), + original_driver_bits=lc.size(parse(r'\x.x (\u.u) x (\u.\r.r x)')), + reset_cont_driver_bits=lc.size(parse(w)), + reset_generator_driver_bits=lc.size(parse(wx)), + ) + (HERE / 'identities.json').write_text(json.dumps(out, indent=2)+'\n') + print(json.dumps(out, indent=2)) + + +if __name__ == '__main__': + run() diff --git a/data/self-interpreter/reasoning_floor/knot/lean_check.log b/data/self-interpreter/reasoning_floor/knot/lean_check.log new file mode 100644 index 00000000..3a13386c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/lean_check.log @@ -0,0 +1,6 @@ +'Blc.OvernightKnot.opaque_knot_twenty' depends on axioms: [propext, Quot.sound] +'Blc.OvernightKnot.current_frame_thirty_one' depends on axioms: [propext, Quot.sound] +'Blc.OvernightKnot.knot_unfold' does not depend on any axioms +exit=0 +elapsed_seconds=0.301355 +threads=2 diff --git a/data/self-interpreter/reasoning_floor/knot/probe189.py b/data/self-interpreter/reasoning_floor/knot/probe189.py new file mode 100644 index 00000000..886d968e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/probe189.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +"""Bounded symbolic head trace of the previously unresolved 189-bit carrier.""" +from checks import * + + +def head_step(t): + if t[0] != 'A': + return None + if t[1][0] == 'L': + return lc.beta(t[1], t[2]) + u = head_step(t[1]) + return None if u is None else ('A', u, t[2]) + + +def run(): + src = (ROOT / 'data/self-interpreter/reasoning_165/knot/one_binder_carrier.lam').read_text() + t = parse(src) + seen = {} + history = [] + start = time.monotonic() + for i in range(600): + f = t + while True: + if f in seen: + out = dict(kind='head_prefix_loop', step=i, prior_step=seen[f], + bits=lc.size(t), seconds=time.monotonic()-start) + (HERE / 'probe189.json').write_text(json.dumps(out, indent=2)+'\n') + (HERE / 'probe189_trace.json').write_text(json.dumps(history+[t])+'\n') + print(out) + return + if f[0] != 'A': + break + f = f[1] + seen[t] = i + history.append(t) + u = head_step(t) + if u is None: + print(dict(kind='head_normal_form', step=i, bits=lc.size(t), + seconds=time.monotonic()-start)) + return + t = u + if i % 20 == 0 and lc.size(t) > 100000: + print(dict(kind='size_cap', step=i, bits=lc.size(t), + seconds=time.monotonic()-start)) + return + print(dict(kind='step_cap', step=600, bits=lc.size(t), + seconds=time.monotonic()-start)) + + +if __name__ == '__main__': + run() diff --git a/data/self-interpreter/reasoning_floor/knot/reference165.blc b/data/self-interpreter/reasoning_floor/knot/reference165.blc new file mode 100644 index 00000000..5c37eb3e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/reference165.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/knot/reference165.lam b/data/self-interpreter/reasoning_floor/knot/reference165.lam new file mode 100644 index 00000000..2861fca0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/reference165.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/knot/reference192.blc b/data/self-interpreter/reasoning_floor/knot/reference192.blc new file mode 100644 index 00000000..b2b6b876 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/reference192.blc @@ -0,0 +1 @@ +010001100001000001000001011000010110000001101111101111001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001110100001010110001010000001101110 diff --git a/data/self-interpreter/reasoning_floor/knot/reference192.lam b/data/self-interpreter/reasoning_floor/knot/reference192.lam new file mode 100644 index 00000000..44a76dc7 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/reference192.lam @@ -0,0 +1,12 @@ +-- Reader-mediated fixed point. No syntactic self-application outside list list. +-- W x = x I x (\unused r. r x). +-- For G = \x. B (W x), the reader identity yields W G -> G G -> B (W G). +(\w. + w (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (w x))) +(\x. x (\u. u) x (\unused \r. r x)) diff --git a/data/self-interpreter/reasoning_floor/knot/reset_cont192.blc b/data/self-interpreter/reasoning_floor/knot/reset_cont192.blc new file mode 100644 index 00000000..4bb50cbd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/reset_cont192.blc @@ -0,0 +1 @@ +010001100001000001000001011000010110000001101111101111001011010111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011101000010101011000101000001010 diff --git a/data/self-interpreter/reasoning_floor/knot/reset_cont192.lam b/data/self-interpreter/reasoning_floor/knot/reset_cont192.lam new file mode 100644 index 00000000..f1f1830a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/reset_cont192.lam @@ -0,0 +1,7 @@ +-- Reader reset bootstrap; source compiled without optimization. +(\w. + w (\x.(\intL.\cont. + (\next.\list. + list (\bit0.bit0 (\unused.\r.r next) cont) (list list cont)) + (\bit1.intL (\exp.bit1 (cont (\args.\arg.exp (\zx.\zy.zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (w x))) +(\x.x (\u.u) x (\a.\b.b) x) diff --git a/data/self-interpreter/reasoning_floor/knot/reset_generator192.blc b/data/self-interpreter/reasoning_floor/knot/reset_generator192.blc new file mode 100644 index 00000000..be6420e4 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/reset_generator192.blc @@ -0,0 +1 @@ +010001100001000001000001011000010110000001101111101111001011010111110000111100001011100111100000011110000001011101110011011110011111000011111000010111101001110100111010000101010110101000001010 diff --git a/data/self-interpreter/reasoning_floor/knot/reset_generator192.lam b/data/self-interpreter/reasoning_floor/knot/reset_generator192.lam new file mode 100644 index 00000000..b6d0aeb4 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/knot/reset_generator192.lam @@ -0,0 +1,7 @@ +-- Reader reset bootstrap; source compiled without optimization. +(\w. + w (\x.(\intL.\cont. + (\next.\list. + list (\bit0.bit0 (\unused.\r.r next) cont) (list list x)) + (\bit1.intL (\exp.bit1 (cont (\args.\arg.exp (\zx.\zy.zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (w x))) +(\x.x x x (\a.\b.b) x) diff --git a/data/self-interpreter/reasoning_floor/lean-floor/NOTES.md b/data/self-interpreter/reasoning_floor/lean-floor/NOTES.md new file mode 100644 index 00000000..29cf7d9d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/lean-floor/NOTES.md @@ -0,0 +1,88 @@ +# lean-floor lane: working notes + +## Size identity (any term, open or closed) + +wire t = 2L + 4V - 2 + X (L lambdas, V leaves, X = sum of 0-based indices). +Charging live binders only: wire + 2 >= 4*nonlinear + 6*live + 4*freeLeaves + X +(`count_wire_bound`, OvernightFloorCount.lean). + +## Kernel-checked facts available before tonight + +- not Chain E: an app node with a nonlinear binder in both children (Omega). +- HasLiveCapture 0 E: a live binder whose body mentions an enclosing binder. +- indexSum E > 0. +- nonlinear E >= 2. + +## Tonight + +- live E >= 3 (`selfInterpreter_three_live`): the capture pair {c,d} cannot be + the incomparable pair, so a third live binder exists. Induction carries + `outerLive d t` = number of enclosing locals mentioned, so the captured + variable counts even when its binder is above the current subterm. +- => SelfintSizeBound 25 (`selfintSizeBound_25`). + Witnesses for the counts (not interpreters): λr.(λp.pp)(λq.qqr) and + λr.(λp.p(pr))(λq.qq), both 25 bits, both normalize. + +## New beta-invariant: ArgOne + +ArgOne t := every application argument has <= 1 distinct free variable. +Preserved by beta (an argument substituted for a variable is itself narrow), +true of K, F, cells, and E C stream when true of E. Output for +S = λfgx. fx(gx) violates it (argument g x). So every interpreter has a +"wide argument" (`selfInterpreter_hasWideArg`). +Counting force on its own: none beyond 25 (the 25-bit count witnesses above +already have one, e.g. (p r)). + +Attempts to weaken ArgOne that FAIL beta-preservation: +- arguments with <= 2 distinct FV (substitution {x,u} <- {g1,g2} gives 3); +- exempting lambda arguments (an app argument with FV {x} becomes wide when + x := wide lambda); +- Appl trees over variables and closed terms (closed lam applied to var reduces + to an open lam). + +Width2 (Statman) is preserved ONLY together with ArgOne, so it adds nothing +over not-ArgOne. Statman's theorem itself (no width-2 term is beta-equal to S) +is the only known route to L>=4, V>=6, X>=3 (33) and is out of reach here. + +## Candidate invariants checked and rejected (not beta-preserved) + +- Sep2 (live binder captures at most one local): λfg.(λp.λx.px)(fg) -> λfgx.fgx. +- capture chains of bounded length: same example. +- "no nonlinear binder captures": affine capturing binder becomes nonlinear. +- "no live affine binder captures": nonlinear binder becomes affine by erasure. +- antichain of nonlinear binders <= 2: (λx.xxx)Δ -> ΔΔΔ. +- Chain for live captures (CChain): λw.(λx.gxx)(λy.yw) -> λw.g(λy.yw)(λy.yw). +- Chain with rigid-head or redex exemptions: heads get substituted / redexes + disappear without constraining their reducts. +- max index <= 1 / X <= 1: beta-equal to width-3 terms (λabc.abc), so only a + Statman-type argument could use it. + +## Normalization-type facts + +- nonlinear <= 1 -> WN (existing). +- No bound variable in head position -> all redexes are residuals -> SN + (finite developments); but Scott cells have k in head position, so the + invocation never satisfies it. Allowing affine head variables breaks it: + L = λu.(λk.ku)u has L L -> L L. + +## Outcome (final) + +SelfintSizeBound 27 in Lean. Chain of results: +- 25: counting (Count). +- lambda-rooted >= 27: non-app body inside the body forces 4 lambdas (Lambda). +- literal interface >= 31 (Literal). +- app-rooted minimal: head redex nonlinear; at L=3,V=5 only + (λx.xx)(λr.λq.B) survives the structural kills; |r|=1 dies by descent + (reduct λq.B[r:=A] is lambda-rooted with 3 lambdas), |r|=2 are six terms + refuted by finite head reduction (App). + +## For 28 + +Wire-27 minimal interpreters have (L,V,X)=(4,5,1): one vacuous binder. +Lambda-rooted: E = λy.(λp.B'')A⃗ with p nonlinear (body head must be a lambda; +affine head redex would shrink since only y is free, one leaf). App-rooted: +(λx.B')A⃗. Cases by the vacuous binder's position; each dies by AppBodies, +counts, minimality, descent, or finite head reduction. Note AppBodies cannot +be relaxed to allow variable bodies in general: (λx.(λv.x)W)(λs.T) emerges +λs.T through the constant function; only bodies that are the root variable +(substituted by the rigid C) are safe. diff --git a/data/self-interpreter/reasoning_floor/lean-floor/PROMPT.md b/data/self-interpreter/reasoning_floor/lean-floor/PROMPT.md new file mode 100644 index 00000000..0fd3a773 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/lean-floor/PROMPT.md @@ -0,0 +1,36 @@ +Lane "lean-floor": raise the kernel-checked unconditional floor. Lane +directory: /Users/a9lim/Work/blam/tmp/overnight/lean-floor/. + +Read /Users/a9lim/Work/blam/tmp/overnight/BRIEF.md (shared ground truth), then +docs/classical/self-interpreter/structural-bounds.md and capture-width.md, and +the Lean modules lean/Blc/SelfintLowerBound.lean (the 18-bit theorem +`selfintSizeBound_eighteen`), SelfintProof.lean (`SelfintSizeBound`, +`IsSelfInterpreter`), SelfintNonlinearChain.lean (two nonlinear binders in +incomparable branches), SelfintCapture.lean (a live capturing abstraction), +SelfintWireCost.lean (exact beta wire costs), SelfintProjections.lean. + +State: Lean proves `SelfintSizeBound 18`. The handwritten floor is 34 globally +(46 for a literal λc s.B interface); it combines the kernel-checked +incomparable pair with Statman's published width obstruction (some subterm has +three distinct free variables), a counting argument (L ≥ 4, V ≥ 6, X ≥ 3 → 33) +and a handwritten exclusion of the 33 equality case. + +Goal: prove `SelfintSizeBound N` in Lean for the largest N you can. +Milestones: (1) combine the existing kernel-checked facts (incomparable +nonlinear pair, live capture witness, closedness, the size identity +|t| = 2L + 4V − 2 + X) with new counting lemmas — this alone should beat 18 +substantially; work out on paper what it gives before formalizing. +(2) Formalize the width obstruction (or a weaker statement sufficient for the +count) to reach 33, then the equality exclusion for 34. (3) Anything beyond +34 that you can prove by reasoning. + +Mechanics. Put new Lean files in lean/Blc/ named `OvernightFloor*.lean` +(new untracked files only — do NOT edit any existing file) and build them +with lake from lean/ (e.g. `lake build Blc.OvernightFloor`, or `lake env lean +Blc/OvernightFloor.lean`). Other lanes may run lake at the same time; if a +build is locked or slow, wait and retry rather than killing anything. Keep +each build under ~10 minutes. Audit final theorems with `#print axioms` +(target: propext, Quot.sound, Classical.choice at most). No `sorry` in +anything you report as proved; mark clearly what is still open. Write a +REPORT.md in your lane directory: theorem names, statements, axioms, +build commands and times, and what remains between your N and 34. diff --git a/data/self-interpreter/reasoning_floor/lean-floor/REPORT.md b/data/self-interpreter/reasoning_floor/lean-floor/REPORT.md new file mode 100644 index 00000000..48f685fa --- /dev/null +++ b/data/self-interpreter/reasoning_floor/lean-floor/REPORT.md @@ -0,0 +1,231 @@ +# Lane "lean-floor": kernel-checked unconditional floor raised 18 → 27 + +Result: `Blc.OvernightFloor.selfintSizeBound_27 : SelfintSizeBound 27` is proved +in Lean with no `sorry`; `#print axioms` gives `[propext, Classical.choice, +Quot.sound]`. Every self-interpreter (the repository's exact closed-source +beta-join contract `IsSelfInterpreter`) has at least 27 bits. The previous +kernel-checked floor was 18 (`selfintSizeBound_eighteen`); the handwritten +floor is 34. + +Six new untracked modules under `lean/Blc/`; no tracked file touched, nothing +committed. + +| module | lines | content | +|---|---|---| +| `OvernightFloorCount.lean` | 211 | live-binder counting, `SelfintSizeBound 25` | +| `OvernightFloorArg.lean` | 259 | new beta-invariant `ArgOne` (wide arguments) | +| `OvernightFloorEmerge.lean` | 228 | stream consumption, `AppBodies`, non-application bodies | +| `OvernightFloorLiteral.lean` | 122 | literal interface `λc s. B` costs ≥ 31 | +| `OvernightFloorLambda.lean` | 295 | abstraction-rooted interpreters: ≥ 4 abstractions, ≥ 27 bits; application-rooted ones are redex-headed | +| `OvernightFloorApp.lean` | 710 | minimal application-rooted interpreters ≥ 27; `SelfintSizeBound 27` | + +Build (from `lean/`): + + lake build Blc.OvernightFloorApp # builds all six; 1.7 s wall from clean + lake env lean Blc/OvernightFloorApp.lean # per-file check, < 1 s each + +Axioms were audited with scratch files importing the modules (`#print axioms`). + +## 1. Theorems (exact statements, namespace `Blc.OvernightFloor`) + +All fully proved, no `sorry`; axioms `[propext, Classical.choice, Quot.sound]` +unless stated. `wire t = (blcCode t).length` (from `SelfintWireCost`). + +### Final bounds + + selfintSizeBound_27 : SelfintSizeBound 27 + selfintSizeBound_25 : SelfintSizeBound 25 + minimal_bound : MinimalInterpreter E → 27 ≤ wire E + lam_rooted_bound : IsSelfInterpreter (lam B) → 27 ≤ wire (lam B) + app_rooted_min_bound : MinimalInterpreter (app f a) → 27 ≤ wire (app f a) + literal_interface_bound : IsSelfInterpreter (lam (lam B)) → 31 ≤ wire (lam (lam B)) + +`selfintSizeBound_27` is strong induction on the wire: an interpreter below +27 bits yields a minimal one (`MinimalInterpreter` of `SelfintWireCost`), +which is abstraction-rooted (≥ 27 by `lam_rooted_bound`) or +application-rooted (≥ 27 by `app_rooted_min_bound`). + +### Counting layer (`OvernightFloorCount`) + + live : Term → Nat -- binders whose own variable occurs + count_wire_bound : 4·nonlinear t + 6·live t + 4·freeLeaves 0 t + indexSum t ≤ wire t + 2 + not_chain_capture_live : ¬Chain t → HasLiveCapture d t → 3 ≤ live t + outerLive d t + selfInterpreter_three_live : IsSelfInterpreter E → 3 ≤ live E + +`outerLive d t` counts the enclosing locals (indices below `d`) that occur; +it lets the induction carry a captured variable whose binder is above the +current subterm. Two incomparable nonlinear binders +(`selfInterpreter_not_chain`) and a live capture +(`selfinterpreter_has_live_capture`) give three live binders; with +`indexSum ≥ 1` (`selfinterpreter_indexSum_pos`) this is `25 ≤ wire`. + +### New beta-invariant: wide arguments (`OvernightFloorArg`) + + NoTwo t := ∀ i j, 0 < occ i t → 0 < occ j t → i = j + ArgOne : Term → Prop -- every application argument satisfies NoTwo + argOne_beta : Beta t u → ArgOne t → ArgOne u + selfInterpreter_not_argOne : IsSelfInterpreter E → ¬ ArgOne E + selfInterpreter_hasWideArg : IsSelfInterpreter E → HasWideArg E + -- some application argument mentions two distinct free variables + +A contracted argument is itself an argument, so substituting it for a +variable never widens another argument's support; K, F, Scott cells and +`E C stream` satisfy `ArgOne` when `E` does; the normal output for the +source `S = λf g x. f x (g x)` has the argument `g x`. This is the only +width-type statement that survives beta without Statman's theorem. It adds no +bit here (the 25-bit count witnesses already have a wide argument); it is +reported as structure. + +### Stream consumption and non-application bodies (`OvernightFloorEmerge`) + + selfInterpreter_stream_consumed : IsSelfInterpreter E → + ∃ k f', headSteps k (app E (var 0)) = some f' ∧ IsLam f' + AppBodies : Term → Prop -- every abstraction body is an application + appBodies_not_selfInterpreter : AppBodies E → ¬ IsSelfInterpreter E + selfInterpreter_hasNonAppBody : IsSelfInterpreter E → HasNonAppBody E + -- some abstraction body is an abstraction or a variable + +Head factorization lands `E C ⌜I⌝N` on a head-normal form that reduces to +`C (λz.I) N`; that form is not an abstraction, so every step is a weak-head +step on an application root; if `E C` never became an abstraction the landing +would be `R Q` with `R` rigid and the Scott cell `Q` would reduce to the +variable `N`. Weak-head steps preserve `AppBodies ∧ IsApp` (contracting +`(λx.B) A` leaves `B`'s application root), so no abstraction can emerge. + +### Abstraction-rooted interpreters (`OvernightFloorLambda`) + + wire_identity : wire t + 2 = 2·lamCount t + 4·leafCount t + indexSum t + leaves_bound : nonlinear t + live t + freeLeaves 0 t ≤ leafCount t + not_chain_nonAppBody_three_lams : ¬Chain t → HasNonAppBody t → 3 ≤ lamCount t + identity_not_selfInterpreter : ¬ IsSelfInterpreter (lam (var 0)) -- axioms [propext, Quot.sound] + lam_rooted_four_lams : IsSelfInterpreter (lam B) → 4 ≤ lamCount (lam B) + selfInterpreter_headsToLam : IsSelfInterpreter E → ∃ k f', headSteps k E = some f' ∧ IsLam f' + app_rooted_head_redex : IsSelfInterpreter (app f a) → ∃ B', spineHead (app f a) = lam B' + +For `E = λy. B` with `B` an application the non-application body lies in `B`; +two incomparable nonlinear binders cannot both sit on one nested pair +`λx.λy.…`, and a variable-bodied binder is affine, so `B` has three +abstractions and `E` four: `2·4 + 4·5 − 2 + 1 = 27`. + +### Literal interface (`OvernightFloorLiteral`) + + literal_public_occ : IsSelfInterpreter (lam (lam B)) → 1 ≤ occ 0 B ∧ 1 ≤ occ 1 B + literal_interface_bound : IsSelfInterpreter (lam (lam B)) → 31 ≤ wire (lam (lam B)) + +Both public variables occur: the output mentions `C` and `N`, reduction cannot +introduce an absent variable, and the output is normal so the join is a +directed reduction. With `selfInterpreter_body_not_chain`: `L ≥ 4`, `V ≥ 6`, +`X ≥ 1`. Complements `headForm_fifty_five` (55 bits for the displayed form +`λc s. c A B`). + +### Minimal application-rooted interpreters (`OvernightFloorApp`) + + minimal_head_nonlinear : MinimalInterpreter (app (lam B') A) → Closed A → 2 ≤ occ 0 B' + single_lam_shape : lamCount t = 1 → FreeUnder 1 t → AppBodies t ∨ indexSum t = 0 ∨ live t = 0 + three_leaf_enum : the six abstraction-free trees over {q, r, r} + refute_cycle, refute_one_arg, refute_three_args_a, refute_three_args_b, + refute_normal_first, refute_redex_first : ¬ IsSelfInterpreter (cand B) for those six B + app_rooted_min_bound : MinimalInterpreter (app f a) → 27 ≤ wire (app f a) + +At ≤ 26 bits the identity forces `L = 3, V = 5` (the proof uses nothing about +`X` beyond `X ≥ 1`). The head redex has a closed argument, so its binder is +nonlinear by `minimal_linear_free_count`. Two spine arguments: all leaves +have index 0, contradiction. One argument with abstraction-free body: the body +is `x x`, the argument is closed with two abstractions and three leaves; if it +is `λr. (application)`, `single_lam_shape` gives `AppBodies`, index sum 0, or +a vacuous binder, each contradictory; if it is `λr. λq. B_q` with one `r`, two +head steps reach `λq. B_q[r := A]`, an abstraction-rooted interpreter with +three abstractions, contradicting `lam_rooted_four_lams`; with two `r`s the +six trees are refuted by finite head reduction certified with `decide`: one +head-reduction 2-cycle (divergence against the normal output), one rigid +landing with one argument, two with three arguments, one whose first argument +is normal and differs from `λλ.0`, one whose first argument is a redex whose +only reduct is an abstraction with rigid body. One abstraction in the body and +one in the argument: `AppBodies`, index sum 0, or descent to a +three-abstraction abstraction-rooted interpreter. + +## 2. Witnesses for the counts (not interpreters) + +- 25 bits, `(L,V,X) = (3,5,1)`: `λr.(λp.pp)(λq.q q r)` and + `λr.(λp.p(pr))(λq.qq)` satisfy every beta-invariant above (incomparable + pair, capture, wide argument, non-application body). Killed by `AppBodies` + and by minimality (an affine head redex with a closed argument shrinks). +- 26 bits: `(λx.xx)(λr.λq.B)` with `B` over `{r,r,q}`: the six refuted terms. +- 27 bits, `(L,V,X) = (4,5,1)`: shapes with exactly one vacuous binder, e.g. + `λy.(λp.pp)(λq.(λv.q) q y)`. Nothing general here excludes them (this one + happens to have an erasing redex, so it is not minimal). + +So 27 is the exact limit of the present general lemmas plus the 26-bit +finite analysis; 28 needs the `(4,5,1)` shapes. + +## 3. What remains between 27 and 34 + +1. **28–30 by the same method: no new idea, costly case analysis.** A minimal + interpreter of wire 27 has `(L,V,X) = (4,5,1)`: one vacuous binder, two + nonlinear binders with two leaves each, one affine live binder, one index + unit. Abstraction-rooted: `E = λy.(λp.B'')A⃗` with `p` nonlinear (the body's + spine head must be a lambda or `E C` is rigid; an affine head redex would + shrink since the only free leaf is `y`). Application-rooted: + `E = (λx.B')A⃗`, `x` nonlinear. The vacuous binder's position (argument, + body of a nested lambda, K-like `λv.z`) multiplies the cases; on paper each + dies by `AppBodies`, a count, minimality, descent to a reduct with + `lamCount < 4` or `live < 3`, or finite head reduction, but the + abstraction-rooted branch alone has dozens of concrete terminal terms + (e.g. `λy.(λp.B''(p,p,y))(λq.T(q,λv.q))` over all trees `B''`, `T`). I + estimate 400+ Lean lines per bit; deriving shapes from counts is the cost, + the kills are routine. `app_rooted_min_bound`'s classification uses only + `L = 3, V = 5`, so it already covers `(3,5,X)` for every `X`. + +2. **33 needs Statman's width theorem** (closed `P =β S` has a subterm with + three distinct free variables). It is the only known route to + `L ≥ 4, V ≥ 6, X ≥ 3` globally. I tested and rejected every syntactic + beta-invariant I could find as a substitute (NOTES.md): bounded capture + multiplicity, capture chains, nonlinear antichains, chains of captures, + Chain with rigid-head or redex exemptions, "nonlinear captures", maximum + index bounds. None is beta-preserved; the counterexamples are the + width-growth mechanism `λfg.(λp.λx.px)(fg) → λfgx.fgx`. `Width2 ∧ ArgOne` + is preserved but is weaker than `¬ArgOne`, which is already forced. The + published proof is on pages 408–409 of Statman (ICTCS 2005), not in the + available two-page preview (`tmp/overnight/global/statman-preview.txt` + has only the HOT setup). Reconstruction attempt: the obstruction is that a + HOT carrier of `(a,b)` reaches the head with a fixed head variable, while + `a c (b c)` needs `a` exposed with `c` as first argument and `b` exposed + separately; but the Scott bits `K`/`F` are rank-1 erasers that split + carriers (`λr.λq. r q (q q)` with `r := F` yields `Δ`), so the invariant + must be stated on lambda terms, not on HOT rewriting. Not done. + +3. **34 (the equality exclusion)** reuses the handwritten `capture-width.md` + argument, which needs the head decomposition `λc s. c A B` / `λc s. s A⃗`. + Pieces now in Lean that it would use: `selfInterpreter_headsToLam`, + `selfInterpreter_stream_consumed`, `app_rooted_head_redex`, + `minimal_head_nonlinear`, `lam_rooted_four_lams`, and the refutation tools + `landing_shape`, `no_one_arg`, `no_three_args`, `two_args_first`, + `cycle_diverges`. Missing: the hnf arity classification (needs "head + normalization reflects from `U V` to `U`" and the var-substitution + commutation for head steps; sketched in head-decomposition.md), and + Statman. + +## 4. Method notes + +- Every invariant was checked on paper against the 165 + (`(λx.xx)(λx.(λintL λcont.B)(xx))`: its `¬Chain` witness is the root redex, + its non-application bodies are `λintL.λcont` and `λnext.λlist`), the + 584/742 two-nonlinear interpreters (closed nonlinear binders; captures by + affine binders) and the beta-normal `λc s. s H c`. +- No enumeration: the six 26-bit refutations are the residue of a structural + classification, each a `decide` on ≤ 7 head steps of a ~100-bit term plus a + shape lemma. +- Descent ("reducts are interpreters", via `selfInterpreter_beta`) is the + sharpest cheap tool: it turns the abstraction-rooted bound `lamCount ≥ 4` + into kills of application-rooted shapes whose head steps lose abstractions. + +## 5. Files + +- `/Users/a9lim/Work/blam/lean/Blc/OvernightFloorCount.lean` +- `/Users/a9lim/Work/blam/lean/Blc/OvernightFloorArg.lean` +- `/Users/a9lim/Work/blam/lean/Blc/OvernightFloorEmerge.lean` +- `/Users/a9lim/Work/blam/lean/Blc/OvernightFloorLiteral.lean` +- `/Users/a9lim/Work/blam/lean/Blc/OvernightFloorLambda.lean` +- `/Users/a9lim/Work/blam/lean/Blc/OvernightFloorApp.lean` +- `/Users/a9lim/Work/blam/tmp/overnight/lean-floor/NOTES.md` (rejected invariants, witnesses, plan for 28) +- `/Users/a9lim/Work/blam/tmp/overnight/lean-floor/REPORT.md` (this file) diff --git a/data/self-interpreter/reasoning_floor/nextfuse/PROMPT.md b/data/self-interpreter/reasoning_floor/nextfuse/PROMPT.md new file mode 100644 index 00000000..a4999fdd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/nextfuse/PROMPT.md @@ -0,0 +1,28 @@ +Lane "nextfuse": fusion across the NEXT region. Your lane directory is +/Users/a9lim/Work/blam/tmp/overnight/nextfuse/ (write only there). Read +/Users/a9lim/Work/blam/tmp/overnight/BRIEF.md first; it is the shared ground truth. + +The NEXT region is header 17 + ABS 40 + APP 35 = 92 bits, more than half of the +interpreter. The 168's module grammar found each module minimal *as an +opaque module*: the NEXT header, ABS, APP, the cell and the lift. The 165's +reader beat that kind of bound by fusing work across module boundaries: +computing once, before a dispatch, a value that is right for both arms, and +letting a Scott structure's own application supply an argument. Nobody has +found the analogous fusion inside NEXT. + +Look at what the two arms share: both end in `cont (λargs. …) rest`; both use +`exp` (the first child's value) applied to an environment; APP's second parse +is `intL (λexp2. …)`; ABS's value is `λargs arg. exp (cell arg args)` and +APP's `λargs. exp args (exp2 args)`; the dispatch `bit1 ABS APP` sits under +the first parse's continuation. Ask: what could be computed once, above the +`bit1` dispatch, that is right for both arms? What could the stream, the tag +bit, or the rest supply by its own application? Can the dispatch move +(before the first parse, after the second, into a value)? The record +(interpreter.md §5, §6, nextfuse/ in reasoning_165) has proved several such +routes impossible (mode-free value builder, tag recovery from q P / q q, +selected-component repairs) and measured many more; read those first so you +attack what is left. + +Goal: a complete interpreter ≤ 164 bits with a passing battery, or a clean +impossibility theorem for a delimited class of NEXT fusions, with proof. +Report as the brief says. diff --git a/data/self-interpreter/reasoning_floor/nextfuse/REPORT.md b/data/self-interpreter/reasoning_floor/nextfuse/REPORT.md new file mode 100644 index 00000000..59ca100a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/nextfuse/REPORT.md @@ -0,0 +1,78 @@ +# Lane nextfuse: fusion across the NEXT region + +(Saved by the coordinating seat from the lane's final message; the harness +refused the lane's own write of this file.) + +No sub-165 interpreter found. The result of this lane is a complete, measured catalogue of where the second-tag dispatch can sit relative to the two parses and the two returns, a set of exact identities (computer-checked with the parser's `next` rigid) that pin down why each placement costs what it does, and a structured argument that, under the 165's interfaces, the NEXT region is exactly 92 bits and admits no cross-module fusion of the kind the reader uses. The argument is handwritten; its leaves are the on-record module-grammar minima plus the checked identities below. + +Files in this directory: `build.py` (writes and measures the variants), `checks.py` (identities), `h.py` (helper), `v_*.lam` (every complete interpreter built). Computation: seven batteries (2 threads, ~2.5 s each), three letopt runs through `tmp/overnight/self/polish.py` (~10 s each), ten identity normalizations. No enumeration. Correction to the lane's draft: the recorded 172 for `(bit1 cont intL)` is that variant measured on the 168; on the 165 it is 169, the same +4. + +## 1. Complete interpreters built + +All are the 165 with NEXT replaced; reader, VAR and knot unchanged. None is new in algorithm: they are the dispatch placements of §3, written out so the costs are measured rather than estimated. Each passes the battery. + +| file | bits | battery | idea | +|---|---:|---|---| +| `v_select_first.lam` | 166 | `ok=667 skip=1 fail=0` | dispatch on the first parse's continuation: `intL (bit1 KA KB)` | +| `v_share_head.lam` | 169 | `ok=667 skip=1 fail=0` | `bit1 cont intL X`, shared argument `X = λy. bit1 A B` with the dispatch inside | +| `v_sharedZ_kapp.lam` | 169 | `ok=667 skip=1 fail=0` | `bit1 (λk. cont V_abs) intL k_app`: APP's continuation is the shared argument, ABS discards it | +| `v_sharedZ_vabs.lam` | 170 | `ok=667 skip=1 fail=0` | `bit1 cont (λv. intL k_app) V_abs`: ABS's value is the shared argument, APP discards it | +| `v_dispatch_first.lam` | 172 | `ok=667 skip=1 fail=0` | dispatch before the first parse, `intL (λexp. …)` duplicated | +| `v_optional_parse.lam` | 175 | `ok=667 skip=1 fail=0` | one `cont` call; null parser `λk. k k` in ABS, dispatch inside the value | + +`polish.py` (battery + `blam golf letopt`, ≤3 cuts, and `--no-inline` ≤2) on the three shared-argument variants: smallest renderings 169, 169, 170; no sub-165 rendering. + +## 2. Exact identities (checked by `checks.py`; `next`, `cont` rigid) + +Write `P` for the 165's parser `λcont λs. s (λb. b (λu r. r next) cont) (s s s)`, `H_k = λb. b Z_k k`, `Z_k = λu r. r next`, `K` = bit 0, `F` = bit 1, `V_abs = λargs arg. exp (λzx zy. zx arg (zy args))`, `k_app = λexp2. cont (λargs. exp args (exp2 args))`. + +1. **The parser on a Boolean as its stream.** `P k K = H_k`, `P k F = F`; hence `P k K F = k`, and with two more arguments `P k K X Y = X Z_k k Y`, `P k F X Y = Y`. Proof: `P k b = b H_k (b b b)`; `K H_k (K K K) = H_k`; `F H_k (F F F) = F`; then `H_k F Y = F Z_k k Y = k Y` and `H_k X Y = X Z_k k Y`. The second tag bit fed to the parser as a stream yields a handler-shaped dispatcher: ABS gets `X Z_k k Y`, APP gets `Y`. The first two equations were recorded by the earlier nextfuse consult; the four-argument forms are new. As a NEXT dispatch this costs ≥ +21 (§3). +2. **A one-cell fake variable stream returns its tail.** `P c (cons F X) = c X (X X (cons F X))` for any X. Proof: the reader gives `c X S` with `S = s s s`, and `s s = s F X = F F X X = X X`. Consequence: ABS cannot return through the parser's VAR path — the tail must be `X =β V_abs`, and then the skip is `V_abs V_abs s = exp (cell s V_abs)` (checked), a rigid-`exp` normal form, never `rest`. Two-cell fake streams return the cell `cons b X` as the value. +3. **`V_abs` and `k_app` are distinct β-normal forms** (checked). `V_abs e r` normalizes to `exp (cell r e)`, with no `cont`. Leaf of the shared-argument lemma. +4. **The one-binder zero arm puts the duplicate after the rest.** `(λr. r next) r r = next b r2 r` for `r = cons b r2` (checked), so with `next = λbit1. P (λexp. …)` the parse runs as `P k r2 r` and the extra `r` reaches `bit1 ABS APP rest r` in every arm. The recorded 162 that fails all 667 fails for exactly this reason; absorbing `r` costs a binder per arm (+6 against the 3 saved) or, used as the redundant tag, becomes the recorded 188. + +## 3. Dispatch placement: the complete catalogue + +After the zero arm, NEXT has `bit1`, `intL`, `cont`, and after the first parse `exp`, `rest`. It must reach `ABS = cont V_abs rest` and `APP = intL k_app rest`. Every position of the Boolean application, measured in §1 or on record: + +| placement | form | bits | why the cost | +|---|---|---:|---| +| after the first parse (the 165) | `intL (λexp. bit1 ABS APP)` | 165 | dispatch 7 (two apps, `bit1` at depth 1), one `intL (λexp.·)` | +| on the first parse's continuation | `intL (bit1 KA KB)` | 166 | `bit1` at depth 0 saves 1, second `λexp` costs 2 | +| shared argument, dispatch inside | `bit1 cont intL (λy. bit1 A B)` | 169 | second `bit1` at depth 2, extra λ and app, `cont`/`exp` one deeper (recorded 172 is this on the 168) | +| shared argument = `k_app` | `bit1 (λk. cont V_abs) intL k_app` | 169 | ABS needs a dummy binder; `k_app` is useless to ABS | +| shared argument = `V_abs` | `bit1 cont (λv. intL k_app) V_abs` | 170 | APP needs a dummy binder; `V_abs` is useless to APP | +| before the first parse | `bit1 (intL KA) (intL KB)` | 172 | `intL (λexp.·)` twice (+8), `bit1` at depth 0 (−1) | +| inside the value, one `cont` | `bit1 (λk. k k) intL (λexp2. cont (λargs. bit1 A B))` | 175 | null parser 8+2, inner dispatch 9, saves one `cont ·` (6) | +| tag re-read after the parse | `λr. r (bit0 parse)` with `D_C` | 188 | recorded: tag replay and three extra arguments | +| tag as the parser's stream | `intL k bit1 X (intL k_app)` | ≥ 186 | identity 1: ABS receives `Z_k k Y rest`, X needs three binders (≥ 48) | + +**Shared-argument lemma** (handwritten; leaf checked). In `bit1 X Y Z rest` with both arms correct under rigid `cont`, `intL`, `exp`, `rest`: if `X = cont` then `Z =β V_abs`, so `Y Z rest = intL k_app rest` forces `Y` to erase `Z` (identity 3: `V_abs` is a `cont`-free normal form, `k_app` a normal form containing `cont`), hence `Y` is a λ dropping its first argument, not `intL`. Symmetrically for `Y = intL`. If neither head is bare, the dispatch is duplicated inside. So a shared argument always adds a dummy binder or a second dispatch; the three measured rows are the three cases. With more shared arguments each adds a dummy per arm not using it; the only arguments usable by both arms are `exp` (η: the select-first row) and `cont` (a let, +5). + +## 4. Why NEXT is exactly 92 under the 165's interfaces + +Hypotheses, all the 165's actual interfaces: (I1) VAR returns the stream tail `r`, so values are applied to environments and `env b r' = b arg (r' args)`; (I2) λ-values are genuine functions after the environment (the contract returns `λz. M`, every inner λ of M appears in the output); (I3) the parser's continuation receives value then rest, `cont` rigid at the root; (I4) tag bits are Scott Booleans dispatched by application. + +1. *Values.* Under (I1) the cell is the unique 24-bit term of its law (on record), the λ-value `λargs arg. exp (cell)` is 34, the lift 19 is the unique minimum of its law. The two values are not unifiable through any marker (mode-free builder exclusion, on record) nor through each other: `V_abs(e) args` is a λ while `lift args` is `exp`-headed, and `lift exp D =β V_abs(exp)` would need `exp args (D args) = λarg. exp (cell arg args)`, impossible for rigid `exp`. +2. *Returns.* Under (I3) ABS must apply `cont` to `V_abs` (identity 2: the VAR path cannot), ≥ 6 at its depth; APP must parse `rest` through `intL k` with `k =β λe. cont (lift exp e)`, whose minimum is 28 at its depth. +3. *Dispatch.* Under (I4) the arms are reached by an application of `bit1`; §3 lists every position and the after-parse position is cheapest at 7. Nothing above the dispatch is right for both arms: ABS needs `cont` applied now, APP needs `intL` applied now, and the Boolean is the only thing that can choose a head. +4. *Handoff.* `r next = next bit1 r2` is η-minimal: `r X` is the only way the stream hands both bit and tail, `next = intL ∘ k`, and binding `next` outside `cont` or passing `cont` along costs ≥ +10. + +Sum: 34 + 19 + 6 + 7 + 8 (`intL (λexp.·)`) + 2 (`λbit1`) + 16 (APP's `intL ·`, `λexp2`, `cont ·`) = 92. A decomposition argument, not a theorem over arbitrary terms: it prices the forced pieces and shows the cross-module options are exhausted by §3. Handwritten; every leaf is an on-record exhaustive module minimum or a checked identity. Not covered: a reader whose handoff gives NEXT something other than `(bit1, r2)` at no extra cost, a value interface other than (I1)–(I2), or a continuation protocol other than (I3) — all changes outside NEXT, each priced ≥ 166 in the record so far. + +## 5. Ideas examined and rejected on paper (not built) + +- *Environment-extension APP* (`λargs. exp (cell (exp2 args) args)`, λ-value = body closure): right for λ-operators, wrong for variable operators (lookup must return a function applied to the operand); root value not `λz. M`. +- *Variable value with its leading 1* to absorb that off-by-one: the operand still needs an application after lookup. +- *Two-argument closures* (`exp args arg`): inner λ-values must pack `(args, arg)`, which is the cell again. +- *Cheaper null parser than `λk. k k`*: no frame variable works (`bit1 = K` has the wrong arity; `exp`, `cont`, `intL`, `x` applied to the continuation give garbage); `λk. k bit1` is 9. +- *Lazy second parse* (`cont (λargs. exp args (intL K rest args)) (intL F rest)`): correct, ≈ +26, exponential in right-nesting. +- *Second parse through `next`* with a fake tag: `next K` λ-wraps the operand, `next F` parses two more terms. +- *Let-hoisting `cont`* over both arms: saves 4 of index, costs 8. *`intL` bound inside `cont`*: 166. *`next` outside `cont`*: ≥ 175. +- *A skip that starts the parse in the zero arm* (`Z = F`): `s s s next` gives `N next` on variables; every application-only skip fails the same way, and a λ-skip right for both arms costs 33. + +## 6. Honest read + +Inside NEXT there is no fusion to find: every bit of the 92 is a forced value shape or a forced control step, and every alternative placement of the one free choice (where `bit1` is applied) measures +1 to +23. The analogue of the reader's move has no candidate because the two arms need different heads (`cont` versus `intL`) applied now. + +A sub-165 has to change an interface NEXT shares with the rest: the handoff (`r next`, 18 bits to deliver `(bit1, r2)` to a 17-bit header), the one-binder zero arm `λr. r next` (saves 3, but identity 4 shows the duplicate lands after `rest` in both arms and nothing consumes it for ≤ 2 bits), or the value/continuation protocols, which the record prices at ≥ 166 each. The next proof step with real content is a joint bound on the handoff plus header (`Z`, the `next` let, `λbit1. intL (λexp. ·)`) allowing `Z` to apply its arguments arbitrarily — the 14-bit zero-arm bound and this lane's 92 together say any saving there must come from the duplicate stream copy, and the only two uses of it found so far (188, and the +6 absorption) lose. diff --git a/data/self-interpreter/reasoning_floor/nextfuse/build.py b/data/self-interpreter/reasoning_floor/nextfuse/build.py new file mode 100644 index 00000000..5d2f1ddc --- /dev/null +++ b/data/self-interpreter/reasoning_floor/nextfuse/build.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +"""Build and measure 165-frame variants: python3 build.py (writes v_*.lam, prints size/battery).""" +import sys +from pathlib import Path +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +import h + +KNOT = r"(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) NEXT) (x x))" +CELL = r"(\zx \zy. zx arg (zy args))" +VABS = rf"(\args \arg. exp {CELL})" +LIFT = r"(\args. exp args (exp2 args))" +KAPP = rf"(\exp2. cont {LIFT})" + +VARIANTS = { + "sharedZ_vabs": rf"(\bit1. intL (\exp. bit1 cont (\v. intL {KAPP}) {VABS}))", + "sharedZ_kapp": rf"(\bit1. intL (\exp. bit1 (\k. cont {VABS}) intL {KAPP}))", + "dispatch_first": rf"(\bit1. bit1 (intL (\exp. cont {VABS})) (intL (\exp. intL {KAPP})))", + "optional_parse": r"(\bit1. intL (\exp. bit1 (\k. k k) intL (\exp2. cont (\args. bit1 (\arg. exp (\zx \zy. zx arg (zy args))) (exp args (exp2 args))))))", +} + +def run(names=None, reader=None): + for name, nxt in VARIANTS.items(): + if names and name not in names: + continue + src = KNOT.replace("NEXT", nxt) + p = HERE / f"v_{name}.lam" + p.write_text(src + "\n") + line, bad = h.bat(str(p)) + print(line) + for b in bad: + print(" ", *b) + +if __name__ == "__main__": + run(sys.argv[1:] or None) diff --git a/data/self-interpreter/reasoning_floor/nextfuse/checks.py b/data/self-interpreter/reasoning_floor/nextfuse/checks.py new file mode 100644 index 00000000..327980cf --- /dev/null +++ b/data/self-interpreter/reasoning_floor/nextfuse/checks.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +"""Finite checks for the identities and lemmas in REPORT.md. Rigid variables are +bound by outer lambdas; the recursive parser is kept rigid where its unfolding +would not normalize (its `next` and knot are free symbols). No search.""" +import sys +from pathlib import Path +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +import h + +def eq(label, a, b): + na, nb = h.normalize_src(a), h.normalize_src(b) + ok = na is not None and na == nb + print(("PASS " if ok else "FAIL ") + label) + if not ok: + print(" ", h.pretty(na) if na else na) + print(" ", h.pretty(nb) if nb else nb) + return ok + +K = r"(\a \b. a)" +F = r"(\a \b. b)" +# The 165's reader with `next` and `cont` rigid (free in the frame below). +READER = r"(\cont \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list))" +H = r"(\bit0. bit0 (\unused \r. r next) k)" # handler closed over k +Z = r"(\unused \r. r next)" + +ok = True +# 1. The parser applied to a Boolean as its stream. +ok &= eq("P k K = H_k", rf"\next \k. {READER} k {K}", rf"\next \k. {H}") +ok &= eq("P k F = F", rf"\next \k. {READER} k {F}", rf"\next \k. {F}") +ok &= eq("P k K F = k", rf"\next \k. {READER} k {K} {F}", r"\next \k. k") +ok &= eq("P k K X Y = X Z_k k Y", rf"\next \k \X \Y. {READER} k {K} X Y", rf"\next \k \X \Y. X {Z} k Y") +ok &= eq("P k F X Y = Y", rf"\next \k \X \Y. {READER} k {F} X Y", r"\next \k \X \Y. Y") + +# 2. A one-cell fake variable stream returns its tail as the value and X X s as the rest. +CONS = lambda b, t: rf"(\f. f {b} {t})" +ok &= eq("P c (cons F X) = c X (X X (cons F X))", + rf"\next \c \X. {READER} c {CONS(F, 'X')}", + rf"\next \c \X. c X (X X {CONS(F, 'X')})") + +# 3. V_abs and k_app have distinct beta-normal forms (both already normal). +VABS = r"(\args \arg. exp (\zx \zy. zx arg (zy args)))" +KAPP = r"(\exp2. cont (\args. exp args (exp2 args)))" +na, nb = h.normalize_src(rf"\exp \cont. {VABS}"), h.normalize_src(rf"\exp \cont. {KAPP}") +print(("PASS " if na != nb else "FAIL ") + "V_abs and k_app are distinct normal forms") +ok &= na != nb +# V_abs applied as a continuation: no cont at the head. +print(h.pretty(h.normalize_src(rf"\exp \cont \e \r. {VABS} e r"))) + +# 4. The skip of a one-cell fake stream evaluates V_abs: not a rest. +ok &= eq("V_abs V_abs s = exp (cell s V_abs)", + rf"\exp \s. {VABS} {VABS} s", + rf"\exp \s. exp (\zx \zy. zx s (zy {VABS}))") + +# 5. Zero-arm with one binder: the duplicate lands after rest. +ok &= eq("(\\r. r next) r r = next b r2 r (cons b r2 = r)", + rf"\next \b \r2. (\r. r next) {CONS('b','r2')} {CONS('b','r2')}", + rf"\next \b \r2. next b r2 {CONS('b','r2')}") + +print("ALL PASS" if ok else "SOME FAILED") diff --git a/data/self-interpreter/reasoning_floor/nextfuse/h.py b/data/self-interpreter/reasoning_floor/nextfuse/h.py new file mode 100644 index 00000000..d498777c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/nextfuse/h.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 +"""Lane helper: size a .lam text (unoptimized), L/A/X breakdown, battery (2 threads), +and rigid-variable normal-form checks. + + python3 h.py size FILE.lam -> bits L A X + python3 h.py bat FILE.lam -> battery line (2 threads) + python3 h.py eq 'TERM1' 'TERM2' -> normalize both closed .lam terms, compare + python3 h.py nf 'TERM' -> normal form (pretty) +""" +import sys, os, subprocess, tempfile +from pathlib import Path +ROOT = Path("/Users/a9lim/Work/blam") +sys.path.insert(0, str(ROOT / "tools/self-interpreter")); sys.path.insert(0, str(ROOT / "tools")) +import battery, blcc, lc + +def parse_text(src): + return battery.compile_lam(src) + +def lax(t, depth=0): + if t[0] == 'V': + return (0, 0, t[1]) + if t[0] == 'L': + l, a, x = lax(t[1], depth + 1); return (l + 1, a, x) + l1, a1, x1 = lax(t[1], depth); l2, a2, x2 = lax(t[2], depth) + return (l1 + l2, a1 + a2 + 1, x1 + x2) + +def size_info(src): + t = parse_text(src) + bits = battery.enc(t) + l, a, x = lax(t) + return len(bits), l, a, x, t + +def normalize_src(src, beta=1 << 20): + t = parse_text(src) + out = battery.normalize(battery.enc(t), beta) + return out + +def pretty(bits): + return lc.show(lc.decode(bits)[0]) + +def bat(path): + t = parse_text(open(path).read()) + ok, skip, bad = battery.check(t, threads=2) + return f"{len(battery.enc(t)):5d} bits ok={ok} skip={skip} fail={len(bad)} {path}", bad[:5] + +if __name__ == "__main__": + cmd = sys.argv[1] + if cmd == "size": + b, l, a, x, _ = size_info(open(sys.argv[2]).read()); print(b, "bits L", l, "A", a, "X", x) + elif cmd == "bat": + line, bad = bat(sys.argv[2]); print(line) + for b in bad: print(" ", *b) + elif cmd == "eq": + a, b = normalize_src(sys.argv[2]), normalize_src(sys.argv[3]) + print("EQUAL" if a == b and a is not None else "DIFF", "\n ", pretty(a) if a else a, "\n ", pretty(b) if b else b) + elif cmd == "nf": + a = normalize_src(sys.argv[2]); print(pretty(a) if a else "no nf (fuel)") diff --git a/data/self-interpreter/reasoning_floor/nextfuse/v_dispatch_first.lam b/data/self-interpreter/reasoning_floor/nextfuse/v_dispatch_first.lam new file mode 100644 index 00000000..d330390a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/nextfuse/v_dispatch_first.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) (\bit1. bit1 (intL (\exp. cont (\args \arg. exp (\zx \zy. zx arg (zy args))))) (intL (\exp. intL (\exp2. cont (\args. exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/nextfuse/v_optional_parse.lam b/data/self-interpreter/reasoning_floor/nextfuse/v_optional_parse.lam new file mode 100644 index 00000000..4d713360 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/nextfuse/v_optional_parse.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) (\bit1. intL (\exp. bit1 (\k. k k) intL (\exp2. cont (\args. bit1 (\arg. exp (\zx \zy. zx arg (zy args))) (exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/nextfuse/v_select_first.lam b/data/self-interpreter/reasoning_floor/nextfuse/v_select_first.lam new file mode 100644 index 00000000..ab8307af --- /dev/null +++ b/data/self-interpreter/reasoning_floor/nextfuse/v_select_first.lam @@ -0,0 +1,7 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (bit1 + (\exp. cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (\exp. intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/nextfuse/v_share_head.lam b/data/self-interpreter/reasoning_floor/nextfuse/v_share_head.lam new file mode 100644 index 00000000..e714b7d3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/nextfuse/v_share_head.lam @@ -0,0 +1,7 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 cont intL + (\y. bit1 (\arg. exp (\zx \zy. zx arg (zy y))) + (cont (\args. exp args (y args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/nextfuse/v_sharedZ_kapp.lam b/data/self-interpreter/reasoning_floor/nextfuse/v_sharedZ_kapp.lam new file mode 100644 index 00000000..2931999f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/nextfuse/v_sharedZ_kapp.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) (\bit1. intL (\exp. bit1 (\k. cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) intL (\exp2. cont (\args. exp args (exp2 args)))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/nextfuse/v_sharedZ_vabs.lam b/data/self-interpreter/reasoning_floor/nextfuse/v_sharedZ_vabs.lam new file mode 100644 index 00000000..6d113a3f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/nextfuse/v_sharedZ_vabs.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) (\bit1. intL (\exp. bit1 cont (\v. intL (\exp2. cont (\args. exp args (exp2 args)))) (\args \arg. exp (\zx \zy. zx arg (zy args)))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/reader-proof/PROMPT.md b/data/self-interpreter/reasoning_floor/reader-proof/PROMPT.md new file mode 100644 index 00000000..a819b0bf --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/PROMPT.md @@ -0,0 +1,35 @@ +Lane "reader-proof": prove the 165's reader optimal for every reader shape. +Your lane directory is /Users/a9lim/Work/blam/tmp/overnight/reader-proof/ +(write only there). Read /Users/a9lim/Work/blam/tmp/overnight/BRIEF.md first, +then handler-bound.md, protocol-obstructions.md (the neutral-operand and inert +replacement parts) and the introduction and section list of cheap-tail-bound.md +in docs/classical/self-interpreter/. + +Setting. Fix the 165's knot and NEXT region. The reader is any term +`λs. B` in the frame [s, next, cont, intL, x] (the 165's is +`λs. s H (s s s)`, 45 bits including its λ). The reader laws, on actual +streams, with next, cont, intL, x independent rigid variables and R, N rigid: + + B[cons K R / s] =β R next + B[1ⁿ0 ++ N / s] =β cont (1ⁿ⁻¹0 ++ N) N (n ≥ 1) + +Known: readers of the form `s H T` with T ∈ {s s s, s, s s} cost ≥ 43 (body), +handwritten, independently reviewed (tens of pages of case analysis). +Neutral operands `s next`, `s cont`, `s (s s)` are dominated. Open: other +operands T (bare `next`, bare `cont`, operands containing λ), other spine +arities `s A1 … Ak` (k ≠ 2), bodies that are not in head normal form (a +β-redex at the head), and bodies whose head is reached only after reduction. + +Goal: prove |B| ≥ 43 for EVERY B satisfying the laws, i.e. the theorem +"with the 165's knot and NEXT fixed, its reader is optimal", or delimit +precisely the residual cases you could not close. Prefer a UNIFORM argument +over another case explosion: e.g. (i) the variable law forces an unbounded +skip, which on a rigid-free frame forces a self-application of s (or of an +s-derived term) — price that; (ii) the two laws force head `R` on zero +streams and head `cont` on variables, which forces a dispatch whose result +depends on the first bit — price that; (iii) show these two requirements +cannot share syntax beyond what the 165 already shares. Use the existing +proven sub-results as lemmas where they apply. Rigour first: state exact +hypotheses; say what is handwritten versus checked. Small mechanical checks +of specific finite claims are fine (minutes, not hours); no enumeration of +reader bodies. Report as the brief says. diff --git a/data/self-interpreter/reasoning_floor/reader-proof/REPORT.md b/data/self-interpreter/reasoning_floor/reader-proof/REPORT.md new file mode 100644 index 00000000..3b47d5be --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/REPORT.md @@ -0,0 +1,858 @@ +# Lane reader-proof: the 165's reader is optimal for every reader shape + +Lane directory: `tmp/overnight/reader-proof/`. Everything here is new to +this lane except where a document in `docs/classical/self-interpreter/` or a +Lean module is cited. No tracked repository file was modified by this lane (the modified and +untracked files `git status` shows under `docs/`, `lean/` and `data/` belong +to other lanes); nothing was committed; no reader bodies were enumerated. Mechanical checks: +`tools/rt.py` (toolkit), `tools/algebra.py` (data-algebra tables), +`tools/symbolic.py` (symbolic-stream head normal forms), `tools/menu.py` +and inline runs (valid alternative readers and their sizes), +`splice/*.lam` with `tools/self-interpreter/battery.py` (complete +interpreters), each a few seconds, two threads. + +## Summary + +**Theorem (handwritten, with checked finite identities).** With the +165's knot and NEXT region fixed, every reader body `B` in the frame +`[s, next, cont, intL, x]` satisfying the two reader laws + + B[cons K R / s] →* R next + B[1ⁿ0 ++ N / s] →* cont (1ⁿ⁻¹0 ++ N) N (n ≥ 1) + +with `next, cont, intL, x, R, N` independent and rigid has `|B| ≥ 43`, +and `|B| = 43` only for the 165's `s (λb. b (λu r. r next) cont) (s s s)`. +No restriction on `B` is assumed: any arity, any operands (bare `next`, +bare `cont`, operands with lambdas), bodies with head redexes or any +internal redexes, bodies whose head is reached only after reduction, and +both dispatch heads (bit selection and tail dispatch) are covered. + +The proof is uniform in the sense the lane asked for: it is driven by what +the two laws force every reduction to *do* (a structure theorem, Part 1), +by a decomposition of any body along the head reduction of the symbolic +stream `λh. h β τ` into dispatch, zero arm, variable arm and operands +(§2.1), and by an inventory of roles each priced at its cheapest +realization (§2.2–2.3); the case analysis that remains is over four +*shapes* of how stream-created nodes can stand in for nodes of `B` +(§2.4), not over reader syntax. Shape (α) — the variable output's first +application is the stream's own node — is where the 165 lives and is +priced exactly (`41 + 2d`, so 43 at depth 1); the other shapes are ≥ 46. +Part 3 lists the steps whose rigour is weakest; the least formal is the +self-passing-walker bound (Lemma 2.3(c)), which has a ≥ 20-bit margin. + +### 1. Complete interpreters built + +No sub-165 claim. To confirm that the two reader laws are exactly what the +interpreter contract needs in the 165's frame, five readers were spliced +into the 165 (`splice/*.lam`) and run through the exact battery +(`python3 tools/self-interpreter/battery.py FILE`, 2 threads): + +| file | reader | idea | battery | +|---|---:|---|---| +| `r165_control.lam` | 43 | the 165 | `165 bits ok=667 skip=1 fail=0` | +| `r46_k1.lam` | 46 | arity 1, nonlinear tail: `s (λb r. b (r next) (cont r (r r r)))` | `168 bits ok=667 skip=1 fail=0` | +| `r58_tau.lam` | 58 | tail-headed dispatch: `s (λb r. r (b next (λb' t. cont r (r r t))))` | `180 bits ok=667 skip=1 fail=0` | +| `r50_tnext.lam` | 50 | bare `next` operand: `s (λb r. b r (λt. cont r (r r t))) next` | `172 bits ok=667 skip=1 fail=0` | +| `r49_betashortcut.lam` | 49 | created selection node, zero arm is a tail: `s I (λt. cont (s F) (s s t)) next` | `171 bits ok=667 skip=1 fail=0` | + +Each measures `165 + (reader − 43)`, as the frame is otherwise unchanged. +About thirty further valid reader bodies (every pattern of the inventory, +including a `(λy. y y)`-compressed head, a self-passing walker at 85 bits, +chains, lets, data dispatch) were checked against the reader laws on +actual streams `n = 1..5` (`tools/menu.py` and inline runs); all are ≥ 43 +and each is at or above the bound its shape receives in §2.4. + +### 2. New exact identities + +* Symbolic stream `S = λh. h β τ` (`β, τ` rigid): `s K →* β`, + `s F →* τ`, `s s →* β β τ τ`, `s s s →* β β τ τ S`, + `s (s s) →* β β τ τ β τ`; the 165's body has symbolic head normal form + `β (λu r. r next) cont τ (S S S)` (checked). Every reader body's + `B[S]` has head normal form `β A₁ … A_k` (`k ≥ 2`) or `τ A₁` (T3). +* `s F` is the uniform tail (`R` on the zero stream, `P_{n-1}` on variable + streams); `s K` is the uniform bit. +* Cell–cell chains alternate roles, `P_i P_j → P_{j-1} P_{i-1}`; they end + in `K N` iff `i = j`, and otherwise in `I` (suffix erased) or in an + `N`-headed neutral, according to the parity of `|i − j|` (T9, checked + for `i, j ≤ 6`). Application-only trees over copies of one `P_n` and + rigid leaves normalize only to `P_n`, `K N`, or rigid-headed neutrals + (checked exhaustively for ≤ 5 leaves). +* The exact wire-cost change of a β-step, `Δ = (m−1)|Q| + (fl(Q)−1)·D − + 2m − 4 − f(M)` (Lean, `wire_beta_delta`), re-derived and re-checked; its + consequence for a minimum reader body (no shrinking redex) is T10. + +### 3. Lower bounds proved + +The theorem above (Part 1 + Part 2), with the status table in §3.1: all +handwritten; finite identities checked; one Lean theorem used. The earlier +27/31/35-bit handler bounds appear as rows of the inventory (§3.4). + +### 4. Honest read + +§3.5: the reader is optimal because its three mechanisms are each at their +floor and share exactly what can be shared; a sub-165 cannot be found by +changing the reader under the 165's laws. The next proof step is a Lean +formalization of residual tracing for the two reader laws, from which +Lemma 2.3 (N-source) and Lemma 2.7 (copies) would follow and the +arithmetic of §2.4 would become a finite check. + +--- +# Part 1. Setting and the uniform structure theorem + +## 1.1 Setting + +Frame `Γ = [s, next, cont, intL, x]`, innermost first; a leaf `s` costs 2 +bits at depth 0, `next` 3, `cont` 4, `intL` 5, `x` 6, and every enclosing +lambda adds one bit to a free leaf. For any term `|M| = 2L + 4A + 2 + X` +(`L` lambdas, `A` applications, `X` the sum of 0-based indices). + +Data. `K = λa b.a`, `F = λa b.b`, `I = λa.a`, `cons b r = λh. h b r`. +`Z_R = cons K R` (the zero stream, rigid tail `R`), +`P_0 = cons K N`, `P_{i+1} = cons F P_i` (so `P_n = 1ⁿ0 ++ N`), `Q = K N`. +`R, N` are fresh rigid variables, as are `next, cont, intL, x`. + +A **reader body** is a term `B` with free variables in `Γ` such that + + (Z) B[Z_R / s] →* R next + (V_n) B[P_n / s] →* cont P_{n-1} N for every n ≥ 1. + +(The brief writes `=β`; the right-hand sides are β-normal, so by +Church–Rosser `=β` is the same as `→*`.) The 165's body is +`s H (s s s)`, `H = λb. b (λu r. r next) cont`, 43 bits (L 3, A 7, X 7). + +**Claim to prove: every reader body has `|B| ≥ 43`.** + +Throughout, "handwritten" means a proof written here; "checked" means a +specific finite identity was run through the normalizer +(`tools/rt.py`, `tools/algebra.py`, `tools/symbolic.py`, `tools/menu.py` in +this lane directory). Nothing in this lane enumerates reader bodies. + +## 1.2 The structure theorem (every reader body) + +**T1 (free variables).** If `B` is a reader body, so is `B[next/intL, +next/x]`, and it is strictly smaller when `intL` or `x` occurs. *Proof.* +Rigid variables absent from both required outputs can be renamed to any +other rigid variable: substitute `next` for `intL` throughout a reduction +`B[Z_R] →* R next`; every step stays a β-step and the target is unchanged. +A leaf `intL` or `x` costs at least two bits more than `next` at the same +depth. ∎ Hence a minimum reader body has free variables among +`s, next, cont`, and we assume this from now on. + +**T2 (open head normal form).** `B` is solvable and its head normal form +is `s A₁ … A_k` with `k ≥ 1` and no leading lambda. *Proof.* `B[Z_R]` +has a normal form, so it is solvable, so `B` is (an instance of an +unsolvable term is unsolvable). Write the hnf `λy⃗. h A⃗`. A leading lambda +would make `B[Z_R]` reduce to an abstraction, which cannot reduce to +`R next`. So `h ∈ Γ`. If `h ≠ s`, both instances keep the rigid head `h`, +but the zero output has head `R`. So `h = s`; and `k = 0` gives +`B[Z_R] = Z_R`, an abstraction. ∎ + +**T3 (symbolic first cell).** Let `S = λh. h β τ` with fresh rigid +`β, τ`, and for a term `U` over `β, τ, next, cont` write +`U⁰ = U[K/β, R/τ]` and `Uⁱ = U[F/β, P_{n-1}/τ]`. Then `B[S/s]` has a +head normal form of exactly one of the two shapes + + (β-case) β A₁ A₂ … A_k, k ≥ 2, with + A₁⁰ A₃⁰ … A_k⁰ →* R next, A₂ⁱ A₃ⁱ … A_kⁱ →* cont P_{n-1} N; + (τ-case) τ A₁, with + A₁⁰ →* next, A₁ⁱ F P_{n-2} →* cont P_{n-1} N (n ≥ 2), + A₁ⁱ K N →* cont P_0 N (n = 1). + +The `A_j` may contain copies of `S`. *Proof.* `B[Z_R] = (B[S])⁰` and +`B[P_n] = (B[S])ⁱ`, so `B[S]` is solvable with a lambda-free hnf `h A⃗`, +`h ∈ {β, τ, next, cont}`. A rigid `next`/`cont` head survives both +instantiations and is wrong for the zero law. If `h = τ`: the zero +instance is `R A₁⁰ … A_k⁰`, forcing `k = 1` and `A₁⁰ →* next` (`next` is +normal); the variable instance is `P_{n-1} A₁ⁱ → A₁ⁱ F P_{n-2}` (or +`A₁ⁱ K N` when `n = 1`). If `h = β`: the zero instance `K A₁⁰ A₂⁰ …` +needs `k ≥ 2` (else it is an abstraction) and reduces to +`A₁⁰ A₃⁰ … A_k⁰`; the variable instance reduces to `A₂ⁱ A₃ⁱ … A_kⁱ`. ∎ + +Checked: the 165's body has symbolic hnf `β Z cont τ (S S S)` with +`Z = λu r. r next`, and the two instantiations reduce to the required +outputs (`tools/symbolic.py`). Also `s K →* β`, `s F →* τ`, +`s s →* β β τ τ`, `s (s s) →* β β τ τ β τ`: the bit, the tail, and the +skip are all data operations on the symbolic cell. + +**T4 (forced leaves).** `B` contains at least one leaf each of `s`, +`next`, `cont`; hence `X ≥ 3` and `A ≥ 2`. *Proof.* Reduction never creates +a free variable; `next` and `cont` occur in the outputs; `s` heads the hnf +of T2. ∎ + +**T5 (no lambda-free body).** `L ≥ 1`. *Proof.* A lambda-free `B` is an +application tree with head `s` (T2) and leaves in `{s, next, cont}`. +Substitute `P_n` for every `s` and normalize innermost-first using the +application table (checked for indices ≤ 6 in `tools/algebra.py`): + + P_n P_n →* Q, P_n Q → N P_{n-1}, Q V → N, + P_n (z A⃗) → z A⃗ F P_{n-1}, (z A⃗) V = z A⃗ V (z rigid). + +Every subtree normalizes to `P_n`, to `Q`, or to a rigid-headed neutral: +the only functional values generated from copies of a single `P_n` are +`P_n` and `Q`, because `F`, `I`, `K`, and lower cells arise only from +`F`-, `K`-, or `I`-arguments or from cells of unequal index, none of which +is available (checked exhaustively for trees with ≤ 5 leaves, n = 3). A +`cont`-headed neutral receives its first argument either from an explicit +subtree, whose value is `P_n`, `Q`, or a neutral, never `P_{n-1}`, or from +`P_n (cont …) → cont … F P_{n-1}`, where `F` precedes `P_{n-1}`. So no +normal form `cont P_{n-1} N` is reachable, contradicting `(V_n)`. ∎ + +**T6 (the suffix is duplicated).** In `B[P_n]` the rigid `N` occurs once +per `s`-leaf of `B`; in the output it occurs twice (inside `P_{n-1}` and +bare). Every lambda of the stream (`λh`, `K`, `F`) binds its variable at +most once, so the only sources of duplication are: `s` occurring at least +twice in `B`, or a lambda of `B` whose binder occurs at least twice and +which is contracted on an argument containing `N`. In particular **either +`s` occurs ≥ 2 times in `B`, or `B` has a nonlinear binder**. + +**T7 (every cell is opened).** Fix the copy of `N` that ends bare in the +output of `(V_n)` and follow it backwards. The `n+1` cell lambdas +`P_n, …, P_0` of its copy of the stream enclose it initially; an enclosing +lambda disappears only when that lambda is contracted. So every reduction +realizing `(V_n)` contracts (a descendant of) every one of these `n+1` +cells. The same holds for the copy whose `P_{n-1}` survives intact: its +`P_n` is contracted. + +**T8 (the last cell).** The final cell `P_0 = λh. h K N` on the surviving +path is contracted on some argument `Y`: `P_0 Y → Y K N`. Checked table: +`P_0 P_0 → Q`; `P_0 F → N`; `P_0 K → K` (erases `N`); `P_0 P_j → I` +for `j ≥ 1` (erases `N`); `P_0 (rigid neutral)` traps `N` as an argument +of that neutral forever. Hence **`Y` is `P_0`, `F`, or a descendant of a +lambda of `B`**. Since the output has `N` as an argument of `cont`, a +reduct `N X` (head `N`) is also fatal. + +**T9 (cell–cell chains).** If two cells meet, `P_i P_j`, the chain is +forced and the two sides alternate roles: +`P_i P_j → P_j F P_{i-1} → P_{j-1} P_{i-1}` (both indices `≥ 1`); at the +bottom `P_0 P_0 → Q`, `P_0 P_j → I` (`j ≥ 1`, `N` erased), +`P_j P_0 → N P_{j-1}` (`j ≥ 1`, `N` trapped as a rigid head, which no +reduction can turn into an argument). So a meeting with unequal indices is +fatal (which of the two deaths occurs depends on the parity of `|i−j|`), +a cell–cell meeting on the surviving path has **equal indices**, and the +chain then ends in `Q = K N`, which yields `N` only when applied to one +more argument. (Checked for all `i, j ≤ 6`, `tools/algebra.py`.) + +**T10 (minimal counterexample is non-shrinking).** Suppose a reader body +below 43 bits exists and take one of minimum size. Contracting any redex +gives a β-equal term, hence another reader body, so every redex +`(λv.M) Q` of the minimum has `Δ ≥ 0`, where (Lean: +`Blc.SelfintWireCost.wire_beta_delta`; re-checked here on 3000 random +redexes) + + Δ = (m−1)|Q| + (fl(Q)−1)·D − 2m − 4 − f(M), + +`m` the number of occurrences of `v` in `M`, `D` the sum over them of +the number of lambdas of `M` above the occurrence, `fl(Q)` the number of +free-variable leaves of `Q`, `f(M)` the number of leaves of `M` free in +`λv.M` (frame variables included). Consequences: no erasing redex +(`m = 0` gives `Δ < 0`); a linear redex needs `fl(Q) ≥ 2` and +`(fl(Q)−1)·D ≥ 6 + f(M)`; a redex with `m = 2` needs +`|Q| + (fl(Q)−1)·D ≥ 8 + f(M)`, with `m = 3` needs +`2|Q| + (fl(Q)−1)·D ≥ 10 + f(M)`. +# Part 2. The head-path decomposition and the role inventory + +The structure theorem says what every reader body computes; this part +says what syntax it must therefore contain. The method is residual +tracing: in any β-reduction every lambda, application and leaf of a reduct +descends from a unique node of the initial term, copies of one node share +that origin, and a node is *consumed* when its residual is the redex (for +an application) or the contracted abstraction (for a lambda), *erased* +when it lies inside the argument of a vacuous contraction, and *surviving* +when its residual is in the output. The stream's own lambdas (`λh`, `K`, +`F`) are affine, so **only lambdas of `B` ever copy anything**. + +Fix a minimum reader body `B` (T10), free variables in `{s, next, cont}` +(T1), and fix reductions `ρ_z : B[Z_R] →* R next` and +`ρ_v : B[P_n] →* cont P_{n-1} N` for one `n` larger than three times the +number of nodes of `B`. "A node of `B`" always means a node of the +original syntax of `B`; the stream copies substituted for the `s`-leaves +are *stream material*, not nodes of `B`. + +## 2.1 The head path and the selection + +Head-reduce `B[S]` (T3). The head steps are of two kinds: + +* a **cell step** `S Y A⃗ → Y β τ A⃗`: the head is a copy of `S`, i.e. the + residual of a leaf of `B` that is `s` or is a bound variable whose binder + was contracted on a copy of `S`; the redex node is an application node + of `B`. The step creates two new application nodes, `(Y β)` and + `((Y β) τ)`, and two new leaves `β, τ` — **stream material**; +* a **λ-step** `(λy.M) Q A⃗ → M[Q/y] A⃗`: the abstraction is (a copy of) a + lambda of `B`; `Q` is `β`, `τ`, a copy of `S`, or a subterm of `B` + (an *operand* bound by a handler lambda, or the argument of a *let*). + +The head reduction stops at `β A₁ … A_k` (β-case) or `τ A₁` (τ-case). + +**Lemma 2.1 (the selection leaf).** In the β-case the head `β` was +created by a cell step as the argument of the stream node `(Y β)`, and it +reaches head position in one of two ways: **(i)** `Y`'s head normal form +is `λb. b …` — a lambda of `B` binds it and the body's head is that +binder's leaf `b` (a node of `B`; `K = λa b.a` is an instance with leaf +`a`) — or **(ii)** `Y` reduces to a copy of `S`, so the cell is applied to +the bit: `S β → β β' τ'`, the binder is the cell's own `λh`, and the two +hnf arguments `A₁, A₂` are the created `β', τ'` (shape (δ) of Lemma 2.6). +In case (i) the two selection nodes `(β A₁)`, `((β A₁) A₂)` are nodes of +`B`, except that one of them may be a created node `((Y' β'') τ'')` with +`Y' β'' →* β` or `→* β A₁` (shapes (β), (β′) of Lemma 2.6). *Proof.* A +created `β` is the argument of its node `(Y β)`; it becomes the head only +if `Y β →* β …`, i.e. `Y`'s hnf is `λb. b …` or `Y →* S` (then +`S β → β β' τ'`); a term over `β', τ', next, cont` and `S`-copies with +hnf head the *argument* `β` must be an abstraction binding it, and the only +abstractions available are lambdas of `B` and the cell's `λh`. A node +whose function residual is `β` or `β A₁` is a node of `B` unless it is a +created node whose function `(Y' β'')` reduces to it. ∎ + +So in case (i) every reader body contains, on its head path, a cell step +(an `s`-leaf or `S`-valued leaf, 2 bits, plus its application node, 2), +a dispatch lambda `λb` (2), its leaf `b` (2), and the two selection nodes +(4; 2 when one is created). Call this the **dispatch**, cost ≥ 12 (≥ 10 +in the created-node shapes). Case (ii) is priced separately in §2.4. The depth `d ≥ 1` of the +selection node is the number of lambdas of `B` enclosing it; every lambda +on the head path encloses it (the handler binders `λb`, `λr`, `λt`, chain +binders, and let binders), so `d` equals the number of head-path λ-steps on +original lambdas, and every free leaf `s, next, cont` inside the arms pays +`d` extra bits. + +**Definition (arms, operands, environment).** `Z` (zero arm) and `V` +(variable arm) are the subterms of `B` at the two argument positions of +the selection node. The **operands** are the subterms of `B` at argument +positions along the head path that are not `Z`, `V` (handler operands and +let arguments). The **environment** at the selection is the set of bound +variables in scope with their values on the two streams: `b ↦ (K, F)`; +`r ↦ (R, P_{n-1})` if a lambda bound the dispatch cell's `τ`; an operand +or let variable `t ↦ (O⁰, Oⁱ)`; a second cell's `b', r'`; and the free +`s ↦ (Z_R, P_n)`. The **rest** is the list of arguments applied to the +selection result: the dispatch cell's `τ` if unbound, then the unbound +operands. The laws read + + Z[env⁰] rest⁰ →* R next, V[envⁱ] restⁱ →* cont P_{n-1} N. + +In `ρ_z` the whole of `V` is erased (`K Z V → Z`), in `ρ_v` the whole of +`Z` is erased. Hence **a node or leaf inside `Z` plays a role only in +`ρ_z`, one inside `V` only in `ρ_v`; only head-path syntax, operands and +let arguments can serve both reductions.** + +**Decomposition.** Since `Z`, `V`, the operands, the head-path leaves and +lambdas, and the selection nodes are pairwise disjoint pieces of the +syntax of `B`, + + |B| ≥ dispatch + Σ_operands (2 + |O|) + Σ_{other head λ} 2 + |Z| + |V|, + +with equality when `B` has no further head-path material (copies made by +nonlinear binders cost nothing extra, which is why this is an inequality +in general). + +## 2.2 The roles + +The two outputs force the following **roles**, each realized by specific +syntax of `B`; two roles whose realizations must be distinct nodes or +leaves of `B` (because they are simultaneously present with different +fates in one reduction, or because one lies in `Z` and the other in `V`) +are charged separately. + +In `ρ_z` (zero): + +* **z-out**: the output node `R next` is a node `n_R` of `B` (a stream + node has argument `K`, `R`, `F`, or a cell, never `next`). It survives. + Either it lies inside `Z`, or it is the spine node of an operand `O` with + `O⁰ →* next` and `Z[env⁰] rest'⁰ →* R`. +* **z-next**: the output leaf `next` is a leaf `ν_z` of `B` (3 bits plus + its depth), surviving in `ρ_z`. +* **z-R**: the function of `n_R` reduces to `R`. `R` enters only as the + tail of a contracted zero cell `Z_R Y → Y K R`. It reaches the function + position of `n_R` either as the value of a bound leaf (`r` from a + head-path `λr`, or `u` from a lambda inside `Z` that receives the + unbound `τ` or an `R`-valued operand), or as the value of a compound + subterm (`s s X`, `s F`, …) placed at that position or bound to a leaf. + +In `ρ_v` (variable): + +* **v-cont**: the output leaf `cont` is a leaf `κ_v` of `B` (4 bits plus + depth), surviving. +* **v-N**: the bare `N` is produced by an **N-source** (Lemma 2.3), whose + syntax is consumed or erased in `ρ_v`. +* **v-P**: the output node `cont P_{n-1}` is `n_P`: either a node of `B` + inside `V` (or a spine node), or the second node `((Y β) τ)` of the + dispatch cell, which requires the selection result on the variable + stream to reduce to `cont` before `τ` is applied and `τ` to be unbound. +* **v-N-node**: the output node `(cont P_{n-1}) N` is `n_N`, a node of + `B` (inside `V`, or the spine node of an N-valued operand); the only + stream node with argument `N` is the last node of `P_0`, and Lemma 2.3 + shows that using it costs more than any realization below. +* **v-tail**: the intact `P_{n-1}` is the tail of the dispatch cell + delivered through `n_P` when `n_P` is the stream node, or the value of a + bound leaf `r`, or a compound (`s F`, a rebuilt cell). + +Shared: **dispatch** (2.1), and **consumption**: every element of `rest` +is applied to the selection result in *both* reductions; an arm that does +not use it must still consume it, by a lambda of its own (2 bits, which +also deepens the arm's free leaves) or by a data selector. + +## 2.3 Resource lemmas + +**Lemma 2.3 (N-source ≥ 10).** The syntax of `B` producing the bare `N` +of `ρ_v` costs at least 10 bits and consists of at least three leaves and +two application nodes, none of which survives in the output; the bound is +attained only by `s s X`-shaped realizations: two leaves whose values are +cells of equal index, their meeting node, a consumer node and its argument +leaf `X` (any leaf). *Proof.* By T7–T9 the surviving copy's last cell is +contracted on `P_0`, `F`, or a descendant `Λ` of a lambda of `B`. + +*(a) Cell–cell.* There is a first meeting redex `P_i P_i` (equal indices +by T9). Its node is a node of `B` whose two argument subtrees contain two +distinct leaves (two `s`-leaves, or bound leaves whose values are cells) +— a single leaf cannot be the origin of both sides of one redex — or it is +a created node `((Y F) P_{i-1})` with `Y F →* P_i`, `Y` a descendant of a +lambda `λb.W` of `B` (2 bits) with `W` cell-valued (≥ 2), applied by a +further cell step (≥ 4): at least 8 instead of 6. The chain then yields +`Q = K N`, consumed by a redex `Q X → N` whose node is a node of `B` with +an argument subtree (≥ 2) or a created node `((Y F) P_{j-1})` with +`Y F →* Q`, `Y = λb.W'` with the chain inside `W'`, applied by a cell step +(≥ 6 instead of 4). The consumer node is a redex, hence consumed, hence +distinct from `n_N`. Total ≥ 6 + 4 = 10. + +*(b) `F`.* `P_0 F → N` needs an `F` *value* at the right moment. `F` +arises only as a syntactic `λa b.b` of `B` (6 bits, a lambda of `B`) or +from `P_j K → F`, where `K` is syntactic (6) or the first component of +some `P_0`, delivered to a lambda of `B`. In either case the `n+1` cell +steps of the surviving copy that are not cell–cell meetings are each +caused by a contraction of a lambda of `B` (an `F`, a `K`, or a receiver +of the cell), and we are in case (c). + +*(c) Lambda walk.* If no cell–cell meeting occurs on the surviving path, +each of its `n+1` cell contractions is caused by a lambda of `B` (directly, +or through an `F` it produced), and `F`-values are at most `2L + c` in +number, so for `n > 3|B|` some lambda `λ*` of `B` is contracted at least +three times in `ρ_v`, hence copied at least twice. Copies arise only from +nonlinear binders of `B`; following the copying relation among the +finitely many lambdas of `B` yields a *walker*: a lambda `Λ` of `B` +contracted on cells of two different indices, whose body applies the +received tail to a copy of a cycle lambda through a leaf `f` bound by a +nonlinear binder (an affine `f` could pass the copy along only once, and +a syntactic copy inside `Λ` is impossible). Its necessary original syntax: +a lambda receiving the bit (2), one binding the tail (2), the nonlinear +`λf` (2) with two leaves `f` (4), the node applying the tail (2) with its +leaf `r` (2) and the node passing `f` (2), and — since `P_0 Λ → Λ K N` +must return the bare `N` while higher levels continue — a test of the bit +(`b`, 2; two nodes, 4) returning the tail (2): **≥ 24**, all consumed or +erased, none of it the `cont` leaf. If the walker's bit test is the +reader's own dispatch, its two arms must behave differently at the top +level (produce `R next`, `cont P_{n-1} N`) and at the bottom (`N`, +continue), so each needs an extra flag argument and test (≥ 4 each); then +`|B| ≥ 4 + 24 + 4 + 3 + 4 + 8 ≥ 47`. Otherwise `|B| ≥ 24 + 12 + 4 + 3 ≥ +43` from the walker, the dispatch, `cont` and `next` alone. Either way no +reader with a lambda walk is below 43, and this case never attains 10 for +the N-source. The same accounting shows that making the last node of `P_0` +the output node `n_N` (which needs a walker carrying `P_{n-1}`) costs +≥ 24. ∎ + +**Lemma 2.4 (zero-R-source).** Realizations of **z-R** and their costs: +(i) a bound leaf (2) whose binder is a head-path `λr` contracted on `τ` +(the lambda is counted in `d`); (ii) a bound leaf (2) whose binder is a +lambda inside `Z` (2) contracted on the unbound `τ` or on an `R`-valued +element of `rest`; (iii) the tail of a cell delivered by a created +selection node (Lemma 2.6(β)), cost 0 for the leaf but with the +dispatch's own costs; (iv) a compound inside `Z` or bound to a leaf, whose +zero value is `R`: it must contract a zero cell with a `Y` returning the +tail (`F`, `λu r.r`: 6 bits, or a second cell `s s` then an argument): +at least 10 bits of syntax that is consumed in `ρ_z`, shareable with the +N-source only when it is the same subterm (an operand or let whose zero +value is `R` and whose variable value is `N`, i.e. a skip `s s X`). +*Proof.* `R` has no other provenance (T3, T7 applied to the zero stream: +`R` occurs once per copy, as the tail). A leaf receives `R` only through a +binder contracted on `R` itself or on a term reducing to `R`; the latter +needs a contracted zero cell and the tail-returning `Y`, as listed. ∎ + +**Lemma 2.5 (variable tail).** Realizations of **v-tail**: (i) the +dispatch cell's `τ` through its own second node (`n_P` = stream node), +cost 0, requiring `V[envⁱ] →* cont`; (ii) a bound leaf `r` (2) bound to +`τ` on the head path (counted in `d`) or inside `V` (2); (iii) `s F` or +`s (λu r. r)` (≥ 10) or any other compound contracting a fresh copy of +the cell with a tail-returning `Y`; (iv) a rebuilt cell `λh. h F' P'` +with `F' →* F` and `P' →* P_{n-2}`: at least 2 + 4 + 2 + 2 + 2 = 12 bits +plus a second cell contraction to obtain `P_{n-2}` (≥ 4) — never +competitive. *Proof.* The output's `P_{n-1}` has a root lambda that is a +residual of a stream cell (then, the cell body being closed, the whole +`P_{n-1}` is that cell's residual, i.e. the tail of a contracted `P_n` +copy), or of a lambda of `B`, which is case (iv). ∎ + +**Lemma 2.6 (stream-node shortcuts).** A created node has argument a bit +(`(Y β)`) or a tail (`((Y β) τ)`). The only roles a created node can take +are: +(α) `n_P` = the second node of a cell step with `(Y β)ⁱ →* cont` — when +it is the dispatch cell, `V[envⁱ] →* cont`; then `n_N` is a node of `B` +applying `cont τ` to the N-source, necessarily the spine node of an +N-valued operand (it cannot lie inside `V`, which is the leaf `cont`); +(β) the first selection node, `((Y β') τ')` with `Y β' →* β`: `Y`'s hnf is +`λb'. b'` or `λb'. b` (an outer bit); then `Z = τ'`, the zero arm cannot +contain `next` (so `ν_z` is an operand and `n_R` its spine node), and `V` +receives no tail from this cell; +(β′) the second selection node, `((Y β') τ')` with `Y β' →* β Z`: then +`V = τ'` is a tail, and on the variable stream `P_{n-1}` is applied to the +following argument `X`, which must satisfy `Xⁱ F P_{n-2} … →* cont P_{n-1} +N` (and handle `n = 1`, where it receives `K N`); +(δ) both arms at once, when the bit is bound by the cell's `λh` +(Lemma 2.1 (ii)): hnf `β β' τ' A₃ …`, so on the zero stream +`K K R A₃⁰ … → A₃⁰ A₅⁰ …` (the tail `R` is erased) and on the variable +stream `F F P_{n-1} A₃ⁱ … → A₃ⁱ F P_{n-2} A₄ⁱ …` (the tail is consumed). +A created node is never `n_R` (argument `next`) nor `n_N` (argument `N`: +only the last node of `P_0`, Lemma 2.3(c)); as a meeting or consumer node +it is priced in Lemma 2.3(a). *Proof.* By inspection of the two created +node shapes and of what their function parts can reduce to (`cont`, `β`, +`β Z`, a cell, `Q`); `(Y β)` with `Y →* β` or `Y →* S` gives (δ). ∎ +**Lemma 2.7 (copies do not help the inventory).** In the minimum `B`, +(i) a let on a single leaf, `(λy.M) Q` with `Q ∈ {s, next, cont}` at +depth `e`, has `Δ = (m−1)(|Q|) − 2m − 4 − f(M)` with `|Q| = 2+e, 3+e, +4+e`; it is negative for `Q = s` always, and otherwise only non-negative +when the leaf is used many times (`m ≥ 7` for `next`, `m ≥ 4` for `cont` +at depth 0). In those cases the let costs `4 + |Q| + 2m` while the +inventory below charges at most `|Q| + e' + 2(m−1)` for the roles its +uses can fill (one output leaf and consumer leaves), so the inventory +remains a lower bound; in all other cases leaves are never copied and +each charged leaf role is an original leaf. +(ii) the residuals of one copied application node all have β-equal +functions and β-equal arguments, since copies of a let argument are +substituted under the same binders. All roles charged within one +reduction have pairwise different (function, argument) signatures +(`n_P`: `(cont, P_{n-1})`; `n_N`: `(cont P_{n-1}, N)`; meeting node: +`(P_i, P_i)`; consumer: `(K N, X)`; the two selection nodes: +`(β, Z)`, `(β Z, V)`; the dispatch cell step: `(S, Y)`), so no two of them +are residuals of one node. Roles in different reductions may share syntax +only through the head path, operands and lets, which the shapes below +treat explicitly. The one mechanism that copies lambdas with *different* +arguments — a self-passing walker — is priced in Lemma 2.3(c). ∎ + +**Remark (forced depths).** Inside an arm the free leaves sit under all +the arm's own leading lambdas: an arm applied to `m` arguments it consumes +with lambdas has head normal form `λu₁ … u_m. body`, and by T10 the +arm's syntax cannot hide a free leaf above those lambdas through a let +(a let on a leaf shrinks; a let `(λy. λu⃗. … y …) Q` with `Q ∋ next` needs +`fl(Q) ≥ 4`, i.e. `|Q| ≥ 14`, far above the savings). Consuming an +argument by a data value instead of a lambda (`K`, `F`, `b`, `s s`, a cell +step) costs ≥ 4 instead of 2 and spares at most one bit of depth on each +free leaf of the arm — never cheaper than the lambda for the arms below, +whose free leaves number at most two. + +## 2.4 The minimization + +Costs: a free `next` at depth `e` costs `3 + e`, `cont` `4 + e`, `s` +`2 + e`; a bound leaf costs `2 +` (lambdas between it and its binder). +`d ≥ 1` is the depth of the selection node; `rest` the arguments applied +to the selection result (§2.1). An arm either uses an element of `rest` +as an output argument, or consumes it (≥ 2 per element, Remark). + +**v-cont and z-next placements.** `κ_v` is a leaf inside `V` (`4 + depth`) +or a leaf elsewhere reaching `V` through a bound variable, which costs the +leaf (≥ 4), a lambda (2), the variable (2) and a node (2) ≥ 10 — never +competitive, so `κ_v ∈ V` below. Likewise `ν_z ∈ Z` (`3 + depth`) or +`ν_z` is an operand `next` (3) applied through its spine node, which is +then `n_R` (2); other indirections cost ≥ 9. + +By Lemma 2.6 exactly one shape applies. + +### Shape (α): `n_P` is the dispatch cell's second node + +Then `V[envⁱ] →* cont` with `κ_v ∈ V`; the only `V` of minimum size is +the leaf `cont`, `4 + d` (any other `V` has a second leaf or a lambda: +≥ `6 + d`). The dispatch's `τ` is unbound and becomes `cont`'s first +argument, so `rest = (τ, T, …)` and `n_N` is the spine node of the operand +`T`, with `Tⁱ →* N`; by Lemma 2.3, `|T| ≥ 10`, with equality only for +`T = s s X`, `X` an index-0 leaf, i.e. `X = s`. **There is no further +operand**: a third element of `rest` would be a third argument of `cont`. + +The zero arm receives exactly `R` and `T⁰`. `n_R` cannot be `T`'s spine +node (`T⁰` would have to be `next`, but `T` is N-valued and `next`-valued +only if it contains a selection with its own bit source: ≥ 10 + 8 more +than a leaf). If `n_R` lay inside `T`, then `T⁰ →* R next` and `Z = λu t.t` +(6): `T` at depth 0 has no bound variables, so it pays a compound +`R`-source (≥ 10), `next` and `n_R` (5), the N-source (10) and a selection +with a bit source (`s K` or a cell with a lambda, ≥ 14): `|B| ≥ 12 + 2 + +39 + 6 + 5 ≥ 64`. Otherwise `Z` contains `n_R`, `ν_z`, and an `R`-source. `Z` +consumes both arguments: two lambdas (4) above `ν_z`, or data consumers +(≥ 4 each, Remark). So `ν_z` costs `3 + d + 2`, the `R`-source is a bound +leaf (2; a compound would cost ≥ 10 by Lemma 2.4 (iv)), and + + |Z| ≥ 4 + 2 + (5 + d) + 2 = 13 + d, + +with equality only for `Z = λu r. r next` with `T⁰ = R` (`T` a skip) — +`λu r. u next` costs one more because `u` sits under the second lambda. +Altogether + + |B| ≥ 12 + (2 + 10) + (13 + d) + (4 + d) = 41 + 2d ≥ 43, + +with equality iff `d = 1`, `T = s s s`, `Z = λu r. r next`, `V = cont`: +**the 165's reader, uniquely**. + +### Shape (β): the first selection node is created, `Z` is a cell's tail + +The dispatch cell's `Y` has head normal form `λb'. b'` or `λb'. b`. + +*`Y →* λb'. b'`.* The cheapest such `Y` is `I` (4): dispatch +`4 + 4 + 0 + 2 = 10` (one selection node is created). `Z = τ'` costs 0, +so `ν_z` is an operand `next` (3) whose spine node is `n_R` (2), and +`rest = (next)` exactly (a second operand would trail `R next`). The +variable arm `V` sits at depth 0, receives `next` and **no tail** +(`F τ' V → V`). It must consume or use `next` — a lambda (2), since `V`'s +value must be a function; using `next` as the N-source's consumer leaf `X` +is allowed and already inside the N-source's 10 — and must realize +**v-tail** without any bound tail: Lemma 2.5 (ii) with a fresh cell step +applying a lambda of `V` that binds the tail (`4 + 4 + 2 = 10`) or +(iii) `s F`/`s (λu r.r)` (10), or (iv) (≥ 16); the N-source (10, disjoint +syntax: its own two cell leaves, meeting node, consumer node and `X`); +`κ_v` (≥ 4 + 1); `n_P`, `n_N` (4). So + + |V| ≥ 2 + 10 + 10 + 5 + 4 = 31, |B| ≥ 10 + 5 + 31 = 46. + +(The cheapest construction found, `s I (λt. cont (s F) (s s t)) next`, +is 49 bits, checked.) + +*`Y →* λb'. b`.* `b` is bound by an outer handler lambda on an outer cell +step: at least `4 + 2` more on the head path than the previous case, while +`V` may now use that outer cell's tail through a bound `r` (saving at most +`10 − 4` on **v-tail**): `|B| ≥ 46 + 6 − 6 = 46`. + +### Shape (β′): the second selection node is created, `V` is a tail + +Here `V = τ'` and the variable stream continues `P_{n-1} X … → X F +P_{n-2} …`, so the continuation `X` must bind or consume two extra +arguments (≥ 4), test the bit it receives (for `n = 1` it receives `K N` +and must not walk `N`: a leaf and two nodes, ≥ 6), contain `κ_v` +(≥ 4 + 2), an N-source (≥ 10), `n_P`, `n_N` (4), and a tail: the outer +cell's `τ` passed to it (a binding, ≥ 4) or a compound (≥ 10). The head +path has two cell steps (8), `λb` and `λb'` (4), the leaf `b` (≥ 2), the +node `(b Z)` (2) and the spine node of `X` (2). The zero arm `Z` is as in +shape (α) (`≥ 13 + d` with `d ≥ 2`). So `|B| ≥ 18 + 15 + 34 ≥ 67`. (A +71-bit construction exists; I did not check it, as it is irrelevant to +the bound.) + +### Shape (δ): the bit is bound by the cell's own `λh` + +Then (Lemma 2.6) `R` is erased before any arm can see it and `P_{n-1}` is +consumed, so **z-R** is a compound (≥ 10, Lemma 2.4 (iv)) and **v-tail** a +compound (≥ 10, Lemma 2.5 (iii)/(iv)); the continuation `A₃` receives +different argument lists on the two streams (`A₅⁰ …` against +`F P_{n-2} A₄ⁱ …`) and must distinguish them, which needs a lambda of `B` +whose bound leaf heads a selection (≥ 8) — with the zero-side selector +supplied by an operand (`K`, ≥ 6) or by a tail test — and must consume +`F` and `P_{n-2}` (≥ 4); the two cell steps cost 8. With `κ_v`, `ν_z`, +`n_R`, `n_P`, `n_N` (≥ 15) and the N-source (10): +`|B| ≥ 8 + 8 + 6 + 4 + 10 + 10 + 10 + 15 ≥ 71`. + +### Shape (γ): `n_P` and `n_N` are nodes of `B` + +`V` contains `κ_v` (`4 + d + e_V`, `e_V` the number of `V`'s own lambdas +above it) and `n_P` (2); it contains `n_N` (2) unless `n_N` is the spine +node of an N-valued operand (case γ2). + +**(γ1) No N-valued operand.** The N-source (≥ 10) lies inside `V`. The +tail is a bound leaf `r` (2) — bound on the head path (then `d ≥ 2`) or by +a lambda of `V` receiving the unbound `τ` (then `e_V ≥ 1`) — or a compound +(≥ 10, worse). The zero arm: `ν_z ∈ Z` gives +`|Z| ≥ 2 + (3 + d + e_Z) + 2 + 2·(consumed)`; `ν_z` an operand `next` +gives `|Z| ≥ 2` (a bound `R`-leaf, `d ≥ 2`) or `|Z| ≥ 4` (`λu. u`). + +| `d` | operands | dispatch | `Z` ≥ | `V` ≥ | total ≥ | attained | +|---|---|---:|---:|---:|---:|---:| +| 1 | none | 12 | 11 (`λu. u next`) | 2+6+2+10+4 = 24 | 47 | 47 | +| 2 | none | 15 | 9 (`r next`) | 6+2+10+4 = 22 | 46 | 46 | +| 1 | `next` (5) | 12 | 4 (`λu. u`) | 4+7+2+10+4 = 27 | 48 | 51 | +| 2 | `next` (5) | 15 | 2 (`r`) | 2+7+2+10+4 = 25 | 47 | 50 | + +(Row 1: `V` binds `τ`, so `e_V = 1`, `κ_v` costs 6, plus `λr` 2, `r` 2, +N-source 10, `n_P n_N` 4. Row 3: `V` binds `τ` and `next`, `e_V = 2`. +Row 4: `V` binds `next`.) Any other operand `O` (`cont`, `s s`, `s F`, +`s K`, a second `next`, …) can serve as an output argument in neither arm +except `cont` for `V` — and `cont` as an operand costs `2 + 4` plus its +consumption by `Z` (2) and binding in `V` (2 + 2) against the `4 + d` +it replaces: a net increase — so it adds at least `2 + |O| + 2 ≥ 8` for +`|O| ≥ 4` over the rows above. A head-path depth `d ≥ 3` adds 2 per extra +lambda and one bit on `b` and on each free leaf of the arms (≥ 4 per +lambda). Hence (γ1) gives `|B| ≥ 46`. + +**(γ2) An N-valued operand `T`** (`2 + |T| ≥ 12`). If `n_N` is `T`'s +spine node, `V[envⁱ]` applied to `τ` (if unbound) reduces to +`cont P_{n-1}`, so `V` contains `κ_v`, `n_P`, and a tail leaf: +`V = cont r` (`d = 2`, 10) or `V = λr. cont r` (`d = 1`, 12). The zero arm +receives `τ` (if unbound) and `T⁰` and contains `n_R`, `ν_z`, an +`R`-leaf: `d = 2`: `|Z| ≥ 2 + 2 + 6 + 2 = 12` (consumes `T⁰`); +`d = 1`: `|Z| ≥ 4 + 2 + 6 + 2 = 14`. Totals: `15 + 12 + 10 + 12 = 49` +and `12 + 12 + 12 + 14 = 50`. If `n_N` is inside `V`, then `V` applies +`cont P_{n-1}` to a leaf `t` bound to `T` (the N-source is then `T` +itself, and `V` binds `t` or `d ≥ 3`) or has its own N-source and wastes +`T`: `|V| ≥ (4 + d + e_V) + 2 + 2 + 2 + 2` with `e_V ≥ 1` or `d ≥ 2`; +with `|Z| ≥ 12` and the operand's 12 and dispatch ≥ 12 this is ≥ 52. + +### Depth-0 operands as role carriers + +An operand at depth 0 sees no bound variable, so any `R`, `P_{n-1}`, `N` +or bit it supplies is a compound (≥ 10 each, Lemmas 2.3–2.5 and `s K`), +and an operand serving a zero role and a variable role with different +values (a *dual* operand) contains a selection with its own bit source +(≥ 8 + 10). Moving a role out of an arm into such an operand therefore +never lowers the bounds above, which already charge the cheapest +realization of every role. + +### Extras + +Each additional head-path cell step costs ≥ 4 and its `β', τ'` must be +bound or consumed (≥ 2); each head-path let costs `≥ 4 + |Q| ≥ 10` +(T10: a let needs `fl(Q) ≥ 2` or `|Q| ≥ 8`); a data dispatch (`s K …`) +costs 14 and forfeits the tail; none lowers the minimum realization cost of +any role, because every role is priced in leaves and nodes (≥ 2 each) and +in forced depths. So each extra only adds to the bounds above. + +**Conclusion of 2.4.** In the β-case `|B| ≥ 43`, with equality exactly for +the 165's reader (shape (α), `d = 1`, `T = s s s`, `Z = λu r. r next`, +`V = cont`). + +## 2.5 The τ-case + +The head `τ` is the residual of a bound leaf `r` (2) whose binder `λr` (2) +is on the head path and was contracted on the dispatch cell's tail after a +`λb` (2) took the bit (data variants `s F`: 6 for the `F`, same count); +the node `(τ A₁)` is a node of `B` (2): a created node `((Y β') τ')` would +need `Y β' →* τ`, giving `τ τ'`, whose zero instance `R R` is not +`R next`. Apply T3's argument to `A₁` (a term with `A₁⁰ →* next` normal +and `A₁ⁱ` a function): its head normal form is `β A₁' A₂' O⃗` with +`A₁'⁰ O⃗⁰ →* next` and `A₂'ⁱ O⃗ⁱ F P_{n-2} →* cont P_{n-1} N`, so `A₁` +contains a selection: a leaf `b` (2 + 1, under `λr`) and two nodes (4). +Its zero arm contains or receives `next` (≥ 5 at depth ≥ 2). Its variable +arm receives `F` and `P_{n-2}` and must consume or use them (≥ 4), +contains `κ_v` (≥ 4 + 2 + 2), the tail leaf `r` (≥ 2), `n_P`, `n_N` (4), +and an N-source (≥ 10). Hence + + |B| ≥ (4 + 2 + 2 + 2 + 2) + (3 + 4) + 5 + (4 + 8 + 2 + 4 + 10) = 52. + +(Cheapest construction found: `s (λb r. r (b next (λb' t. cont r (r r t))))`, +58 bits, checked.) The τ-case never competes. + +## 2.6 Statement + +**Theorem.** Every reader body — every term `B` over the frame +`[s, next, cont, intL, x]` with `B[Z_R/s] →* R next` and +`B[P_n/s] →* cont P_{n-1} N` for all `n ≥ 1`, with `R, N, next, cont, +intL, x` rigid — has `|B| ≥ 43`, and `|B| = 43` only for +`s (λb. b (λu r. r next) cont) (s s s)`. + +The proof is the structure theorem (Part 1), the head-path decomposition +and role inventory (§2.1–2.3, Lemma 2.7), and the minimization +(§2.4–2.5). It is handwritten; the finite identities it uses are checked +by the scripts in `tools/`; the exact wire-cost formula it uses is the +Lean theorem `Blc.SelfintWireCost.wire_beta_delta`. Part 3 lists the steps +whose rigour is weakest. +# Part 3. What is proved, how, and where the argument is thin + +## 3.1 Status by component + +| component | status | +|---|---| +| T1–T4 (free variables, open hnf `s A⃗`, symbolic hnf dichotomy, forced leaves) | handwritten, standard tools (solvability, Church–Rosser); the 165's symbolic hnf checked | +| T5 (no lambda-free body) | handwritten; the application table and the `P_n`-only closure checked for indices ≤ 6 and trees ≤ 5 leaves | +| T6–T9 (duplication, every cell opened, last cell, equal-index chains) | handwritten residual arguments; all finite identities checked | +| T10 (minimum has no shrinking redex; Δ formula) | the formula is Lean (`wire_beta_delta`), re-checked on 3000 random redexes; the minimality argument is one line | +| §2.1 decomposition, Lemma 2.1 (selection leaf) | handwritten residual tracing | +| Lemma 2.3 (N-source ≥ 10), cases (a), (b) | handwritten, tight | +| Lemma 2.3 (c) (self-passing walker ≥ 24) | handwritten and coarse (a count of necessary pieces, see 3.2) — the weakest step | +| Lemmas 2.4–2.6 (R-source, tail, stream-node shortcuts) | handwritten exhaustive lists of realizations | +| Lemma 2.7 (copies) | handwritten; relies on T10 and on the distinct signatures of the roles | +| §2.4 shapes (α), (β), (β′), (δ), (γ) and extras | handwritten arithmetic; every valid construction measured (`tools/menu.py` and inline checks) is ≥ its shape's bound | +| §2.5 τ-case ≥ 52 | handwritten, coarse | + +No Lean was written in this lane: the statements pinned down enough to +formalize (the application tables, T5) are finite-instance checks of +small value, and the load-bearing steps (residual tracing over all +reductions, the inventory) would need a formalization of residuals that +does not exist in `lean/Blc`. + +## 3.2 Where a reviewer should push + +1. **Exhaustiveness of realization lists.** Lemmas 2.4–2.6 enumerate how + `R`, the tail, and the output nodes can be produced. The lists rest on + T3/T7–T9 (what stream material can do) and on the observation that a + created node has argument `β` or `τ`. A missed realization would have + to produce `R`, `P_{n-1}` or `N` from stream material in a way the + tables do not cover; the `P_n`-only closure check and the table are the + evidence that there is none, but the general claim is handwritten. +2. **The walker bound (Lemma 2.3 (c)).** A lambda of `B` contracted on + cells of two different indices must be copied, and the copying binder + must be nonlinear; I price the receiver's binders (bit, tail), the + application of the tail to a copy, the nonlinear binder with two + leaves, and the bit test with the return of `N`: `2+2+2+2+2+2+2+2+4+2 + = 24`, so even with the dispatch shared (the walker's bit test being + the reader's dispatch) the reader is ≥ `12 + (24 − 8) + 4 + 3 + 2 ≥ + 43`. This is a count of necessary pieces, not a case analysis; it has + a 20-bit margin over the cheapest walker I can write (85-bit reader), + but it is the step most likely to contain an unexamined realization. +3. **Lemma 2.7 (ii)** uses that copies of a let argument have β-equal + values. This is true for copies produced by substitution of one + argument; for copies produced inside a walker (different arguments at + each level) it is not, which is why walkers are priced separately. A + reader mixing a walker with cheap arms would have to be re-examined + against both arguments at once; I believe the 24-bit walker cost + closes it, but have not written that case out. +4. **Depth taxes.** The arms' free leaves are charged `+1` per lambda + above them. The Remark in §2.4 shows that a let cannot lift a leaf + above an arm's consumption lambdas in the minimum. Data consumers + (`K`, `b`, `s s`) were priced at ≥ 4 against the lambda's 2 and shown + to save at most one depth bit per free leaf; the arms in the tables + have at most two free leaves, so this is safe, but shape (γ) rows with + several consumptions deserve a re-count. +5. **Shape (γ1) "other operands" and `d ≥ 3`.** These are one-line + dominance arguments (each extra costs more than anything it can + replace). They are correct for the roles as priced, but they are the + kind of step where a clever double use (an operand that is at once a + tail source for `V` and an `R`-source for `Z`, e.g. `s F`) must be + checked: `s F` costs 10 and replaces `r` (2 + binder) in both arms, a + net loss; I checked `s F`, `s s`, `s K`, `next`, `cont`. + +## 3.3 Residual cases + +With the caveats of 3.2, I do not have a residual *class* of reader bodies +outside the theorem: the decomposition covers every term (compressed or +not, any arity, any operand, both dispatch heads), because it is driven by +the head reduction of `B[S]` and by residual tracing rather than by the +syntax of `B`. The residual risk is in the rigour of the listed steps, not +in an identified family of terms. The honest summary: + +* **Fully covered with tight arithmetic:** shape (α) — every reader whose + variable output node `cont P_{n-1}` is the stream's own node (this is + the 165's mechanism; the 165 is the unique minimum there). +* **Covered with margin ≥ 3:** shapes (β), (γ), the τ-case, chains, lets, + data dispatch. +* **Covered with large margin but coarse reasoning:** self-passing + walkers (Lemma 2.3 (c)), rebuilt cells (Lemma 2.5 (iv)). + +## 3.4 Relation to the earlier bounds + +The earlier results are recovered as instances: the 27-bit handler bound +(`s H (s s s)`) is shape (α)/(γ) with `T = s s s`; the 35- and 31-bit +handler bounds for `T = s` and `T = s s` are the rows where the operand is +not N-valued at depth 0 (`s`, `s s`) and the N-source must be completed +inside `V` (`t X` for `s s`); the neutral-operand domination is the +"other operand" line. The bare operands `next` and `cont`, operands with +lambdas, arities `k ≠ 2`, head redexes, and the tail-headed dispatch — the +open list in the lane prompt — are the rows of (β), (γ) and §2.5. + +## 3.5 Honest read + +The reader is optimal because its three mechanisms are each at their +floor and share everything that can be shared: the stream's own second +node is the variable output's first application (shape (α) is the only +way to get an output node for free), the skip `s s s` is the cheapest +N-source (Lemma 2.3) and its zero value happens to be the tail, so one +operand serves both arms, and the zero arm then pays exactly for the two +lambdas that consume what the variable arm uses. Every alternative in the +inventory pays at least 3 more bits. + +Where a sub-165 could still hide is therefore **not in the reader with +the 165's knot and NEXT fixed**: it would have to change the laws — a +different `next` protocol (the zero arm's `r next` is the only place +`next` is used, and the reader never exploits what `next` does), a reader +that hands NEXT something other than the raw remaining stream, or a fusion +of the reader's self-application `s s` with the knot (the reader already +contains the only self-application the knot needs). The next proof step +that would make this record-grade is to formalize residual tracing for +the two reader laws in Lean (origins and fates of nodes, as +`SelfintOrigins.lean` does for quotation-origin binders) and to discharge +Lemma 2.3 and Lemma 2.7 from it; the arithmetic of §2.4 would then be a +finite check over realization patterns. diff --git a/data/self-interpreter/reasoning_floor/reader-proof/splice/r165_control.lam b/data/self-interpreter/reasoning_floor/reader-proof/splice/r165_control.lam new file mode 100644 index 00000000..57093d73 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/splice/r165_control.lam @@ -0,0 +1,7 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/reader-proof/splice/r46_k1.lam b/data/self-interpreter/reasoning_floor/reader-proof/splice/r46_k1.lam new file mode 100644 index 00000000..68fc2882 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/splice/r46_k1.lam @@ -0,0 +1,7 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. \r. bit0 (r next) (cont r (r r r)))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/reader-proof/splice/r49_betashortcut.lam b/data/self-interpreter/reasoning_floor/reader-proof/splice/r49_betashortcut.lam new file mode 100644 index 00000000..75286337 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/splice/r49_betashortcut.lam @@ -0,0 +1,7 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\i. i) (\t. cont (list (\a \b. b)) (list list t)) next) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/reader-proof/splice/r50_tnext.lam b/data/self-interpreter/reasoning_floor/reader-proof/splice/r50_tnext.lam new file mode 100644 index 00000000..298d50d3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/splice/r50_tnext.lam @@ -0,0 +1,7 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. \r. bit0 r (\t. cont r (r r t))) next) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/reader-proof/splice/r58_tau.lam b/data/self-interpreter/reasoning_floor/reader-proof/splice/r58_tau.lam new file mode 100644 index 00000000..5798c873 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/splice/r58_tau.lam @@ -0,0 +1,7 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. \r. r (bit0 next (\b2. \t. cont r (r r t))))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/reader-proof/tools/algebra.py b/data/self-interpreter/reasoning_floor/reader-proof/tools/algebra.py new file mode 100644 index 00000000..52283a2c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/tools/algebra.py @@ -0,0 +1,96 @@ +"""Finite checks of the data-algebra tables used in the structure theorem. +Rigid: N, R, next, cont. Values: P_i (variable-stream cells), F, I, Q=K N, K. +Checks (for indices up to 6) every entry of the application table and the +'P_n-only' closure claim: application-only trees over copies of P_n and the +rigid leaves normalize to P_n, Q, or a rigid-headed neutral. +""" +from rt import * +import itertools +N, R = V('N'), V('R') +Q = A(K, N) +def eqn(a, b): return nf(a) == nf(b) +M = 6 +ok = True +def chk(name, a, b): + global ok + if not eqn(a, b): + ok = False; print('FAIL', name, lc.show(nf(a)), '!=', lc.show(nf(b))) +for i in range(M+1): + chk(f'P{i} F -> tail', A(P(i), F), N if i == 0 else P(i-1)) + chk(f'P{i} K -> F or K', A(P(i), K), K if i == 0 else F) + chk(f'P{i} Q -> N tail', A(P(i), Q), A(N, N if i == 0 else P(i-1))) + chk(f'P{i} I', A(P(i), I), Q if i == 0 else I) + chk(f'P{i} neutral', A(P(i), A(V('cont'), R)), A(V('cont'), R, K if i == 0 else F, N if i == 0 else P(i-1))) + for j in range(M+1): + lhs = A(P(i), P(j)) + if i == j == 0: rhs = Q + elif i == 0: rhs = I + elif j == 0: rhs = A(N, P(i-1)) + else: rhs = A(P(j-1), P(i-1)) + chk(f'P{i} P{j}', lhs, rhs) +chk('F V -> I', A(F, R), I); chk('Q V -> N', A(Q, R), N); chk('I V -> V', A(I, R), R) +# last-cell lemma: P0 Y for Y in {P0, F, K, P_j, N} +chk('P0 P0 -> Q', A(P(0), P(0)), Q); chk('P0 F -> N', A(P(0), F), N); chk('P0 K -> K', A(P(0), K), K) +# equal-index chains end in Q; unequal die +for i in range(M+1): + chk(f'P{i} P{i} -> Q', A(P(i), P(i)), Q) + chk(f'P{i} P{i} X -> N', A(P(i), P(i), R), N) +# unequal indices: fatal either way (I erases N; N P_m traps N as a head); parity decides which +fatal_ok = True +for i in range(M+1): + for j in range(M+1): + if i == j: continue + d = nf(A(P(i), P(j))) + isI = d == nf(I) + h = d + while h[0] == 'A': h = h[1] + isNhead = (h == nf(N)) + if not (isI or isNhead): + fatal_ok = False; print('NOT FATAL', i, j, lc.show(d)) +print('unequal-index chains fatal:', fatal_ok) +print('table checks:', 'PASS' if ok else 'FAIL') + +# P_n-only closure: enumerate all application trees with up to 5 leaves from {P_n, next, cont} +# (n=3) and classify normal forms. +n = 3 +leaves = [('P', P(n)), ('next', V('next')), ('cont', V('cont'))] +def trees(k): + if k == 1: + for name, t in leaves: yield name, t + return + for i in range(1, k): + for (ln, l) in trees(i): + for (rn, r) in trees(k - i): + yield f'({ln} {rn})', A(l, r) +def classify(t): + d = nf(t) + if d == nf(P(n)): return 'P_n' + if d == nf(Q): return 'Q' + # rigid-headed neutral? + h = d + while h[0] == 'A': h = h[1] + if h[0] == 'V': return 'neutral:' + str(h[1]) + return 'OTHER:' + lc.show(d) +from collections import Counter +cnt = Counter() +bad = [] +for k in range(1, 6): + for name, t in trees(k): + try: + c = classify(t) + except lc.Fuel: + c = 'FUEL' + cnt[c.split(':')[0]] += 1 + if c.startswith('OTHER') or c == 'FUEL': bad.append((name, c)) +print('P_n-only closure (<=5 leaves, n=3):', dict(cnt), 'bad:', bad[:5]) +# first argument of a cont-headed neutral is never P_{n-1} +viol = [] +for k in range(1, 6): + for name, t in trees(k): + d = nf(t) + h = d; args = [] + while h[0] == 'A': args.append(h[2]); h = h[1] + args.reverse() + if h == ('V', FRAME.index('cont')) and args and args[0] == nf(P(n-1)): + viol.append(name) +print('cont-headed with first arg P_{n-1}:', viol) diff --git a/data/self-interpreter/reasoning_floor/reader-proof/tools/examples.py b/data/self-interpreter/reasoning_floor/reader-proof/tools/examples.py new file mode 100644 index 00000000..479d2eca --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/tools/examples.py @@ -0,0 +1,42 @@ +from rt import * +s, nx, c = V('s'), V('next'), V('cont') +b, r, t, u = V('b'), V('r'), V('t'), V('u') +Z = L('u', 'r', A(r, nx)) +# k=1 designs +report('k1 unhoisted s (\\b r. b (r next) (cont r (r r r)))', A(s, L('b','r', A(b, A(r,nx), A(c, r, A(r,r,r)))))) +report('k1 split arms s (\\b. b (\\r. r next) (\\r. cont r (r r r)))', A(s, L('b', A(b, L('r', A(r,nx)), L('r', A(c, r, A(r,r,r))))))) +report('k1 shared drop s (\\b r. b (\\u. r next) (cont r) (r r r))', A(s, L('b','r', A(b, L('u', A(r,nx)), A(c,r), A(r,r,r))))) +# tau-headed designs +report('tau-head 60', A(s, L('beta','tau', A(V('tau'), A(V('beta'), nx, L('b','t', A(c, V('tau'), A(V('tau'),V('tau'),V('tau'))))))))) +report('tau-head 58', A(s, L('beta','tau', A(V('tau'), A(V('beta'), nx, L('b','t', A(c, V('tau'), A(V('tau'),V('tau'),t)))))))) +# k=3 design +report('k3 56 s (\\b. b b (\\r t u. cont r t)) (s s s) next', A(s, L('b', A(b, b, L('r','t','u', A(c, r, t)))), A(s,s,s), nx)) +# compressed let design +report('let-skip 60', A(L('t', A(s, L('b', A(b, L('u', A(t, nx)), L('u', A(c, u, t)))))), A(s,s,s))) +report('let-skip normal 67', A(s, L('b', A(b, L('u', A(A(s,s,s), nx)), L('u', A(c, u, A(s,s,s))))))) +# T = next / T = cont handlers from protocol-obstructions +Hj = L('b','r', A(b, r, L('t', A(c, r, A(r, r, t))))) +report('T=next s Hj next (Hj 40)', A(s, Hj, nx)); print(' |Hj| =', size(Hj)) +Hc = L('b','r','t', A(b, A(r, nx), A(t, r, A(r, r, t)))) +report('T=cont s Hc cont (Hc 44)', A(s, Hc, c)); print(' |Hc| =', size(Hc)) +Hj2 = L('b', A(b, L('r', r), L('r','t', A(c, r, A(r, r, t))))) +report('T=next s Hj2 next', A(s, Hj2, nx)); print(' |Hj2| =', size(Hj2)) +# zero-only and variable-only minima guesses +print('zero-only s F next :', size(A(s, F, nx)), 'zero law:', eq(subst_s(A(s,F,nx), zero()), A(V('R'), nx))) +print('var-only cont (s F) (s s s):', size(A(c, A(s,F), A(s,s,s)))) +# s F is the uniform tail +print('s F on zero -> R:', eq(subst_s(A(s,F), zero()), V('R')), '; on P3 -> P2:', eq(subst_s(A(s,F), P(3)), P(2))) +# the Phi-walk +W = L('b','r','w', A(b, r, A(r, V('w'), V('w')))) +print('|W| =', size(W), ' s W W on P4 -> N:', eq(subst_s(A(s, W, W), P(4)), V('N'))) +# delta formula spot checks +import random +def rand_term(depth, nfree): + k = random.random() + if depth == 0 or k < 0.3: return ('V', random.randrange(nfree + 3)) + if k < 0.6: return ('L', rand_term(depth-1, nfree+1)) + return ('A', rand_term(depth-1, nfree), rand_term(depth-1, nfree)) +random.seed(1) +for _ in range(3000): + check_delta(rand_term(5, 1), rand_term(4, 0)) +print('delta formula: 3000 random checks pass') diff --git a/data/self-interpreter/reasoning_floor/reader-proof/tools/menu.py b/data/self-interpreter/reasoning_floor/reader-proof/tools/menu.py new file mode 100644 index 00000000..7b6ef65e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/tools/menu.py @@ -0,0 +1,27 @@ +"""Costs of the environment-decomposition menu designs (all valid readers).""" +from rt import * +s, nx, c = V('s'), V('next'), V('cont') +b, r, t, u, w = V('b'), V('r'), V('t'), V('u'), V('w') +designs = { + 'p1k2 T=sss Z=\\u r.r next V=cont (165)': A(s, L('b', A(b, L('u','r', A(r,nx)), c)), A(s,s,s)), + 'p1k2 T=sss Z=\\u r.u next (166)': A(s, L('b', A(b, L('u','r', A(u,nx)), c)), A(s,s,s)), + 'p1k1 Z=\\u.u next V=\\r.cont r (s s s)': A(s, L('b', A(b, L('u', A(u,nx)), L('r', A(c, r, A(s,s,s)))))), + 'p1k1 Z=\\u.u next V=\\r.cont r (r r r) [nonlinear]': A(s, L('b', A(b, L('u', A(u,nx)), L('r', A(c, r, A(r,r,r)))))), + 'p2k1 Z=r next V=cont r (r r r) [nonlinear]': A(s, L('b','r', A(b, A(r,nx), A(c, r, A(r,r,r))))), + 'p2k1 Z=r next V=cont r (s s s)': A(s, L('b','r', A(b, A(r,nx), A(c, r, A(s,s,s))))), + 'p2k2 T=sss Z=\\t.t next V=cont r': A(s, L('b','r', A(b, L('t', A(t,nx)), A(c, r))), A(s,s,s)), + 'p2k2 T=sss Z=\\t.r next V=cont r': A(s, L('b','r', A(b, L('t', A(r,nx)), A(c, r))), A(s,s,s)), + 'p2k2 T=next Z=r V=\\t.cont r (r r t) [nonlinear]': A(s, L('b','r', A(b, r, L('t', A(c, r, A(r,r,t))))), nx), + 'p1k2 T=next Z=\\u t.u t V=\\r t.cont r (r r t) [nonlinear]': A(s, L('b', A(b, L('u','t', A(u,t)), L('r','t', A(c, r, A(r,r,t))))), nx), + 'p3k2 T=cont Z=r next V=t r (r r t) [nonlinear]': A(s, L('b','r','t', A(b, A(r,nx), A(t, r, A(r,r,t)))), c), + 'p1k2 T=s s Z=\\u t.t u next V=\\r t.cont r (t r)': A(s, L('b', A(b, L('u','t', A(t,u,nx)), L('r','t', A(c, r, A(t,r))))), A(s,s)), + 'p1k2 T=s F Z=\\u t.t next V=\\r t.cont t (s s s)': A(s, L('b', A(b, L('u','t', A(t,nx)), L('r','t', A(c, t, A(s,s,s))))), A(s,F)), + 'data dispatch s K Z=(s s s) next V=cont (s F) (s s s)': A(s, K, A(A(s,s,s), nx), A(c, A(s,F), A(s,s,s))), + 'chain s (s H) H=\\b r b2 r2.b (r next) (cont r (r2 r2 b2))': A(s, A(s, L('b','r','b2','r2', A(b, A(r,nx), A(c, r, A(V('r2'),V('r2'),V('b2'))))))), + 'let-skip (\\t. s (\\b.b (\\u.t next) (\\u.cont u t))) (s s s)': A(L('t', A(s, L('b', A(b, L('u', A(t,nx)), L('u', A(c,u,t)))))), A(s,s,s)), + 'let-skip2 (\\t. s (\\b.b (\\u v.t next) cont) t) (s s s)': A(L('t', A(s, L('b', A(b, L('u','v', A(t,nx)), c)), t)), A(s,s,s)), + 'tau-head s (\\b r. r (b next (\\b2 t. cont r (r r t)))) [nonlinear]': A(s, L('b','r', A(r, A(b, nx, L('b2','t', A(c, r, A(r,r,t))))))), + 'consumer via stream node: s (\\b. b (\\u r. r next) cont) (s (\\b. s s))': A(s, L('b', A(b, L('u','r', A(r,nx)), c)), A(s, L('b', A(s,s)))), +} +for name, body in designs.items(): + report(name, body) diff --git a/data/self-interpreter/reasoning_floor/reader-proof/tools/rt.py b/data/self-interpreter/reasoning_floor/reader-proof/tools/rt.py new file mode 100644 index 00000000..7b4a7ec5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/tools/rt.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python3 +"""Reader-theory toolkit for the reader-proof lane. + +Named lambda terms over the reader frame [s, next, cont, intL, x] with rigid +globals R, N (and extra rigid names on demand). Sizes use the BLC identity +|M| = 2L + 4A + 2 + X. Normalization is normal-order with fuel (lc.nf). +Nothing here enumerates terms; it checks specific identities and sizes. +""" +import sys +from pathlib import Path +sys.dont_write_bytecode = True +ROOT = Path('/Users/a9lim/Work/blam') +sys.path.insert(0, str(ROOT / 'tools/self-interpreter')) +import lc + +# ---------- named AST: ('V', name) | ('L', name, body) | ('A', f, a) ---------- +def V(n): return ('V', n) +def A(f, *xs): + for x in xs: f = ('A', f, x) + return f +def L(*xs): + body = xs[-1] + for n in reversed(xs[:-1]): body = ('L', n, body) + return body + +FRAME = ['s', 'next', 'cont', 'intL', 'x'] # innermost first +RIGID = ['R', 'N', 'T', 'a', 'e', 'f', 'g', 'z', 'beta', 'tau'] # rigid globals beyond the frame + +def db(t, frame): + if t[0] == 'V': + return ('V', frame.index(t[1])) + if t[0] == 'L': + return ('L', db(t[2], [t[1]] + frame)) + return ('A', db(t[1], frame), db(t[2], frame)) + +def to_db(t, frame=None): + return db(t, (frame or FRAME) + RIGID) + +def counts(t): + """(L, A, X) of a de Bruijn term; X is the sum of 0-based indices.""" + if t[0] == 'V': return 0, 0, t[1] + if t[0] == 'L': + l, a, x = counts(t[1]); return l + 1, a, x + lf, af, xf = counts(t[1]); la, aa, xa = counts(t[2]) + return lf + la, af + aa + 1, xf + xa + +def size(t, frame=None): + d = to_db(t, frame) + l, a, x = counts(d) + assert lc.size(d) == 2 * l + 4 * a + 2 + x + return lc.size(d) + +def nf(t, fuel=20000, frame=None): + return lc.nf(to_db(t, frame), [fuel]) + +def eq(a, b, fuel=20000, frame=None): + return nf(a, fuel, frame) == nf(b, fuel, frame) + +# ---------- data ---------- +K = L('ka', 'kb', V('ka')) +F = L('fa', 'fb', V('fb')) +I = L('ia', V('ia')) +def cons(b, r): return L('cs', A(V('cs'), b, r)) +def zero(tail=V('R')): return cons(K, tail) +def P(n, tail=V('N')): + t = cons(K, tail) + for _ in range(n): t = cons(F, t) + return t +def unary(n, tail=V('N')): # 1^n 0 ++ tail + return P(n, tail) + +def subst_s(body, stream): + """body[stream/s] for a named body; stream must be closed or rigid-only.""" + def go(t): + if t[0] == 'V': return stream if t[1] == 's' else t + if t[0] == 'L': return ('L', t[1], go(t[2])) + return ('A', go(t[1]), go(t[2])) + return go(body) + +def laws(body, ns=range(1, 6), fuel=20000, verbose=False): + """Check the two reader laws on actual streams with rigid next/cont/R/N.""" + ok = True + z = nf(subst_s(body, zero()), fuel) + want = nf(A(V('R'), V('next')), fuel) + if z != want: + ok = False + if verbose: print(' zero law fails:', lc.show(z)) + for n in ns: + v = nf(subst_s(body, P(n)), fuel) + wantv = nf(A(V('cont'), P(n - 1), V('N')), fuel) + if v != wantv: + ok = False + if verbose: print(f' var law fails at n={n}:', lc.show(v)) + return ok + +def report(name, body, **kw): + sz = size(body) + d = to_db(body) + l, a, x = counts(d) + try: + ok = laws(body, **kw) + except lc.Fuel: + ok = 'FUEL' + print(f'{name}: {sz} bits (L={l}, A={a}, X={x}) laws={ok}') + return sz, ok + +# ---------- beta wire delta (Lean: SelfintWireCost.wire_beta_delta) ---------- +def occ(j, t): + if t[0] == 'V': return 1 if t[1] == j else 0 + if t[0] == 'L': return occ(j + 1, t[1]) + return occ(j, t[1]) + occ(j, t[2]) +def occ_depth(j, t): + if t[0] == 'V': return 0 + if t[0] == 'L': return occ_depth(j + 1, t[1]) + occ(j + 1, t[1]) + return occ_depth(j, t[1]) + occ_depth(j, t[2]) +def free_leaves(k, t): + """number of variable leaves with index >= k (free w.r.t. k binders).""" + if t[0] == 'V': return 1 if t[1] >= k else 0 + if t[0] == 'L': return free_leaves(k + 1, t[1]) + return free_leaves(k, t[1]) + free_leaves(k, t[2]) +def delta(b, a): + """wire(contract b a) - wire((\\.b) a), de Bruijn b (under one binder), a.""" + m = occ(0, b) + return (m - 1) * lc.size(a) + (free_leaves(0, a) - 1) * occ_depth(0, b) - 2 * m - 4 - free_leaves(1, b) +def check_delta(b, a): + got = lc.size(lc.beta(('L', b), a)) - lc.size(('A', ('L', b), a)) + assert got == delta(b, a), (got, delta(b, a)) + return got + +if __name__ == '__main__': + s, nx, c = V('s'), V('next'), V('cont') + Z = L('u', 'r', A(V('r'), nx)) + H165 = L('b', A(V('b'), Z, c)) + B165 = A(s, H165, A(s, s, s)) + report('165 reader body s H (s s s)', B165) + assert size(B165) == 43 diff --git a/data/self-interpreter/reasoning_floor/reader-proof/tools/symbolic.py b/data/self-interpreter/reasoning_floor/reader-proof/tools/symbolic.py new file mode 100644 index 00000000..2976df92 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/tools/symbolic.py @@ -0,0 +1,38 @@ +"""Symbolic-stream checks: S = \\h. h beta tau with rigid beta, tau.""" +from rt import * +s, nx, c, t = V('s'), V('next'), V('cont'), V('t') +beta, tau = V('beta'), V('tau') +S = L('h', A(V('h'), beta, tau)) +def sym(body): return subst_s(body, S) +def show(t): return lc.show(nf(t)) +Z = L('u', 'r', A(V('r'), nx)) +H165 = L('b', A(V('b'), Z, c)) +B165 = A(s, H165, A(s, s, s)) +print('165 symbolic nf :', show(sym(B165))) +print('s K ->', show(sym(A(s, K)))) +print('s F ->', show(sym(A(s, F)))) +print('s s ->', show(sym(A(s, s)))) +print('s s s ->', show(sym(A(s, s, s)))) +print('s (s s) ->', show(sym(A(s, A(s, s))))) +print('s I ->', show(sym(A(s, I)))) +# instantiate beta,tau +def inst0(t): # zero: beta:=K, tau:=R + def go(u): + if u[0]=='V': return K if u[1]=='beta' else (V('R') if u[1]=='tau' else u) + if u[0]=='L': return ('L', u[1], go(u[2])) + return ('A', go(u[1]), go(u[2])) + return go(t) +def insti(t, n): # var: beta:=F, tau:=P_{n-1} + def go(u): + if u[0]=='V': return F if u[1]=='beta' else (P(n-1) if u[1]=='tau' else u) + if u[0]=='L': return ('L', u[1], go(u[2])) + return ('A', go(u[1]), go(u[2])) + return go(t) +hn = A(beta, Z, c, tau, A(beta, beta, tau, tau)) +print('hnf zero inst ->', show(inst0(hn)), '; var inst n=3 ->', show(insti(hn, 3))) +# last-cell lemma witnesses +print('P0 P0 ->', show(A(P(0), P(0))), '| P0 F ->', show(A(P(0), F)), '| P0 K ->', show(A(P(0), K)), '| P0 P2 ->', show(A(P(0), P(2))), '| P2 P0 ->', show(A(P(2), P(0)))) +print('P3 P1 ->', show(A(P(3), P(1))), '| P1 P3 ->', show(A(P(1), P(3)))) +# the tau-headed example's symbolic hnf +Bt = A(s, L('beta2','tau2', A(V('tau2'), A(V('beta2'), nx, L('b','t', A(c, V('tau2'), A(V('tau2'),V('tau2'),t))))))) +print('tau-head symbolic:', show(sym(Bt))) diff --git a/data/self-interpreter/reasoning_floor/remainder/PROMPT.md b/data/self-interpreter/reasoning_floor/remainder/PROMPT.md new file mode 100644 index 00000000..2e3d7d1e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/PROMPT.md @@ -0,0 +1,43 @@ +Lane "remainder": the exact remainder extractor as a stepping stone to a global +lower bound. Your lane directory is +/Users/a9lim/Work/blam/tmp/overnight/remainder/ (write only there). Read +/Users/a9lim/Work/blam/tmp/overnight/BRIEF.md first, then +docs/classical/self-interpreter/remainder.md, structural-bounds.md and +capture-width.md, and lean/Blc/SelfintRemainder.lean, SelfintZero.lean. + +Observation. If E is a self-interpreter then E (λv r. r) is an exact +remainder extractor on closed sources: R (⌜M⌝ ++ N) =β N for every closed M +and rigid N. It costs |E| + 8 bits. Hence + + |E| ≥ Rmin − 8, Rmin = least size of a closed-source exact remainder extractor. + +The best known extractor is Codex's 70-bit rem70 +(`data/self-interpreter/machines/rem70.lam`, +`\s.(\d.s d d) (\b\r.r (b (\t\u\d.t u (u d d) d d) r))`), which handles open +sources too. The current unconditional floor for interpreters is 34 bits +(handwritten), 18 (Lean). A proof that Rmin ≥ 50 would already lift the +interpreter floor to 42; Rmin ≥ 60 would give 52. + +Your job, in order: +1. Understand rem70 completely; then try hard, by reasoning, to golf it — a + smaller remainder extractor (closed-source suffices for the transfer, but + say which contract yours meets). Its true minimum is the ceiling of this + method, so knowing it matters. Check every candidate with a small exact + test: write a short script that, for every closed program up to ~16 bits + plus some deep-index and divergent sources (Ω, λ.Ω), normalizes + R (⌜M⌝ ++ N) with rigid N via target/release/blam or + tools/self-interpreter/lc.py and compares with N (seconds, not minutes). +2. Prove the strongest lower bound on Rmin you can, rigorously and by + reasoning (no enumeration of candidate terms). Known necessities to price: + two nonlinear binders (SelfintZero, Lean), incomparable branches, + residual-origin code growth on long sources (remainder.md), unary skipping + (the stream must be self-applied or a fixed point used), the three-way tag + dispatch, and the fact that an application node needs two sequential + recursive skips. Combine without double counting; test each claimed + invariant against rem70, against E(λv r. r) for the 165, and against + near-miss non-extractors before relying on it. +3. Report what the transfer gives for interpreters, exactly. + +Light computation only (no run over ~2 minutes, at most 2 threads; no +enumeration of extractor candidates). Lean welcome for pinned lemmas (keep +files in your lane dir; do not edit existing modules). Report as the brief says. diff --git a/data/self-interpreter/reasoning_floor/remainder/REPORT.md b/data/self-interpreter/reasoning_floor/remainder/REPORT.md new file mode 100644 index 00000000..61fd8f0e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/REPORT.md @@ -0,0 +1,879 @@ +# Remainder lane report + +No smaller complete remainder extractor was found. The best upper bound +remains **70 bits**, including open sources. This lane proves +**27 ≤ Rmin ≤ 70** for the closed-source, exact-suffix contract. The +27-bit lower bound is handwritten, with fixed equation checks; its new +incomparable-binder ingredient is checked in Lean. It does **not** establish +Rmin ≥ 50 or improve the existing 34-bit interpreter floor. + +The main new obstruction to the proposed route is constructive: **45 bits +already suffice for every lambda tower and every unary index**. This partial +reader has incomparable nonlinear binders and repeatedly increases the +number of program-origin lambdas. Its exact tower contract is checked in +Lean. Consequently the zero-stream family, even together with the known +code-growth mechanism, cannot by itself prove a 50-bit remainder bound. + +All files written are in this lane directory. No candidate enumeration, +long sweep, external consult, or repository edit was used. The largest +test run took 4.922 seconds with two workers. Lean checks used two threads +and took less than two seconds each. + +## 1. Constructions and exact tests + +No new complete self-interpreter was built. `int165_projection.lam` is the +existing 165 applied to `λv r.r`, used as a reference remainder extractor. + +`check.py` compiles sources without optimization and normalizes + +``` +λn. R (streamOf(code(M),n)) +``` + +against the literal normal form `λn.n`. Thus the suffix is rigid. It tests +all 226 closed programs through 16 bits, eight further closed sources +including Ω, λ.Ω, Ω I, I Ω, indices through 40, and a 48-lambda tower, +plus six open sources. No divergent source is skipped: source syntax is +never evaluated. Every listed candidate received all 240 probes. + +| File stem | Bits | Exact battery counts | Status / idea | +| --- | ---: | --- | --- | +| `reference70` | 70 | pass=240 fail=0 capped=0 timeout=0 | Existing self-passed context. | +| `floated71` | 71 | pass=240 fail=0 capped=0 timeout=0 | Float the context-sharing let outside the stream lambda. | +| `fixedpoint_direct` | 86 | pass=240 fail=0 capped=0 timeout=0 | Explicit fixed point, select the input of the final parse. | +| `fixedpoint_select_after` | 95 | pass=240 fail=0 capped=0 timeout=0 | Explicit fixed point, select between one and two complete parses. | +| `int165_projection` | 173 | pass=240 fail=0 capped=0 timeout=0 | Existing E applied to the six-bit tail projection. | +| `diagonal63_failed` | 63 | pass=0 fail=240 capped=0 timeout=0 | Replace the adapter by D D; wrong normal form already on I. | +| `triple67_capped` | 67 | pass=0 fail=0 capped=240 timeout=0 | D D D. Analytically head-divergent on every zero-headed input; proof below. | +| `right_diagonal67` | 67 | pass=0 fail=240 capped=0 timeout=0 | D (D D); wrong normal form on I. | +| `partial_diagonal69` | 69 | pass=5 fail=200 capped=35 timeout=0 | Self-apply the partial parse s D; wrong normal form on I. | +| `drop_second_skip_failed` | 66 | pass=27 fail=213 capped=0 timeout=0 | Remove one context operand from APP; returns a thunk instead of the exact tail. | +| `unary_only` | 12 | pass=5 fail=235 capped=0 timeout=0 | Ordinary stop-at-first-zero diagonal. | +| `zero_tower_only` | 67 | pass=27 fail=213 capped=0 timeout=0 | Explicit fixed point, ignore the second tag. | +| `tower51` | 51 | pass=27 fail=213 capped=0 timeout=0 | rem70 with Q = λt u d.u d d. | +| `tower45` | 45 | pass=27 fail=213 capped=0 timeout=0 | Skip all leading zero bits, then the unary variable. | + +Every stem has `.lam` and `.blc` files. `checks.json` records the full +counts, groups, and counterexamples. The cap is 12,000 beta steps; caps are +not counted as refutations. The separate proof resolves `triple67_capped`. +The five passes of the unary-only reader are the five open-variable probes. + +### rem70, completely unfolded + +Let K be bit zero, F bit one, and `[b,r]=λh.h b r`. Define + +``` +Q = λt u d.t u (u d d) d d +D = λb r.r (b Q r) +P(s) = s D D +R70 = λs.(λd.s d d) D. +``` + +The adapter gives `R70 s →* P(s)`. A first cell gives + +``` +P([F,r]) →* r r D +P([K,r]) →* r Q D. +``` + +For `r=1^i 0 ++ N`, the self-skip identity is `r r →* K N`, so the +first clause returns N and erases the pending D. On the constructor path, +the second Scott cell exposes t,u before the context argument arrives: + +``` +Q K u D →* u D D = P(u) +Q F u D →* (u D D) D D = P(P(u)). +``` + +Induction on source syntax proves exact extraction for every source, +including open and divergent ones, uniformly in its suffix. Uniformity is +what licenses parsing the first child with the second child's complete +stream as its suffix. No encoded source evaluation is involved. + +Q costs 36, D costs 53, and the adapter costs 17. The total is +L=7, A=12, X=6, hence 70. The binder order in Q puts its four d occurrences +innermost, its two u occurrences next, and its one t occurrence outermost. +`SelfintRemainder.rem70_contract` already proves the full contract; this +lane separately rechecked the source and the 240 exact probes. + +The 86-bit construction satisfies + +``` +P s =β s (λb r. b (r (λt u. P (t u (P u)))) (r r r)). +``` + +The 95-bit version replaces `P(t u(P u))` by `t(P u)(P(P u))`. +Their explicit diagonal/let knots unfold to these equations. The same +source induction proves both correct on open sources and arbitrary tails. +These derivations are handwritten; the finite batteries are corroboration. + +### The capped 67-bit bootstrap really loops + +Use the same D,Q as rem70 and put + +``` +X = Q Q D, Y = X Q Q, +A = D Q Q, B = A Q Q, C = A Q B. +``` + +For an arbitrary zero cell `s=[K,r]`, ordinary weak-head reduction gives + +``` +D D D s →^12 Y s (s K K) K K r +Y →^13 Q Q Q Q (Q Q Q) Q Q C Q Q Q Q. +``` + +Both fixed traces are replayed in `audit.py`. The closed prefix Q Q Q Q +diverges at the head. Indeed every all-Q application spine with at least +three arguments rewrites, by `Q t u d → t u (u d d) d d`, to another +all-Q head spine with at least four arguments. Its t is again an all-Q +application tree. Appending arbitrary arguments cannot interrupt this +invariant: the four newly supplied all-Q arguments precede them. Thus the +displayed input never reaches its suffix. The explicit source-sharing +adapter adds one initial beta step before D D D. + +## 2. A 45-bit boundary for zero-stream arguments + +The exact source is + +``` +λs.(λd.s d d) (λb r d.r (b d r) d). +``` + +Let `D0=λb r d.r(b d r)d` and `P0(s)=s D0 D0`. Its two laws are + +``` +P0([K,r]) →* r D0 D0 = P0(r) +P0([F,r]) →* r r D0. +``` + +Therefore, for every k≥0, m≥1, and arbitrary N, + +``` +R45 (0^k 1^m 0 ++ N) →* N. +``` + +Induct on k and then use unary self-skip. This includes every closed +lambda tower `λ^n.I` and every well-scoped `λ^k.var m`. It even accepts +odd zero prefixes, which need not be a source encoding. `Tower45.lean` +checks the literal 45-bit length, closedness, both symbolic clauses, and +the all-k/all-index/all-suffix theorem, including the tower corollary. +Both public contracts depend only on `propext` and `Quot.sound`. + +It fails, for example, on `λx.x x` (wire `00011010`): it returns +`10 ++ N`, the encoding of the second variable followed by N. +This is a partial reader, not an improvement to Rmin. + +It also realizes the growth mechanism concretely. In one zero-cell cycle +`P0([K,r]) →* P0(r)`, the active D0 consumes its b and r binders. Its +last d contraction then duplicates the other three-lambda D0 twice and +consumes one lambda, increasing the program-origin lambda count by +`(2−1)·3−1 = 2`. Before/after counts in the cycle are 6,5,4,6. This +happens at every zero cell, arbitrarily late in the infinite-zero trace. + +The source has five live binders, three nonlinear binders, and an +incomparable nonlinear pair (the sharing lambda against binders in D0). +Thus two nonlinear binders, incomparable branches, unary skipping, and +arbitrarily late code growth are jointly compatible with 45 bits. +Any sound bound using only these obligations is at most 45 and transfers +at most 37 bits to interpreters. In particular it cannot reach the desired +42-bit interpreter bound. This does not obstruct a bound that additionally +uses genuine application parsing. + +## 3. Incomparable nonlinear binders: new Lean theorem + +`RemainderChain.lean` proves `remainder_not_chain` and +`literal_remainder_body_not_chain`. Hypotheses are closedness and exact +closed-source/closed-suffix beta joinability. The latter theorem puts the +incomparable pair inside the body of a literal one-lambda interface. + +The interpreter's old Omega-output argument cannot simply be reused: +putting Omega in an extractor's suffix puts its two nonlinear binders in +the input already. This proof instead extends the labelled-zero argument. + +Use the existing extended syntax Q with program lambdas and affine data +K,Z_i. Define ChainQ by the existing `Chain` predicate on its binder-count +erasure. All extended steps preserve ChainQ and preserve affineness when +the initial term is affine. Data phases normalize finitely and do not +increase either nonlinear-binder count or program-lambda count. + +At a global program head contraction: + +* An affine binder decreases program-lambda count and does not increase + nonlinear count. +* A nonlinear binder, by the chain property, has an affine argument. + Its contraction therefore decreases nonlinear count by one, regardless + of how many affine program lambdas get copied. + +The lexicographic pair `(nonlinear count, program-lambda count)` decreases +between completed data phases. Thus every closed chain-shaped extended +term reaches a lambda-like answer. This permits arbitrarily many nested +nonlinear binders; it is stronger than assuming their count at most one. + +Simulate the resulting finite trace of R Z0 on a sufficiently long even +zero prefix ending in `stream(I,Omega)`. It is the quotation of a closed +lambda tower followed by Omega. The trace produces an outer lambda, +whereas correctness says it beta-joins Omega. Confluence contradicts this: +all reducts of an outer lambda remain lambdas, and Omega's only reduct is +itself. Hence R is not chain-shaped. + +Lean checks the preservation lemmas, lexicographic termination, finite +simulation, and contradiction. Its final axiom audit is exactly +`[propext, Quot.sound]`; there are no admitted proofs. + +## 4. Handwritten unconditional lower bound: Rmin ≥ 27 + +This proof concerns arbitrary closed sources for R, including beta-redexes. +It assumes neither a normal-form source nor a parser architecture. The +syntax classification below is analytical, not a term enumeration. +`audit.py` replays 33 fixed equations used here and above in about 0.003 s; +the exhaustiveness comes from the following count argument, not those tests. + +### Three live binders, hence at least 24 bits + +Call a binder live when its own variable occurs. An extractor R weak-head +normalizes to a lambda: apply it to a fixed quoted closed source with +normal suffix I, and use head-normalization reflection to its function. +The exposed binder must be live, since otherwise the result would be +independent of the suffix (take closed suffixes I and F). +The reduct remains an extractor by confluence, so `SelfintZero` says that +the exposed lambda's body contains at least two nonlinear binders. + +Suppose the original R had at most two live binders. There must be two, +both nonlinear, and the new chain theorem makes them incomparable. +Each is consequently closed in isolation: every ancestor is vacuous. +Neither body contains another live binder. During weak-head evaluation, +copies of these closed live lambdas retain their original bodies, since +substitution cannot change a closed subterm and no step is taken under a +lambda. Every other original binder is vacuous and remains so under +capture-avoiding substitution. Thus a live exposed lambda would have no +nonlinear binder in its body, the required contradiction. + +R has at least three live binders and two nonlinear binders. Write L,V,X +for lambda nodes, variable leaves, and the sum of zero-based indices. +There are at least five leaves, and + +``` +|R| = 2L + 4V - 2 + X ≥ 2·3 + 4·5 - 2 = 24. +``` + +### The entire allocation through 26 bits + +If |R|≤26, necessarily V=5, exactly three binders are live, exactly two +are nonlinear, and each nonlinear binder occurs exactly twice. The third +live binder is affine. Either + +``` +L=3, X≤2, or L=4, X=0. +``` + +In the second case the fourth lambda is vacuous. Put `D=λx.x x`. + +### Zero index sum + +When X=0 every lambda subterm is closed in isolation. Any lambda exposed +by weak-head evaluation is therefore an unchanged original lambda subterm. +To have two internal nonlinear binders it must be the affine binder, +containing both nonlinear binders. These consume all five source leaves. +There can be no application outside this lambda, because its other operand +would require a leaf. An outer vacuous lambda would itself receive and +discard the public stream. Thus R is literally this affine lambda. + +With three lambdas it has form `λs.T(s,D,D)`, where T is a three-leaf +binary application tree. On any `s=[K,r]`, its six layouts give: + +| Body | Reduct after substituting s | +| --- | --- | +| `(s D) D` | `K D` | +| `(D s) D` | `r` | +| `(D D) s` | `Omega s` | +| `s (D D)` | `Omega K r` | +| `D (s D)` | `K K` | +| `D (D s)` | `r` | + +Take `s=stream(I,n)`, with rigid n; r is a nonempty Scott stream. None +returns n. + +With a fourth, vacuous lambda, its body must be closed because X=0. +It cannot surround an occurrence bound by s or D. It therefore wraps +one D, giving `J=λz.D`, or wraps `D D`. In the latter case the only +layouts are `s(λz.Omega)` and `(λz.Omega)s`, both head-divergent. +In the former case take `s=[K,r]`, `r=[K,u]` (as for source I): + +| Body | Reduct | +| --- | --- | +| `(s D) J` | `K J` | +| `(s J) D` | `u` | +| `(D s) J` | `r` | +| `(D J) s` | `K r` | +| `(J s) D` | `Omega` | +| `(J D) s` | `K r` | +| `s(D J)` | `K` | +| `s(J D)` | `K` | +| `D(s J)` | `u` | +| `D(J s)` | `Omega` | +| `J(s D)` | `D` | +| `J(D s)` | `D` | + +Here u is also a nonempty Scott stream. Again none is n. This excludes +all zero-index allocations through 26 bits. + +### Three lambdas and a positive index sum: literal interface + +If R starts with a lambda, it is the affine binder; a nonlinear root +would be comparable with the only other nonlinear binder. Its sole +stream occurrence must lie inside one of the incomparable nonlinear +binders, or X would be zero. Thus + +``` +R = λs.H_s D, or R = λs.D H_s, +H_s = λx.T(x,x,s). +``` + +The first reduces to the already excluded three-leaf layout. For the +second, the six choices of T give the following on +`s=stream(I,n)=[K,r]`, `r=[K,u]`: + +| T | Behavior of H_s H_s | +| --- | --- | +| `(x x)s` | `H_s H_s → H_s H_s s`, an infinite head expansion | +| `(x s)x` | `I` | +| `(s x)x` | `K H_s` | +| `x(x s)` | `u` | +| `x(s x)` | `K K` | +| `s(x x)` | `H_s H_s →² H_s H_s K r`, an infinite head expansion | + +No choice returns n. The two recurrence equations preserve the head +redex while appending arguments; they are divergence proofs, not fuel caps. + +### Three lambdas and a positive index sum: application root + +A positive index requires two nested live binders in one subtree. The +other nonlinear binder is incomparable, closed, and has no other binder, +so is D. Closure and the five-leaf inventory leave exactly + +``` +R = N D, or R = D N, +``` + +where N contains one affine and one binary nonlinear binder and three +leaves. + +If the affine binder is outermost, positivity forces +`N=λa b.T(a,b,b)`. Both N D and D N reduce to a literal interface whose +body contains exactly one nonlinear binder: respectively D or one copy +of N. The public b binder does not count. `SelfintZero` excludes them. + +If the nonlinear binder is outermost and the affine binder is leading, +`N=λx y.T(x,x,y)`. N D reduces to the excluded 24-bit literal form. +For D N, first reduce to N N: + +| T | Obstruction | +| --- | --- | +| `(x x)y` | `(N N)s →² (N N)s`, a head cycle | +| `(x y)x` | `N N →* λy.y N y`, only one internal nonlinear binder | +| `(y x)x` | `(N N)(stream(I,n)) →* K` | +| `x(x y)` | `N N →* λy z.(N y)((N y)z)`, two leading lambdas | +| `x(y x)` | `N N →* λy z.(y N)(z(y N))`, two leading lambdas | +| `y(x x)` | With X=N N, `X[K,r] →⁷ X`; X already has a lambda head | + +For the fifth row, expanding N once gives +`λy.N(y N) → λy z.(y N)(z(y N))`. Two leading lambdas leave a lambda +after the one public input and cannot yield rigid n. In the last row, +`X → λy.y X`, so the returned X also cannot yield n. + +Finally suppose the inner affine binder is nonleading. It has one own +occurrence and, by positivity, exactly one captured x; the other x is +outside it. The only forms are + +``` +λx.(λy.x y)x, λx.(λy.y x)x, +λx.x(λy.x y), λx.x(λy.y x). +``` + +The first two beta-reduce to D, yielding Omega in either outer order. +For the third let `J(A)=λy.A y` and `N=λx.x J(x)`. N D reaches the +two-step cycle `D J(D) → J(D) J(D) → D J(D)`. For N N the infinite +head progression is + +``` +N J^k(N) → J^k(N) J^(k+1)(N) →* N J^(k+1)(N). +``` + +For the fourth use `J(A)=λy.y A`. N D reduces to Omega, and N N enters +the three-step cycle + +``` +N J(N) → J(N) J(J(N)) → J(J(N)) N → N J(N). +``` + +This exhausts the positive-index allocation. Hence no closed exact +remainder extractor has size at most 26, and **Rmin ≥ 27**. + +The reduction tables and representative recurrence equations passed the +fixed audit. The three-live-binder argument and the exhaustive allocation +classification are handwritten and have not been formalized or independently +reviewed. The Lean numerical remainder floor in this lane remains 18. + +## 5. Transfer, exactly + +For any self-interpreter E let `R_E=E F`, where `F=λv r.r` costs six bits. +Substitute F for the rigid continuation in the self-interpreter contract: + +``` +R_E (stream(M,N)) =β F (λz.M) N →* N. +``` + +This holds for every closed M, including divergent M, and every N. +The source application costs two more bits, so + +``` +|R_E| = |E| + 8, |E| ≥ Rmin − 8. +``` + +`RemainderChain.lean` now checks the general projection theorem, its exact +size equation, and `remainder_bound_transfers`: every universal remainder +bound n gives `SelfintSizeBound (n−8)`. It also checks the 18-bit numerical +remainder floor and that no universal remainder floor can exceed 70, +using the existing rem70 theorem. All these proofs audit to +`[propext, Quot.sound]`. + +The new handwritten remainder bound therefore gives only **|E|≥19**. +The established **34-bit handwritten / 18-bit Lean interpreter floors remain +the strongest overall floors cited here**. In principle this exact transfer +can yield at most 62 bits because rem70 exists. A 50- or 60-bit remainder +floor would give 42 or 52 respectively, but neither was proved. + +## 6. What is and is not priced + +The invariant audit gives: + +| Term | Bits | Live binders | Nonlinear binders | Incomparable pair | +| --- | ---: | ---: | ---: | --- | +| rem70 | 70 | 7 | 4 | yes | +| int165 F | 173 | 17 | 7 | yes | +| tower45 | 45 | 5 | 3 | yes | +| incomplete-APP 66 | 66 | 7 | 4 | yes | +| failed D D 63 | 63 | 6 | 4 | yes | + +The 66-bit near miss has exactly the same zero-branch recurrence and +growth behavior as rem70. It retains a second-tag test, but APP computes +`P(u) D` instead of `P(P(u))`: one context operand is missing. On `λx.x x` +it produces `K N` rather than N. Qualitative binder, branching, unary-skip, +and zero-growth constraints do not detect that error. + +There is no justified additive sum of a unary skipper, three tag branches, +a fixed-point wrapper, and two recursive calls. rem70 already shares the +context between the variable eraser and constructor recursion. A counter +or continuation protocol could share one recursive source occurrence +between the two sequential skips. The semantic requirement for APP is +real; a source-syntax charge for it has not been established. + +Nor can the interpreter's width-three theorem simply be assigned to R. +Its proof reconstructs the exact S combinator from interpreted source; +an extractor only forwards its suffix, which would already contain S if +that were chosen as the suffix. The proof that width comes from E does +not establish the same claim about R. + +The most useful next proof target is an **application-sensitive** invariant +of residual control: after the left child's entire encoding has been +discarded, a still-live obligation must consume exactly one further +source while remaining uniform in the arbitrary final suffix. It must +permit this obligation to be encoded in pending applications, shared +closures, or a counter; requiring two literal recursive call sites would +exclude architectures without proof. A quantitative charge for such +residual control, combined with the zero-reader mechanism, is the missing +step toward 50. I have no valid charge large enough to claim it. + +Constructively, a sub-70 reader would need to exploit actual-context or +actual-stream behavior in Q, or change the recursion protocol. The direct +fixed-point variants cost substantially more; the obvious D/partial-parse +diagonals fail, including the analytically resolved 67-bit loop. This is +not an optimality proof for rem70. + +## Reproduction + +From the repository root: + +``` +PYTHONDONTWRITEBYTECODE=1 python tmp/overnight/remainder/check.py +PYTHONDONTWRITEBYTECODE=1 python tmp/overnight/remainder/audit.py +``` + +From `lean/`, using the existing compiled dependencies and writing no +build output outside the lane: + +``` +LEAN_PATH=/Users/a9lim/Work/blam/lean/.lake/build/lib/lean lean -j 2 /Users/a9lim/Work/blam/tmp/overnight/remainder/RemainderChain.lean +LEAN_PATH=/Users/a9lim/Work/blam/lean/.lake/build/lib/lean lean -j 2 /Users/a9lim/Work/blam/tmp/overnight/remainder/Tower45.lean +``` + +The final outputs are recorded in `lean-checks.txt`, `checks.json`, and +`audit.json`. No existing Lean module or tracked artifact was changed. + +## 7. Application-sensitive residual control + +**Outcome of the follow-up.** The pending-source obligation is now precise +and checked in Lean, including its program-origin version and an unbounded +family of distinguishable pending depths. Three proposed ways of charging +it to original syntax are false: a complete extractor need not have a third +nonlinear binder, a third live capturing binder, or a second width-three +subterm. A new **647-bit** counterexample proves all three facts at once; +its full contract and exact structural counts are kernel-checked. + +A separate handwritten theorem proves **70 bits is optimal in the restricted +rem70 frame with an opaque, lambda-free Q body**. This is a genuine charge +for two sequential skips in that frame, not a global 70-bit bound. Two new +65-bit attempts to pack the pending pair into one argument fail, with +kernel-checked counterexamples. No sub-70 complete extractor was found. +The unconditional numerical result remains the handwritten **27 ≤ Rmin ≤ 70** +from section 4, subject to its stated review boundary. Its transfer remains +**|E| ≥ 19**, and does not improve the coordinating global lane's handwritten +37-bit interpreter floor (`../global/PROOF37.md`). + +### 7.1 Exact obligation: semantic derivatives, without an assumed parser + +Write `p ++ S` for the Scott stream of the finite word p with tail S. +For a closed exact extractor R define + +``` +D_p(S) = R (p ++ S). +``` + +For every closed M, closed Q, and arbitrary S,N, correctness gives + +``` +D_code(M)(S) =β S, +D_(01 code(M))(code(Q) ++ N) =β N. +``` + +The first residual is done. The second must still extract one complete +source, uniformly in the final suffix. They cannot be the same residual +operation: supply both with `code(I) ++ n`, with n rigid. The first gives +the nonempty Scott stream `code(I) ++ n`, an outer lambda; the second +gives n. An outer lambda cannot beta-join a rigid variable, by confluence. +This proof applies to every closed M, so in particular to the unbounded +family `M=λ^m.I`, and does not evaluate M or assume that M normalizes. + +This is the precise sense of "flat" excluded here: identifying the +operations for zero and one pending sources. It is not the unrelated +`SelfintGrowthOrigins.Flat` predicate on a single closed lambda. + +There are actually infinitely many necessary modes. Put + +``` +w = code(I), +p_k = (01)^k code(M), +C_k = (((M I) I) ... I), k right children, +code(C_k) = p_k w^k. +``` + +For `i0. These are not finite-depth tests. + +### 7.2 What must survive a uniform cut, including origins + +Suppose the open residual body B has only its tail variable free and +satisfies the uniform cut equation + +``` +R (01 code(M) ++ S) =β B[S] for every S. +``` + +Then `λs.B` is itself an exact closed-source remainder extractor. Therefore +B contains two incomparable nonlinear binders. This follows from the +earlier remainder theorem, not from interpreting a divergent source as +an output. It requires only closed next sources and closed suffixes for +the nonlinear/chain contradiction. + +The origin statement is also checked. Mark original reader lambdas red +and the finite prefix's Scott cells and Boolean lambdas blue. Start with + +``` +red(R) (blue_stream(01 code(M), rigid_s)) +``` + +and take any color-preserving beta trace to a residual b whose erasure +has only s free. `QuoteOrigins.Marked.good_steps` preserves the protected +shape of blue lambdas; `good_blueAffine` makes every blue lambda affine. +Substituting for rigid s transports this same trace to every actual suffix, +so the cut equation above holds. The two incomparable nonlinear binders +in b must consequently have **reader origin**. In particular +`2 ≤ Marked.redCount b`. + +`marked_pending_has_code` checks this argument using the existing origin +machinery. It returns the red-count bound and non-chain property. It does +not require old prefix garbage to have disappeared; when a clean cut does +exist it applies there too. Conversely, the exact contract alone does not +assert that every implementation exposes a syntactically clean cut before +looking at the next source. The unconditional object is the semantic +derivative; a particular operational factorization needs its own proof. + +This is the charging obstruction: the two required residual binders may be +copies of the same original pair that processed the left child. The theorem +does not provide two additional original binders, a second independent code +package, or additive original wire cost. + +### 7.3 Three proposed source charges have checked counterexamples + +First, the existing 584-bit interpreter gives + +``` +rem592 = intL584 F. +``` + +It is a complete closed-source extractor with exactly **two nonlinear +binders**, both closed as standalone lambda subterms. `rem592_contract`, +`rem592_two_nonlinear`, and `rem592_nonlinear_closed` are in +`ResidualControl.lean`. Hence application parsing does not force a third +nonlinear binder or a nonlinear capturing binder. + +The new construction `shared_s_remainder.lam` / `.blc` is more discriminating. +Compile rem70 by the ordinary beta-exact SKI abstraction rules + +``` +[x]x = I, +[x]T = K T when x is absent, +[x](U V) = S ([x]U) ([x]V), +S = λx y z.x z (y z). +``` + +There is no eta shortcut. Abstract every source lambda, then replace all +copies of S by one let-bound variable: + +``` +(λs. compiled_expression(s,K,I)) S. +``` + +The resulting exact source costs **647 bits**. K and I are affine; each +inserted K and I is closed. The shared s binder and S's z binder are the +only nonlinear binders. The only live capturing binders are S's y and z. +The only subterm with three or more distinct free variables is the single +body `x z (y z)` inside the one literal S. Thus the source has exactly + +``` +nonlinear binders 2, +live capturing binders 2, +width-three subterms 1. +``` + +`SharedS647.lean` checks 413 explicit beta steps to the same 114-bit normal +form as rem70, then derives the complete contract for **all sources, +including open sources, and arbitrary suffixes** by confluence and +`rem70_contract`. It also computes all three structural counts in the +kernel. `widthWitnesses` counts actual subterm occurrences, not merely +distinct triples of variable names. The count is one in the whole reader +and zero in the compiled body outside S. + +The structural count theorems use no axioms. The semantic contract's axiom +audit is `[propext, Quot.sound]`. The 647 is not a size improvement; it +refutes the proposed qualitative increments. The same translation explains +how expanding residual control can be generated from one shared width +witness. This does not establish a width-three lower bound for extractors; +that separate necessity remains unproved here. + +### 7.4 A tight conditional price: the existing opaque frame costs 70 + +Consider exactly this source architecture: + +``` +R_Q = λs.(λd.s d d) (λb r.r (b Q r)), +Q = λt u d.H(t,u,d), +``` + +where H is an application tree of t,u,d, with **no further lambdas**, and Q +satisfies the following laws for **rigid, independent** u and d: + +``` +Q K u d =β u d d, +Q F u d =β u d d d d. +``` + +These opaque laws are stronger than correctness when d is the one actual +recursive context. They are explicit hypotheses, not consequences asserted +for every closed-source extractor. + +Let T,U,D count t,u,d leaves in H. After substituting K or F for t, every +contracted lambda is affine: H contributes no lambdas of its own. The +application law therefore implies D≥4 and U≥1. The two different laws +imply T≥1. H cannot have rigid head u, because its top-level arity would +be fixed in both cases; it cannot have rigid head d either. Hence + +``` +H = t A1 A2 A3 ... Am, m≥2. +``` + +If U=1, that sole u cannot occur in A1 or A2, since one Boolean selection +would erase it. It must occur in a later argument. Both selected branches +A1 and A2 must then become functions capable of reaching that later u. +Each must contain t: without t or u, it is an inert application tree of +the rigid d. Thus **U≥2 or T≥3**. + +The exact wire cost in this binder order is + +``` +|Q| = 4 + 6T + 5U + 4D. +``` + +If U≥2 the minimum is 36; if U=1 it is at least 43. Therefore |Q|≥36. +Equality forces `(T,U,D)=(1,2,4)`. There is one u in each selected branch +and no further t. If k common trailing d arguments follow the selector, +the branches must contain respectively 2−k and 4−k d arguments. The four +available d leaves give `6−k=4`, so k=2. The unique equality form is + +``` +H = t u (u d d) d d. +``` + +Finally the reader adapter costs 17 bits and the rest of D costs 17: + +``` +|R_Q| = |Q| + 34 ≥ 70. +``` + +The semantic leaf argument and uniqueness classification are handwritten. +`frame_size`, `next_size`, and `opaque_leaf_price` check the wire accounting +and final arithmetic in Lean. The existing rem70 clauses check attainment. +This rules out a smaller Q in the displayed opaque, lambda-free frame. +It does not rule out extra lambdas, a different reader interface, or use +of the actual d's behavior. In particular it is **not Rmin ≥ 70**. + +### 7.5 Exact behavior of the required controls and two 65-bit attempts + +For rem70, `P(s)=s D D` and APP gives `P(P(u))`. If +`u=code(M1) ++ S`, the inner parse reduces to S uniformly, leaving + +``` +S D D = P(S). +``` + +This is the retained one-source obligation. It is carried by two pending +applications of existing code; no new source binder is implied. + +Tower45 fails earlier than a clean-cut account would suggest. Lean proves +the exact all-suffix identity + +``` +tower45 (010 ++ r) →* r. +``` + +Thus on `01 code(M1) code(M2) ++ N` with a zero-headed left child, it +removes only the first bit of M1. In particular this fails for every +closed tower left child. On the closed source `λx.x x` it returns +`10 ++ N`. The 51-bit partial reader is a more literal flat-cut example: +it discards the second tag and, for a tower left child, reaches S with +no pending parser at all. Its measured width is only two. + +For the 66-bit near miss, APP instead produces + +``` +u D D D = P(u) D. +``` + +After a correctly parsed left tower, the residual is **S D**, one operand +short of the required S D D. If the right child is a variable under a +closing source lambda, S D becomes K N. On a closed right child such as I, +the result is a different unresolved reader abstraction; it is not generally +K N. The exact K N counterexample is the closed source `λx.x x`. +The failure is the wrong retained control, not merely forgetting that +some work remains. + +The 165 projection E F satisfies the same derivative theorem by its full +contract. Its continuation-passing implementation is admitted without +requiring the displayed rem70 factorization. It passes all tests below. + +Two reasoning-derived 65-bit alternatives kept D's frame but used + +``` +Q_tail = λt u d.u d (t d (d d)), +Q_handler = λt u d.u (t d (d d)) d. +``` + +Both preserve ABS. They attempt to pack the APP obligation into the tail +operand or handler operand. On `λx.x x`, with rigid suffix n, their exact +normal forms are respectively + +``` +10 ++ n, +λa.a a K n a. +``` + +The tail packing is erased by the first variable's unary-skip return; +the handler packing changes the operation rather than composing two +parses. `FixedResiduals.lean` kernel-checks these two counterexamples and +the corresponding tower45 and near66 failures. Each is proved not to be +an exact remainder extractor. No cap is used as a refutation. + +### 7.6 Checks, artifacts, and remaining bound + +`residual_checks.py` runs the original 240 exact probes plus 20 closed +left-comb sources (left tower depths 0,1,4,12 and pending depths 0..4), +plus `λx.(λy.y) x`: **261 cases per construction**, at most two workers. + +| Construction | Bits | Pass | Wrong normal form | Capped | +| --- | ---: | ---: | ---: | ---: | +| rem70 | 70 | 261 | 0 | 0 | +| tower45 | 45 | 31 | 230 | 0 | +| tower51 | 51 | 31 | 230 | 0 | +| near66 | 66 | 31 | 230 | 0 | +| int165 F | 173 | 261 | 0 | 0 | +| shared-S rem70 | 647 | 261 | 0 | 0 | +| int584 F | 592 | 261 | 0 | 0 | +| tail packing | 65 | 31 | 210 | 20 | +| handler packing | 65 | 31 | 230 | 0 | + +The initial run took 3.608 s. The shared-S reader's 48-lambda tower alone +exhausted the original 12,000-beta budget; one 50,000-beta retry passed in +0.006 s. Both initial and final counts are retained in +`residual-checks.json`. The 20 tail-packing caps remain unresolved clocks; +the separate exact counterexample already refutes that candidate. + +All new semantic Lean theorems audit to `[propext, Quot.sound]`; none uses +`sorryAx`. The new sources are `ResidualControl.lean`, `SharedS647.lean`, +and `FixedResiduals.lean`. `pin_shared.py` and `pin_failures.py` regenerate +the finite trace files. The former trace is 413 steps; the four failure +traces are 36,45,33,40 steps. Final compiler output and elapsed times are +in `lean-residual-checks.txt`. No new complete interpreter was built. + +The next genuinely quantitative gap is now explicit: source syntax must +generate the infinitely distinguishable pending operations, but one shared +nonlinear pair and one shared width witness suffice to do so. A proof must +charge the **amount of source syntax implementing this sharing**, or exclude +small ways of doing it, rather than charge a new binder or width witness +for each recursive obligation. The restricted 70-bit theorem supplies that +charge in one frame. I do not have a valid global charge beyond section 4's +27-bit floor, so neither Rmin ≥ 50 nor Rmin ≥ 60 is claimed. + +To reproduce the new checks from the repository root: + +``` +PYTHONDONTWRITEBYTECODE=1 python tmp/overnight/remainder/residual_checks.py +PYTHONDONTWRITEBYTECODE=1 python tmp/overnight/remainder/pin_shared.py +PYTHONDONTWRITEBYTECODE=1 python tmp/overnight/remainder/pin_failures.py +``` + +For Lean, run from `lean/`, set +`LEAN_PATH=$PWD/.lake/build/lib/lean:$PWD/../tmp/overnight/remainder`, and use +`lean -j 2 -R ../tmp/overnight/remainder`. First compile `RemainderChain.lean` +and `Tower45.lean` with their `-o` paths inside the lane. Compile +`ResidualControl.lean` to its lane-local `.olean`, then check `SharedS647.lean` +and `FixedResiduals.lean`. All authored files and local build outputs remain +inside the remainder lane. diff --git a/data/self-interpreter/reasoning_floor/remainder/audit.json b/data/self-interpreter/reasoning_floor/remainder/audit.json new file mode 100644 index 00000000..76da4ee8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/audit.json @@ -0,0 +1,290 @@ +{ + "checks": [ + { + "label": "24-sDD", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "24-DsD", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "24-D-sD", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "24-D-Ds", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "26-sDJ", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "26-sJD", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "26-DsJ", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "26-DJs", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "26-JDs", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "26-s-DJ", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "26-s-JD", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "26-D-sJ", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "26-J-sD", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "26-J-Ds", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "25-dependent-xyx", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "25-dependent-yxx", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "25-dependent-xxy", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "25-dependent-xyx-right", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "25-dependent-xxs-loop", + "kind": "head-steps", + "steps": 1, + "pass": true + }, + { + "label": "25-dependent-sxx-loop", + "kind": "head-steps", + "steps": 2, + "pass": true + }, + { + "label": "26-closed-xxy-loop", + "kind": "head-steps", + "steps": 2, + "pass": true + }, + { + "label": "26-closed-xyx-one-internal-nonlinear", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "26-closed-yxx", + "kind": "beta-normal-forms", + "pass": true + }, + { + "label": "26-closed-yxx-right-returns-reader", + "kind": "head-steps", + "steps": 7, + "pass": true + }, + { + "label": "25-Neta-Delta-enters-loop", + "kind": "head-steps", + "steps": 1, + "pass": true + }, + { + "label": "25-Neta-Delta-loop", + "kind": "head-steps", + "steps": 2, + "pass": true + }, + { + "label": "25-Neta-growing-loop-0", + "kind": "head-steps", + "steps": 1, + "pass": true + }, + { + "label": "25-Neta-growing-loop-1", + "kind": "head-steps", + "steps": 2, + "pass": true + }, + { + "label": "25-Neta-growing-loop-3", + "kind": "head-steps", + "steps": 4, + "pass": true + }, + { + "label": "25-Nflip-Delta-to-Omega", + "kind": "head-steps", + "steps": 4, + "pass": true + }, + { + "label": "25-Nflip-self-cycle", + "kind": "head-steps", + "steps": 3, + "pass": true + }, + { + "label": "67-triple-first-zero", + "kind": "head-steps", + "steps": 12, + "pass": true + }, + { + "label": "67-triple-all-Q-divergent-prefix", + "kind": "head-steps", + "steps": 13, + "pass": true + } + ], + "inventory": { + "reference70": { + "bits": 70, + "LAX": [ + 7, + 12, + 6 + ], + "live": 7, + "nonlinear": 4, + "incomparable_nonlinear": true, + "nonlinear_paths": [ + "bf", + "bab", + "babbafab", + "babbafabb" + ] + }, + "int165_projection": { + "bits": 173, + "LAX": [ + 19, + 26, + 29 + ], + "live": 17, + "nonlinear": 7, + "incomparable_nonlinear": true, + "nonlinear_paths": [ + "ff", + "fa", + "fabf", + "fabfb", + "fabfbbfb", + "fabfbbaba", + "fabfbbababaaba" + ] + }, + "tower45": { + "bits": 45, + "LAX": [ + 5, + 7, + 5 + ], + "live": 5, + "nonlinear": 3, + "incomparable_nonlinear": true, + "nonlinear_paths": [ + "bf", + "bab", + "babb" + ] + }, + "drop_second_skip_failed": { + "bits": 66, + "LAX": [ + 7, + 11, + 6 + ], + "live": 7, + "nonlinear": 4, + "incomparable_nonlinear": true, + "nonlinear_paths": [ + "bf", + "bab", + "babbafab", + "babbafabb" + ] + }, + "diagonal63_failed": { + "bits": 63, + "LAX": [ + 6, + 11, + 5 + ], + "live": 6, + "nonlinear": 4, + "incomparable_nonlinear": true, + "nonlinear_paths": [ + "f", + "ab", + "abbafab", + "abbafabb" + ] + }, + "triple67_capped": { + "bits": 67, + "LAX": [ + 6, + 12, + 5 + ], + "live": 6, + "nonlinear": 4, + "incomparable_nonlinear": true, + "nonlinear_paths": [ + "f", + "ab", + "abbafab", + "abbafabb" + ] + } + }, + "elapsed_s": 0.0024955000044428743, + "scope": "Fixed handwritten proof equations; no extractor enumeration." +} diff --git a/data/self-interpreter/reasoning_floor/remainder/audit.py b/data/self-interpreter/reasoning_floor/remainder/audit.py new file mode 100644 index 00000000..5e7c8d8d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/audit.py @@ -0,0 +1,189 @@ +#!/usr/bin/env python3 +"""Replay fixed equations in the handwritten <=26-bit exclusion. + +This is a proof-equation audit, not a candidate generator or size census. +Divergence claims are checked by finite recurrence identities, never by caps. +""" +import json +from pathlib import Path +import signal +import sys +import time +sys.dont_write_bytecode = True +from check import HERE, CANDIDATES, parse, lc, stats + +signal.alarm(100) +start = time.monotonic() +A = lambda f, a: ('A', f, a) +V = lambda n: ('V', n) +L = lambda b: ('L', b) +S = lc.bitlist('0010', V(0)) +r = lc.bitlist('010', V(0)) +u = lc.bitlist('10', V(0)) +Dsrc = r'\x.x x' +Jsrc = rf'\z.({Dsrc})' +D = parse(Dsrc) +J = parse(Jsrc) +K = lc.TRUE +I = parse(r'\x.x') +rows = [] + +def equal_nf(label, left, right): + ln = lc.nf(left, [4000]) + rn = lc.nf(right, [4000]) + assert ln == rn, (label, lc.show(ln), lc.show(rn)) + rows.append({'label': label, 'kind': 'beta-normal-forms', 'pass': True}) + +def source_at_I(src): + return L(A(parse(src), S)) + +def head_step(t): + if t[0] != 'A': + raise AssertionError('not a weak-head redex') + if t[1][0] == 'L': + return lc.beta(t[1], t[2]) + return A(head_step(t[1]), t[2]) + +def head_eq(label, left, count, right): + for _ in range(count): + left = head_step(left) + assert left == right, (label, lc.show(left), lc.show(right)) + rows.append({'label': label, 'kind': 'head-steps', 'steps': count, 'pass': True}) + +# The four terminating layouts with leaves s,D,D. The other two contain +# the unchanged head-divergent Omega after invocation. +for label, body, expected in [ + ('24-sDD', f's ({Dsrc}) ({Dsrc})', A(K, D)), + ('24-DsD', f'({Dsrc}) s ({Dsrc})', r), + ('24-D-sD', f'({Dsrc}) (s ({Dsrc}))', A(K, K)), + ('24-D-Ds', f'({Dsrc}) (({Dsrc}) s)', r), +]: + equal_nf(label, source_at_I('\\s.' + body), L(expected)) + +# Ten terminating layouts of s,D,J with J=K D. The other two reduce to Omega. +for label, body, expected in [ + ('26-sDJ', f's ({Dsrc}) ({Jsrc})', A(K, J)), + ('26-sJD', f's ({Jsrc}) ({Dsrc})', u), + ('26-DsJ', f'({Dsrc}) s ({Jsrc})', r), + ('26-DJs', f'({Dsrc}) ({Jsrc}) s', A(K, r)), + ('26-JDs', f'({Jsrc}) ({Dsrc}) s', A(K, r)), + ('26-s-DJ', f's (({Dsrc}) ({Jsrc}))', K), + ('26-s-JD', f's (({Jsrc}) ({Dsrc}))', K), + ('26-D-sJ', f'({Dsrc}) (s ({Jsrc}))', u), + ('26-J-sD', f'({Jsrc}) (s ({Dsrc}))', D), + ('26-J-Ds', f'({Jsrc}) (({Dsrc}) s)', D), +]: + equal_nf(label, source_at_I('\\s.' + body), L(expected)) + +# The dependent helper H_s=λx.T(x,x,s), in λs.Δ H_s. +for label, body, expected in [ + ('25-dependent-xyx', 'x s x', I), + ('25-dependent-yxx', 's x x', None), + ('25-dependent-xxy', 'x (x s)', u), + ('25-dependent-xyx-right', 'x (s x)', A(K, K)), +]: + H = lc.beta(parse(r'\s.\x.' + body), S) + if expected is None: + expected = A(K, H) + equal_nf(label, L(A(H, H)), L(expected)) + +H = lc.beta(parse(r'\s\x.x x s'), S) +X = A(H, H) +head_eq('25-dependent-xxs-loop', X, 1, A(X, S)) +H = lc.beta(parse(r'\s\x.s (x x)'), S) +X = A(H, H) +head_eq('25-dependent-sxx-loop', X, 2, A(A(X, K), r)) + +# Closed N=λx y.T(x,x,y), in Δ N. +N = parse(r'\x\y.x x y') +X = A(N, N) +head_eq('26-closed-xxy-loop', A(X, S), 2, A(X, S)) +N = parse(r'\x\y.x y x') +expected = parse(r'\y.y (\x\y.x y x) y') +equal_nf('26-closed-xyx-one-internal-nonlinear', A(N, N), expected) +N = parse(r'\x\y.y x x') +equal_nf('26-closed-yxx', L(A(A(N, N), S)), L(K)) +N = parse(r'\x\y.y (x x)') +X = A(N, N) +head_eq('26-closed-yxx-right-returns-reader', A(X, S), 7, X) + +# The two nonleading affine helpers, with J(A)=λy.A y or λy.y A. +Neta = parse(r'\x.x (\y.x y)') +def eta(t): + return L(A(lc.shift(1, 0, t), V(0))) +Jdelta = eta(D) +head_eq('25-Neta-Delta-enters-loop', A(Neta, D), 1, A(D, Jdelta)) +head_eq('25-Neta-Delta-loop', A(D, Jdelta), 2, A(D, Jdelta)) +for k in [0, 1, 3]: + arg = Neta + for _ in range(k): + arg = eta(arg) + head_eq('25-Neta-growing-loop-' + str(k), A(Neta, arg), k + 1, A(Neta, eta(arg))) + +Nflip = parse(r'\x.x (\y.y x)') +def flip(t): + return L(A(V(0), lc.shift(1, 0, t))) +Jn = flip(Nflip) +head_eq('25-Nflip-Delta-to-Omega', A(Nflip, D), 4, A(D, D)) +head_eq('25-Nflip-self-cycle', A(Nflip, Jn), 3, A(Nflip, Jn)) + +# The capped 67-bit bootstrap is analytically divergent, not merely slow. +# QQQQ, and every all-Q head spine with at least three arguments, stays +# head-reducible forever: Q t u d supplies four fresh all-Q arguments to t. +Q70 = parse(r'\t\u\d.t u (u d d) d d') +D70 = parse(r'\b\r.r (b (\t\u\d.t u (u d d) d d) r)') +def apps(head, *args): + for arg in args: + head = A(head, arg) + return head +X = apps(Q70, Q70, D70) +Y = apps(X, Q70, Q70) +H = apps(D70, Q70, D70) +AA = apps(D70, Q70, Q70) +BB = apps(AA, Q70, Q70) +CC = apps(AA, Q70, BB) +qqq = apps(Q70, Q70, Q70) +head_eq('67-triple-first-zero', apps(D70, D70, D70, S), 12, + apps(Y, S, apps(S, K, K), K, K, r)) +head_eq('67-triple-all-Q-divergent-prefix', Y, 13, + apps(Q70, Q70, Q70, Q70, qqq, Q70, Q70, CC, + Q70, Q70, Q70, Q70)) + +def occ(t, index=0): + if t[0] == 'V': + return int(t[1] == index) + if t[0] == 'L': + return occ(t[1], index + 1) + return occ(t[1], index) + occ(t[2], index) + +def binding_inventory(t): + live = [] + nonlinear = [] + def go(t, path): + if t[0] == 'L': + count = occ(t[1]) + if count: + live.append(path) + if count > 1: + nonlinear.append(path) + go(t[1], path + 'b') + elif t[0] == 'A': + go(t[1], path + 'f') + go(t[2], path + 'a') + go(t, '') + return {'live': len(live), 'nonlinear': len(nonlinear), + 'incomparable_nonlinear': any(not a.startswith(b) and not b.startswith(a) + for a in nonlinear for b in nonlinear), 'nonlinear_paths': nonlinear} + +inventory = {} +for name in ['reference70', 'int165_projection', 'tower45', + 'drop_second_skip_failed', 'diagonal63_failed', 'triple67_capped']: + t = parse(CANDIDATES[name][0]) + inventory[name] = {'bits': lc.size(t), 'LAX': stats(t), **binding_inventory(t)} + +elapsed = time.monotonic() - start +out = {'checks': rows, 'inventory': inventory, 'elapsed_s': elapsed, + 'scope': 'Fixed handwritten proof equations; no extractor enumeration.'} +(HERE / 'audit.json').write_text(json.dumps(out, indent=2) + '\n') +print(f"fixed-equation checks={len(rows)} pass={len(rows)} elapsed={elapsed:.4f}s") +print(json.dumps(inventory, indent=2)) diff --git a/data/self-interpreter/reasoning_floor/remainder/check.py b/data/self-interpreter/reasoning_floor/remainder/check.py new file mode 100644 index 00000000..580446b5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/check.py @@ -0,0 +1,159 @@ +#!/usr/bin/env python3 +"""Fixed, reasoning-derived remainder candidates; no candidate enumeration. + +Every checked input is closed as a lambda term by binding the rigid suffix n. +The encoded source is not evaluated, so divergent sources have no skip case. +All writes stay beside this script. At most two blam children run together. +""" +from concurrent.futures import ThreadPoolExecutor +from functools import lru_cache +import json +import os +from pathlib import Path +import signal +import subprocess +import sys +import time + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +sys.dont_write_bytecode = True +sys.path[:0] = [str(ROOT / 'tools'), str(ROOT / 'tools/self-interpreter')] +import blcc +import lc + +def parse(src): + src = blcc.strip_comments(src) + p = blcc.P(src) + term = blcc.to_db(blcc.p_lc(p)) + p.ws() + assert p.i == len(src) + return term + +@lru_cache(None) +def sources(n, depth=0): + out = [] + if n >= 2 and n - 2 < depth: + out.append(('V', n - 2)) + if n >= 4: + out.extend(('L', b) for b in sources(n - 2, depth + 1)) + for i in range(2, n - 3): + out.extend(('A', f, a) for f in sources(i, depth) + for a in sources(n - 2 - i, depth)) + return tuple(out) + +def bind(n, t): + for _ in range(n): + t = ('L', t) + return t + +def probes(): + cases = [('closed-' + lc.enc(t), t, 'closed16') + for n in range(4, 17) for t in sources(n)] + omega = parse(r'(\x.x x) (\x.x x)') + ident = parse(r'\x.x') + extras = [('Omega', omega), ('lambda-Omega', ('L', omega)), + ('Omega-I', ('A', omega, ident)), ('I-Omega', ('A', ident, omega)), + ('deep-16', bind(16, ('V', 15))), + ('deep-40', bind(40, ('V', 39))), + ('tower-48', bind(48, ident)), + ('deep-app', bind(16, ('A', ('V', 15), ('V', 0))))] + cases.extend((label, t, 'closed-extra') for label, t in extras) + cases.extend(('open-var-' + str(i + 1), ('V', i), 'open-extra') + for i in [0, 1, 4, 15, 39]) + cases.extend([('open-app', parse(r'\x.x'), 'open-extra')]) + cases[-1] = ('open-app', ('A', ('V', 4), ('L', ('V', 2))), 'open-extra') + return cases + +Q = r'\t\u\d.t u (u d d) d d' +D = rf'\b\r.r (b ({Q}) r)' +CANDIDATES = { + 'reference70': (rf'\s.(\d.s d d) ({D})', 'all sources'), + 'floated71': (rf'(\d\s.s d d) ({D})', 'all sources'), + 'diagonal63_failed': (rf'(\d.d d) ({D})', 'hypothesis'), + 'triple67_capped': (rf'(\d.d d d) ({D})', 'hypothesis'), + 'right_diagonal67': (rf'(\d.d (d d)) ({D})', 'hypothesis'), + 'partial_diagonal69': (rf'\s.(\x.x x) (s ({D}))', 'hypothesis'), + 'drop_second_skip_failed': + (r'\s.(\d.s d d) (\b\r.r (b (\t\u\d.t u (u d) d d) r))', 'hypothesis'), + 'unary_only': (r'\s.s s s', 'variable sources only'), + 'zero_tower_only': (r'(\x.x x) (\x\s.s (\b\r.b (r (\t\u.x x u)) (r r r)))', + 'lambda towers ending in a variable only'), + 'tower45': (r'\s.(\d.s d d) (\b\r\d.r (b d r) d)', + 'all zero prefixes followed by a unary variable code; not applications'), + 'tower51': (r'\s.(\d.s d d) (\b\r.r (b (\t\u\d.u d d) r))', + 'lambda towers ending in a variable only; not applications'), + 'fixedpoint_direct': + (r'(\x.x x) (\x.(\p\s.s (\b\r.b (r (\t\u.p (t u (p u)))) (r r r))) (x x))', + 'all sources'), + 'fixedpoint_select_after': + (r'(\x.x x) (\x.(\p\s.s (\b\r.b (r (\t\u.t (p u) (p (p u)))) (r r r))) (x x))', + 'all sources'), + 'int165_projection': + ('(' + (ROOT / 'data/self-interpreter/machines/int165.lam').read_text() + + r') (\v\r.r)', 'closed sources (the internal parser also covers open syntax)'), +} + +def stats(t): + if t[0] == 'V': + return (0, 0, t[1]) + if t[0] == 'L': + l, a, x = stats(t[1]) + return l + 1, a, x + x, y = stats(t[1]), stats(t[2]) + return x[0] + y[0], x[1] + y[1] + 1, x[2] + y[2] + +def check(probe): + label, m, group, r = probe + term = ('L', ('A', r, lc.bitlist(lc.enc(m), ('V', 0)))) + try: + run = subprocess.run([str(ROOT / 'target/release/blam'), 'normalize', + lc.enc(term), '--beta', '12000'], + capture_output=True, text=True, timeout=3, + env={**os.environ, 'RAYON_NUM_THREADS': '1'}) + except subprocess.TimeoutExpired: + return {'label': label, 'group': group, 'verdict': 'timeout'} + words = run.stdout.split() + if run.returncode or not words or not set(words[0]) <= {'0', '1'}: + return {'label': label, 'group': group, 'verdict': 'capped-or-error', + 'returncode': run.returncode, 'stdout': run.stdout[:200], + 'stderr': run.stderr[:200]} + return {'label': label, 'group': group, + 'verdict': 'pass' if words[0] == '0010' else 'fail', + **({} if words[0] == '0010' else {'normal_form': words[0][:500]})} + +def main(): + signal.alarm(110) + start = time.monotonic() + all_probes = probes() + wanted = sys.argv[1:] or list(CANDIDATES) + results = [] + with ThreadPoolExecutor(max_workers=2) as pool: + for name in wanted: + src, contract = CANDIDATES[name] + t = parse(src) + (HERE / (name + '.lam')).write_text(src + '\n') + (HERE / (name + '.blc')).write_text(lc.enc(t) + '\n') + run_probes = all_probes + checked = list(pool.map(check, [(*p, t) for p in run_probes])) + counts = {v: sum(c['verdict'] == v for c in checked) + for v in ['pass', 'fail', 'capped-or-error', 'timeout']} + record = {'name': name, 'bits': lc.size(t), 'LAX': stats(t), + 'intended_contract': contract, 'counts': counts, + 'tested': len(checked), 'groups': {}, + 'failures': [c for c in checked if c['verdict'] != 'pass']} + for group in ['closed16', 'closed-extra', 'open-extra']: + relevant = [c for c in checked if c['group'] == group] + record['groups'][group] = {v: sum(c['verdict'] == v for c in relevant) + for v in counts} + results.append(record) + print(f"{name}: {lc.size(t)} bits pass={counts['pass']} fail={counts['fail']} " + f"capped={counts['capped-or-error']} timeout={counts['timeout']} " + f"tested={len(checked)}", flush=True) + elapsed = time.monotonic() - start + (HERE / 'checks.json').write_text(json.dumps({'elapsed_s': elapsed, + 'threads': 2, 'source_cases': len(all_probes), 'results': results}, indent=2) + '\n') + print(f'elapsed={elapsed:.3f}s', flush=True) + +if __name__ == '__main__': + main() diff --git a/data/self-interpreter/reasoning_floor/remainder/checks.json b/data/self-interpreter/reasoning_floor/remainder/checks.json new file mode 100644 index 00000000..83e72630 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/checks.json @@ -0,0 +1,13350 @@ +{ + "elapsed_s": 4.921741375001147, + "threads": 2, + "source_cases": 240, + "results": [ + { + "name": "reference70", + "bits": 70, + "LAX": [ + 7, + 12, + 6 + ], + "intended_contract": "all sources", + "counts": { + "pass": 240, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 226, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "closed-extra": { + "pass": 8, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "open-extra": { + "pass": 6, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + } + }, + "failures": [] + }, + { + "name": "floated71", + "bits": 71, + "LAX": [ + 7, + 12, + 7 + ], + "intended_contract": "all sources", + "counts": { + "pass": 240, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 226, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "closed-extra": { + "pass": 8, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "open-extra": { + "pass": 6, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + } + }, + "failures": [] + }, + { + "name": "diagonal63_failed", + "bits": 63, + "LAX": [ + 6, + 11, + 5 + ], + "intended_contract": "hypothesis", + "counts": { + "pass": 0, + "fail": 240, + "capped-or-error": 0, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 0, + "fail": 226, + "capped-or-error": 0, + "timeout": 0 + }, + "closed-extra": { + "pass": 0, + "fail": 8, + "capped-or-error": 0, + "timeout": 0 + }, + "open-extra": { + "pass": 0, + "fail": 6, + "capped-or-error": 0, + "timeout": 0 + } + }, + "failures": [ + { + "label": "closed-0010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011011110" + }, + { + "label": "closed-000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-00000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111110" + }, + { + "label": "closed-000000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111110" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0000000011110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111110" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-00000000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-000000000011110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0000000000111110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111111110" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111111111110" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111111111110" + }, + { + "label": "deep-16", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001" + }, + { + "label": "deep-40", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100" + }, + { + "label": "tower-48", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000" + }, + { + "label": "open-var-1", + "group": "open-extra", + "verdict": "fail", + "normal_form": "0001010101010101010110000010000101100000110110010110000010000010000010000010000010000101100000110110000010000101100000110110" + }, + { + "label": "open-var-2", + "group": "open-extra", + "verdict": "fail", + "normal_form": "000101010101010101100001011000001000010110000011011100110000010000010000010000010000101100000100001011000001101110000010000101100000100001011000001101110" + }, + { + "label": "open-var-5", + "group": "open-extra", + "verdict": "fail", + "normal_form": "000101010110000010000101100000100001011000001000010110000010000101100000100001011000001101111110000010000101100000100001011000001000010110000010000101100000100001011000001101111110" + }, + { + "label": "open-var-16", + "group": "open-extra", + "verdict": "fail", + "normal_form": "00010101010101010110000101100000100001011000001101110000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111110000010000010000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111" + }, + { + "label": "open-var-40", + "group": "open-extra", + "verdict": "fail", + "normal_form": "00010101010101010110000101100000100001011000001101110000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111110" + } + ] + }, + { + "name": "triple67_capped", + "bits": 67, + "LAX": [ + 6, + 12, + 5 + ], + "intended_contract": "hypothesis", + "counts": { + "pass": 0, + "fail": 0, + "capped-or-error": 240, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 0, + "fail": 0, + "capped-or-error": 226, + "timeout": 0 + }, + "closed-extra": { + "pass": 0, + "fail": 0, + "capped-or-error": 8, + "timeout": 0 + }, + "open-extra": { + "pass": 0, + "fail": 0, + "capped-or-error": 6, + "timeout": 0 + } + }, + "failures": [ + { + "label": "closed-0010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000011110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000000001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000000011110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000000000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000000111110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000000001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "deep-16", + "group": "closed-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "deep-40", + "group": "closed-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "tower-48", + "group": "closed-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "open-var-1", + "group": "open-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "open-var-2", + "group": "open-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "open-var-5", + "group": "open-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "open-var-16", + "group": "open-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "open-var-40", + "group": "open-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + } + ] + }, + { + "name": "right_diagonal67", + "bits": 67, + "LAX": [ + 6, + 12, + 5 + ], + "intended_contract": "hypothesis", + "counts": { + "pass": 0, + "fail": 240, + "capped-or-error": 0, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 0, + "fail": 226, + "capped-or-error": 0, + "timeout": 0 + }, + "closed-extra": { + "pass": 0, + "fail": 8, + "capped-or-error": 0, + "timeout": 0 + }, + "open-extra": { + "pass": 0, + "fail": 6, + "capped-or-error": 0, + "timeout": 0 + } + }, + "failures": [ + { + "label": "closed-0010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00010101010101010101010110000001011000001000010110000011011110000101100000110000101100000110000101100000100001011000001101111100001011000001100001011000001100001011000001000010110000011011111000010110000011000010110000011000010110000010000101100000110111110000101100000110000101100000110000101100000100001011000001101111100001011000001100001011000001000010110000011011110000000110000000110000011000001100001011000001100001011000001000010110000011011110" + }, + { + "label": "closed-000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00010101010101010101010110000101100000110110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111000010110000011000010110000011000010110000011000010110000010000101100" + }, + { + "label": "closed-0000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00010101010101010101010110000101100000110110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101" + }, + { + "label": "closed-00000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111110" + }, + { + "label": "closed-000000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00010101010101011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110000000110000000110000011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00010101010101011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110000000110000000110000011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000" + }, + { + "label": "closed-0000000011110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00010101010110000000110000000110000011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000000011110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000000000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000000111110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00010101010101011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111000010110000010000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111000000011000000011000001" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111111110" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111111110" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111111111110" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "deep-16", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "deep-40", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "tower-48", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000000110" + }, + { + "label": "open-var-1", + "group": "open-extra", + "verdict": "fail", + "normal_form": "00010101010101010101010101011001010110000101100000100001011000001101110000101100000100001011000001101110000101100000100001011000001101110010101100001011000001000010110000011011100001011000001000010110000011011100001011000001000010110000011011100101010101100001011000001000010110000011011100001011000001000010110000011011100001011000001000010110000011011100001011000001000010110000011011100001011000001000010110000011011100001011000001000010110000011011100001011000001000010110000011011100001011000001" + }, + { + "label": "open-var-2", + "group": "open-extra", + "verdict": "fail", + "normal_form": "00010101010101010101010101011001010110000101100000100001011000001000010110000011011110000101100000100001011000001000010110000011011110000101100000100001011000001000010110000011011110010101100001011000001000010110000010000101100000110111100001011000001000010110000010000101100000110111100001011000001000010110000010000101100000110111100101010101100001011000001000010110000010000101100000110111100001011000001000010110000010000101100000110111100001011000001000010110000010000101100000110111100001011000" + }, + { + "label": "open-var-5", + "group": "open-extra", + "verdict": "fail", + "normal_form": "00010101010101010101010101011001010110000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111110000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111110000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111110010101100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111100001011000001000010110000010000101100000100001011000001000010110000010000101100000" + }, + { + "label": "open-var-16", + "group": "open-extra", + "verdict": "fail", + "normal_form": "00010101010101010101010101011001010110000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111110000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110" + }, + { + "label": "open-var-40", + "group": "open-extra", + "verdict": "fail", + "normal_form": "00010101010101010101010101011001010110000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "fail", + "normal_form": "00000001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111111110" + } + ] + }, + { + "name": "partial_diagonal69", + "bits": 69, + "LAX": [ + 7, + 12, + 5 + ], + "intended_contract": "hypothesis", + "counts": { + "pass": 5, + "fail": 200, + "capped-or-error": 35, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 0, + "fail": 195, + "capped-or-error": 31, + "timeout": 0 + }, + "closed-extra": { + "pass": 0, + "fail": 5, + "capped-or-error": 3, + "timeout": 0 + }, + "open-extra": { + "pass": 5, + "fail": 0, + "capped-or-error": 1, + "timeout": 0 + } + }, + "failures": [ + { + "label": "closed-0010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000101100001011000001101100001010110000010000101100000110111010" + }, + { + "label": "closed-000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000010000101100000110111111010" + }, + { + "label": "closed-0000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000010000101100000100001011000001101111111010" + }, + { + "label": "closed-00000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111010" + }, + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111010" + }, + { + "label": "closed-000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111010" + }, + { + "label": "closed-0000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111010" + }, + { + "label": "closed-0000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111010" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111010" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111010" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111010" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111010" + }, + { + "label": "closed-000000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111111010" + }, + { + "label": "closed-000000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111010" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111010" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111010" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111111010" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111010" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111010" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111010" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111010" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111010" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111010" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000011110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001101111111111111010" + }, + { + "label": "closed-0000000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111010" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111010" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111111010" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111010" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111010" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001101111111111111010" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111010" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111010" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111010" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111010" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111010" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00000000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111010" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000000000011110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000000000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111111010" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000000000111110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010101100000110000101100000100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111111010" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000000101011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111111111010" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "deep-16", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000" + }, + { + "label": "deep-40", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011" + }, + { + "label": "tower-48", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + } + ] + }, + { + "name": "drop_second_skip_failed", + "bits": 66, + "LAX": [ + 7, + 11, + 6 + ], + "intended_contract": "hypothesis", + "counts": { + "pass": 27, + "fail": 213, + "capped-or-error": 0, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 19, + "fail": 207, + "capped-or-error": 0, + "timeout": 0 + }, + "closed-extra": { + "pass": 3, + "fail": 5, + "capped-or-error": 0, + "timeout": 0 + }, + "open-extra": { + "pass": 5, + "fail": 1, + "capped-or-error": 0, + "timeout": 0 + } + }, + "failures": [ + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001000010110000011011111010" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111010" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111101010" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111101010" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001000010110000011011111101010" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000100001011000001100001011000001000010110000011011111101010" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001000010110000011011111010" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111010" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111010" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111010" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111101010" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111101010" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111010" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001000010110000011011111010" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111010" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111101010" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111101010" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111101010" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001000010110000011011111101010" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000100001011000001100001011000001000010110000011011111101010" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001000010110000011011111010" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111010" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111010" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111101010" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111101010" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111101010" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111101010" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111101010" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111010" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111101010" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111101010" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011011110" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011011110" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111010" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111101010" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111010" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010101011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111101010" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001000010110000011011111010" + } + ] + }, + { + "name": "unary_only", + "bits": 12, + "LAX": [ + 1, + 2, + 0 + ], + "intended_contract": "variable sources only", + "counts": { + "pass": 5, + "fail": 235, + "capped-or-error": 0, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 0, + "fail": 226, + "capped-or-error": 0, + "timeout": 0 + }, + "closed-extra": { + "pass": 0, + "fail": 8, + "capped-or-error": 0, + "timeout": 0 + }, + "open-extra": { + "pass": 5, + "fail": 1, + "capped-or-error": 0, + "timeout": 0 + } + }, + "failures": [ + { + "label": "closed-0010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011011110" + }, + { + "label": "closed-000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-00000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111110" + }, + { + "label": "closed-000000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111110" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0000000011110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-00000000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-000000000011110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111111110" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "closed-0000000000111110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111110" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111111111110" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111111111111110" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111111111110" + }, + { + "label": "deep-16", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010" + }, + { + "label": "deep-40", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000" + }, + { + "label": "tower-48", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111111110" + } + ] + }, + { + "name": "zero_tower_only", + "bits": 67, + "LAX": [ + 7, + 10, + 11 + ], + "intended_contract": "lambda towers ending in a variable only", + "counts": { + "pass": 27, + "fail": 213, + "capped-or-error": 0, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 19, + "fail": 207, + "capped-or-error": 0, + "timeout": 0 + }, + "closed-extra": { + "pass": 3, + "fail": 5, + "capped-or-error": 0, + "timeout": 0 + }, + "open-extra": { + "pass": 5, + "fail": 1, + "capped-or-error": 0, + "timeout": 0 + } + }, + "failures": [ + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111111110" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + } + ] + }, + { + "name": "tower45", + "bits": 45, + "LAX": [ + 5, + 7, + 5 + ], + "intended_contract": "all zero prefixes followed by a unary variable code; not applications", + "counts": { + "pass": 27, + "fail": 213, + "capped-or-error": 0, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 19, + "fail": 207, + "capped-or-error": 0, + "timeout": 0 + }, + "closed-extra": { + "pass": 3, + "fail": 5, + "capped-or-error": 0, + "timeout": 0 + }, + "open-extra": { + "pass": 5, + "fail": 1, + "capped-or-error": 0, + "timeout": 0 + } + }, + "failures": [ + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111111111110" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111111111110" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + } + ] + }, + { + "name": "tower51", + "bits": 51, + "LAX": [ + 7, + 8, + 3 + ], + "intended_contract": "lambda towers ending in a variable only; not applications", + "counts": { + "pass": 27, + "fail": 213, + "capped-or-error": 0, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 19, + "fail": 207, + "capped-or-error": 0, + "timeout": 0 + }, + "closed-extra": { + "pass": 3, + "fail": 5, + "capped-or-error": 0, + "timeout": 0 + }, + "open-extra": { + "pass": 5, + "fail": 1, + "capped-or-error": 0, + "timeout": 0 + } + }, + "failures": [ + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111111110" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + } + ] + }, + { + "name": "fixedpoint_direct", + "bits": 86, + "LAX": [ + 8, + 14, + 12 + ], + "intended_contract": "all sources", + "counts": { + "pass": 240, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 226, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "closed-extra": { + "pass": 8, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "open-extra": { + "pass": 6, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + } + }, + "failures": [] + }, + { + "name": "fixedpoint_select_after", + "bits": 95, + "LAX": [ + 8, + 15, + 17 + ], + "intended_contract": "all sources", + "counts": { + "pass": 240, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 226, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "closed-extra": { + "pass": 8, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "open-extra": { + "pass": 6, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + } + }, + "failures": [] + }, + { + "name": "int165_projection", + "bits": 173, + "LAX": [ + 19, + 26, + 29 + ], + "intended_contract": "closed sources (the internal parser also covers open syntax)", + "counts": { + "pass": 240, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "tested": 240, + "groups": { + "closed16": { + "pass": 226, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "closed-extra": { + "pass": 8, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + }, + "open-extra": { + "pass": 6, + "fail": 0, + "capped-or-error": 0, + "timeout": 0 + } + }, + "failures": [] + } + ] +} diff --git a/data/self-interpreter/reasoning_floor/remainder/diagonal63_failed.blc b/data/self-interpreter/reasoning_floor/remainder/diagonal63_failed.blc new file mode 100644 index 00000000..51e6d7fd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/diagonal63_failed.blc @@ -0,0 +1 @@ +010001101000000110010111000000001010101111011001011101010101010 diff --git a/data/self-interpreter/reasoning_floor/remainder/diagonal63_failed.lam b/data/self-interpreter/reasoning_floor/remainder/diagonal63_failed.lam new file mode 100644 index 00000000..200ea23d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/diagonal63_failed.lam @@ -0,0 +1 @@ +(\d.d d) (\b\r.r (b (\t\u\d.t u (u d d) d d) r)) diff --git a/data/self-interpreter/reasoning_floor/remainder/drop_second_skip_failed.blc b/data/self-interpreter/reasoning_floor/remainder/drop_second_skip_failed.blc new file mode 100644 index 00000000..040c25aa --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/drop_second_skip_failed.blc @@ -0,0 +1 @@ +000100010111010100000011001011100000000101010111101100111010101010 diff --git a/data/self-interpreter/reasoning_floor/remainder/drop_second_skip_failed.lam b/data/self-interpreter/reasoning_floor/remainder/drop_second_skip_failed.lam new file mode 100644 index 00000000..aafe877e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/drop_second_skip_failed.lam @@ -0,0 +1 @@ +\s.(\d.s d d) (\b\r.r (b (\t\u\d.t u (u d) d d) r)) diff --git a/data/self-interpreter/reasoning_floor/remainder/fixedpoint_direct.blc b/data/self-interpreter/reasoning_floor/remainder/fixedpoint_direct.blc new file mode 100644 index 00000000..9f08bfa2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/fixedpoint_direct.blc @@ -0,0 +1 @@ +01000110100001000001100000010111001100000011111110010111010011111110100101101010011010 diff --git a/data/self-interpreter/reasoning_floor/remainder/fixedpoint_direct.lam b/data/self-interpreter/reasoning_floor/remainder/fixedpoint_direct.lam new file mode 100644 index 00000000..e4b49a5a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/fixedpoint_direct.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\p\s.s (\b\r.b (r (\t\u.p (t u (p u)))) (r r r))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/remainder/fixedpoint_select_after.blc b/data/self-interpreter/reasoning_floor/remainder/fixedpoint_select_after.blc new file mode 100644 index 00000000..1c679c27 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/fixedpoint_select_after.blc @@ -0,0 +1 @@ +01000110100001000001100000010111001100000010111001111111010011111110011111110100101101010011010 diff --git a/data/self-interpreter/reasoning_floor/remainder/fixedpoint_select_after.lam b/data/self-interpreter/reasoning_floor/remainder/fixedpoint_select_after.lam new file mode 100644 index 00000000..78a02140 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/fixedpoint_select_after.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\p\s.s (\b\r.b (r (\t\u.t (p u) (p (p u)))) (r r r))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/remainder/floated71.blc b/data/self-interpreter/reasoning_floor/remainder/floated71.blc new file mode 100644 index 00000000..288d2475 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/floated71.blc @@ -0,0 +1 @@ +01000001011011011000000110010111000000001010101111011001011101010101010 diff --git a/data/self-interpreter/reasoning_floor/remainder/floated71.lam b/data/self-interpreter/reasoning_floor/remainder/floated71.lam new file mode 100644 index 00000000..d4d9f590 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/floated71.lam @@ -0,0 +1 @@ +(\d\s.s d d) (\b\r.r (b (\t\u\d.t u (u d d) d d) r)) diff --git a/data/self-interpreter/reasoning_floor/remainder/followup.md b/data/self-interpreter/reasoning_floor/remainder/followup.md new file mode 100644 index 00000000..aa079431 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/followup.md @@ -0,0 +1,23 @@ +Follow-up (coordinating Claude seat). Your report names the missing step: an +application-sensitive invariant of residual control — after the left child's +entire encoding has been discarded, a still-live obligation must consume +exactly one further source while staying uniform in the suffix. Tower45 shows +every other known obligation fits in 45 bits; the global lane independently +proved the interpreter floor 37 and Rmin ≥ 24 (tmp/overnight/global/ +PROJECTIONS.md, PROOF37.md), and your Rmin ≥ 27 is under independent review. + +Please attack that step for real: +1. Formulate the obligation precisely (e.g. via the existing labelled-stream + / origin machinery in lean/Blc/SelfintGrowth*.lean and SelfintZero.lean): + on inputs 01 ⌜M1⌝ ⌜M2⌝ N with M1 drawn from an unbounded family, what must + the residual term carry after M1 is consumed, and why can no "flat" residual + (one that does not distinguish 'one more source pending' from 'none') work? +2. Price it in source syntax: does it force a third nonlinear binder, a + further live capture, a second width witness, or a lower bound on how the + two sequential skips share code? Test every candidate invariant against + rem70, tower45 (which must violate it — it fails on λx.x x), your 66-bit + near miss (which drops one context operand and returns K N), and E F. +3. Turn whatever you can prove into the best Rmin bound (and hence + |E| ≥ Rmin − 8), handwritten with exact hypotheses; Lean for pinned lemmas. +Also, if reasoning suggests a sub-70 extractor, build and test it. No +enumeration; runs of seconds. Append a new section to REPORT.md and return it. diff --git a/data/self-interpreter/reasoning_floor/remainder/int165_projection.blc b/data/self-interpreter/reasoning_floor/remainder/int165_projection.blc new file mode 100644 index 00000000..5fc19d80 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/int165_projection.blc @@ -0,0 +1 @@ +01010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010000010 diff --git a/data/self-interpreter/reasoning_floor/remainder/int165_projection.lam b/data/self-interpreter/reasoning_floor/remainder/int165_projection.lam new file mode 100644 index 00000000..c07f1eb2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/int165_projection.lam @@ -0,0 +1,14 @@ +(-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +) (\v\r.r) diff --git a/data/self-interpreter/reasoning_floor/remainder/int584_projection.blc b/data/self-interpreter/reasoning_floor/remainder/int584_projection.blc new file mode 100644 index 00000000..e7dedae5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/int584_projection.blc @@ -0,0 +1 @@ +0101000101000001111000010110001111011000000111010010000011110000101100011110110000001010000011111100001011000111101100000010000011111111000010110001111011000010000011111111100001011000111101100000010001000001111111111110000101100011110110000100000111111111111100001011000111101100001000001111111111111100001011000111101100000010111110000101100000011011111111011111111100101111011010000111111100100000111111111111000010110001111011000000101111001111110000001111100000010111011100110111100111111110000111111001000001111111111111110000101100011110110000001011111011001111010011101000011010000010 diff --git a/data/self-interpreter/reasoning_floor/remainder/int584_projection.lam b/data/self-interpreter/reasoning_floor/remainder/int584_projection.lam new file mode 100644 index 00000000..e44b6167 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/int584_projection.lam @@ -0,0 +1 @@ +(\a.(\b\c.a (\d.d (\e.b) c)) (\b\c.b c) ((\b\c.a (\d.d (\e.b) c)) (\b\c.(\d\e.a (\f.f (\g.d) e)) (\d\e.(\f\g.a (\h.h (\i.f) g)) (\f.(\g\h.a (\i.i (\j.g) h)) (\g\h.(\i.(\j\k.a (\l.l (\m.j) k)) (\j.(\k\l.a (\m.m (\n.k) l)) (\k.(\l\m.a (\n.n (\o.l) m)) (\l\m.j (\n.n (\o\p.p i) f) (k l m))))) (\i.d ((\j\k.a (\l.l (\m.j) k)) (\j\k.i (g (\l\m.j (\n\o.n m (o l)))) (e (\l.h ((\m\n.a (\o.o (\p.m) n)) (\m\n.k m (l n))))))))))) (b c)))) (\a.a a) (\a\b.b) diff --git a/data/self-interpreter/reasoning_floor/remainder/lean-checks.txt b/data/self-interpreter/reasoning_floor/remainder/lean-checks.txt new file mode 100644 index 00000000..ff37addd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/lean-checks.txt @@ -0,0 +1,11 @@ +RemainderChain.lean: exit=0 elapsed=0.293s +'Blc.RemainderLane.remainder_not_chain' depends on axioms: [propext, Quot.sound] +'Blc.RemainderLane.literal_remainder_body_not_chain' depends on axioms: [propext, Quot.sound] +'Blc.RemainderLane.projection_remainder' depends on axioms: [propext, Quot.sound] +'Blc.RemainderLane.remainder_bound_transfers' depends on axioms: [propext, Quot.sound] +'Blc.RemainderLane.remainder_bound_eighteen' depends on axioms: [propext, Quot.sound] +'Blc.RemainderLane.remainder_bound_at_most_seventy' depends on axioms: [propext, Quot.sound] + +Tower45.lean: exit=0 elapsed=0.178s +'Blc.RemainderTower45.reader_zeros_variable' depends on axioms: [propext, Quot.sound] +'Blc.RemainderTower45.reader_towers' depends on axioms: [propext, Quot.sound] diff --git a/data/self-interpreter/reasoning_floor/remainder/lean-residual-checks.txt b/data/self-interpreter/reasoning_floor/remainder/lean-residual-checks.txt new file mode 100644 index 00000000..e33afd80 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/lean-residual-checks.txt @@ -0,0 +1,21 @@ +ResidualControl.lean: exit=0 elapsed=0.241s +'Blc.RemainderResidual.pending_ne_done' depends on axioms: [propext, Quot.sound] +'Blc.RemainderResidual.pending_depths_distinct' depends on axioms: [propext, Quot.sound] +'Blc.RemainderResidual.clean_cut_body_two_nonlinear' depends on axioms: [propext, Quot.sound] +'Blc.RemainderResidual.clean_cut_body_not_chain' depends on axioms: [propext, Quot.sound] +'Blc.RemainderResidual.marked_pending_has_code' depends on axioms: [propext, Quot.sound] +'Blc.RemainderResidual.tower45_app_zero' depends on axioms: [propext, Quot.sound] +'Blc.RemainderResidual.rem592_contract' depends on axioms: [propext, Quot.sound] +'Blc.RemainderResidual.rem592_two_nonlinear' does not depend on any axioms + +SharedS647.lean: exit=0 elapsed=1.066s +'Blc.RemainderSharedS.reader_contract' depends on axioms: [propext, Quot.sound] +'Blc.RemainderSharedS.reader_two_nonlinear' does not depend on any axioms +'Blc.RemainderSharedS.reader_two_live_captures' does not depend on any axioms +'Blc.RemainderSharedS.reader_one_width_three_subterm' does not depend on any axioms + +FixedResiduals.lean: exit=0 elapsed=0.308s +'Blc.RemainderFailures.tower_not_remainder' depends on axioms: [propext, Quot.sound] +'Blc.RemainderFailures.near66_not_remainder' depends on axioms: [propext, Quot.sound] +'Blc.RemainderFailures.tail65_not_remainder' depends on axioms: [propext, Quot.sound] +'Blc.RemainderFailures.handler65_not_remainder' depends on axioms: [propext, Quot.sound] diff --git a/data/self-interpreter/reasoning_floor/remainder/pack_handler65.blc b/data/self-interpreter/reasoning_floor/remainder/pack_handler65.blc new file mode 100644 index 00000000..47aecc13 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/pack_handler65.blc @@ -0,0 +1 @@ +00010001011101010000001100101110000000010111001011110100110101010 diff --git a/data/self-interpreter/reasoning_floor/remainder/pack_handler65.lam b/data/self-interpreter/reasoning_floor/remainder/pack_handler65.lam new file mode 100644 index 00000000..bb35d0a8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/pack_handler65.lam @@ -0,0 +1 @@ +\a.(\b.a b b) (\b\c.c (b (\d\e\f.e (d f (f f)) f) c)) diff --git a/data/self-interpreter/reasoning_floor/remainder/pack_tail65.blc b/data/self-interpreter/reasoning_floor/remainder/pack_tail65.blc new file mode 100644 index 00000000..96ee7749 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/pack_tail65.blc @@ -0,0 +1 @@ +00010001011101010000001100101110000000010111010010111101001101010 diff --git a/data/self-interpreter/reasoning_floor/remainder/pack_tail65.lam b/data/self-interpreter/reasoning_floor/remainder/pack_tail65.lam new file mode 100644 index 00000000..c0eb5ae6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/pack_tail65.lam @@ -0,0 +1 @@ +\a.(\b.a b b) (\b\c.c (b (\d\e\f.e f (d f (f f))) c)) diff --git a/data/self-interpreter/reasoning_floor/remainder/partial_diagonal69.blc b/data/self-interpreter/reasoning_floor/remainder/partial_diagonal69.blc new file mode 100644 index 00000000..051e83e0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/partial_diagonal69.blc @@ -0,0 +1 @@ +000100011010011000000110010111000000001010101111011001011101010101010 diff --git a/data/self-interpreter/reasoning_floor/remainder/partial_diagonal69.lam b/data/self-interpreter/reasoning_floor/remainder/partial_diagonal69.lam new file mode 100644 index 00000000..1398e0f2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/partial_diagonal69.lam @@ -0,0 +1 @@ +\s.(\x.x x) (s (\b\r.r (b (\t\u\d.t u (u d d) d d) r))) diff --git a/data/self-interpreter/reasoning_floor/remainder/pin_failures.py b/data/self-interpreter/reasoning_floor/remainder/pin_failures.py new file mode 100644 index 00000000..2ca6802e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/pin_failures.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +"""Generate four fixed counterexample traces; no term search.""" +import sys +sys.dont_write_bytecode = True +from residual_checks import HERE, parse, lc, A, L, V + + +def step(t): + if t[0] == 'A': + if t[1][0] == 'L': + return [], lc.beta(t[1], t[2]) + z = step(t[1]) + if z is not None: + return ['left'] + z[0], A(z[1], t[2]) + z = step(t[2]) + if z is not None: + return ['right'] + z[0], A(t[1], z[1]) + elif t[0] == 'L': + z = step(t[1]) + if z is not None: + return ['under'] + z[0], L(z[1]) + return None + + +def lean(t): + if t[0] == 'V': + return f'(.var {t[1]})' + if t[0] == 'L': + return f'(.lam {lean(t[1])})' + return f'(.app {lean(t[1])} {lean(t[2])})' + + +source = parse(r'\x.x x') +chunks = ['''/- Fixed beta-exact failure witnesses for application parsing. -/ +import ResidualControl + +namespace Blc.RemainderFailures +open Term SelfintControl RemainderLane RemainderResidual SelfintSharp +set_option maxRecDepth 100000 +set_option maxHeartbeats 4000000 + +def dupSource : Term := .lam (.app (.var 0) (.var 0)) +'''] +for stem, name in [('tower45', 'tower'), ('drop_second_skip_failed', 'near66'), + ('pack_tail65', 'tail65'), ('pack_handler65', 'handler65')]: + term = parse((HERE / (stem + '.lam')).read_text()) + current = A(term, lc.bitlist(lc.enc(source), V(0))) + trace = [] + while (z := step(current)) is not None: + trace.append(z[0]) + current = z[1] + assert len(trace) < 4000 + assert current[0] == 'L' + paths = '[' + ', '.join('[' + ', '.join('.' + p for p in ps) + ']' + for ps in trace) + ']' + chunks.append(f''' +def {name} : Term := {lean(term)} +def {name}Result : Term := {lean(current)} +def {name}Trace : List (List Direction) := {paths} +theorem {name}_checked : replay {name}Trace + (.app {name} (streamOf (blcCode dupSource) (.var 0))) = some {name}Result := by decide +theorem {name}_not_remainder : ¬ IsRemainder {name} := by + intro h + have hs := h.2 dupSource (by decide) (.var 0) + have ht := join_of_betas (replay_sound {name}_checked) + exact lam_not_join_var _ _ (join_trans (join_symm ht) hs) +#print axioms {name}_not_remainder +''') + print(stem, len(trace), 'beta steps; result', lc.show(current)) +chunks.append('end Blc.RemainderFailures\n') +(HERE / 'FixedResiduals.lean').write_text('\n'.join(chunks)) diff --git a/data/self-interpreter/reasoning_floor/remainder/pin_shared.py b/data/self-interpreter/reasoning_floor/remainder/pin_shared.py new file mode 100644 index 00000000..11c2fd8f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/pin_shared.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +"""Pin a finite beta trace and source counts for the shared-S counterexample.""" +from pathlib import Path +import sys +sys.dont_write_bytecode = True +from residual_checks import HERE, lc, parse, I, S, A, L, V + + +def step(t): + if t[0] == 'A': + if t[1][0] == 'L': + return [], lc.beta(t[1], t[2]) + z = step(t[1]) + if z is not None: + return ['left'] + z[0], A(z[1], t[2]) + z = step(t[2]) + if z is not None: + return ['right'] + z[0], A(t[1], z[1]) + elif t[0] == 'L': + z = step(t[1]) + if z is not None: + return ['under'] + z[0], L(z[1]) + return None + + +def lean(t): + if t[0] == 'V': + return f'(.var {t[1]})' + if t[0] == 'L': + return f'(.lam {lean(t[1])})' + return f'(.app {lean(t[1])} {lean(t[2])})' + + +t = parse((HERE / 'shared_s_remainder.lam').read_text()) +trace = [] +current = t +while (z := step(current)) is not None: + trace.append(z[0]) + current = z[1] + assert len(trace) < 4000 +reference = parse((HERE / 'reference70.lam').read_text()) +assert current == lc.nf(reference, [20000]) +paths = '[' + ',\n '.join('[' + ', '.join('.' + p for p in path) + ']' + for path in trace) + ']' +text = '''/- +647-bit exact remainder extractor with two nonlinear binders, two live +capturing binders, and exactly one width-three subterm. The generated trace +is checked by Lean's kernel; the Python generator is not trusted. +-/ +import RemainderChain +import Blc.SelfintSharp + +namespace Blc.RemainderSharedS +open Term SelfintControl RemainderLane SelfintSharp +set_option maxRecDepth 100000 +set_option maxHeartbeats 16000000 + +def body : Term := BODY +def sComb : Term := SCOMB +def reader : Term := .app (.lam body) sComb +def common : Term := .lam (.app (.app (.var 0) SelfintRemainder.context) + SelfintRemainder.context) +def trace : List (List Direction) := TRACE + +theorem checked_trace : replay trace reader = some common := by decide +theorem reader_reduces : Betas reader common := replay_sound checked_trace +theorem reference_reduces : Betas SelfintRemainder.rem70 common := + replay_sound (by decide : replay [[.under]] SelfintRemainder.rem70 = some common) + +theorem reader_closed : Closed reader := by decide +theorem reader_size : (blcCode reader).length = 647 := by decide +theorem reader_two_nonlinear : SelfintLowerBound.nonlinear reader = 2 := by decide + +/-- A live lambda captures when it is not closed as a standalone subterm. -/ +def liveCaptures : Term → Nat + | .var _ => 0 + | .app f a => liveCaptures f + liveCaptures a + | .lam b => liveCaptures b + + if 0 < occ 0 b ∧ ¬ Closed (.lam b) then 1 else 0 + +/-- Distinct free de Bruijn indices, relative to this subterm. -/ +def freeVars : Term → List Nat + | .var n => [n] + | .app f a => (freeVars f ++ freeVars a).eraseDups + | .lam b => (freeVars b).filterMap (fun n => if n = 0 then none else some (n - 1)) + +def widthWitnesses : Term → Nat + | .var _ => 0 + | .lam b => widthWitnesses b + if 3 ≤ (freeVars (.lam b)).length then 1 else 0 + | .app f a => widthWitnesses f + widthWitnesses a + + if 3 ≤ (freeVars (.app f a)).length then 1 else 0 + +theorem reader_two_live_captures : liveCaptures reader = 2 := by decide +theorem reader_one_width_three_subterm : widthWitnesses reader = 1 := by decide +theorem body_no_width_three_subterm : widthWitnesses body = 0 := by decide +theorem sComb_one_width_three_subterm : widthWitnesses sComb = 1 := by decide + +/-- Full beta-exact contract, with open sources and arbitrary suffixes. -/ +theorem reader_contract (M N : Term) : + BetaJoin (.app reader (streamOf (blcCode M) N)) N := by + have hsame : BetaJoin reader SelfintRemainder.rem70 := + ⟨common, reader_reduces, reference_reduces⟩ + exact join_trans (join_appL _ hsame) + (join_of_betas (SelfintRemainder.rem70_contract M N)) + +theorem reader_isRemainder : IsRemainder reader := + ⟨reader_closed, fun M _ N => reader_contract M N⟩ + +#print axioms reader_contract +#print axioms reader_two_nonlinear +#print axioms reader_two_live_captures +#print axioms reader_one_width_three_subterm + +end Blc.RemainderSharedS +''' +text = text.replace('BODY', lean(t[1][1])).replace('SCOMB', lean(S)).replace('TRACE', paths) +(HERE / 'SharedS647.lean').write_text(text) +print(f'Pinned {len(trace)} beta steps, {lc.size(current)}-bit common normal form.') diff --git a/data/self-interpreter/reasoning_floor/remainder/reference70.blc b/data/self-interpreter/reasoning_floor/remainder/reference70.blc new file mode 100644 index 00000000..ec51c7bc --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/reference70.blc @@ -0,0 +1 @@ +0001000101110101000000110010111000000001010101111011001011101010101010 diff --git a/data/self-interpreter/reasoning_floor/remainder/reference70.lam b/data/self-interpreter/reasoning_floor/remainder/reference70.lam new file mode 100644 index 00000000..ebab2600 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/reference70.lam @@ -0,0 +1 @@ +\s.(\d.s d d) (\b\r.r (b (\t\u\d.t u (u d d) d d) r)) diff --git a/data/self-interpreter/reasoning_floor/remainder/residual-checks.json b/data/self-interpreter/reasoning_floor/remainder/residual-checks.json new file mode 100644 index 00000000..2d3d776b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/residual-checks.json @@ -0,0 +1,7160 @@ +{ + "elapsed_s": 3.607567541002936, + "threads": 2, + "shared_s_normal_form_matches_rem70": true, + "results": [ + { + "name": "reference70", + "bits": 70, + "LAX": [ + 7, + 12, + 6 + ], + "structural": { + "live": 7, + "nonlinear": 4, + "live_capturing": 4, + "width": 3, + "distinct_width_ge3_variable_sets": 1 + }, + "tested": 261, + "counts": { + "pass": 261 + }, + "failures": [] + }, + { + "name": "tower45", + "bits": 45, + "LAX": [ + 5, + 7, + 5 + ], + "structural": { + "live": 5, + "nonlinear": 3, + "live_capturing": 3, + "width": 3, + "distinct_width_ge3_variable_sets": 1 + }, + "tested": 261, + "counts": { + "pass": 31, + "fail": 230 + }, + "failures": [ + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111111110" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111110" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111111111110" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111111111110" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "left-depth-0-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "left-depth-0-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111110" + }, + { + "label": "left-depth-0-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111111110" + }, + { + "label": "left-depth-0-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111111111111110" + }, + { + "label": "left-depth-1-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "left-depth-1-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "left-depth-1-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111111111110" + }, + { + "label": "left-depth-1-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111111111111111110" + }, + { + "label": "left-depth-4-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111110" + }, + { + "label": "left-depth-4-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111111111110" + }, + { + "label": "left-depth-4-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111111111111111111110" + }, + { + "label": "left-depth-4-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111" + }, + { + "label": "left-depth-12-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111111111111111111110" + }, + { + "label": "left-depth-12-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110000101" + }, + { + "label": "left-depth-12-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101" + }, + { + "label": "left-depth-12-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011" + }, + { + "label": "closed-wrap-right-variable", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000110000101100000100001011000001101111110" + } + ] + }, + { + "name": "tower51", + "bits": 51, + "LAX": [ + 7, + 8, + 3 + ], + "structural": { + "live": 6, + "nonlinear": 3, + "live_capturing": 3, + "width": 2, + "distinct_width_ge3_variable_sets": 0 + }, + "tested": 261, + "counts": { + "pass": 31, + "fail": 230 + }, + "failures": [ + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000010000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010110000010000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111111110" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111111111111110" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "left-depth-0-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "left-depth-0-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "left-depth-0-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "left-depth-0-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "left-depth-1-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "left-depth-1-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "left-depth-1-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "left-depth-1-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "left-depth-4-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "left-depth-4-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "left-depth-4-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "left-depth-4-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "left-depth-12-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "left-depth-12-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "left-depth-12-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111110" + }, + { + "label": "left-depth-12-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111111111110" + }, + { + "label": "closed-wrap-right-variable", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + } + ] + }, + { + "name": "drop_second_skip_failed", + "bits": 66, + "LAX": [ + 7, + 11, + 6 + ], + "structural": { + "live": 7, + "nonlinear": 4, + "live_capturing": 4, + "width": 3, + "distinct_width_ge3_variable_sets": 1 + }, + "tested": 261, + "counts": { + "pass": 31, + "fail": 230 + }, + "failures": [ + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001000010110000011011111010" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111010" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111101010" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111101010" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001000010110000011011111101010" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000100001011000001100001011000001000010110000011011111101010" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001000010110000011011111010" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111010" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111010" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111010" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111101010" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111101010" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111010" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001000010110000011011111010" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111010" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111101010" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111101010" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111101010" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001000010110000011011111101010" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000100001011000001100001011000001000010110000011011111101010" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001000010110000011011111010" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111010" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111010" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010101100000100001011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111101010" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111101010" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111101010" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010101100000110000101100000110000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111101010" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001000010110000011011111111101010" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111010" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111101010" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111101010" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101010110000010000101100000110000101100000100001011000001101111101010" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001101111010" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011011110" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011011110" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111010" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010101100000110000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111101010" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011011111010" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111111010" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000010101011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111111111101010" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "0000110" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001000010110000011011111010" + }, + { + "label": "left-depth-0-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "left-depth-0-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "left-depth-0-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "left-depth-0-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "left-depth-1-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "left-depth-1-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "left-depth-1-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "left-depth-1-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "left-depth-4-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "left-depth-4-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "left-depth-4-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "left-depth-4-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "left-depth-12-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110111010" + }, + { + "label": "left-depth-12-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "left-depth-12-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111010" + }, + { + "label": "left-depth-12-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-wrap-right-variable", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "0000110" + } + ] + }, + { + "name": "int165_projection", + "bits": 173, + "LAX": [ + 19, + 26, + 29 + ], + "structural": { + "live": 17, + "nonlinear": 7, + "live_capturing": 13, + "width": 4, + "distinct_width_ge3_variable_sets": 11 + }, + "tested": 261, + "counts": { + "pass": 261 + }, + "failures": [] + }, + { + "name": "shared_s_remainder", + "bits": 647, + "LAX": [ + 97, + 102, + 43 + ], + "structural": { + "live": 57, + "nonlinear": 2, + "live_capturing": 2, + "width": 3, + "distinct_width_ge3_variable_sets": 1 + }, + "tested": 261, + "counts": { + "pass": 261, + "capped-or-error": 0 + }, + "failures": [], + "initial_counts": { + "pass": 260, + "capped-or-error": 1 + }, + "retries": [ + { + "label": "tower-48", + "beta_budget": 50000, + "verdict": "pass" + } + ], + "retry_elapsed_s": 0.005237249999481719 + }, + { + "name": "int584_projection", + "bits": 592, + "LAX": [ + 71, + 68, + 176 + ], + "structural": { + "live": 59, + "nonlinear": 2, + "live_capturing": 55, + "width": 7, + "distinct_width_ge3_variable_sets": 49 + }, + "tested": 261, + "counts": { + "pass": 261 + }, + "failures": [] + }, + { + "name": "pack_tail65", + "bits": 65, + "LAX": [ + 7, + 11, + 5 + ], + "structural": { + "live": 7, + "nonlinear": 3, + "live_capturing": 4, + "width": 3, + "distinct_width_ge3_variable_sets": 1 + }, + "tested": 261, + "counts": { + "pass": 31, + "fail": 210, + "capped-or-error": 20 + }, + "failures": [ + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011011110" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011011110" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011011110" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111111110" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111110" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000011011110" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001000010110000011000010110000010000101100000110111110" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111110" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000110000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001000010110000011000010110000011000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101100000110000101100000100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001011000001100001011000001000010110000011000010110000010000101100000100001011000001100001011000001000010110000011000010110000010000101100000110111111111110" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "capped-or-error", + "returncode": 0, + "stdout": "no normal form within budget: beta budget exhausted\n", + "stderr": "" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000101100000100001011000001101110" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "fail", + "normal_form": "0000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111110" + }, + { + "label": "left-depth-0-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000010" + }, + { + "label": "left-depth-0-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-0-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-0-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-1-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-1-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-1-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-1-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-4-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-4-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-4-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-4-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-12-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-12-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-12-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "left-depth-12-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "000010" + }, + { + "label": "closed-wrap-right-variable", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000010" + } + ] + }, + { + "name": "pack_handler65", + "bits": 65, + "LAX": [ + 7, + 11, + 5 + ], + "structural": { + "live": 7, + "nonlinear": 3, + "live_capturing": 4, + "width": 3, + "distinct_width_ge3_variable_sets": 1 + }, + "tested": 261, + "counts": { + "pass": 31, + "fail": 230 + }, + "failures": [ + { + "label": "closed-00011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011010000011011010" + }, + { + "label": "closed-0000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011010000011011010" + }, + { + "label": "closed-0001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001101111010" + }, + { + "label": "closed-0001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011010000010000101100000110111010" + }, + { + "label": "closed-00000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011011110" + }, + { + "label": "closed-00011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001000010110000011011111010" + }, + { + "label": "closed-00010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011010000011011010" + }, + { + "label": "closed-000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001101111010" + }, + { + "label": "closed-000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000011000010110000010000101100000110111111010" + }, + { + "label": "closed-000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000100001011000001000010110000011000010110000010000101100000110111111010" + }, + { + "label": "closed-000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011010000010000101100000110111010" + }, + { + "label": "closed-0000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011011110" + }, + { + "label": "closed-0000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001000010110000011011111010" + }, + { + "label": "closed-0000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111010" + }, + { + "label": "closed-0001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011010000011011010" + }, + { + "label": "closed-00000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011010000010000101100000100001011000001101111010" + }, + { + "label": "closed-00000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001101111010" + }, + { + "label": "closed-00000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-00000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011011110" + }, + { + "label": "closed-00000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-00000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000011000010110000010000101100000110111111010" + }, + { + "label": "closed-00000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000100001011000001000010110000011000010110000010000101100000110111111010" + }, + { + "label": "closed-00000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-00000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111010" + }, + { + "label": "closed-00011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111010" + }, + { + "label": "closed-00011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111010" + }, + { + "label": "closed-00011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111010" + }, + { + "label": "closed-00011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111010" + }, + { + "label": "closed-00010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-00010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-01001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-01001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-01000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-01000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-01000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000000000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011010000010000101100000110111010" + }, + { + "label": "closed-000000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011011110" + }, + { + "label": "closed-000000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001000010110000011011111010" + }, + { + "label": "closed-000000011101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-000000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-000000011110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-000000010010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111010" + }, + { + "label": "closed-000001100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111010" + }, + { + "label": "closed-000001100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111010" + }, + { + "label": "closed-000001110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111110" + }, + { + "label": "closed-000001110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000001110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111110" + }, + { + "label": "closed-000001001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000001001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000001000010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000001011010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000001011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000001011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000110000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111010" + }, + { + "label": "closed-000110000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000010000101100000110111111111010" + }, + { + "label": "closed-000110000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-000110011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110111111111010" + }, + { + "label": "closed-000110010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110000101100000110000101100000100001011000001000010110000011000010110000010000101100000110111111111010" + }, + { + "label": "closed-000100100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000100001000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000101101000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000100011011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000100011101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000101100011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-000101001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-010010000000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-010000100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-010000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-010000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000000000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011010000011011010" + }, + { + "label": "closed-0000000001101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101011010000010000101100000100001011000001101111010" + }, + { + "label": "closed-0000000001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001101111010" + }, + { + "label": "closed-0000000001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000010000101100000110111110" + }, + { + "label": "closed-0000000001111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011011110" + }, + { + "label": "closed-0000000001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000000110001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000100001011000001000010110000010000101100000110111111010" + }, + { + "label": "closed-0000000110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000011000010110000010000101100000110111111010" + }, + { + "label": "closed-0000000110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000100001011000001000010110000011000010110000010000101100000110111111010" + }, + { + "label": "closed-0000000111000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001000010110000011011111110" + }, + { + "label": "closed-0000000111101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001011000001000010110000010000101100000100001011000001101111110" + }, + { + "label": "closed-0000000111100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001101111110" + }, + { + "label": "closed-0000000100101110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000000100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000000100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000000100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000000100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000000101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000011000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000011000010110000010000101100000100001011000001000010110000011011111111010" + }, + { + "label": "closed-0000011000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000011011111111010" + }, + { + "label": "closed-0000011000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000010000101100000100001011000001100001011000001000010110000011011111111010" + }, + { + "label": "closed-0000011001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001100001011000001100001011000001100001011000001000010110000011011111111010" + }, + { + "label": "closed-0000011001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000100001011000001000010110000010000101100000110000101100000100001011000001000010110000011011111111010" + }, + { + "label": "closed-0000011001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110000101100000110000101100000100001011000001100001011000001000010110000011011111111010" + }, + { + "label": "closed-0000011100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000000010110000011000010110000011000010110000011000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011100110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111110" + }, + { + "label": "closed-0000011100111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000100001011000001000010110000010000101100000110000101100000100001011000001101111111110" + }, + { + "label": "closed-0000010010001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010000110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010110110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010111010110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0000010100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "0000010101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001100001110110", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000011000010110000011000010110000010000101100000100001011000001000010110000011000010110000010000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001100001011000001100001011000001000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001100110000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001000010110000010000101100000110000101100000110000101100000110000101100000110000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001100110011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000100001011000001100001011000001100001011000001000010110000010000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001000010110000011000010110000011000010110000010000101100000110000101100000110000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001100100001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000101011000001000010110000011000010110000011000010110000011000010110000011000010110000010000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001100101101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "000001010110000010000101100000110000101100000100001011000001000010110000011000010110000010000101100000110000101100000100001011000001101111111111010" + }, + { + "label": "closed-0001001000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001001001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001001001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001011010011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000011000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000000111010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000110001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000111011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001000100101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001011000001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001011001101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001010010001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001010000101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0001010110101010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100100000001110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100100000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100100000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100100001100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100100001001010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100100100100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100001000000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100001000011010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100001100000110", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100000010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100011010000010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100000011100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100000000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100000110100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100011000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0100010010100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-0101001000100010", + "group": "closed16", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "lambda-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "Omega-I", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "I-Omega", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "deep-app", + "group": "closed-extra", + "verdict": "fail", + "normal_form": "00000001011000001000010110000011011110" + }, + { + "label": "open-app", + "group": "open-extra", + "verdict": "fail", + "normal_form": "0000000101100000110000101100000110000101100000100001011000001000010110000010000101100000110111111110" + }, + { + "label": "left-depth-0-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-0-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-0-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-0-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-1-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-1-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-1-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-1-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-4-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-4-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-4-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-4-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-12-pending-1", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-12-pending-2", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-12-pending-3", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "left-depth-12-pending-4", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + }, + { + "label": "closed-wrap-right-variable", + "group": "pending-combs", + "verdict": "fail", + "normal_form": "00000001010111011001011101001101010" + } + ] + } + ] +} diff --git a/data/self-interpreter/reasoning_floor/remainder/residual_checks.py b/data/self-interpreter/reasoning_floor/remainder/residual_checks.py new file mode 100644 index 00000000..7307476d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/residual_checks.py @@ -0,0 +1,190 @@ +#!/usr/bin/env python3 +"""Fixed constructions and residual checks; no candidate enumeration.""" +from collections import Counter +from concurrent.futures import ThreadPoolExecutor +from functools import lru_cache +import json +import os +from pathlib import Path +import signal +import subprocess +import sys +import time +sys.dont_write_bytecode = True +from check import HERE, ROOT, CANDIDATES, parse, lc, stats, probes, check + +signal.alarm(110) +A = lambda f, a: ('A', f, a) +L = lambda b: ('L', b) +V = lambda i: ('V', i) +I = parse(r'\x.x') +S = parse(r'\x\y\z.x z (y z)') + + +@lru_cache(None) +def fv(t): + if t[0] == 'v': + return frozenset([t[1]]) + if t[0] == 'a': + return fv(t[1]) | fv(t[2]) + return frozenset() + + +def abstract(x, t): + if t == ('v', x): + return ('i',) + if x not in fv(t): + return ('a', ('k',), t) + assert t[0] == 'a' + return ('a', ('a', ('s',), abstract(x, t[1])), abstract(x, t[2])) + + +def ski(t, env=(), serial=None): + if serial is None: + serial = [0] + if t[0] == 'V': + return ('v', env[t[1]]) + if t[0] == 'A': + return ('a', ski(t[1], env, serial), ski(t[2], env, serial)) + x = serial[0] + serial[0] += 1 + return abstract(x, ski(t[1], (x,) + env, serial)) + + +def shared_s_body(t): + if t[0] == 's': + return V(0) + if t[0] == 'k': + return lc.TRUE + if t[0] == 'i': + return I + assert t[0] == 'a' + return A(shared_s_body(t[1]), shared_s_body(t[2])) + + +def structural(t): + result = {'live': 0, 'nonlinear': 0, 'live_capturing': 0, 'width': 0} + triples = set() + serial = [0] + def walk(t, env): + if t[0] == 'V': + c = Counter({env[t[1]]: 1}) + elif t[0] == 'A': + c = walk(t[1], env) + walk(t[2], env) + else: + x = serial[0] + serial[0] += 1 + c = walk(t[1], (x,) + env) + n = c.pop(x, 0) + result['live'] += n > 0 + result['nonlinear'] += n > 1 + result['live_capturing'] += n > 0 and bool(c) + result['width'] = max(result['width'], len(c)) + if len(c) >= 3: + triples.add(tuple(sorted(c))) + return c + assert not walk(t, ()) + result['distinct_width_ge3_variable_sets'] = len(triples) + return result + + +def save(name, term): + (HERE / (name + '.blc')).write_text(lc.enc(term) + '\n') + (HERE / (name + '.lam')).write_text(lc.show(term) + '\n') + + +def retry_shared(record): + """Retry only a capped deep case, preserving the original counts.""" + start = time.monotonic() + term = parse((HERE / 'shared_s_remainder.lam').read_text()) + cases = {label: source for label, source, _ in probes()} + retries = [] + for row in record['failures']: + if row['verdict'] != 'capped-or-error': + continue + source = cases[row['label']] + test = L(A(term, lc.bitlist(lc.enc(source), V(0)))) + run = subprocess.run([str(ROOT / 'target/release/blam'), 'normalize', lc.enc(test), + '--beta', '50000'], capture_output=True, text=True, + timeout=3, env={**os.environ, 'RAYON_NUM_THREADS': '1'}) + words = run.stdout.split() + assert run.returncode == 0 and words and words[0] == '0010', (row, run.stdout) + retries.append({'label': row['label'], 'beta_budget': 50000, 'verdict': 'pass'}) + record['initial_counts'] = record['counts'].copy() + record['retries'] = retries + record['retry_elapsed_s'] = time.monotonic() - start + passed = {r['label'] for r in retries} + record['failures'] = [r for r in record['failures'] if r['label'] not in passed] + record['counts']['pass'] += len(retries) + record['counts']['capped-or-error'] -= len(retries) + return record + + +def main(): + started = time.monotonic() + reference = parse(CANDIDATES['reference70'][0]) + shared = A(L(shared_s_body(ski(reference))), S) + # This is a beta-exact SKI compilation, with one shared S. No eta rule. + assert lc.nf(shared, [20000]) == lc.nf(reference, [20000]) + assert structural(shared)['nonlinear'] == 2 + assert structural(shared)['live_capturing'] == 2 + assert structural(shared)['distinct_width_ge3_variable_sets'] == 1 + ref584 = parse((ROOT / 'data/self-interpreter/machines/int584_two_nonlinear.lam').read_text()) + candidates = { + name: parse(CANDIDATES[name][0]) for name in + ['reference70', 'tower45', 'tower51', 'drop_second_skip_failed', 'int165_projection'] + } + candidates['shared_s_remainder'] = shared + candidates['int584_projection'] = A(ref584, lc.FALSE) + # Two reasoning-derived ways of packing the pending D pair into one + # argument. The tail-operand variant must lose that information when + # the first child is a variable and erases its unary-skip operand. + candidates['pack_tail65'] = parse( + r'\s.(\d.s d d) (\b\r.r (b (\t\u\d.u d (t d (d d))) r))') + candidates['pack_handler65'] = parse( + r'\s.(\d.s d d) (\b\r.r (b (\t\u\d.u (t d (d d)) d) r))') + extra = [] + for depth in [0, 1, 4, 12]: + left = I + for _ in range(depth): + left = L(left) + source = left + for k in range(5): + extra.append((f'left-depth-{depth}-pending-{k}', source, 'pending-combs')) + source = A(source, I) + # The near miss's exact K N failure uses an open right child under a + # closing source lambda. Its closed-child residual is different. + extra.append(('closed-wrap-right-variable', parse(r'\x.(\y.y) x'), 'pending-combs')) + cases = probes() + extra + records = [] + with ThreadPoolExecutor(max_workers=2) as pool: + for name, term in candidates.items(): + if name not in CANDIDATES: + save(name, term) + checked = list(pool.map(check, [(*p, term) for p in cases])) + counts = Counter(row['verdict'] for row in checked) + record = {'name': name, 'bits': lc.size(term), 'LAX': stats(term), + 'structural': structural(term), 'tested': len(checked), + 'counts': dict(counts), + 'failures': [c for c in checked if c['verdict'] != 'pass']} + if name == 'shared_s_remainder' and counts.get('capped-or-error', 0): + retry_shared(record) + records.append(record) + print(f'{name}: {lc.size(term)} bits {record["counts"]} tested={len(checked)} ' + f'structure={record["structural"]}', flush=True) + result = {'elapsed_s': time.monotonic() - started, 'threads': 2, + 'shared_s_normal_form_matches_rem70': True, + 'results': records} + (HERE / 'residual-checks.json').write_text(json.dumps(result, indent=2) + '\n') + print(f'elapsed={result["elapsed_s"]:.3f}s', flush=True) + + +if __name__ == '__main__': + if sys.argv[1:] == ['--retry-shared']: + result = json.loads((HERE / 'residual-checks.json').read_text()) + record = next(r for r in result['results'] if r['name'] == 'shared_s_remainder') + retry_shared(record) + (HERE / 'residual-checks.json').write_text(json.dumps(result, indent=2) + '\n') + print(record['counts'], 'retry elapsed', record['retry_elapsed_s']) + else: + main() diff --git a/data/self-interpreter/reasoning_floor/remainder/right_diagonal67.blc b/data/self-interpreter/reasoning_floor/remainder/right_diagonal67.blc new file mode 100644 index 00000000..992e9e9b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/right_diagonal67.blc @@ -0,0 +1 @@ +0100011001101000000110010111000000001010101111011001011101010101010 diff --git a/data/self-interpreter/reasoning_floor/remainder/right_diagonal67.lam b/data/self-interpreter/reasoning_floor/remainder/right_diagonal67.lam new file mode 100644 index 00000000..648caaaa --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/right_diagonal67.lam @@ -0,0 +1 @@ +(\d.d (d d)) (\b\r.r (b (\t\u\d.t u (u d d) d d) r)) diff --git a/data/self-interpreter/reasoning_floor/remainder/shared_s_remainder.blc b/data/self-interpreter/reasoning_floor/remainder/shared_s_remainder.blc new file mode 100644 index 00000000..6a24ab2d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/shared_s_remainder.blc @@ -0,0 +1 @@ +01000101100101100101100100001101001011001011001000011010010110010000110000011000100100001100010010000110001001000011001011001000011001100010010110010110010000110100101100100001100000110010110001001000011001011001011001000011010010110010000110011001000011010010110010110010000110100101100100001100110010000110100101100101100100001101001011001000011001100100001101001011001000011001100100001100000110010110010110010000110100101100100001100000110001001000011000100100001100101100101100100001101001011001011001000011010010110010000110000011000100100001100010010000110001001000011001000011000100100001100100001100010010000110001000000001011110100111010 diff --git a/data/self-interpreter/reasoning_floor/remainder/shared_s_remainder.lam b/data/self-interpreter/reasoning_floor/remainder/shared_s_remainder.lam new file mode 100644 index 00000000..8ae7b752 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/shared_s_remainder.lam @@ -0,0 +1 @@ +(\a.a (a (a ((\b\c.b) a) (a (a ((\b\c.b) a) (a ((\b\c.b) (\b\c.b)) (\b.b))) ((\b\c.b) (\b.b)))) ((\b\c.b) (\b.b))) ((\b\c.b) (a ((\b\c.b) (a (\b.b))) (a (a ((\b\c.b) a) (a ((\b\c.b) (\b\c.b)) (a (\b.b) ((\b\c.b) (a (a ((\b\c.b) a) (a ((\b\c.b) (a ((\b\c.b) a))) (a (a ((\b\c.b) a) (a ((\b\c.b) (a ((\b\c.b) a))) (a (a ((\b\c.b) a) (a ((\b\c.b) (a ((\b\c.b) a))) (a ((\b\c.b) (a ((\b\c.b) (\b\c.b)))) (a (a ((\b\c.b) a) (a ((\b\c.b) (\b\c.b)) (\b.b))) ((\b\c.b) (\b.b)))))) ((\b\c.b) (a (a ((\b\c.b) a) (a (a ((\b\c.b) a) (a ((\b\c.b) (\b\c.b)) (\b.b))) ((\b\c.b) (\b.b)))) ((\b\c.b) (\b.b))))))) ((\b\c.b) ((\b\c.b) (\b.b)))))) ((\b\c.b) ((\b\c.b) (\b.b)))))))) ((\b\c.b) (\b.b)))))) (\a\b\c.a c (b c)) diff --git a/data/self-interpreter/reasoning_floor/remainder/tower45.blc b/data/self-interpreter/reasoning_floor/remainder/tower45.blc new file mode 100644 index 00000000..14094b19 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/tower45.blc @@ -0,0 +1 @@ +000100010111010100000000101110010111101011010 diff --git a/data/self-interpreter/reasoning_floor/remainder/tower45.lam b/data/self-interpreter/reasoning_floor/remainder/tower45.lam new file mode 100644 index 00000000..e6b369b4 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/tower45.lam @@ -0,0 +1 @@ +\s.(\d.s d d) (\b\r\d.r (b d r) d) diff --git a/data/self-interpreter/reasoning_floor/remainder/tower51.blc b/data/self-interpreter/reasoning_floor/remainder/tower51.blc new file mode 100644 index 00000000..92db308d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/tower51.blc @@ -0,0 +1 @@ +000100010111010100000011001011100000000101110101010 diff --git a/data/self-interpreter/reasoning_floor/remainder/tower51.lam b/data/self-interpreter/reasoning_floor/remainder/tower51.lam new file mode 100644 index 00000000..698fe4bb --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/tower51.lam @@ -0,0 +1 @@ +\s.(\d.s d d) (\b\r.r (b (\t\u\d.u d d) r)) diff --git a/data/self-interpreter/reasoning_floor/remainder/triple67_capped.blc b/data/self-interpreter/reasoning_floor/remainder/triple67_capped.blc new file mode 100644 index 00000000..0379d2a8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/triple67_capped.blc @@ -0,0 +1 @@ +0100010110101000000110010111000000001010101111011001011101010101010 diff --git a/data/self-interpreter/reasoning_floor/remainder/triple67_capped.lam b/data/self-interpreter/reasoning_floor/remainder/triple67_capped.lam new file mode 100644 index 00000000..a3a5e121 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/triple67_capped.lam @@ -0,0 +1 @@ +(\d.d d d) (\b\r.r (b (\t\u\d.t u (u d d) d d) r)) diff --git a/data/self-interpreter/reasoning_floor/remainder/unary_only.blc b/data/self-interpreter/reasoning_floor/remainder/unary_only.blc new file mode 100644 index 00000000..499ad908 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/unary_only.blc @@ -0,0 +1 @@ +000101101010 diff --git a/data/self-interpreter/reasoning_floor/remainder/unary_only.lam b/data/self-interpreter/reasoning_floor/remainder/unary_only.lam new file mode 100644 index 00000000..1ad603ae --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/unary_only.lam @@ -0,0 +1 @@ +\s.s s s diff --git a/data/self-interpreter/reasoning_floor/remainder/zero_tower_only.blc b/data/self-interpreter/reasoning_floor/remainder/zero_tower_only.blc new file mode 100644 index 00000000..ae5c210c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/zero_tower_only.blc @@ -0,0 +1 @@ +0100011010000001100000010111001100000010111111101111110100101101010 diff --git a/data/self-interpreter/reasoning_floor/remainder/zero_tower_only.lam b/data/self-interpreter/reasoning_floor/remainder/zero_tower_only.lam new file mode 100644 index 00000000..348639d6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/remainder/zero_tower_only.lam @@ -0,0 +1 @@ +(\x.x x) (\x\s.s (\b\r.b (r (\t\u.x x u)) (r r r))) diff --git a/data/self-interpreter/reasoning_floor/scratch/PROMPT.md b/data/self-interpreter/reasoning_floor/scratch/PROMPT.md new file mode 100644 index 00000000..d8af8ab0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/PROMPT.md @@ -0,0 +1,34 @@ +Lane "scratch": design a minimal BLC self-interpreter FROM SCRATCH. Lane +directory: /Users/a9lim/Work/blam/tmp/overnight/scratch/ (write only there). + +Do NOT read anything under docs/classical/self-interpreter/, +data/self-interpreter/, tmp/overnight/ (except your own directory), or the +.lam files of ref/AIT, and do not reconstruct known interpreters from memory +on purpose. The point of this lane is an architecture nobody has anchored on. +(For calibration only: the best known is 165 bits.) + +Contract. `⌜λM⌝ = 00⌜M⌝`, `⌜M N⌝ = 01⌜M⌝⌜N⌝`, `⌜var n⌝ = 1ⁿ0` (n ≥ 1, de +Bruijn, 1 = innermost). Input streams are Scott lists `cons b r = λf. f b r` +with bit 0 = `λx y. x` and bit 1 = `λx y. y`. A self-interpreter is a closed +E with `E C (⌜M⌝ ++ N) =β C (λz. M) N` for every closed M (including M with +no normal form), C and N rigid. Size in bits: λ and application cost 2 each, +`var n` costs n+1 (so |M| = 2L + 4A + 2 + X with X the sum of 0-based indices). + +Design from first principles. Enumerate on paper the jobs an interpreter must +do (read bits, dispatch three tags, skip/lookup unary indices, build closures, +apply, recurse, return the exact remainder) and look for representations where +one operation does several jobs — data structures whose own application does +work, computations whose single result serves several branches. Try at least +three genuinely different architectures before optimizing one. + +Tools (run from /Users/a9lim/Work/blam): +- `python3 tools/self-interpreter/battery.py FILE.lam` — exact contract on 668 + programs, ~2 s; success prints `N bits ok=667 skip=1 fail=0`. Write .lam in + named-lambda syntax (`\x. body`, application by juxtaposition); lets are + explicit redexes `(\v. body) value` and are not optimized, so the printed + size is exactly the term as written. +- `python3 tmp/overnight/self/polish.py FILE.lam` — battery plus the optimal + let structure (`blam golf letopt`); use it on every correct design. +No exhaustive sweeps, no run over ~2 minutes, at most 2 threads (shared +machine). Write REPORT.md: every architecture tried, every correct +interpreter (bits, battery line, polished size), and the ideas behind them. diff --git a/data/self-interpreter/reasoning_floor/scratch/REPORT.md b/data/self-interpreter/reasoning_floor/scratch/REPORT.md new file mode 100644 index 00000000..3e03a3ba --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/REPORT.md @@ -0,0 +1,299 @@ +# Scratch lane: a 220-bit interpreter derived independently + +The smallest interpreter found here is **220 bits**, in `best.lam` and +`best.blc`. It is byte-identical to `a7_shared_unary_update.lam` / `.blc`. +The supplied battery reports `220 bits ok=667 skip=1 fail=0`; the supplied +polishing script reports `smallest 220` with its two-cut search. This does +not improve on the supplied 165-bit calibration, and it is not a claim of +global minimality. + +No existing interpreter was read or intentionally reconstructed. Only the +lane's own files were read under `tmp/overnight/`; the separately authorized +`self/polish.py` was executed without reading its source. No files under the +excluded documentation/data directories or reference `.lam` files were read. +All writes made by this lane are in this directory. + +## Jobs and candidate representations + +The initial design inventory was: + +1. Destructure a Scott input cell to obtain its boolean and exact tail. +2. Dispatch `00`, `01`, and the initial `1`. +3. Consume the rest of a unary variable index through its terminating zero. +4. Turn that index into a lexical lookup operation. +5. Extend a lexical environment when constructing an abstraction. +6. Construct an application without evaluating the represented application. +7. Recur on the finite source syntax without demanding a source normal form. +8. Return the untouched input suffix with the represented term. +9. Supply the contract's extra unused outer binder. + +Architectures A, B, and C were each constructed and battery-tested before +optimizing any one of them. D and E were subsequent attempts to remove whole +operations rather than just adjust binding placement. + +### A. CPS parser producing functions of environments + +The parser returns a semantic function `f : environment -> source value`, +together with the remaining stream. Environments are Scott pairs. A variable +compiles to a projection; abstraction extends the environment; application +combines two semantic functions pointwise. + +The key representation saving is at the root: for a closed source term, +`f =β λenvironment. M`. Thus the environment argument itself supplies the +required `λz`; neither an initial environment nor a final wrapper is needed. +The first implementation was 345 bits. This architecture ultimately produced +the 220-bit candidate. + +### B. Parse a Church-fold syntax tree, then interpret it + +The first stage returns a tree and its exact remainder. Its constructors are +encoded as a fold over lambda/application/variable handlers. A second stage +folds that tree into the semantic functions from A. Unary selectors are leaf +payloads. + +This cleanly separates syntax consumption from evaluation and passed at +507 bits. Its overhead shows exactly what A's fusion eliminates: constructor +packaging, handler plumbing, and a second traversal. This was a genuinely +separate implemented pipeline, not merely a renamed A continuation. + +### C. Direct environment evaluator returning pairs + +This parser takes an actual environment and returns `(value, remainder)`. +For abstraction it constructs the value + +``` +λx. first (parse (cons x environment) body_stream) +``` + +and obtains the remainder from a separate parse whose value is discarded. +The latter parse never needs to evaluate environment entries: variable +lookups remain in the discarded value component. Application likewise puts +the source application inside a lazy pair component. + +This removes semantic compilation functions but duplicates body parsing +when abstraction is observed. It passed at 488 bits. Pair projections, +explicit environment threading, and lifting abstraction through a pair cost +more than the compiler representation saves. + +### D. The grammar and environment are bit-reading tries + +Define a node by + +``` +Node zero one stream = stream (λbit. bit zero one). +``` + +It reads one bit, chooses a child, and gives that child the exact tail. A +grammar state is `Node (Node lambda_branch application_branch) environment`. +An environment entry holding `x` with outer environment `e` is +`Node (Pair x) e`. + +Consequently, the environment's own application reads the remaining unary +index and returns the selected value and exact suffix. There is no separate +unary recursion. The same constructor implements grammar dispatch, variable +lookup, and index skipping. + +Abstraction uses a local function `f x` returning the body's value/remainder +pair. It returns `Pair (λx. first (f x)) (second (f f))`. The dummy argument +`f` is harmless because extracting a remainder never demands a source value. +This design passed at 299 bits. Its duplicate body parsing and pair-lifting +costs outweigh removal of the unary loop. The fallback let search found a +288-bit rendering, not separately battery-tested. + +### E. A single recursive decoder with two states + +A boolean distinguishes term parsing from unary parsing. In term state, +the first one changes state without shifting the projection. Further ones +compose a tail projection. A zero either reads the second term tag or emits +the head projection, depending on state. + +This eliminates the separate recursive knot but adds state-dependent +branches, state arguments, and their deeper variable references. It passed +at 251 bits and polished to a reported 247. It lost to the two-loop design. + +## How A reached 220 bits + +The substantive transformations were: + +- Both `00` and `01` parse a first child. Select its continuation before one + common recursive call. Application's continuation schedules the second + child. This and tail-continuation contraction reduced 345 to 250 bits. +- Select stream consumers before supplying the unread tail. A separate + shared reader combinator was tried, but its extra binding did not win. +- Move the unary fixed point to its only syntactic use. The earlier distant + binding made its two references expensive in de Bruijn encoding. +- Bind the main recursive parser once after its knot unfolds; also bind the + second-tag handler outside the input-reading lambdas. These changes give + a 231-bit interpreter using literal environment selectors. +- Reuse input bits as selectors. The zero ending a unary index is already + `K = λx y. x`, the environment head selector. Each continuing one is already + `F = λx y. y`, the environment tail selector. Both selector constants can + therefore disappear. This gives 225 bits. +- Factor the unary loop's continuation update. Both branches compose a + decoded suffix projection with `environment -> environment bit`. On zero, + the suffix projection is `I`; on one, obtain it recursively. This gives + 220 bits. + +The last two steps are the strongest reuse of a data operation found in this +lane: each input bit simultaneously controls recursion and performs the +environment operation required by that recursion. + +## Readable equations for the final interpreter + +These are defining equations for explanation, not size-free primitives in +the implementation. `best.lam` contains all fixed points, constructors, +continuations, and local bindings explicitly. + +``` +I = λx. x +Pair x e = λh. h x e + +U k s = s (λb. + b (λj. j I) U (λd. k (λe. d (e b)))) + +P k s = s (λb. + b (λt. t (λc. + P (c (λd. k (λe x. d (Pair x e))) + (λf. P (λg. k (λe. f e (g e))))))) + (U k)) + +E = P +``` + +Both `U` and `P` are realized with the explicit self-application knot +`(λself. self self) body`. The final implementation also binds the repeated +main recursive call and the second-tag handler. No implied optimizer is +needed to obtain the reported size. + +## Structural correctness argument + +This argument is independent of the finite test battery. + +Let `K` and `F` be the given zero and one booleans. Define projections + +``` +π₁ e = e K +πₙ₊₁ e = πₙ (e F). +``` + +The unary loop has the invariant, for every `n >= 1`, arbitrary `k`, and +arbitrary suffix `N`, + +``` +U k (1^(n-1) 0 ++ N) =β k πₙ N. +``` + +For a terminal zero, the bit chooses `λj. j I`; applying the common +continuation to `I` returns `λe. I (e K)`, which beta-reduces to `π₁`. +For a one, the bit chooses the recursive `U`. Induction on the remaining +unary length yields `λe. πₙ (e F) = πₙ₊₁`. The returned suffix is unchanged +at each step. These are beta reductions; no eta equivalence is needed. + +For a finite source term define the ordinary environment translation: + +``` +T[var n] e = πₙ e +T[λM] e = λx. T[M] (Pair x e) +T[M N] e = (T[M] e) (T[N] e). +``` + +Structural induction on the source syntax, using the unary invariant and +the three parser branches, gives + +``` +P C (code(M) ++ N) =β C (λe. T[M] e) N. +``` + +The lambda branch parses its body and constructs the environment-extension +function. The application branch parses left then right, threading their +exact remainders, and constructs a source application inside its semantic +function. Neither branch needs to contract that source application. + +Under a stack `Pair x₁ (Pair x₂ ... base)`, a variable whose index is within +the stack reduces to its corresponding `xᵢ`. For closed `M`, every variable +is within the syntactically introduced stack; no projection ever reaches +`base`. Expanding interpreter overhead and those projections therefore +gives `λe. M`, up to alpha conversion. Hence + +``` +E C (code(M) ++ N) =β C (λz. M) N. +``` + +All inductions are on finite syntax or finite unary length. They do not +assume termination, weak-head normalization, or normalizability of `M`. +The proof uses a finite choice of beta reductions that expands interpreter +overhead while leaving source computation uncontracted. The leading +environment lambda is retained, including for a source abstraction. + +The local let bindings in the final 220-bit file only factor subexpressions +of these equations; expanding them gives the displayed parser. In +particular, the required outer binder is not eta-contracted away. + +## Results for every constructed candidate + +Each battery line below is copied in substance from the corresponding +`*.battery.log`; only its path is omitted. Each file was also submitted to +the supplied `polish.py`. `*` means that script returned `smallest ?` +because let inlining did not terminate. The displayed fallback is the +minimum reported by an explicitly bounded `--no-inline --max-cuts 2` run; +that fallback rendering was not separately battery-tested. + +| File | Battery line | Polished bits | +|---|---|---:| +| `a_env_cps.lam` | `345 bits ok=667 skip=1 fail=0` | 321* | +| `b_tree_fold.lam` | `507 bits ok=667 skip=1 fail=0` | 483* | +| `c_direct_pair.lam` | `488 bits ok=667 skip=1 fail=0` | 427* | +| `a2_shared_parse.lam` | `250 bits ok=667 skip=1 fail=0` | 243* | +| `d_trie_environment.lam` | `299 bits ok=667 skip=1 fail=0` | 288* | +| `a3_shared_read.lam` | `249 bits ok=667 skip=1 fail=0` | 246* | +| `a4_local_unary.lam` | `242 bits ok=667 skip=1 fail=0` | 231 | +| `a5_shared_recursion.lam` | `233 bits ok=667 skip=1 fail=0` | 231 | +| `e_unified_decoder.lam` | `251 bits ok=667 skip=1 fail=0` | 247 | +| `a5_polished.lam` | `231 bits ok=667 skip=1 fail=0` | 231 | +| `a6_input_selectors.lam` | `225 bits ok=667 skip=1 fail=0` | 225 | +| `a7_shared_unary_update.lam` | `220 bits ok=667 skip=1 fail=0` | 220 | +| `best.lam` | `220 bits ok=667 skip=1 fail=0` | 220 | + +The final 231- and 220-bit renderings were both materialized and independently +passed through the battery and polishing script. The battery's one skipped +case is not counted as a pass; the general non-normalizing-source claim is +supported by the structural argument above, not by that skip. + +`a7_shared_unary_update.letopt.log` contains the final optimizer result: + +``` +input 220 bits; core 231 bits (88 nodes) +smallest rendering over 0..=2 cuts: 220 bits +``` + +This is an optimum only within the optimizer's specified cut search over +that core. The original calibration and these measurements provide no lower +bound on a different architecture. + +## Reproduction and operational limits + +From the repository root: + +``` +python3 tmp/overnight/scratch/derive.py +python3 tmp/overnight/scratch/check.py best.lam +``` + +`derive.py` constructs the initial architectures and optimization stages from +named ASTs, independently counts their BLC encodings, and writes their source +and bit files. `check.py` invokes the two authorized checkers with 110-second +timeouts and worker limits of two. The final battery runs took approximately +two seconds each; the final direct let search took under a second. No +exhaustive interpreter sweep or long experiment was run. + +All external compute invocations used `RAYON_NUM_THREADS=2`; direct letopt +also used `--threads 2`. One early battery/letopt pair briefly overlapped, +so the aggregate two-thread constraint was not strictly maintained at that +point. Subsequent compute runs were serialized. + +The supplied polishing wrapper did not surface its early inlining errors; +the direct `*.letopt.log` records do. An additional tool quirk was observed: +with `--report-le 0`, the printed `best` term could remain the input although +the `smallest rendering` statistic was lower. No final artifact was taken +from that contradictory `best` line. The 220-bit candidate was constructed +directly and its normal-threshold optimizer output agrees with it. diff --git a/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.battery.log b/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.battery.log new file mode 100644 index 00000000..8215a422 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.battery.log @@ -0,0 +1,2 @@ +battery a2_shared_parse.lam: exit=0 seconds=2.058 + 250 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a2_shared_parse.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.blc b/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.blc new file mode 100644 index 00000000..d557f81a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.blc @@ -0,0 +1 @@ +0100010001101000000001100001011000011000010111111101111110010110000111111100000011110000101101101110000101111111101111111000011111111000010111101001110100101111110111110111000000001100001011001111000011000001100101111101111000011111000011100110000010 diff --git a/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.lam b/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.lam new file mode 100644 index 00000000..8ad52e81 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.lam @@ -0,0 +1 @@ +((\u. ((\p. (p p)) (\p. (\k. (\s. (s (\b. ((b (\t. (t (\c. ((p p) ((c (\d. (k (\e. (\x. (d (\h. ((h x) e)))))))) (\f. ((p p) (\g. (k (\e. ((f e) (g e))))))))))))) ((u u) k))))))))) (\u. (\k. (\s. (s (\b. ((b (k (\e. (e (\a. (\b. a)))))) ((u u) (\d. (k (\e. (d (e (\a. (\b. b))))))))))))))) diff --git a/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.letopt-no-inline.log b/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.letopt-no-inline.log new file mode 100644 index 00000000..b3abf7d9 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.letopt-no-inline.log @@ -0,0 +1,171 @@ +input 250 bits; core 250 bits (93 nodes); 657 candidate cuts (14 shared) +k=1: 657 valid, 0 invalid, 0.0s; smallest sizes 243:3 244:4 246:2 247:2 248:1 249:2 + 243 [[9, 27]->43] + (\a. (\b. b b) (\b c d. d (\e. e (\f. f ((\g h. g (h (\i. c (\j k. i (\l. l k j))) (\i. g (\j. c (\k. i k (j k)))))) (b b))) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000000110000101100001100100000111001011000011111111000000111100001011011011100001111000011111111100001011110100111010011111101111100101111110111110111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 243 [[9, 27]->45] + (\a. (\b. b b) (\b c d. d (\e. e ((\f g. g (\h. f (h (\i. c (\j k. i (\l. l k j))) (\i. f (\j. c (\k. i k (j k))))))) (b b)) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000000110000101100100000110000111100101100001111111100000011110000101101101110000111110000111111111000010111101001110100111110111100101111110111110111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 243 [[9, 27]->56] + (\a. (\b. b b) (\b. (\c d e. e (\f. f (\g. g (\h. c (h (\i. d (\j k. i (\l. l k j))) (\i. c (\j. d (\k. i k (j k))))))) (a a d))) (b b))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100001000000011000010110000110000111111100101100001111111000000111100001011011011100001111111100001111111100001011110100111010010111111101111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 244 [[43]->55] + (\a. (\b. b b) (\b c. (\d e. e (\f. f (\g. g d) (a a c))) (\d. b b (d (\e. c (\f g. e (\h. h g f))) (\e. b b (\f. c (\g. e g (f g)))))))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101000000100000110000101100001101111001011111110111111011110000101111011100101100001111000000111100001011011011100001011111011110000111110000101111010011101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 244 [[9, 27]->42] + (\a. (\b. b b) (\b c d. d (\e. e (\f. f (\g. (\h. h (g (\i. c (\j k. i (\l. l k j))) (\i. h (\j. c (\k. i k (j k)))))) (b b))) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101000000001100001011000011000010001100101110000111111110000001111000010110110111000011100001111111110000101111010011101001111111011111100101111110111110111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 244 [[9, 27]->44] + (\a. (\b. b b) (\b c d. d (\e. e (\f. (\g. f (\h. g (h (\i. c (\j k. i (\l. l k j))) (\i. g (\j. c (\k. i k (j k))))))) (b b)) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101000000001100001011000010001110000111001011000011111111000000111100001011011011100001111000011111111100001011110100111010011111101111100101111110111110111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 244 [[9, 27]->46] + (\a. (\b. b b) (\b c d. d (\e. (\f. e (\g. g (\h. f (h (\i. c (\j k. i (\l. l k j))) (\i. f (\j. c (\k. i k (j k)))))))) (b b) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101000000001100001010001110000110000111100101100001111111100000011110000101101101110000111110000111111111000010111101001110100111110111100101111110111110111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[9, 27]->53] + (\a. (\b. b b) (\b c d. d ((\e f. f (\g. g (\h. e (h (\i. c (\j k. i (\l. l k j))) (\i. e (\j. c (\k. i k (j k))))))) (a a c)) (b b)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000000110010000010110000110000111110010110000111111110000001111000010110110111000011111100001111111110000101111010011101001011111110111111011110011110111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[9, 27]->55] + (\a. (\b. b b) (\b c. (\d e. e (\f. f (\g. g (\h. d (h (\i. c (\j k. i (\l. l k j))) (\i. d (\j. c (\k. i k (j k))))))) (a a c))) (b b))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000010000011000010110000110000111111001011000011111111000000111100001011011011100001111111000011111111100001011110100111010010111111101111110111100111011000000001100001011001111000011000001100101111101111000011111000011100110000010 + 247 [[9, 27]->52] + (\a. (\b. b b) (\b c d. d (\e. (\f. e (\g. g (\h. f (h (\i. c (\j k. i (\l. l k j))) (\i. f (\j. c (\k. i k (j k))))))) (a a c)) (b b)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101000000001100001000101110000110000111100101100001111111100000011110000101101101110000111110000111111111000010111101001110100101111111011111101111001111101111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 247 [[9, 27]->54] + (\a. (\b. b b) (\b c d. (\e. d (\f. f (\g. g (\h. e (h (\i. c (\j k. i (\l. l k j))) (\i. e (\j. c (\k. i k (j k))))))) (a a c))) (b b))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101000000001000111000010110000110000111110010110000111111110000001111000010110110111000011111100001111111110000101111010011101001011111110111111011110011110111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 248 [[53]->55] + (\a. (\b. b b) (\b c. (\d e. e d) (\d. d (\e. e (\f. b b (f (\g. c (\h i. g (\j. j i h))) (\g. b b (\h. c (\i. g i (h i))))))) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100011010000001000001101100001011000011000010111111011111001011000011111100000011110000101101101110000101111111011111100001111111000010111101001110100101111101111011000000001100001011001111000011000001100101111101111000011111000011100110000010 + 249 [[43]->53] + (\a. (\b. b b) (\b c d. d ((\e f. f (\g. g e) (a a c)) (\e. b b (e (\f. c (\g h. f (\i. i h g))) (\f. b b (\g. c (\h. f h (g h))))))))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000000110010000010110000110111001011111110111111011110000101111101111001011000011111000000111100001011011011100001011111101111100001111110000101111010011101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 249 [[45]->55] + (\a. (\b. b b) (\b c. (\d e. e (\f. f d (a a c))) (\d. d (\e. b b (e (\f. c (\g h. f (\i. i h g))) (\f. b b (\g. c (\h. f h (g h))))))))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000010000011000010110111001011111110111111011110000110000101111101111001011000011111000000111100001011011011100001011111101111100001111110000101111010011101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 250 [[43]->54] + (\a. (\b. b b) (\b c d. (\e. d (\f. f (\g. g e) (a a c))) (\e. b b (e (\f. c (\g h. f (\i. i h g))) (\f. b b (\g. c (\h. f h (g h)))))))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101000000001000111000010110000110111001011111110111111011110000101111101111001011000011111000000111100001011011011100001011111101111100001111110000101111010011101000000001100001011001111000011000001100101111101111000011111000011100110000010 +k=2: 191417 valid, 24079 invalid, 0.2s; smallest sizes 243:5 244:8 245:12 246:32 247:35 248:18 + 243 [[43]->55 [9, 27]->43] + (\a. (\b. b b) (\b c. (\d e. e (\f. f (\g. g d) (a a c))) ((\d e. d (e (\f. c (\g h. f (\i. i h g))) (\f. d (\g. c (\h. f h (g h)))))) (b b)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000010000011000010110000110111100101111111011111101111001000001110010110000111110000001111000010110110111000011110000111111000010111101001110100111011000000001100001011001111000011000001100101111101111000011111000011100110000010 + 243 [[43]->55 [9, 27]->56] + (\a. (\b. b b) (\b. (\c d. (\e f. f (\g. g (\h. h e) (a a d))) (\e. c (e (\f. d (\g h. f (\i. i h g))) (\f. c (\g. d (\h. f h (g h))))))) (b b))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100001000001000001100001011000011011110010111111110111111101111000011110010110000111100000011110000101101101110000111110000111110000101111010011101001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 243 [[53]->55 [9, 27]->43] + (\a. (\b. b b) (\b c. (\d e. e d) (\d. d (\e. e ((\f g. f (g (\h. c (\i j. h (\k. k j i))) (\h. f (\i. c (\j. h j (i j)))))) (b b))) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000010000011011000010110000110010000011100101100001111111000000111100001011011011100001111000011111111000010111101001110100111110111100101111101111011000000001100001011001111000011000001100101111101111000011111000011100110000010 + 243 [[53]->55 [9, 27]->45] + (\a. (\b. b b) (\b c. (\d e. e d) (\d. d ((\e f. f (\g. e (g (\h. c (\i j. h (\k. k j i))) (\h. e (\i. c (\j. h j (i j))))))) (b b)) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000010000011011000010110010000011000011110010110000111111100000011110000101101101110000111110000111111110000101111010011101001111011100101111101111011000000001100001011001111000011000001100101111101111000011111000011100110000010 + 243 [[53]->55 [9, 27]->56] + (\a. (\b. b b) (\b. (\c d. (\e f. f e) (\e. e (\f. f (\g. c (g (\h. d (\i j. h (\k. k j i))) (\h. c (\i. d (\j. h j (i j))))))) (a a d))) (b b))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100001000001000001101100001011000011000011111100101100001111110000001111000010110110111000011111110000111111100001011110100111010010111111011111011001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 244 [[43]->55 [9, 27]->42] + (\a. (\b. b b) (\b c. (\d e. e (\f. f (\g. g d) (a a c))) (\d. (\e. e (d (\f. c (\g h. f (\i. i h g))) (\f. e (\g. c (\h. f h (g h)))))) (b b)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101000000100000110000101100001101111001011111110111111011110000100011001011100001111100000011110000101101101110000111000011111100001011110100111010011110111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 244 [[49]->57 [9, 27]->56] + (\a. (\b. b b) ((\b c. (\d e f. f (\g. g (\h. h (\i. d (i (\j. e (\k l. j (\m. m l k))) (\j. d (\k. e (\l. j l (k l))))))) (b e))) (c c)) (a a))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101001000001000000011000010110000110000111111100101100001111111000000111100001011011011100001111111100001111111100001011110100111010011111110111001101001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 244 [[49]->58 [9, 27]->56] + (\a. (\b. (\c. c c) (\c. (\d e f. f (\g. g (\h. h (\i. d (i (\j. e (\k l. j (\m. m l k))) (\j. d (\k. e (\l. j l (k l))))))) (b e))) (c c))) (a a)) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001000110100001000000011000010110000110000111111100101100001111111000000111100001011011011100001111111100001111111100001011110100111010011111110111001101001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 244 [[51]->57 [9, 27]->56] + (\a. (\b. b b) ((\b c. (\d e f. f (\g. g (\h. h (\i. d (i (\j. e (\k l. j (\m. m l k))) (\j. d (\k. e (\l. j l (k l))))))) (b e))) (c c)) (a a))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101001000001000000011000010110000110000111111100101100001111111000000111100001011011011100001111111100001111111100001011110100111010011111110111001101001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 244 [[51]->58 [9, 27]->56] + (\a. (\b. (\c. c c) (\c. (\d e f. f (\g. g (\h. h (\i. d (i (\j. e (\k l. j (\m. m l k))) (\j. d (\k. e (\l. j l (k l))))))) (b e))) (c c))) (a a)) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001000110100001000000011000010110000110000111111100101100001111111000000111100001011011011100001111111100001111111100001011110100111010011111110111001101001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 244 [[53]->55 [9, 27]->42] + (\a. (\b. b b) (\b c. (\d e. e d) (\d. d (\e. e (\f. (\g. g (f (\h. c (\i j. h (\k. k j i))) (\h. g (\i. c (\j. h j (i j)))))) (b b))) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101000000100000110110000101100001100001000110010111000011111110000001111000010110110111000011100001111111100001011110100111010011111101111100101111101111011000000001100001011001111000011000001100101111101111000011111000011100110000010 + 244 [[53]->55 [9, 27]->44] + (\a. (\b. b b) (\b c. (\d e. e d) (\d. d (\e. (\f. e (\g. f (g (\h. c (\i j. h (\k. k j i))) (\h. f (\i. c (\j. h j (i j))))))) (b b)) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101000000100000110110000101100001000111000011100101100001111111000000111100001011011011100001111000011111111000010111101001110100111110111100101111101111011000000001100001011001111000011000001100101111101111000011111000011100110000010 + 244 [[53]->55 [9, 27]->46] + (\a. (\b. b b) (\b c. (\d e. e d) (\d. (\e. d (\f. f (\g. e (g (\h. c (\i j. h (\k. k j i))) (\h. e (\i. c (\j. h j (i j)))))))) (b b) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 0100010001101000000100000110110000101000111000011000011110010110000111111100000011110000101101101110000111110000111111110000101111010011101001111011100101111101111011000000001100001011001111000011000001100101111101111000011111000011100110000010 + 245 [[43]->55 [49]->57] + (\a. (\b. b b) ((\b c d. (\e f. f (\g. g (\h. h e) (b d))) (\e. c c (e (\f. d (\g h. f (\i. i h g))) (\f. c c (\g. d (\h. f h (g h))))))) (a a))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100011010010000000100000110000101100001101111001111111011110000101111011100101100001111000000111100001011011011100001011111011110000111110000101111010011101001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 245 [[43]->55 [49]->58] + (\a. (\b. (\c. c c) (\c d. (\e f. f (\g. g (\h. h e) (b d))) (\e. c c (e (\f. d (\g h. f (\i. i h g))) (\f. c c (\g. d (\h. f h (g h)))))))) (a a)) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100010001101000000100000110000101100001101111001111111011110000101111011100101100001111000000111100001011011011100001011111011110000111110000101111010011101001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 245 [[43]->55 [51]->57] + (\a. (\b. b b) ((\b c d. (\e f. f (\g. g (\h. h e) (b d))) (\e. c c (e (\f. d (\g h. f (\i. i h g))) (\f. c c (\g. d (\h. f h (g h))))))) (a a))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100011010010000000100000110000101100001101111001111111011110000101111011100101100001111000000111100001011011011100001011111011110000111110000101111010011101001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 245 [[43]->55 [51]->58] + (\a. (\b. (\c. c c) (\c d. (\e f. f (\g. g (\h. h e) (b d))) (\e. c c (e (\f. d (\g h. f (\i. i h g))) (\f. c c (\g. d (\h. f h (g h)))))))) (a a)) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100010001101000000100000110000101100001101111001111111011110000101111011100101100001111000000111100001011011011100001011111011110000111110000101111010011101001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 245 [[49]->57 [9, 27]->43] + (\a. (\b. b b) ((\b c d e. e (\f. f (\g. g ((\h i. h (i (\j. d (\k l. j (\m. m l k))) (\j. h (\k. d (\l. j l (k l)))))) (c c))) (b d))) (a a))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100011010010000000001100001011000011001000001110010110000111111110000001111000010110110111000011110000111111111000010111101001110100111111011111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 245 [[49]->57 [9, 27]->45] + (\a. (\b. b b) ((\b c d e. e (\f. f ((\g h. h (\i. g (i (\j. d (\k l. j (\m. m l k))) (\j. g (\k. d (\l. j l (k l))))))) (c c)) (b d))) (a a))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100011010010000000001100001011001000001100001111001011000011111111000000111100001011011011100001111100001111111110000101111010011101001111101111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 245 [[49]->58 [9, 27]->43] + (\a. (\b. (\c. c c) (\c d e. e (\f. f (\g. g ((\h i. h (i (\j. d (\k l. j (\m. m l k))) (\j. h (\k. d (\l. j l (k l)))))) (c c))) (b d)))) (a a)) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100010001101000000001100001011000011001000001110010110000111111110000001111000010110110111000011110000111111111000010111101001110100111111011111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 245 [[49]->58 [9, 27]->45] + (\a. (\b. (\c. c c) (\c d e. e (\f. f ((\g h. h (\i. g (i (\j. d (\k l. j (\m. m l k))) (\j. g (\k. d (\l. j l (k l))))))) (c c)) (b d)))) (a a)) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100010001101000000001100001011001000001100001111001011000011111111000000111100001011011011100001111100001111111110000101111010011101001111101111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 245 [[51]->57 [9, 27]->43] + (\a. (\b. b b) ((\b c d e. e (\f. f (\g. g ((\h i. h (i (\j. d (\k l. j (\m. m l k))) (\j. h (\k. d (\l. j l (k l)))))) (c c))) (b d))) (a a))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100011010010000000001100001011000011001000001110010110000111111110000001111000010110110111000011110000111111111000010111101001110100111111011111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 245 [[51]->57 [9, 27]->45] + (\a. (\b. b b) ((\b c d e. e (\f. f ((\g h. h (\i. g (i (\j. d (\k l. j (\m. m l k))) (\j. g (\k. d (\l. j l (k l))))))) (c c)) (b d))) (a a))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100011010010000000001100001011001000001100001111001011000011111111000000111100001011011011100001111100001111111110000101111010011101001111101111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 245 [[51]->58 [9, 27]->43] + (\a. (\b. (\c. c c) (\c d e. e (\f. f (\g. g ((\h i. h (i (\j. d (\k l. j (\m. m l k))) (\j. h (\k. d (\l. j l (k l)))))) (c c))) (b d)))) (a a)) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100010001101000000001100001011000011001000001110010110000111111110000001111000010110110111000011110000111111111000010111101001110100111111011111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 245 [[51]->58 [9, 27]->45] + (\a. (\b. (\c. c c) (\c d e. e (\f. f ((\g h. h (\i. g (i (\j. d (\k l. j (\m. m l k))) (\j. g (\k. d (\l. j l (k l))))))) (c c)) (b d)))) (a a)) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 01000100010001101000000001100001011001000001100001111001011000011111111000000111100001011011011100001111100001111111110000101111010011101001111101111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[43]->45 [9, 27]->43] + (\a. (\b. b b) (\b c d. d (\e. e ((\f g. g f) ((\f g. f (g (\h. c (\i j. h (\k. k j i))) (\h. f (\i. c (\j. h j (i j)))))) (b b))) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000000110000101100100000110110010000011100101100001111111000000111100001011011011100001111000011111111000010111101001110100111110111100101111110111110111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[43]->45 [9, 27]->45] + (\a. (\b. b b) (\b c d. d (\e. e ((\f. (\g h. h g) (\g. f (g (\h. c (\i j. h (\k. k j i))) (\h. f (\i. c (\j. h j (i j))))))) (b b)) (a a c)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000000110000101100100010000011011000011100101100001111111000000111100001011011011100001111000011111111000010111101001110100111110111100101111110111110111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[43]->45 [9, 27]->56] + (\a. (\b. b b) (\b. (\c d e. e (\f. f ((\g h. h g) (\g. c (g (\h. d (\i j. h (\k. k j i))) (\h. c (\i. d (\j. h j (i j))))))) (a a d))) (b b))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100001000000011000010110010000011011000011111100101100001111110000001111000010110110111000011111110000111111100001011110100111010010111111101111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[43]->53 [9, 27]->43] + (\a. (\b. b b) (\b c d. d ((\e f. f (\g. g e) (a a c)) ((\e f. e (f (\g. c (\h i. g (\j. j i h))) (\g. e (\h. c (\i. g i (h i)))))) (b b))))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000000110010000010110000110111001011111110111111011110010000011100101100001111110000001111000010110110111000011110000111111100001011110100111010011110111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[43]->53 [9, 27]->56] + (\a. (\b. b b) (\b. (\c d e. e ((\f g. g (\h. h f) (a a d)) (\f. c (f (\g. d (\h i. g (\j. j i h))) (\g. c (\h. d (\i. g i (h i)))))))) (b b))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100001000000011001000001011000011011100101111111101111111011110000111110010110000111110000001111000010110110111000011111100001111110000101111010011101001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[43]->55 [9, 27]->55] + (\a. (\b. b b) (\b c. (\d. (\e f. f (\g. g (\h. h e) (a a c))) (\e. d (e (\f. c (\g h. f (\i. i h g))) (\f. d (\g. c (\h. f h (g h))))))) (b b))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000010001000001100001011000011011110010111111110111111101111100001110010110000111110000001111000010110110111000011110000111111000010111101001110100111011000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[45]->55 [9, 27]->43] + (\a. (\b. b b) (\b c. (\d e. e (\f. f d (a a c))) (\d. d ((\e f. e (f (\g. c (\h i. g (\j. j i h))) (\g. e (\h. c (\i. g i (h i)))))) (b b))))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000010000011000010110111001011111110111111011110000110010000011100101100001111110000001111000010110110111000011110000111111100001011110100111010011110111000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[45]->55 [9, 27]->45] + (\a. (\b. b b) (\b c. (\d e. e (\f. f d (a a c))) ((\d e. e (\f. d (f (\g. c (\h i. g (\j. j i h))) (\g. d (\h. c (\i. g i (h i))))))) (b b)))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100000010000011000010110111001011111110111111011110010000011000011110010110000111111000000111100001011011011100001111100001111111000010111101001110100111011000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[45]->55 [9, 27]->56] + (\a. (\b. b b) (\b. (\c d. (\e f. f (\g. g e (a a d))) (\e. e (\f. c (f (\g. d (\h i. g (\j. j i h))) (\g. c (\h. d (\i. g i (h i)))))))) (b b))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100001000001000001100001011011100101111111101111111011110000110000111110010110000111110000001111000010110110111000011111100001111110000101111010011101001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[49]->57 [9, 27]->42] + (\a. (\b. b b) ((\b c d e. e (\f. f (\g. g (\h. (\i. i (h (\j. d (\k l. j (\m. m l k))) (\j. i (\k. d (\l. j l (k l)))))) (c c))) (b d))) (a a))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100100000000011000010110000110000100011001011100001111111100000011110000101101101110000111000011111111100001011110100111010011111110111111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[49]->57 [9, 27]->44] + (\a. (\b. b b) ((\b c d e. e (\f. f (\g. (\h. g (\i. h (i (\j. d (\k l. j (\m. m l k))) (\j. h (\k. d (\l. j l (k l))))))) (c c)) (b d))) (a a))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100100000000011000010110000100011100001110010110000111111110000001111000010110110111000011110000111111111000010111101001110100111111011111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[49]->57 [9, 27]->46] + (\a. (\b. b b) ((\b c d e. e (\f. (\g. f (\h. h (\i. g (i (\j. d (\k l. j (\m. m l k))) (\j. g (\k. d (\l. j l (k l)))))))) (c c) (b d))) (a a))) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000110100100000000011000010100011100001100001111001011000011111111000000111100001011011011100001111100001111111110000101111010011101001111101111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[49]->58 [9, 27]->42] + (\a. (\b. (\c. c c) (\c d e. e (\f. f (\g. g (\h. (\i. i (h (\j. d (\k l. j (\m. m l k))) (\j. i (\k. d (\l. j l (k l)))))) (c c))) (b d)))) (a a)) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000100011010000000011000010110000110000100011001011100001111111100000011110000101101101110000111000011111111100001011110100111010011111110111111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[49]->58 [9, 27]->44] + (\a. (\b. (\c. c c) (\c d e. e (\f. f (\g. (\h. g (\i. h (i (\j. d (\k l. j (\m. m l k))) (\j. h (\k. d (\l. j l (k l))))))) (c c)) (b d)))) (a a)) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000100011010000000011000010110000100011100001110010110000111111110000001111000010110110111000011110000111111111000010111101001110100111111011111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + 246 [[49]->58 [9, 27]->46] + (\a. (\b. (\c. c c) (\c d e. e (\f. (\g. f (\h. h (\i. g (i (\j. d (\k l. j (\m. m l k))) (\j. g (\k. d (\l. j l (k l)))))))) (c c) (b d)))) (a a)) (\a b c. c (\d. d (b (\e. e (\f g. f))) (a a (\e. b (\f. e (f (\g h. h))))))) + 010001000100011010000000011000010100011100001100001111001011000011111111000000111100001011011011100001111100001111111110000101111010011101001111101111001111110111001101000000001100001011001111000011000001100101111101111000011111000011100110000010 + ... 264 more at <= 250 +smallest rendering over 0..=2 cuts: 243 bits +best 243 010001000110100000000110000101100001100100000111001011000011111111000000111100001011011011100001111000011111111100001011110100111010011111101111100101111110111110111000000001100001011001111000011000001100101111101111000011111000011100110000010 diff --git a/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.polish.log b/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.polish.log new file mode 100644 index 00000000..c0ab8201 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a2_shared_parse.polish.log @@ -0,0 +1,3 @@ +polish a2_shared_parse.lam: exit=0 seconds=2.801 +/Users/a9lim/Work/blam/tmp/overnight/scratch/a2_shared_parse.lam: 250 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a2_shared_parse.lam + letopt --max-cuts 2: smallest ? diff --git a/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.battery.log b/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.battery.log new file mode 100644 index 00000000..dfb14285 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.battery.log @@ -0,0 +1,2 @@ +battery a3_shared_read.lam: exit=0 seconds=1.764 + 249 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a3_shared_read.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.blc b/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.blc new file mode 100644 index 00000000..1cbe41e9 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.blc @@ -0,0 +1 @@ +010001000100011010000001111100001011001111110000101111101111001011000011111000000111100001011011011100001011111101111100001111110000101111010011101001011111011110110000001111000010110011100001100000110010111101110000111100001110011000001000000110110 diff --git a/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.lam b/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.lam new file mode 100644 index 00000000..68bcf7e2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.lam @@ -0,0 +1 @@ +((\read. ((\u. ((\p. (p p)) (\p. (\k. (read (\b. ((b (read (\c. ((p p) ((c (\d. (k (\e. (\x. (d (\h. ((h x) e)))))))) (\f. ((p p) (\g. (k (\e. ((f e) (g e)))))))))))) ((u u) k)))))))) (\u. (\k. (read (\b. ((b (k (\e. (e (\a. (\b. a)))))) ((u u) (\d. (k (\e. (d (e (\a. (\b. b))))))))))))))) (\h. (\s. (s h)))) diff --git a/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.letopt-no-inline.log b/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.letopt-no-inline.log new file mode 100644 index 00000000..3b83df9a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.letopt-no-inline.log @@ -0,0 +1,6 @@ +a3_shared_read.lam: exit=0 seconds=0.207 +input 249 bits; core 249 bits (97 nodes); 684 candidate cuts (14 shared) +k=1: 684 valid, 0 invalid, 0.0s; smallest sizes 246:1 247:2 248:2 250:1 251:2 252:1 +k=2: 208626 valid, 24960 invalid, 0.2s; smallest sizes 251:7 252:23 253:47 254:87 255:123 256:94 +smallest rendering over 0..=2 cuts: 246 bits +best 249 010001000100011010000001111100001011001111110000101111101111001011000011111000000111100001011011011100001011111101111100001111110000101111010011101001011111011110110000001111000010110011100001100000110010111101110000111100001110011000001000000110110 diff --git a/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.polish.log b/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.polish.log new file mode 100644 index 00000000..992298ea --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a3_shared_read.polish.log @@ -0,0 +1,3 @@ +polish a3_shared_read.lam: exit=0 seconds=2.499 +/Users/a9lim/Work/blam/tmp/overnight/scratch/a3_shared_read.lam: 249 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a3_shared_read.lam + letopt --max-cuts 2: smallest ? diff --git a/data/self-interpreter/reasoning_floor/scratch/a4_local_unary.battery.log b/data/self-interpreter/reasoning_floor/scratch/a4_local_unary.battery.log new file mode 100644 index 00000000..ad3ad10c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a4_local_unary.battery.log @@ -0,0 +1,2 @@ +battery a4_local_unary.lam: exit=0 seconds=1.736 + 242 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a4_local_unary.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/a4_local_unary.blc b/data/self-interpreter/reasoning_floor/scratch/a4_local_unary.blc new file mode 100644 index 00000000..532d596b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a4_local_unary.blc @@ -0,0 +1 @@ +01000110100000000110000101100001100001011111110111111001011000011111110000001111000010110110111000010111111110111111100001111111100001011110100111010010100011010000000011000010110011110000110000011001011111011110000111110000111001100000101110 diff --git a/data/self-interpreter/reasoning_floor/scratch/a4_local_unary.lam b/data/self-interpreter/reasoning_floor/scratch/a4_local_unary.lam new file mode 100644 index 00000000..10e11b6a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a4_local_unary.lam @@ -0,0 +1 @@ +((\p. (p p)) (\p. (\k. (\s. (s (\b. ((b (\t. (t (\c. ((p p) ((c (\d. (k (\e. (\x. (d (\h. ((h x) e)))))))) (\f. ((p p) (\g. (k (\e. ((f e) (g e))))))))))))) (((\u. (u u)) (\u. (\k. (\s. (s (\b. ((b (k (\e. (e (\a. (\b. a)))))) ((u u) (\d. (k (\e. (d (e (\a. (\b. b))))))))))))))) k)))))))) diff --git a/data/self-interpreter/reasoning_floor/scratch/a4_local_unary.polish.log b/data/self-interpreter/reasoning_floor/scratch/a4_local_unary.polish.log new file mode 100644 index 00000000..b662a0e6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a4_local_unary.polish.log @@ -0,0 +1,3 @@ +polish a4_local_unary.lam: exit=0 seconds=1.996 +/Users/a9lim/Work/blam/tmp/overnight/scratch/a4_local_unary.lam: 242 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a4_local_unary.lam + letopt --max-cuts 2: smallest 231 diff --git a/data/self-interpreter/reasoning_floor/scratch/a5_polished.battery.log b/data/self-interpreter/reasoning_floor/scratch/a5_polished.battery.log new file mode 100644 index 00000000..17a227aa --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a5_polished.battery.log @@ -0,0 +1,2 @@ +battery a5_polished.lam: exit=0 seconds=1.740 + 231 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a5_polished.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/a5_polished.blc b/data/self-interpreter/reasoning_floor/scratch/a5_polished.blc new file mode 100644 index 00000000..a22c349d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a5_polished.blc @@ -0,0 +1 @@ +010001101000010000010000011000010110000110111100101000110100000000110000101100111100001100000110010111110111100001111100001110011000001011110000111100101100001111000000111100001011011011100001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/scratch/a5_polished.lam b/data/self-interpreter/reasoning_floor/scratch/a5_polished.lam new file mode 100644 index 00000000..24efb2a2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a5_polished.lam @@ -0,0 +1 @@ +((\p. (p p)) (\p. ((\r. (\k. ((\tag. (\s. (s (\b. ((b (\t. (t tag))) (((\u. (u u)) (\u. (\k. (\s. (s (\b. ((b (k (\e. (e (\a. (\b. a)))))) ((u u) (\d. (k (\e. (d (e (\a. (\b. b))))))))))))))) k)))))) (\c. (r ((c (\d. (k (\e. (\x. (d (\h. ((h x) e)))))))) (\f. (r (\g. (k (\e. ((f e) (g e))))))))))))) (p p)))) diff --git a/data/self-interpreter/reasoning_floor/scratch/a5_polished.polish.log b/data/self-interpreter/reasoning_floor/scratch/a5_polished.polish.log new file mode 100644 index 00000000..649b469d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a5_polished.polish.log @@ -0,0 +1,3 @@ +polish a5_polished.lam: exit=0 seconds=2.030 +/Users/a9lim/Work/blam/tmp/overnight/scratch/a5_polished.lam: 231 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a5_polished.lam + letopt --max-cuts 2: smallest 231 diff --git a/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.battery.log b/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.battery.log new file mode 100644 index 00000000..9343b5f2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.battery.log @@ -0,0 +1,2 @@ +battery a5_shared_recursion.lam: exit=0 seconds=1.726 + 233 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a5_shared_recursion.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.blc b/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.blc new file mode 100644 index 00000000..30be339e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.blc @@ -0,0 +1 @@ +01000110100001000000011000010110000110000111111100101100001111111000000111100001011011011100001111111100001111111100001011110100111010010100011010000000011000010110011110000110000011001011111011110000111110000111001100000101110011010 diff --git a/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.lam b/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.lam new file mode 100644 index 00000000..9a12c5ab --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.lam @@ -0,0 +1 @@ +((\p. (p p)) (\p. ((\r. (\k. (\s. (s (\b. ((b (\t. (t (\c. (r ((c (\d. (k (\e. (\x. (d (\h. ((h x) e)))))))) (\f. (r (\g. (k (\e. ((f e) (g e))))))))))))) (((\u. (u u)) (\u. (\k. (\s. (s (\b. ((b (k (\e. (e (\a. (\b. a)))))) ((u u) (\d. (k (\e. (d (e (\a. (\b. b))))))))))))))) k))))))) (p p)))) diff --git a/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.letopt.log b/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.letopt.log new file mode 100644 index 00000000..089eb0ce --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.letopt.log @@ -0,0 +1,14 @@ +input 233 bits; core 242 bits (93 nodes); 755 candidate cuts (13 shared) +k=1: 755 valid, 0 invalid, 0.0s; smallest sizes 233:1 234:1 235:2 236:5 237:2 239:2 + 233 [[9, 27]->90] + (\a. a a) (\a. (\b c d. d (\e. e (\f. f (\g. b (g (\h. c (\i j. h (\k. k j i))) (\h. b (\i. c (\j. h j (i j))))))) ((\f. f f) (\f g h. h (\i. i (g (\j. j (\k l. k))) (f f (\j. g (\k. j (k (\l m. m))))))) c))) (a a)) + 01000110100001000000011000010110000110000111111100101100001111111000000111100001011011011100001111111100001111111100001011110100111010010100011010000000011000010110011110000110000011001011111011110000111110000111001100000101110011010 +k=2: 257338 valid, 27297 invalid, 0.2s; smallest sizes 231:1 233:1 234:4 235:2 236:7 237:14 + 231 [[43]->89 [9, 27]->90] + (\a. a a) (\a. (\b c. (\d e. e (\f. f (\g. g d) ((\g. g g) (\g h i. i (\j. j (h (\k. k (\l m. l))) (g g (\k. h (\l. k (l (\m n. n))))))) c))) (\d. b (d (\e. c (\f g. e (\h. h g f))) (\e. b (\f. c (\g. e g (f g))))))) (a a)) + 010001101000010000010000011000010110000110111100101000110100000000110000101100111100001100000110010111110111100001111100001110011000001011110000111100101100001111000000111100001011011011100001111100001111100001011110100111010011010 + 233 [[43]->89 [9, 27]->43] + (\a. a a) (\a b. (\c d. d (\e. e (\f. f c) ((\f. f f) (\f g h. h (\i. i (g (\j. j (\k l. k))) (f f (\j. g (\k. j (k (\l m. m))))))) b))) ((\c d. c (d (\e. b (\f g. e (\h. h g f))) (\e. c (\f. b (\g. e g (f g)))))) (a a))) + 01000110100000010000011000010110000110111100101000110100000000110000101100111100001100000110010111110111100001111100001110011000001011110010000011100101100001111100000011110000101101101110000111100001111110000101111010011101001110110 +smallest rendering over 0..=2 cuts: 231 bits +best 231 010001101000010000010000011000010110000110111100101000110100000000110000101100111100001100000110010111110111100001111100001110011000001011110000111100101100001111000000111100001011011011100001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.polish.log b/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.polish.log new file mode 100644 index 00000000..b7031220 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a5_shared_recursion.polish.log @@ -0,0 +1,3 @@ +polish a5_shared_recursion.lam: exit=0 seconds=2.006 +/Users/a9lim/Work/blam/tmp/overnight/scratch/a5_shared_recursion.lam: 233 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a5_shared_recursion.lam + letopt --max-cuts 2: smallest 231 diff --git a/data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.battery.log b/data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.battery.log new file mode 100644 index 00000000..bb23285b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.battery.log @@ -0,0 +1,2 @@ +battery a6_input_selectors.lam: exit=0 seconds=1.738 + 225 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a6_input_selectors.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.blc b/data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.blc new file mode 100644 index 00000000..82d62dbd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.blc @@ -0,0 +1 @@ +010001101000010000010000011000010110000110111100101000110100000000110000101100111100001101100101111101111000011111000011100110111011110000111100101100001111000000111100001011011011100001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.lam b/data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.lam new file mode 100644 index 00000000..d69fca27 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.lam @@ -0,0 +1 @@ +((\p. (p p)) (\p. ((\r. (\k. ((\tag. (\s. (s (\b. ((b (\t. (t tag))) (((\u. (u u)) (\u. (\k. (\s. (s (\b. ((b (k (\e. (e b)))) ((u u) (\d. (k (\e. (d (e b))))))))))))) k)))))) (\c. (r ((c (\d. (k (\e. (\x. (d (\h. ((h x) e)))))))) (\f. (r (\g. (k (\e. ((f e) (g e))))))))))))) (p p)))) diff --git a/data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.polish.log b/data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.polish.log new file mode 100644 index 00000000..fa9b1a97 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a6_input_selectors.polish.log @@ -0,0 +1,3 @@ +polish a6_input_selectors.lam: exit=0 seconds=1.945 +/Users/a9lim/Work/blam/tmp/overnight/scratch/a6_input_selectors.lam: 225 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a6_input_selectors.lam + letopt --max-cuts 2: smallest 225 diff --git a/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.battery.log b/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.battery.log new file mode 100644 index 00000000..1988c28c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.battery.log @@ -0,0 +1,2 @@ +battery a7_shared_unary_update.lam: exit=0 seconds=1.746 + 220 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a7_shared_unary_update.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.blc b/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.blc new file mode 100644 index 00000000..f8e5bdb1 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.blc @@ -0,0 +1 @@ +0100011010000100000100000110000101100001101111001010001101000000001100001010110000110001001111101111000011111000011100110111011110000111100101100001111000000111100001011011011100001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.lam b/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.lam new file mode 100644 index 00000000..56c0ff28 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.lam @@ -0,0 +1 @@ +((\p. (p p)) (\p. ((\r. (\k. ((\tag. (\s. (s (\b. ((b (\t. (t tag))) (((\u. (u u)) (\u. (\k. (\s. (s (\b. (((b (\j. (j (\a. a)))) (u u)) (\d. (k (\e. (d (e b)))))))))))) k)))))) (\c. (r ((c (\d. (k (\e. (\x. (d (\h. ((h x) e)))))))) (\f. (r (\g. (k (\e. ((f e) (g e))))))))))))) (p p)))) diff --git a/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.letopt.log b/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.letopt.log new file mode 100644 index 00000000..cd323536 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.letopt.log @@ -0,0 +1,8 @@ +input 220 bits; core 231 bits (88 nodes); 672 candidate cuts (13 shared) +k=1: 672 valid, 0 invalid, 0.0s; smallest sizes 222:1 223:1 224:2 225:5 226:2 228:2 +k=2: 200674 valid, 24782 invalid, 0.2s; smallest sizes 220:1 222:1 223:4 224:2 225:5 226:13 + 220 [[43]->84 [9, 27]->85] + (\a. a a) (\a. (\b c. (\d e. e (\f. f (\g. g d) ((\g. g g) (\g h i. i (\j. j (\k. k (\l. l)) (g g) (\k. h (\l. k (l j))))) c))) (\d. b (d (\e. c (\f g. e (\h. h g f))) (\e. b (\f. c (\g. e g (f g))))))) (a a)) + 0100011010000100000100000110000101100001101111001010001101000000001100001010110000110001001111101111000011111000011100110111011110000111100101100001111000000111100001011011011100001111100001111100001011110100111010011010 +smallest rendering over 0..=2 cuts: 220 bits +best 220 0100011010000100000100000110000101100001101111001010001101000000001100001010110000110001001111101111000011111000011100110111011110000111100101100001111000000111100001011011011100001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.polish.log b/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.polish.log new file mode 100644 index 00000000..e21d3dd7 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a7_shared_unary_update.polish.log @@ -0,0 +1,3 @@ +polish a7_shared_unary_update.lam: exit=0 seconds=1.955 +/Users/a9lim/Work/blam/tmp/overnight/scratch/a7_shared_unary_update.lam: 220 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a7_shared_unary_update.lam + letopt --max-cuts 2: smallest 220 diff --git a/data/self-interpreter/reasoning_floor/scratch/a_env_cps.battery.log b/data/self-interpreter/reasoning_floor/scratch/a_env_cps.battery.log new file mode 100644 index 00000000..2625c938 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a_env_cps.battery.log @@ -0,0 +1,2 @@ +battery a_env_cps.lam: exit=0 seconds=2.055 + 345 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a_env_cps.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/a_env_cps.blc b/data/self-interpreter/reasoning_floor/scratch/a_env_cps.blc new file mode 100644 index 00000000..6cabb619 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a_env_cps.blc @@ -0,0 +1 @@ +010001000110100000000110000001011100110000001011100101011111111011111110000001011111111100000011111000010110110111010100101011111111011111110000001010111111111101111111110000001011111111111000010111111010011110101010100101011111110111111011110100000000110000001011100101111100001100000110100101011111101111100000010111111100001111001100000101010 diff --git a/data/self-interpreter/reasoning_floor/scratch/a_env_cps.lam b/data/self-interpreter/reasoning_floor/scratch/a_env_cps.lam new file mode 100644 index 00000000..e46de11b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a_env_cps.lam @@ -0,0 +1 @@ +((\u. ((\p. (p p)) (\p. (\k. (\s. (s (\b. (\t. ((b (t (\c. (\w. ((c (((p p) (\d. (\r. ((k (\e. (\x. (d (\h. ((h x) e)))))) r)))) w)) (((p p) (\f. (\r. (((p p) (\g. (\q. ((k (\e. ((f e) (g e)))) q)))) r)))) w)))))) (((u u) k) t)))))))))) (\u. (\k. (\s. (s (\b. (\t. ((b ((k (\e. (e (\a. (\b. a))))) t)) (((u u) (\d. (\r. ((k (\e. (d (e (\a. (\b. b)))))) r)))) t))))))))) diff --git a/data/self-interpreter/reasoning_floor/scratch/a_env_cps.letopt-no-inline.log b/data/self-interpreter/reasoning_floor/scratch/a_env_cps.letopt-no-inline.log new file mode 100644 index 00000000..7d883765 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a_env_cps.letopt-no-inline.log @@ -0,0 +1,6 @@ +a_env_cps.lam: exit=0 seconds=0.634 +input 345 bits; core 345 bits (121 nodes); 1087 candidate cuts (62 shared) +k=1: 1087 valid, 0 invalid, 0.0s; smallest sizes 321:2 322:2 323:1 325:1 326:2 327:3 +k=2: 533721 valid, 56520 invalid, 0.6s; smallest sizes 321:4 322:20 323:19 324:20 325:40 326:58 +smallest rendering over 0..=2 cuts: 321 bits +best 345 010001000110100000000110000001011100110000001011100101011111111011111110000001011111111100000011111000010110110111010100101011111111011111110000001010111111111101111111110000001011111111111000010111111010011110101010100101011111110111111011110100000000110000001011100101111100001100000110100101011111101111100000010111111100001111001100000101010 diff --git a/data/self-interpreter/reasoning_floor/scratch/a_env_cps.letopt.log b/data/self-interpreter/reasoning_floor/scratch/a_env_cps.letopt.log new file mode 100644 index 00000000..b00a0e72 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a_env_cps.letopt.log @@ -0,0 +1,2 @@ +a_env_cps.lam: exit=2 seconds=0.402 +blam golf letopt: inlining the lets does not finish; try --no-inline diff --git a/data/self-interpreter/reasoning_floor/scratch/a_env_cps.polish.log b/data/self-interpreter/reasoning_floor/scratch/a_env_cps.polish.log new file mode 100644 index 00000000..ef6b6b8a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/a_env_cps.polish.log @@ -0,0 +1,3 @@ +polish a_env_cps.lam: exit=0 seconds=2.458 +/Users/a9lim/Work/blam/tmp/overnight/scratch/a_env_cps.lam: 345 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/a_env_cps.lam + letopt --max-cuts 2: smallest ? diff --git a/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.battery.log b/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.battery.log new file mode 100644 index 00000000..e9043e6b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.battery.log @@ -0,0 +1,2 @@ +battery b_tree_fold.lam: exit=0 seconds=2.062 + 507 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/b_tree_fold.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.blc b/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.blc new file mode 100644 index 00000000..3fe78c40 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.blc @@ -0,0 +1 @@ +010001000000010101111011100000010111110010101110000000011110000101101101110000000010111101001110100010101000000001100000010111001100000010111001010111111110111111100000010111111111000000001111001010111111011101101010100101011111111011111110000001010111111111101111111110000001011111111111000000001011100101011111111011101101001010111111011101101010101001010111111101111110000001011111110000000011011111010100000000110000001011100101111100001100000110100101011111101111100000010111111100001111001100000101010 diff --git a/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.lam b/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.lam new file mode 100644 index 00000000..7805a689 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.lam @@ -0,0 +1 @@ +((\u. ((\p. (\k. (\s. (((p p) (\t. (\r. ((k (((t (\d. (\e. (\x. (d (\h. ((h x) e))))))) (\f. (\g. (\e. ((f e) (g e)))))) (\a. a))) r)))) s)))) (\p. (\k. (\s. (s (\b. (\t. ((b (t (\c. (\w. ((c (((p p) (\d. (\r. ((k (\l. (\a. (\v. (l (((d l) a) v)))))) r)))) w)) (((p p) (\f. (\r. (((p p) (\g. (\q. ((k (\l. (\a. (\v. ((a (((f l) a) v)) (((g l) a) v)))))) q)))) r)))) w)))))) (((u u) (\d. (\r. ((k (\l. (\a. (\v. (v d))))) r)))) t)))))))))) (\u. (\k. (\s. (s (\b. (\t. ((b ((k (\e. (e (\a. (\b. a))))) t)) (((u u) (\d. (\r. ((k (\e. (d (e (\a. (\b. b)))))) r)))) t))))))))) diff --git a/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.letopt-no-inline.log b/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.letopt-no-inline.log new file mode 100644 index 00000000..f87d6e53 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.letopt-no-inline.log @@ -0,0 +1,6 @@ +b_tree_fold.lam: exit=0 seconds=2.296 +input 507 bits; core 507 bits (184 nodes); 1800 candidate cuts (63 shared) +k=1: 1800 valid, 0 invalid, 0.0s; smallest sizes 483:2 484:2 485:1 487:1 488:2 489:3 +k=2: 1515798 valid, 103302 invalid, 2.3s; smallest sizes 483:4 484:12 485:11 486:16 487:38 488:70 +smallest rendering over 0..=2 cuts: 483 bits +best 507 010001000000010101111011100000010111110010101110000000011110000101101101110000000010111101001110100010101000000001100000010111001100000010111001010111111110111111100000010111111111000000001111001010111111011101101010100101011111111011111110000001010111111111101111111110000001011111111111000000001011100101011111111011101101001010111111011101101010101001010111111101111110000001011111110000000011011111010100000000110000001011100101111100001100000110100101011111101111100000010111111100001111001100000101010 diff --git a/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.letopt.log b/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.letopt.log new file mode 100644 index 00000000..ec392d15 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.letopt.log @@ -0,0 +1,2 @@ +b_tree_fold.lam: exit=2 seconds=1.018 +blam golf letopt: inlining the lets does not finish; try --no-inline diff --git a/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.polish.log b/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.polish.log new file mode 100644 index 00000000..270dedd5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/b_tree_fold.polish.log @@ -0,0 +1,3 @@ +polish b_tree_fold.lam: exit=0 seconds=3.070 +/Users/a9lim/Work/blam/tmp/overnight/scratch/b_tree_fold.lam: 507 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/b_tree_fold.lam + letopt --max-cuts 2: smallest ? diff --git a/data/self-interpreter/reasoning_floor/scratch/best.battery.log b/data/self-interpreter/reasoning_floor/scratch/best.battery.log new file mode 100644 index 00000000..e67ad4f0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/best.battery.log @@ -0,0 +1,2 @@ +battery best.lam: exit=0 seconds=1.747 + 220 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/best.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/best.blc b/data/self-interpreter/reasoning_floor/scratch/best.blc new file mode 100644 index 00000000..f8e5bdb1 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/best.blc @@ -0,0 +1 @@ +0100011010000100000100000110000101100001101111001010001101000000001100001010110000110001001111101111000011111000011100110111011110000111100101100001111000000111100001011011011100001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/scratch/best.lam b/data/self-interpreter/reasoning_floor/scratch/best.lam new file mode 100644 index 00000000..56c0ff28 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/best.lam @@ -0,0 +1 @@ +((\p. (p p)) (\p. ((\r. (\k. ((\tag. (\s. (s (\b. ((b (\t. (t tag))) (((\u. (u u)) (\u. (\k. (\s. (s (\b. (((b (\j. (j (\a. a)))) (u u)) (\d. (k (\e. (d (e b)))))))))))) k)))))) (\c. (r ((c (\d. (k (\e. (\x. (d (\h. ((h x) e)))))))) (\f. (r (\g. (k (\e. ((f e) (g e))))))))))))) (p p)))) diff --git a/data/self-interpreter/reasoning_floor/scratch/best.polish.log b/data/self-interpreter/reasoning_floor/scratch/best.polish.log new file mode 100644 index 00000000..450dbcfd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/best.polish.log @@ -0,0 +1,3 @@ +polish best.lam: exit=0 seconds=1.976 +/Users/a9lim/Work/blam/tmp/overnight/scratch/best.lam: 220 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/best.lam + letopt --max-cuts 2: smallest 220 diff --git a/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.battery.log b/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.battery.log new file mode 100644 index 00000000..fa7e4f23 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.battery.log @@ -0,0 +1,2 @@ +battery c_direct_pair.lam: exit=0 seconds=2.071 + 488 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/c_direct_pair.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.blc b/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.blc new file mode 100644 index 00000000..2bb9e40f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.blc @@ -0,0 +1 @@ +01000100010001000100000001010101111011100010100000010111110001110100000000110000001011100110000001011100101111111111110000101010111111111011111111001011111111111110101111111011011111111111001010101111111101111111011111101011111111100101010111111110111111101111110100000010101011111111110111111111011111111010000001011111111111111110011111011010010101111111011111101111010000000011000000101110010111111111001111101111111010010101111110111110011111011111101000001000001100000000101101110110 diff --git a/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.lam b/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.lam new file mode 100644 index 00000000..2f7fb3ae --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.lam @@ -0,0 +1 @@ +((\pair. ((\head. ((\tail. ((\u. ((\p. (\k. (\s. ((((p p) (\a. a)) s) (\m. (\r. ((k (\z. m)) r))))))) (\p. (\e. (\s. (s (\b. (\t. ((b (t (\c. (\w. ((c ((pair (\x. ((((p p) ((pair x) e)) w) head))) ((((p p) e) w) tail))) ((((p p) e) w) (\f. (\r. ((((p p) e) r) (\g. (\q. ((pair (f g)) q)))))))))))) (((u u) e) t)))))))))) (\u. (\e. (\s. (s (\b. (\t. ((b ((pair (e head)) t)) (((u u) (e tail)) t)))))))))) (\a. (\b. b)))) (\a. (\b. a)))) (\x. (\e. (\h. ((h x) e))))) diff --git a/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.letopt-no-inline.log b/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.letopt-no-inline.log new file mode 100644 index 00000000..ce46c39e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.letopt-no-inline.log @@ -0,0 +1,6 @@ +c_direct_pair.lam: exit=0 seconds=1.892 +input 488 bits; core 488 bits (146 nodes); 1729 candidate cuts (345 shared) +k=1: 1729 valid, 0 invalid, 0.0s; smallest sizes 448:1 449:3 450:1 451:2 452:3 454:1 +k=2: 1344281 valid, 149575 invalid, 1.9s; smallest sizes 427:1 428:1 430:1 431:1 434:1 435:4 +smallest rendering over 0..=2 cuts: 427 bits +best 488 01000100010001000100000001010101111011100010100000010111110001110100000000110000001011100110000001011100101111111111110000101010111111111011111111001011111111111110101111111011011111111111001010101111111101111111011111101011111111100101010111111110111111101111110100000010101011111111110111111111011111111010000001011111111111111110011111011010010101111111011111101111010000000011000000101110010111111111001111101111111010010101111110111110011111011111101000001000001100000000101101110110 diff --git a/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.letopt.log b/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.letopt.log new file mode 100644 index 00000000..d78f7fe8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.letopt.log @@ -0,0 +1,2 @@ +c_direct_pair.lam: exit=2 seconds=0.238 +blam golf letopt: inlining the lets does not finish; try --no-inline diff --git a/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.polish.log b/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.polish.log new file mode 100644 index 00000000..1338a226 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/c_direct_pair.polish.log @@ -0,0 +1,3 @@ +polish c_direct_pair.lam: exit=0 seconds=2.349 +/Users/a9lim/Work/blam/tmp/overnight/scratch/c_direct_pair.lam: 488 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/c_direct_pair.lam + letopt --max-cuts 2: smallest ? diff --git a/data/self-interpreter/reasoning_floor/scratch/check.py b/data/self-interpreter/reasoning_floor/scratch/check.py new file mode 100644 index 00000000..b6755f24 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/check.py @@ -0,0 +1,30 @@ +"""Bound every allowed external check and cap its worker count.""" +import os +import subprocess +import sys +import time +from pathlib import Path + +ROOT = Path(__file__).resolve().parent +REPO = ROOT.parents[2] +env = os.environ.copy() +env.update(RAYON_NUM_THREADS='2', OMP_NUM_THREADS='2', OPENBLAS_NUM_THREADS='2') +for source in sys.argv[1:]: + path = ROOT / source + for label, script in [('battery', 'tools/self-interpreter/battery.py'), ('polish', 'tmp/overnight/self/polish.py')]: + start = time.monotonic() + try: + result = subprocess.run(['python3', script, str(path)], cwd=REPO, env=env, text=True, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=110) + output = result.stdout + status = result.returncode + except subprocess.TimeoutExpired as exc: + output = (exc.stdout or b'').decode() if isinstance(exc.stdout, bytes) else (exc.stdout or '') + output += '\nTIMEOUT after 110 seconds\n' + status = 124 + elapsed = time.monotonic() - start + record = f'{label} {source}: exit={status} seconds={elapsed:.3f}\n{output}' + print(record, flush=True) + (ROOT / (path.stem + '.' + label + '.log')).write_text(record) + if label == 'battery' and (status or 'fail=0' not in output): + break diff --git a/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.battery.log b/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.battery.log new file mode 100644 index 00000000..2632f244 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.battery.log @@ -0,0 +1,2 @@ +battery d_trie_environment.lam: exit=0 seconds=2.085 + 299 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/d_trie_environment.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.blc b/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.blc new file mode 100644 index 00000000..0fde15a8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.blc @@ -0,0 +1 @@ +01000100010001000000010101011110111011010000111100011000000101111100101111100001111100001010111110111100101111111001111111101011101100001010101111011101101000000101010111111011111011110100001111111111001111010100001011110000101110100000110010110100000100000000110000101101111011100000000101101110110 diff --git a/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.lam b/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.lam new file mode 100644 index 00000000..1c207a8d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.lam @@ -0,0 +1 @@ +((\pair. ((\node. ((\abs. ((\p. (\k. (\s. ((((p p) k) s) (\m. (k (\z. m))))))) (\p. (\e. ((node ((node (\w. (abs (\x. (((p p) ((node (pair x)) e)) w))))) (\w. ((((p p) e) w) (\f. (\r. ((((p p) e) r) (\g. (pair (f g)))))))))) e))))) (\f. ((pair (\x. ((f x) (\a. (\b. a))))) ((f f) (\a. (\b. b))))))) (\h. (\t. (\s. (s (\b. ((b h) t)))))))) (\x. (\e. (\h. ((h x) e))))) diff --git a/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.letopt-no-inline.log b/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.letopt-no-inline.log new file mode 100644 index 00000000..68360eb3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.letopt-no-inline.log @@ -0,0 +1,6 @@ +d_trie_environment.lam: exit=0 seconds=0.307 +input 299 bits; core 299 bits (112 nodes); 776 candidate cuts (64 shared) +k=1: 776 valid, 0 invalid, 0.0s; smallest sizes 288:1 290:1 294:1 295:2 296:2 297:2 +k=2: 278154 valid, 22546 invalid, 0.3s; smallest sizes 292:4 293:5 294:14 295:30 296:35 297:45 +smallest rendering over 0..=2 cuts: 288 bits +best 299 01000100010001000000010101011110111011010000111100011000000101111100101111100001111100001010111110111100101111111001111111101011101100001010101111011101101000000101010111111011111011110100001111111111001111010100001011110000101110100000110010110100000100000000110000101101111011100000000101101110110 diff --git a/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.polish.log b/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.polish.log new file mode 100644 index 00000000..2229b5cb --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/d_trie_environment.polish.log @@ -0,0 +1,3 @@ +polish d_trie_environment.lam: exit=0 seconds=2.834 +/Users/a9lim/Work/blam/tmp/overnight/scratch/d_trie_environment.lam: 299 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/d_trie_environment.lam + letopt --max-cuts 2: smallest ? diff --git a/data/self-interpreter/reasoning_floor/scratch/derive.py b/data/self-interpreter/reasoning_floor/scratch/derive.py new file mode 100644 index 00000000..23098b71 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/derive.py @@ -0,0 +1,208 @@ +"""First-principles scratch-lane designs; no external interpreter inputs.""" +from dataclasses import dataclass +from pathlib import Path + +ROOT = Path(__file__).resolve().parent + +@dataclass(frozen=True) +class V: + name: str + +@dataclass(frozen=True) +class A: + f: object + x: object + +@dataclass(frozen=True) +class L: + name: str + body: object + +def v(name): return V(name) +def app(f, *xs): + if isinstance(f, str): f = v(f) + for x in xs: + if isinstance(x, str): x = v(x) + f = A(f, x) + return f +def lam(names, body): + for name in reversed(names.split()): body = L(name, body) + return body +def let(name, value, body): return app(lam(name, body), value) +def lets(bindings, body): + for name, value in reversed(bindings): body = let(name, value, body) + return body +def render(t): + if isinstance(t, V): return t.name + if isinstance(t, L): return f"(\\{t.name}. {render(t.body)})" + return f"({render(t.f)} {render(t.x)})" +def bits(t, ctx=()): + if isinstance(t, V): return "1" * (ctx.index(t.name) + 1) + "0" + if isinstance(t, L): return "00" + bits(t.body, (t.name,) + ctx) + return "01" + bits(t.f, ctx) + bits(t.x, ctx) +def decode(code): + pos = 0 + count = 0 + def go(ctx): + nonlocal pos, count + if code[pos] == '1': + end = code.index('0', pos) + n = end - pos + pos = end + 1 + return V(ctx[n - 1]) + tag = code[pos:pos + 2] + pos += 2 + if tag == '00': + name = f'v{count}' + count += 1 + return L(name, go((name,) + ctx)) + return A(go(ctx), go(ctx)) + term = go(()) + assert pos == len(code) + assert bits(term) == code + return term +def save(name, t): + code = bits(t) + (ROOT / (name + '.lam')).write_text(render(t) + '\n') + (ROOT / (name + '.blc')).write_text(code + '\n') + print(name, len(code)) + +K = lam('a b', v('a')) +F = lam('a b', v('b')) +I = lam('a', v('a')) +PAIR = lam('x e h', app('h', 'x', 'e')) +def pp(k, s): return app('p', 'p', k, s) + +# A. CPS parsing into functions of a Scott environment. +u_a = lam('u k s', app('s', lam('b t', app('b', + app('k', lam('e', app('e', K)), 't'), + app('u', 'u', lam('d r', app('k', lam('e', app('d', app('e', F))), 'r')), 't'))))) +lam_a = pp(lam('d r', app('k', lam('e x', app('d', lam('h', app('h', 'x', 'e')))), 'r')), 'w') +app_a = pp(lam('f r', pp(lam('g q', app('k', lam('e', app(app('f', 'e'), app('g', 'e'))), 'q')), 'r')), 'w') +p_a = lam('p k s', app('s', lam('b t', app('b', + app('t', lam('c w', app('c', lam_a, app_a))), + app('u', 'u', 'k', 't'))))) +design_a = let('u', u_a, app(lam('p', app('p', 'p')), p_a)) + +# B. Parse a Church-fold syntax tree, then interpret its constructors. +# Variables retain a compiled unary selector as their leaf payload. +lam_tree = lam('l a v', app('l', app('d', 'l', 'a', 'v'))) +app_tree = lam('l a v', app('a', app('f', 'l', 'a', 'v'), app('g', 'l', 'a', 'v'))) +var_tree = lam('l a v', app('v', 'd')) +lam_b = pp(lam('d r', app('k', lam_tree, 'r')), 'w') +app_b = pp(lam('f r', pp(lam('g q', app('k', app_tree, 'q')), 'r')), 'w') +p_b = lam('p k s', app('s', lam('b t', app('b', + app('t', lam('c w', app('c', lam_b, app_b))), + app('u', 'u', lam('d r', app('k', var_tree, 'r')), 't'))))) +eval_l = lam('d e x', app('d', lam('h', app('h', 'x', 'e')))) +eval_a = lam('f g e', app(app('f', 'e'), app('g', 'e'))) +design_b = lets([('u', u_a), ('p', p_b)], lam('k s', pp(lam('t r', app('k', app('t', eval_l, eval_a, I), 'r')), 's'))) + +# C. Direct environment evaluator returning Scott (value, remainder) pairs. +# Abstraction obtains the remainder through a discarded-value invocation; +# its value reparses the same body under the actual argument environment. +def ppe(e, s): return app('p', 'p', e, s) +def pair(x, e): return app('pair', x, e) +u_c = lam('u e s', app('s', lam('b t', app('b', + pair(app('e', 'head'), 't'), + app('u', 'u', app('e', 'tail'), 't'))))) +lam_c = pair(lam('x', app(ppe(pair('x', 'e'), 'w'), 'head')), app(ppe('e', 'w'), 'tail')) +app_c = app(ppe('e', 'w'), lam('f r', app(ppe('e', 'r'), lam('g q', pair(app('f', 'g'), 'q'))))) +p_c = lam('p e s', app('s', lam('b t', app('b', + app('t', lam('c w', app('c', lam_c, app_c))), + app('u', 'u', 'e', 't'))))) +design_c = lets([('pair', PAIR), ('head', K), ('tail', F), ('u', u_c), ('p', p_c)], + lam('k s', app(ppe(I, 's'), lam('m r', app('k', lam('z', v('m')), 'r'))))) + +# A2. Factor the common first-child parse and select stream consumers before +# applying them to the unread tail. CPS continuation tails eta-contract. +u_a2 = lam('u k s', app('s', lam('b', app('b', + app('k', lam('e', app('e', K))), + app('u', 'u', lam('d', app('k', lam('e', app('d', app('e', F)))))))))) +kl_a2 = lam('d', app('k', lam('e x', app('d', lam('h', app('h', 'x', 'e')))))) +ka_a2 = lam('f', app('p', 'p', lam('g', app('k', lam('e', app(app('f', 'e'), app('g', 'e'))))))) +zero_a2 = lam('t', app('t', lam('c', app('p', 'p', app('c', kl_a2, ka_a2))))) +p_a2 = lam('p k s', app('s', lam('b', app('b', zero_a2, app('u', 'u', 'k'))))) +design_a2 = let('u', u_a2, app(lam('p', app('p', 'p')), p_a2)) + +# D. A trie serves both as the grammar and as the environment. Its node +# consumes one Scott bit and sends the remaining stream to the selected arm. +NODE = lam('h t s', app('s', lam('b', app('b', 'h', 't')))) +ABS = lam('f', pair(lam('x', app('f', 'x', K)), app('f', 'f', F))) +lam_d = lam('w', app('abs', lam('x', ppe(app('node', app('pair', 'x'), 'e'), 'w')))) +# The final result's remainder is supplied to partial pair by the parser. +app_d = lam('w', app(ppe('e', 'w'), lam('f r', app(ppe('e', 'r'), lam('g', app('pair', app('f', 'g'))))))) +p_d = lam('p e', app('node', app('node', lam_d, app_d), 'e')) +design_d = lets([('pair', PAIR), ('node', NODE), ('abs', ABS), ('p', p_d)], + lam('k s', app(ppe('k', 's'), lam('m', app('k', lam('z', v('m'))))))) + +# A3. Reading a Scott cell is the same transposition in all three places. +READ = lam('h s', app('s', 'h')) +u_a3 = lam('u k', app('read', lam('b', app('b', + app('k', lam('e', app('e', K))), + app('u', 'u', lam('d', app('k', lam('e', app('d', app('e', F)))))))))) +zero_a3 = app('read', lam('c', app('p', 'p', app('c', kl_a2, ka_a2)))) +p_a3 = lam('p k', app('read', lam('b', app('b', zero_a3, app('u', 'u', 'k'))))) +design_a3 = lets([('read', READ), ('u', u_a3)], app(lam('p', app('p', 'p')), p_a3)) + +# A4. The unary fixed point has one syntactic use. Place its binding there, +# eliminating the distant free variable references in the main parser. +ufix = app(lam('u', app('u', 'u')), u_a2) +p_a4 = lam('p k s', app('s', lam('b', app('b', zero_a2, app(ufix, 'k'))))) +design_a4 = app(lam('p', app('p', 'p')), p_a4) + +# A5. Share the two uses of the main recursive parser after the knot unfolds. +ka_a5 = lam('f', app('r', lam('g', app('k', lam('e', app(app('f', 'e'), app('g', 'e'))))))) +zero_a5 = lam('t', app('t', lam('c', app('r', app('c', kl_a2, ka_a5))))) +p_a5 = lam('p', let('r', app('p', 'p'), + lam('k s', app('s', lam('b', app('b', zero_a5, app(ufix, 'k'))))))) +design_a5 = app(lam('p', app('p', 'p')), p_a5) + +# E. A single recursive decoder, with a boolean mode selecting term parsing +# (false) or unary-index parsing (true). The first 1 changes modes without +# shifting; later 1s compose the environment-tail projection. +ka_e = lam('f', app('p', lam('g', app('k', lam('e', app(app('f', 'e'), app('g', 'e'))))))) +zero_e = lam('t', app('t', lam('c', app('p', app('c', kl_a2, ka_e))))) +shift_k = lam('d', app('k', lam('e', app('d', app('e', F))))) +e_loop = lam('r', lets([('q', app('r', 'r')), ('p', app('q', F))], + lam('m k s', app('s', lam('b', app('b', + app('m', app('k', lam('e', app('e', K))), zero_e), + app('q', K, app('m', shift_k, 'k')))))))) +design_e = app(app(lam('r', app('r', 'r')), e_loop), F) + +# A6. Every input bit doubles as the required environment selector: the +# terminating zero is head/K, while every preceding one is tail/F. +u_a6 = lam('u k s', app('s', lam('b', app('b', + app('k', lam('e', app('e', 'b'))), + app('u', 'u', lam('d', app('k', lam('e', app('d', app('e', 'b')))))))))) + +def small_parser(unary): + uf = app(lam('u', app('u', 'u')), unary) + body = lam('p', let('r', app('p', 'p'), + lam('k', let('tag', lam('c', app('r', app('c', kl_a2, ka_a5))), + lam('s', app('s', lam('b', app('b', lam('t', app('t', 'tag')), app(uf, 'k'))))))))) + return app(lam('p', app('p', 'p')), body) + +design_a6 = small_parser(u_a6) + +# A7. Both branches now use one continuation update. On zero, its recursive +# result is I; on one, obtain that result by decoding the remaining unary. +u_a7 = lam('u k s', app('s', lam('b', app( + app('b', lam('j', app('j', I)), app('u', 'u')), + lam('d', app('k', lam('e', app('d', app('e', 'b'))))))))) +design_a7 = small_parser(u_a7) + +if __name__ == '__main__': + save('a_env_cps', design_a) + save('b_tree_fold', design_b) + save('c_direct_pair', design_c) + save('a2_shared_parse', design_a2) + save('d_trie_environment', design_d) + save('a3_shared_read', design_a3) + save('a4_local_unary', design_a4) + save('a5_shared_recursion', design_a5) + save('e_unified_decoder', design_e) + save('a6_input_selectors', design_a6) + save('a7_shared_unary_update', design_a7) + save('a5_polished', small_parser(u_a2)) + save('best', design_a7) diff --git a/data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.battery.log b/data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.battery.log new file mode 100644 index 00000000..8e41e0d4 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.battery.log @@ -0,0 +1,2 @@ +battery e_unified_decoder.lam: exit=0 seconds=1.686 + 251 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/e_unified_decoder.lam diff --git a/data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.blc b/data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.blc new file mode 100644 index 00000000..1f672ca4 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.blc @@ -0,0 +1 @@ +01010001101000010001000000000110000101100101111100111100001100000110000110000111111110010110000111111100000011110000101101101110000111111111000011111111000010111101001110100101111111000001100101111100001111100001110011000001011100110000010011010000010 diff --git a/data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.lam b/data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.lam new file mode 100644 index 00000000..31ddbe0e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.lam @@ -0,0 +1 @@ +(((\r. (r r)) (\r. ((\q. ((\p. (\m. (\k. (\s. (s (\b. ((b ((m (k (\e. (e (\a. (\b. a)))))) (\t. (t (\c. (p ((c (\d. (k (\e. (\x. (d (\h. ((h x) e)))))))) (\f. (p (\g. (k (\e. ((f e) (g e)))))))))))))) ((q (\a. (\b. a))) ((m (\d. (k (\e. (d (e (\a. (\b. b)))))))) k))))))))) (q (\a. (\b. b))))) (r r)))) (\a. (\b. b))) diff --git a/data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.polish.log b/data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.polish.log new file mode 100644 index 00000000..1e674874 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/e_unified_decoder.polish.log @@ -0,0 +1,3 @@ +polish e_unified_decoder.lam: exit=0 seconds=2.129 +/Users/a9lim/Work/blam/tmp/overnight/scratch/e_unified_decoder.lam: 251 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/scratch/e_unified_decoder.lam + letopt --max-cuts 2: smallest 247 diff --git a/data/self-interpreter/reasoning_floor/scratch/letopt.py b/data/self-interpreter/reasoning_floor/scratch/letopt.py new file mode 100644 index 00000000..cbe4d07f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/scratch/letopt.py @@ -0,0 +1,28 @@ +"""Capture letopt's actual output (the supplied polish wrapper prints '?').""" +import os +from pathlib import Path +import subprocess +import sys +import time + +ROOT = Path(__file__).resolve().parent +REPO = ROOT.parents[2] +for name in sys.argv[1:]: + path = ROOT / name + code = path.with_suffix('.blc').read_text().strip() + start = time.monotonic() + env = dict(os.environ, RAYON_NUM_THREADS='2') + try: + result = subprocess.run(['target/release/blam', 'golf', 'letopt', '--bits', code, + '--no-inline', '--max-cuts', '2', '--threads', '2', '--report-le', str(len(code))], + cwd=REPO, env=env, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, text=True, timeout=110) + output, status = result.stdout, result.returncode + except subprocess.TimeoutExpired as exc: + output = (exc.stdout or b'').decode() if isinstance(exc.stdout, bytes) else (exc.stdout or '') + output += '\nTIMEOUT after 110 seconds\n' + status = 124 + record = f'{name}: exit={status} seconds={time.monotonic()-start:.3f}\n{output}' + (ROOT / (path.stem + '.letopt-no-inline.log')).write_text(record) + lines = record.splitlines() + print('\n'.join(lines[:4] + lines[-2:]), flush=True) diff --git a/data/self-interpreter/reasoning_floor/verify/v37.md b/data/self-interpreter/reasoning_floor/verify/v37.md new file mode 100644 index 00000000..eca690b8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/v37.md @@ -0,0 +1,28 @@ +Adversarial verification request. You are a fresh, independent reviewer; your +job is to find an error if there is one. Repository: /Users/a9lim/Work/blam. + +Claim under review: every exact BLC self-interpreter has at least 37 bits +(raising the handwritten floor from 34). The full handwritten proof is +/Users/a9lim/Work/blam/tmp/overnight/global/PROOF37.md; supporting files are in +the same directory (verify.py, verified.json, FiniteChecks.lean, +lean-check.log). Background it relies on: docs/classical/self-interpreter/ +capture-width.md (the 34-bit bound, Statman's width obstruction, the 33 +exclusion), structural-bounds.md, head-decomposition.md, and the Lean modules +lean/Blc/SelfintNonlinearChain.lean, SelfintWireCost.lean. The contract: +E C (⌜M⌝ ++ N) =β C (λz. M) N for every closed M (divergent included), C, N +rigid; ⌜λM⌝ = 00⌜M⌝, ⌜M N⌝ = 01⌜M⌝⌜N⌝, var n = 1ⁿ0, bits K = λxy.x (0), +F = λxy.y (1), cons b r = λf. f b r; |M| = 2L + 4A + 2 + X. + +Check every step: the counting reduction to four live binders / six leaves / +at most one vacuous binder; the claim that a head redex contracting a +width-chain binder destroys width three; the source-minimality (wire-cost) +arguments; the completeness of the 12 / 60 / 2×18 layout inventories at +34/35/36 bits; each refutation (head arity, identity-source payloads, +repeated head states); the six parametric divergence invariants (are they +proved for all iteration counts, substitution-safe, and do they really show +non-existence of the required normal form?); and the vacuous-binder cases. +You may run small fixed checks (a few seconds) to test specific reductions; +no enumeration. Answer with: verdict (correct / gap / error), every gap or +error with a precise location and, for an error, a counterexample or the +failing step; and which parts you checked fully. Write your review to +/Users/a9lim/Work/blam/tmp/overnight/verify/v37_codex.md as well. diff --git a/data/self-interpreter/reasoning_floor/verify/v37_codex.md b/data/self-interpreter/reasoning_floor/verify/v37_codex.md new file mode 100644 index 00000000..951780cb --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/v37_codex.md @@ -0,0 +1,77 @@ +( •̀_•́) **Verdict: correct.** I found no substantive gap or error in the handwritten 37-bit lower bound. In particular, the width-loss step is valid under the six-leaf allocation, the vacuous-binder split is complete, and all six growing families have valid, substitution-safe head-divergence proofs. This verdict concerns the handwritten theorem; the supplied Lean file proves finite reduction clauses, not the complete lower bound. + +Reviewed `../global/PROOF37.md`, 556 lines, SHA-256 `d9b11e5c90b003c1fb435a3a0022d44bad4ee15ab8f2df4d308201e8a18d3236`. Locations below refer to this version. I did not consult another agent or run a term enumeration. + +**Gaps or errors found: none.** The following records the checks and the reasoning at the potentially fragile steps. + +1. **Contract and structural dependencies — lines 30–58.** The actual `IsSelfInterpreter` definition in `lean/Blc/SelfintProof.lean:1030` uses closed sources, independent rigid continuation/suffix variables, and beta joinability. It includes divergent sources. The arguments do not silently replace this with directed reconstruction on divergent inputs. + + I independently extracted the first page of the supplied publisher-preview PDF. Printed p. 406 explicitly states the width obstruction used here: a closed term beta-convertible to S must have a subterm with three distinct free variables. This is the stated consequence in Statman's [*Two Variables Are Not Enough*](https://doi.org/10.1007/11560586_32). I checked the statement, not the complete proof of the published theorem. + + The application to `E K stream(S,I) I` is sound: all added operands are closed and have width one, and their applications introduce no new free support. The internal version is also sound. Substituting closed width-one terms for the two public variables removes those variables from the support of every surviving body subterm; inserted subterms cannot supply width three. Thus the required three variables must be bound inside the literal body. + + I checked the exact head-arity argument in `head-decomposition.md`. Reflection of head normalizability through application uses substitution stability of defined head steps. Three surviving leading lambdas are impossible even without normalizing the body. A one-lambda closed head normal form, after invocation, has the whole nonempty stream as its last rigid-head argument, so cannot give the required rigid suffix. The two-lambda continuation-headed case must have exactly two arguments. + + I inspected and successfully rechecked both requested Lean modules, `SelfintNonlinearChain.lean` and `SelfintWireCost.lean`. Their statements match the uses here, including preservation of the full interpreter contract under contextual beta reduction. The chain predicate genuinely excludes all arrangements with nonlinear binders on one ancestor chain. The internal nonlinear requirement follows either from the body's failure of that predicate or from `selfInterpreter_two_inside_interface`. For a literal interface, the internal width witness and incomparable pair require four internal live binders and six internal leaves. The two live public binders add two binders and two leaves, and the continuation occurrence adds an index unit separate from the internal witness. Thus `L>=6,V>=8,X>=4`, giving the stated 46-bit floor. + +2. **Counting and isolation of the fourth binder — lines 80–112.** Three support variables give three live binders on one chain and index sum at least `2+1+0=3`. The incomparable nonlinear pair forces a fourth live binder and at least six leaves. Seven leaves already cost at least `2*4+4*7-2+3=37`; six abstractions already cost at least `2*6+4*6-2+3=37`. Hence only `(L,V)=(4,6),(5,6)` remain. + + Five live binders would need seven leaves once the two nonlinear binders are counted, so exactly four are live. The six leaves force multiplicities `2,2,1,1`. This also proves that the fifth binder, when present, is vacuous. + + The off-chain nonlinear binder d cannot contain a chain binder without becoming comparable with the chain's nonlinear binder. Any chain ancestor it could capture is affine, and its only occurrence is already needed in the width witness outside d. Consequently d's abstraction is closed in isolation and has exactly its two own leaves. A possible leading source binder is live, affine, and on the width chain. These facts justify the free-occurrence bound used at the first source head redex. + +3. **Minimality, width loss, and the diagonal reduction — lines 109–156.** The wire formula is applied to source redexes in their actual surrounding contexts. For `k=0`, the occurrence-depth sum is zero and the contraction strictly shrinks. For `k=1,f<=1`, the change is at most `-6-g`. There is no assumption that arbitrary affine contractions shrink. + + If the first contractor is on the width chain, its body contains the whole width witness and both occurrences of that nonlinear variable. The argument is closed: a possible leading affine variable has spent its sole occurrence in the witness. It must therefore contain d, the only remaining possible live binder. The six leaves leave no pending argument or other live syntax outside these pieces. + + The width-loss conclusion is valid. Substitution inserts closed width-one terms. A subterm internal to an inserted copy has width at most one; a subterm inherited from the body can mention only the two remaining live chain variables, since inserted closed copies add no free support. This is a specific closed-substitution argument, not an invalid claim that width generally decreases under beta reduction. The reduct has width at most two and still satisfies the interpreter contract, a contradiction. + + Thus the contractor must be d and the source has one of the two displayed diagonal forms. The operand-normality argument is also valid: every live operand binder is on the witness chain, so its redex body contains its k own leaves and the other two required variables. The remaining argument has at most `2-k` leaves. The nonlinear case leaves none; the affine case has at most one free occurrence and shrinks. Vacuous redexes shrink separately. + +4. **Six normal shapes and finite inventory completeness — lines 160–202, 268–281, 403–411, 475–485.** The witness uses one occurrence of each chain variable below all three binders. Only one additional leaf remains. If it lies above a later binder block, normality fixes its orientation as the function of that block. This gives exactly the six displayed shapes and index sums `3,4,5,3,4,3`; no four-lambda `X=6` case is missing. In the open form the outer variable is affine, leaving precisely the last three shapes. + + The internal-nonlinearity exclusions for the closed middle and the inner families are valid. The open middle-below-inner exclusion uses internal width correctly: each residual copy of A has only two internal binders; outside those copies there are only public variables. Copies do not acquire common internal binding scope merely by occurring in one application tree. + + The residual counts follow analytically. Three distinct leaves have `6*2=12` ordered binary trees. The four-leaf multiset has `12*5=60`, split into 30 a-headed, 15 b-headed, and 15 c-headed trees. For a boxed three-leaf tree, each left-associated ordering admits two normal boxing sites and each right-associated ordering admits one, giving `6*(2+1)=18`. This applies to both boxed families. The count is not inferred from a search returning the expected number. + +5. **Inherited 33-bit exclusion.** I checked `capture-width.md:316–476`, including its source-minimality reduction and twelve final layouts. A fixed replay confirms the ten finite head-form cases, including the quoted 8-, 5-, and 4-step reductions. The two eta-based exclusions are legitimate impossibility arguments for the beta-exact contract. Their eta reducts give Omega or the stated three-state head cycle; the cycle terms and the identity-source invocation have no competing eta reduction that could invalidate the argument. Beta-eta confluence separates them from the required beta-eta-normal identity output. + +6. **Finite refutations — lines 220–235, 283–326, 417–436, 482–485.** I checked every finite residual against its claimed obstruction, not only that a finite reduction equality exists. The independent checker `v37_fixed_check.py` parses the supplied Lean terms and the fixed named layouts separately, implements capture-avoiding substitution/head reduction without importing the author's Python reduction code, and checks the resulting shapes and payload mismatches. It matched all 108 fixed layouts and verified all 102 finite refutations; the other six are the growing families addressed below. + + In particular, the 24 non-left-spine a-headed 35-bit cases expose a third lambda; the two remaining repeated-state cases have positive periods three and six; the other rigid-head arity exclusions agree with the tables. The b-headed two-payload cases always have an independently decisive fixed N or nonempty stream payload, so no normalization of `N N` is needed. + + I additionally checked the paper's exact payload descriptions, where its chosen reason differs from the JSON's first detected reason: the three fixed-N payload claims in the 34-bit table; `C K stream(I,Ntail)` and `C N C` in the 35-bit table; and both exceptional fixed payloads in the 36-bit table. They are correct. All normal payload inequalities are beta inequalities by uniqueness of normal forms. + +7. **Vacuous-binder cases — lines 332–411.** A vacuous binder in D has exactly the stated possibilities. Above d it creates an erasing head redex; around both d leaves it spends two index units and exceeds the budget; around the function leaf it creates an erasing redex. The sole remaining normal form is `lambda d.d (lambda u.d)`, of size 11. Its five listed argument families reduce as claimed: to a smaller interpreter, a wrong one-lambda head form, or an interface with insufficient internal nonlinearity. + + Deleting a vacuous binder from a normal argument preserves normality and the relevant witness/counts. Reinsertion costs `2+freeLeaves(U)` with multiplicity. The base diagonal's 33-bit floor is a syntax-counting fact, so this does not incorrectly assume that the deleted-binder term is itself an interpreter. + + The zero-free-occurrence site is only the entire closed argument. A one-free-occurrence site in a 33-bit base is precisely a variable or the subterm containing the two inner live binders and the single outer-variable occurrence. The displayed three block insertions and their open counterparts cover these sites. Their exclusions are correct. For leaf insertion, the closed middle family retains a one-lambda head form; each inner family contains only one residual copy contributing internal nonlinearity. The open middle family is correctly retained for its separate eighteen-case analysis rather than discarded by the latter argument. + +8. **All six divergence invariants — lines 237–266, 438–471, 488–524.** Each is valid for all iteration counts, as a direct symbolic argument: + + - Advancing wrappers: for a word W of length k, peeling its wrappers gives `W U ->^k N U tk ... t1`. Therefore `N W P rest ->^(k+2) N (J_P(W)) tk ... t1 rest`. The wrapper length increases to `k+1`; because `k>=1`, at least one argument remains available for the next macro. The stated initial invocation reaches this set. + - Pair pumping: with the displayed W and L, the four contractions are `N W S ->^2 W P(W,S) -> P(W,S) N C -> N W S C`. This is exactly `L ->^4 L C`. + - Forward wrappers: induction gives `F^k(N) U V ->^(2k) N U (K^k V)`. One initial N contraction yields the stated recursive macro in `2k+1` steps. The pending S remains outside that macro, and k increases. + - Reverse wrappers: expanding `Y=N G(N)` gives `Y P ->^5 Y (K(K P))`. P may be an arbitrary term, so the macro applies again to the new boxed argument without an extra hypothesis. + - Open middle chain: peeling k J wrappers gives the first identity in k steps and the second in `k+1` steps. The active argument stays immediately after A; all accumulated T arguments and the public stream remain behind it. + - Open middle pair: `L=A P(A) -> P(A) P(P(A)) -> P(P(A)) A T -> A P(A) T T`, exactly the asserted three-step pump. + + These are head contractions on application spines, not arbitrary reductions inside erasable arguments. All auxiliary binders can be chosen fresh. The equations hold with arbitrary substituted parameter terms, and every displayed head redex persists under capture-avoiding substitution. For the open families, first supply the outer continuation binder; the invariant then runs in the resulting application to the actual stream. Thus substitution of `stream(I,Ntail)` does not interrupt any trace. + + Every macro has positive finite length and stays in its invariant, producing an infinite deterministic weak-head reduction of the invoked candidate. Head standardization therefore rules out a head normal form, and in particular rules out the required normal result `C (lambda z.I) Ntail`. No cap or mere growth observation is being used as a nontermination proof. + +9. **Conclusion and checking boundary — lines 528–539.** With the two source inventories exhausted, well-ordering applies; the repository's existing `isSelfInterpreter_intL165` theorem supplies existence. The conclusion of at least 37 bits follows. I did not find a missing 34-, 35-, or 36-bit syntax family. + + Direct validation completed in this review: + + ```text + lake env lean -j 1 /Users/a9lim/Work/blam/tmp/overnight/global/FiniteChecks.lean + lake env lean -j 1 Blc/SelfintNonlinearChain.lean + lake env lean -j 1 Blc/SelfintWireCost.lean + python tmp/overnight/verify/v37_fixed_check.py + ``` + + The Lean commands ran from `lean/` and all exited zero. The finite file rechecked in approximately 1.13 seconds; the two structural modules in 0.26 and 0.44 seconds. The independent Python replay took 0.0075 seconds: 152 fixed clauses, comprising 144 global clauses and eight unrelated remainder clauses; all 102 finite layout refutations passed, including 13 recorded normal-payload mismatches. The checker uses no candidate generation and treats no normalization cap as a negative result. + +The full syntax classification, semantic exclusions, and six parametric invariants were checked as mathematics above. The complete 37-bit theorem remains handwritten. I did not re-prove Statman's external theorem, audit every transitive Lean-library dependency, or rerun the known interpreter batteries; none of those was used as a substitute for the global exclusion argument. The proof and its supporting global files were left unchanged. diff --git a/data/self-interpreter/reasoning_floor/verify/v37_fixed_check.py b/data/self-interpreter/reasoning_floor/verify/v37_fixed_check.py new file mode 100644 index 00000000..290e7ce4 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/v37_fixed_check.py @@ -0,0 +1,226 @@ +"""Independent replay of the supplied fixed clauses; no term enumeration.""" +import json +import re +import time +from pathlib import Path + +BASE = Path(__file__).resolve().parents[1] / "global" +V = lambda n: ("v", n) +L = lambda b: ("l", b) +A = lambda f, a: ("a", f, a) + + +def named(src): + tokens = re.findall(r"\\|\.|\(|\)|[A-Za-z_][A-Za-z_0-9]*", src) + pos = 0 + + def expr(env): + nonlocal pos + if tokens[pos] == "\\": + name = tokens[pos + 1] + pos += 2 + assert tokens[pos] == "." + pos += 1 + return L(expr([name] + env)) + t = atom(env) + while pos < len(tokens) and tokens[pos] != ")": + t = A(t, atom(env)) + return t + + def atom(env): + nonlocal pos + token = tokens[pos] + if token == "(": + pos += 1 + t = expr(env) + assert tokens[pos] == ")" + pos += 1 + return t + if token == "\\": + return expr(env) + pos += 1 + return V(env.index(token)) + + t = expr([]) + assert pos == len(tokens) + return t + + +def lean_term(src): + tokens = re.findall(r"\(|\)|\.var|\.lam|\.app|\d+", src) + pos = 0 + + def parse(): + nonlocal pos + assert tokens[pos] == "(" + kind = tokens[pos + 1] + pos += 2 + if kind == ".var": + t = V(int(tokens[pos])) + pos += 1 + elif kind == ".lam": + t = L(parse()) + else: + assert kind == ".app" + t = A(parse(), parse()) + assert tokens[pos] == ")" + pos += 1 + return t + + t = parse() + assert pos == len(tokens) + return t + + +def shift(t, amount, cut=0): + if t[0] == "v": + return V(t[1] + amount if t[1] >= cut else t[1]) + if t[0] == "l": + return L(shift(t[1], amount, cut + 1)) + return A(shift(t[1], amount, cut), shift(t[2], amount, cut)) + + +def subst(body, arg, cut=0): + if body[0] == "v": + n = body[1] + return arg if n == cut else V(n - (n > cut)) + if body[0] == "l": + return L(subst(body[1], shift(arg, 1), cut + 1)) + return A(subst(body[1], arg, cut), subst(body[2], arg, cut)) + + +def step(t, full=False): + if t[0] == "v": + return None + if t[0] == "l": + u = step(t[1], full) + return None if u is None else L(u) + if t[1][0] == "l": + return subst(t[1][1], t[2]) + u = step(t[1], full) + if u is not None: + return A(u, t[2]) + if full: + u = step(t[2], full) + if u is not None: + return A(t[1], u) + return None + + +def nf(t): + seen = set() + for _ in range(1000): + if t in seen: + return None + seen.add(t) + u = step(t, True) + if u is None: + return t + t = u + return None + + +def spine(t): + binders = 0 + while t[0] == "l": + binders += 1 + t = t[1] + args = [] + while t[0] == "a": + args.append(t[2]) + t = t[1] + return binders, t, args[::-1] + + +def size(t): + if t[0] == "v": + return t[1] + 2 + if t[0] == "l": + return 2 + size(t[1]) + return 2 + size(t[1]) + size(t[2]) + + +def invoke_identity(e): + tail = V(0) + # The literal BLC code for I is 0010; a Scott cell is lambda k.k bit tail. + for bit in reversed("0010"): + value = L(L(V(1 if bit == "0" else 0))) + tail = L(A(A(V(0), value), shift(tail, 1))) + return L(L(A(A(e, V(1)), tail))) + + +def main(): + started = time.monotonic() + clauses = {} + pattern = r"theorem (\w+) : headSteps (\d+) (.*?) = some (.*?) := by decide" + for name, n, source, target in re.findall(pattern, (BASE / "FiniteChecks.lean").read_text()): + source, target = lean_term(source), lean_term(target) + t = source + for _ in range(int(n)): + t = step(t) + assert t is not None, name + assert t == target, name + clauses[name] = (source, target, int(n)) + assert len(clauses) == 152 + + rows = json.loads((BASE / "verified.json").read_text())["layouts"] + delta = named(r"\x.x x") + groups = {} + payload_rows = [] + for i, row in enumerate(rows): + body, group, kind = row["body"], row["group"], row["kind"] + groups[str(group)] = groups.get(str(group), 0) + 1 + if group == 34: + e = A(delta, named(r"\a.\b.a (\c." + body + ")")) + elif group == 35: + e = A(delta, named(r"\a.\b.\c." + body)) + elif group == 36: + e = A(delta, named(r"\a.a (\b.\c." + body + ")")) + else: + assert group == "36open" + e = named(r"\a.(\x.x x) (\b.b (\c." + body + "))") + assert size(e) == (36 if group == "36open" else group) + if kind == "handwritten_growth_invariant": + continue + name = f"g{group}_{i}" + if kind == "exact_head_cycle": + assert clauses[name + "_prefix"][0] == e + mid = clauses[name + "_prefix"][1] + assert clauses[name + "_cycle"][0] == mid == clauses[name + "_cycle"][1] + assert clauses[name + "_cycle"][2] > 0 + continue + if kind.startswith("identity_"): + name += "_I" + expected_source = invoke_identity(e) + else: + expected_source = e + source, target, _ = clauses[name] + assert source == expected_source, name + b, h, args = spine(target) + if kind in ("at_least_three_lambdas", "identity_extra_lambda"): + assert b >= 3, name + continue + assert step(target) is None, name + if kind == "wrong_interface_arity": + assert b != 2, name + elif kind == "wrong_continuation_spine": + assert (b, h) == (2, V(1)) and len(args) != 2, name + elif kind == "identity_wrong_spine": + assert (b, h, len(args)) != (2, V(1), 2), name + else: + assert kind == "identity_wrong_payload", name + assert (b, h, len(args)) == (2, V(1), 2) + j = row["payload"] + result = nf(args[j]) + assert result is not None and result != (L(L(V(0))) if j == 0 else V(0)), name + payload_rows.append(i) + assert groups == {"34": 12, "35": 60, "36": 18, "36open": 18} + print(json.dumps({"fixed_clauses_replayed": len(clauses), + "fixed_layouts_matched": groups, + "finite_refutations_checked": len(rows) - 6, + "payload_mismatches_normalized": payload_rows, + "seconds": round(time.monotonic() - started, 4)}, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/data/self-interpreter/reasoning_floor/verify/v37_gemini.md b/data/self-interpreter/reasoning_floor/verify/v37_gemini.md new file mode 100644 index 00000000..87dd2393 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/v37_gemini.md @@ -0,0 +1,61 @@ +### Verdict + +**`correct`** — No errors or logical gaps found. The proof in [`PROOF37.md`](file:///Users/a9lim/Work/blam/tmp/overnight/global/PROOF37.md) and its supporting dependencies establish unconditionally that every closed BLC self-interpreter satisfying the exact contract $E\,C\,(\text{stream}(M, N)) =_\beta C\,(\lambda z.\,M)\,N$ has length at least **37 bits**. + +--- + +### Parts Checked and Verification Summary + +#### 1. Counting Reduction to $(L, V) \in \{(4, 6), (5, 6)\}$ (`PROOF37.md` §1–§2, `capture-width.md`) +- **Verified fully by hand.** +- From $|E| = 2L + 4A + 2 + X = 2L + 4V - 2 + X$: + - **Width $\ge 3$:** For $P = E\,K\,(\text{stream}(S, I))\,I =_\beta S$, every subterm of $\text{stream}(S, I)$, $K$, and $I$ has width at most $1$ because every tail and bit is closed, so $\text{width}(P) = \max(\text{width}(E), 1)$. Statman's theorem ($\text{width}(P) \ge 3$) forces a subterm $U$ of $E$ with three distinct free variables bound by a chain of three live ancestor binders $a > b > c$. Their occurrences inside $U$ have 0-based de Bruijn indices at least $2, 1, 0$, giving $X \ge 3$. + - **Four live binders and six leaves:** By [`SelfintNonlinearChain.selfInterpreter_not_chain`](file:///Users/a9lim/Work/blam/lean/Blc/SelfintNonlinearChain.lean#L205-L217), $E$ has at least two incomparable nonlinear binders. Because $a > b > c$ is a chain, at most one of the incomparable pair lies in $\{a, b, c\}$, requiring a fourth live binder $d$. Two nonlinear binders ($\ge 2$ leaves each) plus two other live binders ($\ge 1$ leaf each) force $L \ge 4$ and $V \ge 6$. + - **Size $\le 36$:** $2L + 4V - 2 + X \le 36 \implies 2L + 4V + X \le 38$. Since $L \ge 4$ and $X \ge 3$, $4V \le 27 \implies V = 6$, and $2L + X \le 14 \implies (L, V) = (4, 6)$ with $X \le 6$, or $(L, V) = (5, 6)$ with $X \le 4$. + - **Binder multiplicities and isolation of $d$:** With $V = 6$ and at least four live binders of which two are nonlinear, there are *exactly* four live binders (two with multiplicity $2$, two with multiplicity $1$), and for $L = 5$ the fifth binder $u$ is vacuous ($0$ occurrences). Because any ancestor of any of $a, b, c$ is an ancestor of $c$ (and $U$), and the ancestors of $c$ are linearly ordered, $d$ can neither contain any of $a, b, c$ nor lie inside $c$ without being comparable to the chain's nonlinear binder. Thus the subtree of $\lambda d$ is disjoint from $\lambda c$ (and $U$). Any chain binder enclosing $d$ must be affine, and its sole occurrence is already inside $U \subseteq \lambda c$ outside $\lambda d$. Hence $\lambda d$ is closed in isolation, with two own leaves and at most the one vacuous binder. + +#### 2. Exclusion of Width-Chain Head Contractors (`PROOF37.md` §2) +- **Verified fully by hand.** +- A literal two-lambda interface $\lambda c s.\,B$ costs $\ge 46$ bits (its body $B$ needs internal width $\ge 3$ and two incomparable internal nonlinear binders, forcing $L \ge 6, V \ge 8, X \ge 4$). Thus $E$ has at most one leading lambda $y$, which must be live (else $C$ is erased) and affine (a nonlinear root is an ancestor of all binders). +- Following the head spine under at most $\lambda y$ to the first beta redex $(\lambda x.\,B)\,A$: + - $x$ cannot be vacuous ([`erasing_beta_shrinks`](file:///Users/a9lim/Work/blam/lean/Blc/SelfintWireCost.lean#L123-L128)) or affine (only affine $y$ can be free in $A$, so $\text{freeLeaves}(0, A) \le 1$, shrinking by [`linear_small_free_beta_shrinks`](file:///Users/a9lim/Work/blam/lean/Blc/SelfintWireCost.lean#L132-L139)). + - If $x \in \{a, b, c\}$ is the nonlinear binder on the width-3 chain, then $U \subseteq B$, so all $4$ chain-bound leaves lie in $B$. The remaining $2$ leaves of $E$ are the $2$ occurrences of $d$, which together with $\lambda d$ must lie in $A$ (leaving $0$ leaves for any further spine argument). Thus $A$ is closed with $\text{width}(A) = 1$. + - Contracting $(\lambda x.\,B)\,A$ produces a beta-reduct $E'$ (still a closed interpreter by [`selfInterpreter_beta`](file:///Users/a9lim/Work/blam/lean/Blc/SelfintWireCost.lean#L190-L200)) in which $\lambda x$ is removed and closed copies of $A$ ($\text{width}(A) = 1$) are substituted. Every subterm of $E'$ either lies inside $A$ ($\le 1$ free variable) or has free variables $\text{FV}(W_0) \setminus \{x\} \subseteq \{a, b, c\} \setminus \{x\}$ ($\le 2$ free variables). Thus $\text{width}(E') \le 2$, contradicting $\text{width}(E') \ge 3$. + +#### 3. Source-Minimality / Beta-Normality of $D$ and the 4-Leaf Operand (`PROOF37.md` §2) +- **Verified fully by hand and against [`SelfintWireCost.lean`](file:///Users/a9lim/Work/blam/lean/Blc/SelfintWireCost.lean).** +- The head contractor is $d$, giving $E = D\,N$ or $E = \lambda y.\,D\,A(y)$. +- Both $D$ and $N$ (or $A(y)$) are beta-normal: any vacuous redex shrinks, and in the 4-leaf operand any live redex binder $z \in \{a, b, c\}$ is an ancestor of $U$, so its body contains $U$ and has at least $k + 2$ leaves, leaving at most $4 - (k + 2) = 2 - k$ leaves for its argument ($k = 2$ is impossible; $k = 1$ gives $\le 1$ argument leaf, which strictly shrinks). + +#### 4. Completeness of the 12 / 60 / $2 \times 18$ Layout Inventories and Vacuous-Binder Cases (`PROOF37.md` §3–§4) +- **Verified fully by hand and script.** +- **Four-lambda inventory ($L = 4, V = 6$):** $D = \Delta$. In $N$, three leaves ($a, b, c$) lie below $\lambda c$ in $U$ ($X \ge 3$), and the fourth leaf repeats one of $a, b, c$. Normality forces any leaf placed above $\lambda b$ or $\lambda c$ to be in function position applied to the inner lambda block, yielding the $6$ closed shapes ($X \in \{3, 4, 5\}$) and $3$ open shapes (since outer $y = a$ is affine). + - All $X = 3$ shapes have size $33$ (excluded in `capture-width.md`). + - Closed middle-below-inner ($\lambda a b c.\,T_4(a, b, b, c)$, $34$ bits) reduces in $2$ steps to $\lambda b c.\,T_4(N, b, b, c)$, whose body has only $1$ internal nonlinear binder, contradicting [`selfInterpreter_two_inside_interface`](file:///Users/a9lim/Work/blam/lean/Blc/SelfintLowerBound.lean#L384-L399). + - Open middle-below-inner ($\lambda y.\,\Delta\,(\lambda b c.\,T_4(y, b, b, c))$, $34$ bits) reduces in $2$ steps to $\lambda y c.\,T_4(y, A, A, c)$, whose body has internal width $2$ (each copy of $A$ has only $2$ internal binders, and $y, c$ are public), contradicting the internal width-$3$ theorem for literal two-lambda interfaces (`capture-width.md`). + - The remaining two closed families are $N = \lambda a b.\,a\,(\lambda c.\,T_3(a, b, c))$ (**12 layouts** at $34$ bits, §3a) and $N = \lambda a b c.\,T_4(a, a, b, c)$ ($12 \text{ leaf orders} \times 5 \text{ binary trees} =$ **60 layouts** at $35$ bits, §3b). +- **Five-lambda inventory ($L = 5, V = 6, X \le 4$):** + - *Vacuous $\lambda u$ in $D$:* Non-shrinking and $X \le 4$ (since $U$ already uses $3$ index units) force $D = \delta_K = \lambda d.\,d\,(K\,d)$ ($|D| = 11$, $X_D = 1$) and an $X = 3$ four-leaf argument ($3$ closed + $2$ open families). All $5$ families fail immediately under $\delta_K\,A \to A\,(K\,A)$: closed outer-before-middle reduces in $3$ steps to $A$ (strictly smaller); closed middle-before-inner reduces to a $1$-lambda HNF; closed/open inner-duplicate reduce to $\lambda b c.\,B$ with $1$ internal nonlinear binder; open middle-duplicate reduces in $3$ steps to $\lambda y.\,A_y$ ($0$ internal nonlinear binders). + - *Vacuous $\lambda u$ in the 4-leaf argument:* $D = \Delta$. Deleting $\lambda u$ from a normal term preserves normality (since $\lambda u.\,W$ could not have been the left child of an application) and yields a 4-lambda base $E_0$ of size $\ge 33$ with $|E| = |E_0| + 2 + \text{freeLeaves}(W) \le 36$, so $\text{freeLeaves}(W) \in \{0, 1\}$. + - $\text{freeLeaves}(W) = 0$: No proper subterm of $N_0$ or $A_0(y)$ is closed, so $W = N_0$, giving $\Delta\,(K\,N_0) \to^2 N_0$, contradicting minimality. + - $\text{freeLeaves}(W) = 1$ with $|E_0| = 33$: Inside $T_3$ or $T_4$ every application node has $\ge 2$ free leaves, so $W$ is either the two-innermost-binder block (giving $3$ closed + $2$ open families, each reducing in $2$–$4$ steps to $\le 1$ internal nonlinear binder, a vacuous continuation binder, or $3$ leading lambdas) or a single variable leaf inside $T_3$/$T_4$. + - Boxing a leaf inside $T_3$/$T_4$ leaves the closed middle family with a $1$-lambda HNF and the closed/open inner families with $1$ internal nonlinear binder. The remaining two families are closed outer-before-middle and open middle-before-inner, each with $6 \times 3 =$ **18 normal boxed layouts** at $36$ bits (§4a and §4b). + +#### 5. The 102 Finite Refutations (`PROOF37.md` §3a, §3b, §4a, §4b, `FiniteChecks.lean`, `verify.py`) +- **Verified fully by running `lake env lean` on [`FiniteChecks.lean`](file:///Users/a9lim/Work/blam/tmp/overnight/global/FiniteChecks.lean) (152 `headSteps` theorems, exit 0 in 1.2s) and inspecting every output.** +- Every finite refutation falls into one of four sound obstructions: + 1. `at_least_three_lambdas` / `identity_extra_lambda`: a head reduct of $E$ or $E\,C\,(\text{stream}(I, N_{\text{tail}}))$ has $\ge 3$ leading lambdas, which is preserved by all subsequent reductions and cannot join a rigid $C$-headed normal form. + 2. `wrong_interface_arity` / `wrong_continuation_spine` / `identity_wrong_spine`: the head normal form has $1$ leading lambda, or has head $N_{\text{tail}}$ instead of $C$, or applies rigid $C$ to $m \neq 2$ arguments. + 3. `exact_head_cycle`: `(((a a) b) c)` and `(((a a) c) b)` at $35$ bits enter exact head cycles of periods $3$ and $6$ after $2$ steps (`g35_16_prefix`/`g35_16_cycle` and `g35_21_prefix`/`g35_21_cycle`). + 4. `identity_wrong_payload` (13 cases across 34/35/36 bits): I verified directly on the Lean-certified HNF terms (`g34_4_I`, `g34_6_I`, `g34_11_I`, `g35_41_I`, `g35_44_I`, `g35_45_I`, `g35_49_I`, `g35_50_I`, `g35_54_I`, `g35_55_I`, `g35_63_I`, `g36_74_I`, `g36_83_I`) that in **every one of the 13 cases**, the cited payload ($A_0$ or $A_1$ in $\lambda c s.\,c\,A_0\,A_1$) is **already in beta-normal form** in the certified HNF and syntactically distinct from the required normal form ($K\,I = \lambda z x.\,x$ for $A_0$, or $N_{\text{tail}}$ for $A_1$). No uncertified internal normalization is needed. + +#### 6. The Six Parametric Divergence Invariants (`PROOF37.md` §3a, §4a, §4b) +- **Verified fully by hand induction for all $k \ge 1$.** + 1. **34-bit `(a c) b`:** $J_t(X) = \lambda u.\,X\,u\,t$, $N = \lambda a b.\,a\,(J_b(a))$. By induction on $k \ge 1$, $W\,U = J_{t_1}(\dots J_{t_k}(N))\,U \to_{\text{wh}}^k N\,U\,t_k \dots t_1$, hence $N\,W\,P\,\text{rest} \to_{\text{wh}}^{k+2} N\,(J_P(W))\,t_k \dots t_1\,\text{rest}$. Starting from $\Delta\,N\,C\,S \to_{\text{wh}}^3 N\,(J_C(N))\,S$ ($k=1$), each cycle increases $k$ by $1$ and pops $k \ge 1$ arguments, so a next argument $P$ is always present. + 2. **34-bit `(c a) b`:** $P(X,Y) = \lambda u.\,u\,X\,Y$, $N = \lambda a b.\,a\,P(a,b)$, $W = P(N, C)$, $L = N\,W\,S$. Direct trace gives $\Delta\,N\,C\,S \to_{\text{wh}}^3 L$ and $L \to_{\text{wh}}^4 L\,C$, which iterates in growing application contexts $L\,C^m \to_{\text{wh}}^4 L\,C^{m+1}$. + 3. **36-bit `(a b) Kc`:** $F(X) = \lambda b c.\,X\,b\,(K\,c)$, $N = \lambda a.\,a\,(F(a))$. By induction on $k \ge 1$, $F^k(N)\,U\,V \to_{\text{wh}}^{2k} N\,U\,(K^k\,V)$, hence $N\,F^k(N)\,P \to_{\text{wh}}^{2k+1} N\,F^{k+1}(N)\,(K^k\,P)$. From $\Delta\,N\,C\,S \to_{\text{wh}}^2 N\,F(N)\,C\,S$, this iterates for all $k \ge 1$ with $S$ permanently pending. + 4. **36-bit `(b a) Kc`:** $G(X) = \lambda b c.\,b\,X\,(K\,c)$, $N = \lambda a.\,a\,(G(a))$, $Y = N\,G(N)$. Direct trace gives $\Delta\,N\,C\,S \to_{\text{wh}}^2 Y\,C\,S$ and $Y\,P \to_{\text{wh}}^5 Y\,(K\,(K\,P))$ for all $P$. + 5. **36-bit open `(b c) Ka`:** With $T = K\,a$, $J(X) = \lambda c.\,X\,c\,T$, $A = \lambda b.\,b\,J(b)$, induction on $k \ge 1$ gives $J^k(A)\,U \to_{\text{wh}}^k A\,U\,T^k$ and $A\,J^k(A) \to_{\text{wh}}^{k+1} A\,J^{k+1}(A)\,T^k$ at the head of the spine, entered via $\Delta\,A \to_{\text{wh}}^2 A\,J(A)$. + 6. **36-bit open `(c b) Ka`:** With $T = K\,a$, $P(X) = \lambda c.\,c\,X\,T$, $A = \lambda b.\,b\,P(b)$, $L = A\,P(A)$, direct trace gives $\Delta\,A \to_{\text{wh}}^2 L$ and $L \to_{\text{wh}}^3 L\,T\,T$. +- **Substitution safety and non-normalization:** Every step in all six invariants contracts an explicit lambda at the weak-head spine root (never a free placeholder $C, S, a$), so the exact weak-head step sequence is preserved under capture-avoiding substitution of $C$ and $S = \text{stream}(I, N_{\text{tail}})$ and coincides with standard head reduction. By head factorization (`Blc/Factor.lean`) and confluence (`Blc/Confluence.lean`), an infinite head reduction precludes beta-equivalence to the normal form $C\,(\lambda z.\,I)\,N_{\text{tail}}$. +[gaslamp] job: gm-20261021-022428-9e7d · session: d5b599bf-624a-4631-ac34-05794bbd51af · resume: gaslamp gemini --resume d5b599bf-624a-4631-ac34-05794bbd51af · model: gemini-4-argon · tok: 1064k→34k diff --git a/data/self-interpreter/reasoning_floor/verify/v37_gemini_prompt.md b/data/self-interpreter/reasoning_floor/verify/v37_gemini_prompt.md new file mode 100644 index 00000000..ecacdd8a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/v37_gemini_prompt.md @@ -0,0 +1,28 @@ +Adversarial verification request. You are a fresh, independent reviewer; your +job is to find an error if there is one. Repository: /Users/a9lim/Work/blam. + +Claim under review: every exact BLC self-interpreter has at least 37 bits +(raising the handwritten floor from 34). The full handwritten proof is +/Users/a9lim/Work/blam/tmp/overnight/global/PROOF37.md; supporting files are in +the same directory (verify.py, verified.json, FiniteChecks.lean, +lean-check.log). Background it relies on: docs/classical/self-interpreter/ +capture-width.md (the 34-bit bound, Statman's width obstruction, the 33 +exclusion), structural-bounds.md, head-decomposition.md, and the Lean modules +lean/Blc/SelfintNonlinearChain.lean, SelfintWireCost.lean. The contract: +E C (⌜M⌝ ++ N) =β C (λz. M) N for every closed M (divergent included), C, N +rigid; ⌜λM⌝ = 00⌜M⌝, ⌜M N⌝ = 01⌜M⌝⌜N⌝, var n = 1ⁿ0, bits K = λxy.x (0), +F = λxy.y (1), cons b r = λf. f b r; |M| = 2L + 4A + 2 + X. + +Check every step: the counting reduction to four live binders / six leaves / +at most one vacuous binder; the claim that a head redex contracting a +width-chain binder destroys width three; the source-minimality (wire-cost) +arguments; the completeness of the 12 / 60 / 2×18 layout inventories at +34/35/36 bits; each refutation (head arity, identity-source payloads, +repeated head states); the six parametric divergence invariants (are they +proved for all iteration counts, substitution-safe, and do they really show +non-existence of the required normal form?); and the vacuous-binder cases. +You may run small fixed checks (a few seconds) to test specific reductions; +no enumeration. Answer with: verdict (correct / gap / error), every gap or +error with a precise location and, for an error, a counterexample or the +failing step; and which parts you checked fully. (You are read-only; do not write files. Ignore the instruction to write) +/Users/a9lim/Work/blam/tmp/overnight/verify/v37_codex.md as well. diff --git a/data/self-interpreter/reasoning_floor/verify/vrem.md b/data/self-interpreter/reasoning_floor/verify/vrem.md new file mode 100644 index 00000000..d0a33857 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vrem.md @@ -0,0 +1,32 @@ +Adversarial verification request. You are a fresh, independent reviewer; your +job is to find an error if there is one. Repository: /Users/a9lim/Work/blam. + +Two handwritten lower bounds are under review. + +(1) Every closed exact remainder extractor R — R (⌜M⌝ ++ N) =β N for every +closed M (divergent included) and rigid N — has |R| ≥ 27. Proof: +/Users/a9lim/Work/blam/tmp/overnight/remainder/REPORT.md §4 (with §3's Lean +theorem in RemainderChain.lean, and audit.py). An independent lane proved a +weaker 24 by a different route: /Users/a9lim/Work/blam/tmp/overnight/global/ +PROJECTIONS.md. + +(2) Every self-interpreter whose literal source is λc s. c A B has at least +70 bits: PROJECTIONS.md (same directory as above). + +Background: docs/classical/self-interpreter/remainder.md, structural-bounds.md, +capture-width.md, head-decomposition.md; Lean modules lean/Blc/SelfintZero.lean, +SelfintNonlinearChain.lean, SelfintProjections.lean. Encoding: ⌜λM⌝ = 00⌜M⌝, +⌜M N⌝ = 01⌜M⌝⌜N⌝, var n = 1ⁿ0, K = λxy.x (0), F = λxy.y (1), +cons b r = λf. f b r; |M| = 2L + 4A + 2 + X. + +Check every step, especially: the three-live-binder argument (is "closed in +isolation ⇒ copies keep their bodies ⇒ no nonlinear binder inside the exposed +lambda" sound for weak-head evaluation with arbitrary redexes?); the claim that +the allocation through 26 bits is exactly the listed cases; every reduction +table entry; the divergence recurrences; for (2), whether the width-three and +incomparable-pair requirements really sit inside A, whether |B| ≥ 22 is +justified for the open body, and whether anything is double counted. Small +fixed checks (seconds) are fine; no enumeration. Answer: verdict per claim +(correct / gap / error), every problem with location and counterexample or +failing step, and what you checked fully. Also write your review to +/Users/a9lim/Work/blam/tmp/overnight/verify/vrem_codex.md. diff --git a/data/self-interpreter/reasoning_floor/verify/vrem_codex.md b/data/self-interpreter/reasoning_floor/verify/vrem_codex.md new file mode 100644 index 00000000..95481687 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vrem_codex.md @@ -0,0 +1,76 @@ +(・_・) **Verdicts: (1) correct; (2) correct.** I found no invalid inference, omitted allocation, or incorrect reduction in the two claimed lower bounds. These are valid handwritten arguments on top of the stated formal and published results; neither numerical bound has thereby become a Lean theorem. + +Review scope: `remainder/REPORT.md` §3–4, `remainder/RemainderChain.lean`, `remainder/audit.py`, and `global/PROJECTIONS.md` §1–2, together with the relevant definitions and proofs in `SelfintZero`, `SelfintNonlinearChain`, `SelfintProjections`, and the background documents. I did not consult another agent or inspect another review. No candidate enumeration was performed. + +**Claim (1): every closed exact remainder extractor has at least 27 bits.** + +The three-live-binder argument at `remainder/REPORT.md:234–250` is sound for the chosen weak-head evaluation, including when the source contains arbitrary redexes. The details that matter are: + +1. Correctness on a fixed quote with normal suffix forces `R` to expose a lambda by weak-head reduction. Before that first lambda appears, every weak-head step of an invocation is a step in its function `R`. Closedness excludes a free-variable head. The exposed binder is live: otherwise applying any stream gives the same closed body, which cannot be beta-convertible to both `I` and `F`. Confluence transfers the extractor contract to this reduct, and `remainder_body_two_nonlinear` applies to its body. +2. If the source has at most two live binders, both must be nonlinear. The new chain theorem makes those two incomparable. Every ancestor of either is then vacuous, so neither lambda can refer to an ancestor: each is closed in isolation. Neither contains any other live binder. +3. Track surviving lambda occurrences through weak-head contractions. An uncontracted copy of one of these two closed live lambdas cannot be changed by a surrounding substitution, and weak-head evaluation never reduces its body. Contracting that lambda destroys that particular occurrence; it does not create a modified surviving version of its binder. Copies inserted later are again copies of the same closed source subterms. All other original binders are vacuous, and capture-avoiding substitution cannot introduce an occurrence of their own variable. Thus any exposed *live* lambda is an unchanged copy of one of the two source live lambdas, with no internal nonlinear binder. This contradicts the body theorem. + +This is not an assertion that closed lambda bodies are invariant under unrestricted beta reduction. They are not. The proof explicitly chooses weak-head reduction, which is enough to obtain the required contradiction. + +The allocation at `REPORT.md:252–268` is exhaustive. Three live binders, including two nonlinear ones, require `L >= 3` and `V >= 5`. With `2L + 4V - 2 + X <= 26`, increasing `V` to six already costs 28, and increasing `L` to five also costs 28. Therefore `V=5`, there are exactly two binary nonlinear binders and one affine live binder, and the only possibilities are `L=3, X<=2` or `L=4, X=0`. The fourth binder, if present, is vacuous. + +I checked the subsequent grammar classification independently: + +- **Zero index sum (`REPORT.md:274–319`).** Every lambda subterm is closed. The same weak-head residual argument applies to every lambda. The exposed live lambda with two internal nonlinear binders must therefore be the affine source binder containing both others. Its subtree contains all five leaves, so no application can lie outside it. An outer vacuous lambda discards the public stream. With three lambdas this leaves precisely the two binary association patterns on `s,D,D`, with the three positions for `s`: the six displayed layouts. With a fourth vacuous lambda, its closed body can wrap one `D` or the application `D D`; a wrapper containing an occurrence of `s` or a `D`-bound variable would make `X>0`. These are exactly the twelve `s,D,J` layouts and the two wrapped-Omega layouts listed in the report. +- **Positive index sum, lambda root (`REPORT.md:323–346`).** The root cannot be nonlinear because the only other nonlinear binder would be comparable to it. The only possible positive-index occurrence is the unique `s` occurrence inside one nonlinear binder. That helper has three leaves, the other helper is `D`, and the body is their application in one of the two orders. `H_s D` reduces to one of the six already handled layouts; `D H_s` reduces to `H_s H_s`. The six displayed helper bodies are complete. +- **Positive index sum, application root (`REPORT.md:351–408`).** The nested pair of binders occupies one closed operand `N`; the incomparable nonlinear binder occupies the other operand and is exactly `D`. No leaf remains for a third component. If the affine binder is outermost, positive index sum forces the two lambdas to be leading: `N=λa b.T(a,b,b)`. In both outer application orders the exposed interface body has only one internal nonlinear binder. If the nonlinear binder is outermost, a leading affine binder gives the six displayed `T(x,x,y)` cases. A nonleading affine binder must contain its own occurrence and exactly one captured `x`, leaving the other `x` outside. The four displayed forms are then the only possibilities. + +All four reduction tables in §4 check out, as do the adjacent reductions involving the wrapped `D D` and nonleading affine helpers. On `stream(I,n)`, every terminating table result either visibly retains an outer lambda or reduces to a normal term different from rigid `n`. The other cases are excluded by the stated cycles, growing head spines, or the internal-binder theorem. The two leading-lambda reductions at `REPORT.md:376–377`, which the supplied audit does not check, are also correct: + +``` +N = λx y.x(x y): N N → λy.N(N y) → λy z.(N y)((N y)z) +N = λx y.x(y x): N N → λy.N(y N) → λy z.(y N)(z(y N)). +``` + +The divergence arguments are genuine recurrences, not conclusions from running out of fuel. In the `J(A)=λy.A y` family, `J^k(N) V →^k N V`, so the displayed recurrence is valid for every `k`, not merely the checked values `0,1,3`. Each intervening head lambda has a pending argument. The flip family is an exact three-step cycle. The all-`Q` argument in §1 is also sound: after consuming three all-`Q` arguments, its head is another all-`Q` tree with four all-`Q` arguments before any arbitrary pending suffix arguments. This preserves an indefinitely reducible protected head prefix. + +I also checked the independent 24-bit proof in `global/PROJECTIONS.md:25–106`. Its four `(L,V)` allocations are complete; shortest-source minimality excludes every erasing source redex, including internal ones. This justifies the beta-normal operand classification. The five one-vacuous and three two-vacuous layouts are complete under their index budgets and have the stated reductions. The final application-tree invariant for the binary/ternary diagonal cases is preserved at every head contraction. This weaker proof is consistent with the 27-bit result. + +**Claim (2): a literal `λc s.c A B` self-interpreter has at least 70 bits.** + +The requirements really do sit in the original `A`, not merely in a residual or in the public interface. + +- **Incomparability (`PROJECTIONS.md:135–140`).** The quotation of Omega with rigid tail is binder-affine. Substituting it for the free stream variable preserves `Chain` if `A` had that property. Rigid projection gives a beta join with `λz.Omega`; every reduct of that target is itself. Thus the instantiated payload would reduce to a term without `Chain`, contradicting preservation. The contradiction starts from the syntax of `A`, so the incomparable nonlinear pair lies inside `A`. +- **Internal width three (`PROJECTIONS.md:142–148`).** Form the actual source term `P = A[K/c,stream(S,I)/s] I`, without further reducing it. It is closed and beta-convertible to `S`. The substituted closed terms have width one. In this *unreduced substitution result*, every subterm either lies inside an inserted closed argument or descends from an original subterm `U` of `A`; in the latter case its free-variable set is exactly `FV(U) \ {c,s}`. The final application to closed `I` adds no support. Statman's theorem therefore forces three distinct variables bound internally to `A` in one original subterm. No beta-monotonicity of width is assumed. +- **Counting (`PROJECTIONS.md:150–159`).** Those three binders lie on one ancestor chain. They cannot contain both members of an incomparable pair, so at least four live internal binders are present. Four live binders with at least two nonlinear ones require at least six internally bound leaves. A required stream occurrence supplies a distinct seventh leaf. Selected occurrences of the three width-witness variables have indices at least `2,1,0`. Consequently `L(A)>=4`, `V(A)>=7`, `X(A)>=3`, and `|A|>=37`. +- **The open remainder body (`PROJECTIONS.md:126–130`).** `SelfintProjections.remainder_two_nonlinear` is a theorem about `B` itself. Fixing `c` to closed affine `I` does not change its nonlinear count. The independent stream-occurrence theorem supplies a free leaf. The exact inequality `10 nonlinear(B) + 4 freeLeaves(0,B) <= |B|+2` was proved for arbitrary open terms, so it gives `|B|>=22` without adding a closure binder. +- **Disjoint accounting (`PROJECTIONS.md:162–180`).** `A` and `B` are disjoint source subtrees. The two outer lambdas cost four bits, the two outer applications four, and the head occurrence of `c` three. Thus the additive overhead is exactly eleven, and `11+37+22=70`. Internal binders, leaves, and index contributions have not been charged twice. None of this transfers the same bound to an arbitrary source that expands into the displayed form. + +I independently downloaded the publisher's preview of [Statman's *Two Variables Are Not Enough*](https://page-one.springer.com/pdf/preview/10.1007/11560586_32) and checked printed page 406 visually and as text. It explicitly states the width-three consequence for a closed term beta-convertible to `S`. I verified that the cited theorem has the needed scope; I did not reconstruct its complete published proof from the two-page preview. + +**Two presentation clarifications; neither invalidates a bound.** + +- `REPORT.md:287–316` gives beta reducts, not uniformly deterministic weak-head traces. For example, `D(J s)` reduces to `Omega` by first contracting its argument `J s`; ordinary weak-head reduction instead cycles between `D(J s)` and `(J s)(J s)`. Likewise, reducing the argument first gives `D(s D) →* D K → K K`. Both uses in the exclusion are valid by confluence. Keep the distinction when describing what the audit checks. +- In `PROJECTIONS.md:57–64`, “literal vacuous boxes” is essential notation. The 11-bit `deltaK` is literally `λx.x(λu.x)`. Writing an actual application of the seven-bit `K` to `x` would cost more. The classification and reductions use the literal-box interpretation stated in the text. + +**The two verified results together actually give 73 for the literal class.** Let `q` count free `c` occurrences in the original `B`. The projection law permits capture-avoiding substitution `C:=stream(M,N)` for the rigid continuation, so `R_B=λs.B[s/c]` is a closed exact remainder extractor. Each replacement lowers the corresponding de Bruijn index by one and changes no other node. Hence + +``` +|R_B| = 2 + |B| - q >= 27, +|B| >= 25 + q, +|H| = 11 + |A| + |B| >= 73 + q >= 73. +``` + +This is a further handwritten consequence, not a reason to reject the claimed 70. The closure cost is explicitly subtracted, so it is not an additive charge of a whole extractor alongside the open payload. + +**Checks actually executed.** + +- `lake env lean -j2 ../tmp/overnight/remainder/RemainderChain.lean`: success, about 0.18 s. All six printed axiom audits contain only `propext` and `Quot.sound`. I inspected its chain preservation, lexicographic descent, finite zero-prefix simulation, and the final lambda-versus-Omega contradiction. +- Separate `lake env lean -j2` checks of `Blc/SelfintZero.lean`, `Blc/SelfintNonlinearChain.lean`, and `Blc/SelfintProjections.lean`: success, each under one second, using the available compiled imports. This was not a clean rebuild of every transitive dependency. +- The supplied `remainder/audit.py`: 33/33 equations passed in 0.0025 s. I suppressed only its output-file write, leaving the author's artifact untouched; its probe enumerator was never invoked. +- Independent `verify/vrem_codex_checks.py`: 52/52 fixed equations passed in about 0.001 s. It uses `blcc` only as a parser and its own capture-avoiding substitution and beta reducer, independent of the author's `lc.py` reducer. It covers all four §4 reduction tables, the two omitted two-lambda expansions, the other displayed cycles, the 24-bit proof's finite reductions, and both 67-bit bootstrap traces. Two terminating identities are checked by finite common normal forms; the claimed cycles and exact step counts are checked by literal finite traces. Results are in `verify/vrem_codex_checks.json`. +- The allocation completeness, residual-origin argument, all-`k` recurrence, width localization, and bit accounting were checked analytically. Finite equation checks do not stand in for those arguments. I did not run a candidate census or the 240-probe construction battery. + +Reviewed snapshot SHA-256 values: + +``` +eeca4bbab7aa66e6210336ae0ae26acb3453b50b90d04f12f6f57b58270e73cc remainder/REPORT.md +1c3f43653892b6e8b944511a59356e984ef2e77327f03a96d311a581fffdda19 remainder/RemainderChain.lean +a5127296be938da3189974a00f48b069b520a41907c9a8ddfc14cd8b0e257638 remainder/audit.py +41e156a0a3e39ed5a637b8c7d984e93cad65af6e48ab4ec33297278295767455 global/PROJECTIONS.md +``` diff --git a/data/self-interpreter/reasoning_floor/verify/vrem_codex_checks.json b/data/self-interpreter/reasoning_floor/verify/vrem_codex_checks.json new file mode 100644 index 00000000..28f3b1e8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vrem_codex_checks.json @@ -0,0 +1,266 @@ +{ + "checks": 52, + "passed": 52, + "elapsed_s": 0.0009448749988223426, + "scope": "Fixed proof equations only; no enumeration.", + "records": [ + { + "label": "zero-three-sDD", + "steps": 4, + "strategy": "weak-head" + }, + { + "label": "zero-three-DsD", + "steps": 7, + "strategy": "weak-head" + }, + { + "label": "zero-three-DDs", + "steps": 0, + "strategy": "weak-head" + }, + { + "label": "zero-three-s(DD)", + "steps": 1, + "strategy": "weak-head" + }, + { + "label": "zero-three-D(sD)", + "strategy": "common-normal-form" + }, + { + "label": "zero-three-D(Ds)", + "steps": 8, + "strategy": "weak-head" + }, + { + "label": "zero-four-sDJ", + "steps": 4, + "strategy": "weak-head" + }, + { + "label": "zero-four-sJD", + "steps": 9, + "strategy": "weak-head" + }, + { + "label": "zero-four-DsJ", + "steps": 7, + "strategy": "weak-head" + }, + { + "label": "zero-four-DJs", + "steps": 7, + "strategy": "weak-head" + }, + { + "label": "zero-four-JsD", + "steps": 1, + "strategy": "weak-head" + }, + { + "label": "zero-four-JDs", + "steps": 6, + "strategy": "weak-head" + }, + { + "label": "zero-four-s(DJ)", + "steps": 6, + "strategy": "weak-head" + }, + { + "label": "zero-four-s(JD)", + "steps": 5, + "strategy": "weak-head" + }, + { + "label": "zero-four-D(sJ)", + "steps": 10, + "strategy": "weak-head" + }, + { + "label": "zero-four-D(Js)", + "steps": 0, + "strategy": "weak-head" + }, + { + "label": "zero-four-J(sD)", + "steps": 1, + "strategy": "weak-head" + }, + { + "label": "zero-four-J(Ds)", + "steps": 1, + "strategy": "weak-head" + }, + { + "label": "vacuous-wrap-Omega-right", + "steps": 2, + "strategy": "weak-head" + }, + { + "label": "vacuous-wrap-Omega-left", + "steps": 1, + "strategy": "weak-head" + }, + { + "label": "dependent-x x s", + "steps": 1, + "strategy": "weak-head" + }, + { + "label": "dependent-x s x", + "steps": 17, + "strategy": "weak-head" + }, + { + "label": "dependent-s x x", + "steps": 8, + "strategy": "weak-head" + }, + { + "label": "dependent-x (x s)", + "steps": 16, + "strategy": "weak-head" + }, + { + "label": "dependent-x (s x)", + "strategy": "common-normal-form" + }, + { + "label": "dependent-s (x x)", + "steps": 2, + "strategy": "weak-head" + }, + { + "label": "closed-xxy-cycle", + "steps": 2, + "strategy": "weak-head" + }, + { + "label": "closed-xyx", + "steps": 3, + "strategy": "full-leftmost" + }, + { + "label": "closed-yxx", + "steps": 10, + "strategy": "weak-head" + }, + { + "label": "closed-x(xy)-two-lambdas", + "steps": 2, + "strategy": "full-leftmost" + }, + { + "label": "closed-x(yx)-two-lambdas", + "steps": 2, + "strategy": "full-leftmost" + }, + { + "label": "closed-y(xx)-return-X", + "steps": 7, + "strategy": "weak-head" + }, + { + "label": "nonleading-contract-\\x.(\\y.x y) x", + "steps": 1, + "strategy": "full-leftmost" + }, + { + "label": "nonleading-contract-\\x.(\\y.y x) x", + "steps": 1, + "strategy": "full-leftmost" + }, + { + "label": "eta-D-entry", + "steps": 1, + "strategy": "weak-head" + }, + { + "label": "eta-D-cycle", + "steps": 2, + "strategy": "weak-head" + }, + { + "label": "eta-self-growing-0", + "steps": 1, + "strategy": "weak-head" + }, + { + "label": "eta-self-growing-1", + "steps": 2, + "strategy": "weak-head" + }, + { + "label": "eta-self-growing-3", + "steps": 4, + "strategy": "weak-head" + }, + { + "label": "flip-D", + "steps": 4, + "strategy": "weak-head" + }, + { + "label": "flip-self-entry", + "steps": 1, + "strategy": "weak-head" + }, + { + "label": "flip-self-cycle", + "steps": 3, + "strategy": "weak-head" + }, + { + "label": "bound24-D(KD)", + "steps": 2, + "strategy": "weak-head" + }, + { + "label": "bound24-deltaK-D", + "steps": 3, + "strategy": "weak-head" + }, + { + "label": "bound24-D-deltaK", + "steps": 4, + "strategy": "weak-head" + }, + { + "label": "bound24-V-D", + "steps": 1, + "strategy": "weak-head" + }, + { + "label": "bound24-D-V", + "steps": 2, + "strategy": "weak-head" + }, + { + "label": "bound24-D(K(KD))", + "steps": 2, + "strategy": "weak-head" + }, + { + "label": "bound24-D(KdeltaK)", + "steps": 2, + "strategy": "weak-head" + }, + { + "label": "bound24-deltaK(KD)", + "steps": 2, + "strategy": "weak-head" + }, + { + "label": "bootstrap-zero", + "steps": 12, + "strategy": "weak-head" + }, + { + "label": "bootstrap-all-Q-prefix", + "steps": 13, + "strategy": "weak-head" + } + ] +} diff --git a/data/self-interpreter/reasoning_floor/verify/vrem_codex_checks.py b/data/self-interpreter/reasoning_floor/verify/vrem_codex_checks.py new file mode 100644 index 00000000..b9974aa9 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vrem_codex_checks.py @@ -0,0 +1,269 @@ +#!/usr/bin/env python3 +"""Fixed equations from the two reviewed proofs; no term enumeration. + +Uses blcc only as a parser. Substitution and reduction are independent of +the lc.py reducer used by the author's audit. No timeout is a proof here: +every assertion checks an exact finite trace or a finite common normal form. +""" +import json +from pathlib import Path +import sys +import time + +sys.dont_write_bytecode = True +ROOT = Path(__file__).resolve().parents[3] +sys.path.insert(0, str(ROOT / 'tools')) +import blcc + + +def parse(src): + p = blcc.P(src) + term = blcc.to_db(blcc.p_lc(p)) + p.ws() + assert p.i == len(src) + return term + + +def var(n): + return ('V', n) + + +def lam(b): + return ('L', b) + + +def apps(f, *args): + for a in args: + f = ('A', f, a) + return f + + +def shift(t, amount, cutoff=0): + if t[0] == 'V': + return var(t[1] + amount) if t[1] >= cutoff else t + if t[0] == 'L': + return lam(shift(t[1], amount, cutoff + 1)) + return apps(shift(t[1], amount, cutoff), shift(t[2], amount, cutoff)) + + +def subst(body, arg, depth=0): + if body[0] == 'V': + if body[1] == depth: + return shift(arg, depth) + return var(body[1] - 1) if body[1] > depth else body + if body[0] == 'L': + return lam(subst(body[1], arg, depth + 1)) + return apps(subst(body[1], arg, depth), subst(body[2], arg, depth)) + + +def step(t, full=False): + if t[0] == 'A': + if t[1][0] == 'L': + return subst(t[1][1], t[2]) + f = step(t[1], full) + if f is not None: + return apps(f, t[2]) + if full: + a = step(t[2], full) + if a is not None: + return apps(t[1], a) + elif t[0] == 'L' and full: + b = step(t[1], full) + if b is not None: + return lam(b) + return None + + +K = parse(r'\a\b.a') +F = parse(r'\a\b.b') +I = parse(r'\x.x') +D = parse(r'\x.x x') +J = lam(D) +O = apps(D, D) + + +def cell(b, r): + return lam(apps(var(0), shift(b, 1), shift(r, 1))) + + +def stream(bits, tail): + for bit in reversed(bits): + tail = cell(K if bit == '0' else F, tail) + return tail + + +def at(body, s): + return subst(parse('\\s.' + body)[1], s) + + +records = [] + + +def reaches(label, t, expected, full=False, steps=None): + start = t + bound = steps if steps is not None else 100 + for n in range(bound + 1): + if t == expected and (steps is None or n == steps): + records.append({'label': label, 'steps': n, + 'strategy': 'full-leftmost' if full else 'weak-head'}) + return + if n == bound: + break + t = step(t, full) + if t is None: + break + if steps is None: + # Some displayed non-normal targets require a different redex order. + # Example: D(s D) reaches K K by first reducing its argument s D. + def normal(term): + for _ in range(1000): + next_term = step(term, full=True) + if next_term is None: + return term + term = next_term + raise AssertionError((label, 'normalization did not finish')) + if normal(start) == normal(expected): + records.append({'label': label, 'strategy': 'common-normal-form'}) + return + raise AssertionError((label, 'expected', expected, 'actual', t, 'start', start)) + + +start = time.perf_counter() +ds = r'(\x.x x)' +js = r'(\z.\x.x x)' + +# REPORT lines 285-292: symbolic first zero cell, all six rows. +r = var(0) +s = cell(K, r) +for name, body, target in [ + ('sDD', f's {ds} {ds}', apps(K, D)), + ('DsD', f'{ds} s {ds}', r), + ('DDs', f'{ds} {ds} s', apps(O, s)), + ('s(DD)', f's ({ds} {ds})', apps(O, K, r)), + ('D(sD)', f'{ds} (s {ds})', apps(K, K)), + ('D(Ds)', f'{ds} ({ds} s)', r), +]: + reaches('zero-three-' + name, at(body, s), target) + +# REPORT lines 303-316: symbolic first two zero cells, all twelve rows. +u = var(0) +r = cell(K, u) +s = cell(K, r) +for name, body, target in [ + ('sDJ', f's {ds} {js}', apps(K, J)), + ('sJD', f's {js} {ds}', u), + ('DsJ', f'{ds} s {js}', r), + ('DJs', f'{ds} {js} s', apps(K, r)), + ('JsD', f'{js} s {ds}', O), + ('JDs', f'{js} {ds} s', apps(K, r)), + ('s(DJ)', f's ({ds} {js})', K), + ('s(JD)', f's ({js} {ds})', K), + ('D(sJ)', f'{ds} (s {js})', u), + ('D(Js)', f'{ds} ({js} s)', O), + ('J(sD)', f'{js} (s {ds})', D), + ('J(Ds)', f'{js} ({ds} s)', D), +]: + t = at(body, s) + if name == 'D(Js)': + # Contract J s in argument position before the outer diagonal. + reduced_arg = step(t[2]) + assert reduced_arg == D + t = apps(t[1], reduced_arg) + reaches('zero-four-' + name, t, target) +reaches('vacuous-wrap-Omega-right', apps(s, lam(O)), apps(O, r)) +reaches('vacuous-wrap-Omega-left', apps(lam(O), s), O) + +# REPORT lines 337-344: all six dependent helpers, with exact quote(I,n). +s = stream('0010', var(0)) +r = stream('010', var(0)) +u = stream('10', var(0)) +for body, target_kind in [ + ('x x s', 'grow-s'), ('x s x', 'I'), ('s x x', 'KH'), + ('x (x s)', 'u'), ('x (s x)', 'KK'), ('s (x x)', 'grow-Kr'), +]: + h = at('\\x.' + body, s) + x = apps(h, h) + target = {'grow-s': apps(x, s), 'I': I, 'KH': apps(K, h), + 'u': u, 'KK': apps(K, K), 'grow-Kr': apps(x, K, r)}[target_kind] + reaches('dependent-' + body, x, target, + steps={'grow-s': 1, 'grow-Kr': 2}.get(target_kind)) + +# REPORT lines 371-378: all six closed leading-affine cases. +n = parse(r'\x\y.x x y') +reaches('closed-xxy-cycle', apps(n, n, s), apps(n, n, s), steps=2) +n = parse(r'\x\y.x y x') +reaches('closed-xyx', apps(n, n), parse(r'\y.y (\x\y.x y x) y'), full=True) +n = parse(r'\x\y.y x x') +reaches('closed-yxx', apps(n, n, s), K) +n = parse(r'\x\y.x (x y)') +reaches('closed-x(xy)-two-lambdas', apps(n, n), + parse(r'\y\z.((\x\y.x (x y)) y) (((\x\y.x (x y)) y) z)'), + full=True, steps=2) +n = parse(r'\x\y.x (y x)') +reaches('closed-x(yx)-two-lambdas', apps(n, n), + parse(r'\y\z.(y (\x\y.x (y x))) (z (y (\x\y.x (y x))))'), + full=True, steps=2) +n = parse(r'\x\y.y (x x)') +reaches('closed-y(xx)-return-X', apps(n, n, s), apps(n, n), steps=7) + +# REPORT lines 390-407: both reducible helpers and both recurrence families. +for source in [r'\x.(\y.x y) x', r'\x.(\y.y x) x']: + reaches('nonleading-contract-' + source, parse(source), D, full=True, steps=1) + + +def eta(t): + return lam(apps(shift(t, 1), var(0))) + + +def flip(t): + return lam(apps(var(0), shift(t, 1))) + + +ne = parse(r'\x.x (\y.x y)') +reaches('eta-D-entry', apps(ne, D), apps(D, eta(D)), steps=1) +reaches('eta-D-cycle', apps(D, eta(D)), apps(D, eta(D)), steps=2) +for k in (0, 1, 3): + e = ne + for _ in range(k): + e = eta(e) + reaches('eta-self-growing-' + str(k), apps(ne, e), apps(ne, eta(e)), steps=k + 1) +nf = parse(r'\x.x (\y.y x)') +reaches('flip-D', apps(nf, D), O, steps=4) +reaches('flip-self-entry', apps(nf, nf), apps(nf, flip(nf)), steps=1) +reaches('flip-self-cycle', apps(nf, flip(nf)), apps(nf, flip(nf)), steps=3) + +# PROJECTIONS lines 60-94: vacuous boxes are literal lambdas, not K applications. +dk = parse(r'\x.x (\u.x)') +v = parse(r'\x\u.x x') +for label, term, target in [ + ('D(KD)', apps(D, lam(D)), D), + ('deltaK-D', apps(dk, D), D), + ('D-deltaK', apps(D, dk), dk), + ('V-D', apps(v, D), lam(O)), + ('D-V', apps(D, v), lam(apps(v, v))), + ('D(K(KD))', apps(D, lam(lam(D))), lam(D)), + ('D(KdeltaK)', apps(D, lam(dk)), dk), + ('deltaK(KD)', apps(dk, lam(D)), D), +]: + reaches('bound24-' + label, term, target) + +# REPORT lines 122-123: the two fixed bootstrap traces, with symbolic r. +q = parse(r'\t\u\d.t u (u d d) d d') +d = parse(r'\b\r.r (b (\t\u\d.t u (u d d) d d) r)') +r = var(0) +s = cell(K, r) +x = apps(q, q, d) +y = apps(x, q, q) +a = apps(d, q, q) +b = apps(a, q, q) +c = apps(a, q, b) +reaches('bootstrap-zero', apps(d, d, d, s), + apps(y, s, apps(s, K, K), K, K, r), steps=12) +reaches('bootstrap-all-Q-prefix', y, + apps(q, q, q, q, apps(q, q, q), q, q, c, q, q, q, q), steps=13) + +elapsed = time.perf_counter() - start +output = {'checks': len(records), 'passed': len(records), 'elapsed_s': elapsed, + 'scope': 'Fixed proof equations only; no enumeration.', 'records': records} +Path(__file__).with_suffix('.json').write_text(json.dumps(output, indent=2) + '\n') +print(f'{len(records)}/{len(records)} fixed equations passed in {elapsed:.6f}s') diff --git a/data/self-interpreter/theory/floor37.json b/data/self-interpreter/theory/floor37.json new file mode 100644 index 00000000..30b9553b --- /dev/null +++ b/data/self-interpreter/theory/floor37.json @@ -0,0 +1,851 @@ +{ + "layouts": [ + { + "group": 34, + "body": "(a b) c", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 6 + }, + { + "group": 34, + "body": "a (b c)", + "kind": "at_least_three_lambdas", + "steps": 5 + }, + { + "group": 34, + "body": "(a c) b", + "kind": "handwritten_growth_invariant", + "family": "(a c) b" + }, + { + "group": 34, + "body": "a (c b)", + "kind": "at_least_three_lambdas", + "steps": 5 + }, + { + "group": 34, + "body": "(b a) c", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b.a (\\c.b a c)", + "steps": 6 + }, + { + "group": 34, + "body": "b (a c)", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 4 + }, + { + "group": 34, + "body": "(b c) a", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a.a (\\b\\c.b) (\\b.b (\\c\\d.c) (\\c.c (\\d\\e.e) (\\d.d (\\e\\f.e) #4))) (\\b.#3 b (\\c\\d.c (\\e.d e c)))", + "steps": 6 + }, + { + "group": 34, + "body": "b (c a)", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 4 + }, + { + "group": 34, + "body": "(c a) b", + "kind": "handwritten_growth_invariant", + "family": "(c a) b" + }, + { + "group": 34, + "body": "c (a b)", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 7 + }, + { + "group": 34, + "body": "(c b) a", + "kind": "wrong_continuation_spine", + "arity": 3, + "steps": 5 + }, + { + "group": 34, + "body": "c (b a)", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b.a (\\c.c (b a))", + "steps": 7 + }, + { + "group": 35, + "body": "(a (a (b c)))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "(a ((a b) c))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "((a a) (b c))", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "((a (a b)) c)", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "(((a a) b) c)", + "kind": "exact_head_cycle", + "prefix": 2, + "period": 3 + }, + { + "group": 35, + "body": "(a (a (c b)))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "(a ((a c) b))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "((a a) (c b))", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "((a (a c)) b)", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "(((a a) c) b)", + "kind": "exact_head_cycle", + "prefix": 2, + "period": 6 + }, + { + "group": 35, + "body": "(a (b (a c)))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "(a ((b a) c))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "((a b) (a c))", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "((a (b a)) c)", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "(((a b) a) c)", + "kind": "wrong_continuation_spine", + "arity": 3, + "steps": 5 + }, + { + "group": 35, + "body": "(a (b (c a)))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "(a ((b c) a))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "((a b) (c a))", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "((a (b c)) a)", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "(((a b) c) a)", + "kind": "wrong_continuation_spine", + "arity": 3, + "steps": 5 + }, + { + "group": 35, + "body": "(a (c (a b)))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "(a ((c a) b))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "((a c) (a b))", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "((a (c a)) b)", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "(((a c) a) b)", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 4, + "steps": 8 + }, + { + "group": 35, + "body": "(a (c (b a)))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "(a ((c b) a))", + "kind": "at_least_three_lambdas", + "steps": 3 + }, + { + "group": 35, + "body": "((a c) (b a))", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "((a (c b)) a)", + "kind": "at_least_three_lambdas", + "steps": 4 + }, + { + "group": 35, + "body": "(((a c) b) a)", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b.a", + "steps": 13 + }, + { + "group": 35, + "body": "(b (a (a c)))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 2 + }, + { + "group": 35, + "body": "(b ((a a) c))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 2 + }, + { + "group": 35, + "body": "((b a) (a c))", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b\\c.b a (a c)", + "steps": 4 + }, + { + "group": 35, + "body": "((b (a a)) c)", + "kind": "identity_wrong_payload", + "payload": 1, + "normal_form": "\\a.a (\\b\\c.b) (\\b.b (\\c\\d.c) (\\c.c (\\d\\e.e) (\\d.d (\\e\\f.e) #4)))", + "steps": 4 + }, + { + "group": 35, + "body": "(((b a) a) c)", + "kind": "wrong_continuation_spine", + "arity": 3, + "steps": 2 + }, + { + "group": 35, + "body": "(b (a (c a)))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 2 + }, + { + "group": 35, + "body": "(b ((a c) a))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 2 + }, + { + "group": 35, + "body": "((b a) (c a))", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b\\c.b a (c a)", + "steps": 4 + }, + { + "group": 35, + "body": "((b (a c)) a)", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b.a (b (\\c\\d.c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.f) (\\e.e (\\f\\g.f) #5)))) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.e) (\\e.e (\\f\\g.g) (\\f.f (\\g\\h.g) #6))))", + "steps": 4 + }, + { + "group": 35, + "body": "(((b a) c) a)", + "kind": "wrong_continuation_spine", + "arity": 3, + "steps": 2 + }, + { + "group": 35, + "body": "(b (c (a a)))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 2 + }, + { + "group": 35, + "body": "(b ((c a) a))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 2 + }, + { + "group": 35, + "body": "((b c) (a a))", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a.a (\\b\\c.b) (\\b.b (\\c\\d.c) (\\c.c (\\d\\e.e) (\\d.d (\\e\\f.e) #4)))", + "steps": 4 + }, + { + "group": 35, + "body": "((b (c a)) a)", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a.a (\\b\\c.b) (\\b\\c.b) (\\b.b (\\c\\d.d) (\\c.c (\\d\\e.d) #3)) (\\b\\c.b)", + "steps": 4 + }, + { + "group": 35, + "body": "(((b c) a) a)", + "kind": "wrong_continuation_spine", + "arity": 3, + "steps": 2 + }, + { + "group": 35, + "body": "(c (a (a b)))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 1, + "steps": 14 + }, + { + "group": 35, + "body": "(c ((a a) b))", + "kind": "identity_extra_lambda", + "steps": 12 + }, + { + "group": 35, + "body": "((c a) (a b))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 3, + "steps": 14 + }, + { + "group": 35, + "body": "((c (a a)) b)", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 0)", + "arity": 6, + "steps": 20 + }, + { + "group": 35, + "body": "(((c a) a) b)", + "kind": "identity_extra_lambda", + "steps": 17 + }, + { + "group": 35, + "body": "(c (a (b a)))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 4, + "steps": 9 + }, + { + "group": 35, + "body": "(c ((a b) a))", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b\\c.c (a b a)", + "steps": 10 + }, + { + "group": 35, + "body": "((c a) (b a))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 3, + "steps": 8 + }, + { + "group": 35, + "body": "((c (a b)) a)", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 5, + "steps": 9 + }, + { + "group": 35, + "body": "(((c a) b) a)", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 4, + "steps": 8 + }, + { + "group": 35, + "body": "(c (b (a a)))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 3, + "steps": 5 + }, + { + "group": 35, + "body": "(c ((b a) a))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 4, + "steps": 5 + }, + { + "group": 35, + "body": "((c b) (a a))", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 3, + "steps": 5 + }, + { + "group": 35, + "body": "((c (b a)) a)", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 4, + "steps": 5 + }, + { + "group": 35, + "body": "(((c b) a) a)", + "kind": "identity_wrong_spine", + "binders": 2, + "head": "('V', 1)", + "arity": 4, + "steps": 5 + }, + { + "group": 36, + "body": "(a (\\u.b)) c", + "kind": "wrong_continuation_spine", + "arity": 0, + "steps": 12 + }, + { + "group": 36, + "body": "(a b) (\\u.c)", + "kind": "handwritten_growth_invariant", + "family": "(a b) (\\u.c)" + }, + { + "group": 36, + "body": "a (b (\\u.c))", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b.b (\\c\\d.c) (\\c.c (\\d\\e.d) (\\d.d (\\e\\f.f) (\\e.e (\\f\\g.f) #5)))", + "steps": 12 + }, + { + "group": 36, + "body": "(a c) (\\u.b)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + { + "group": 36, + "body": "(a (\\u.c)) b", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 6 + }, + { + "group": 36, + "body": "a (c (\\u.b))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + { + "group": 36, + "body": "(b (\\u.a)) c", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 8 + }, + { + "group": 36, + "body": "(b a) (\\u.c)", + "kind": "handwritten_growth_invariant", + "family": "(b a) (\\u.c)" + }, + { + "group": 36, + "body": "b (a (\\u.c))", + "kind": "wrong_continuation_spine", + "arity": 1, + "steps": 7 + }, + { + "group": 36, + "body": "(b c) (\\u.a)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 6 + }, + { + "group": 36, + "body": "(b (\\u.c)) a", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 7 + }, + { + "group": 36, + "body": "b (c (\\u.a))", + "kind": "identity_wrong_payload", + "payload": 0, + "normal_form": "\\a\\b.b (\\c\\d.c (d (\\e.b)))", + "steps": 7 + }, + { + "group": 36, + "body": "(c (\\u.a)) b", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": 36, + "body": "(c a) (\\u.b)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": 36, + "body": "c (a (\\u.b))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": 36, + "body": "(c b) (\\u.a)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": 36, + "body": "(c (\\u.b)) a", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": 36, + "body": "c (b (\\u.a))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "(a (\\u.b)) c", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "(a b) (\\u.c)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "a (b (\\u.c))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "(a c) (\\u.b)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "(a (\\u.c)) b", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "a (c (\\u.b))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 4 + }, + { + "group": "36open", + "body": "(b (\\u.a)) c", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 6 + }, + { + "group": "36open", + "body": "(b a) (\\u.c)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + { + "group": "36open", + "body": "b (a (\\u.c))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + { + "group": "36open", + "body": "(b c) (\\u.a)", + "kind": "handwritten_growth_invariant", + "family": "(b c) (\\u.a)" + }, + { + "group": "36open", + "body": "(b (\\u.c)) a", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 11 + }, + { + "group": "36open", + "body": "b (c (\\u.a))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 9 + }, + { + "group": "36open", + "body": "(c (\\u.a)) b", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 6 + }, + { + "group": "36open", + "body": "(c a) (\\u.b)", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + { + "group": "36open", + "body": "c (a (\\u.b))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 5 + }, + { + "group": "36open", + "body": "(c b) (\\u.a)", + "kind": "handwritten_growth_invariant", + "family": "(c b) (\\u.a)" + }, + { + "group": "36open", + "body": "(c (\\u.b)) a", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 7 + }, + { + "group": "36open", + "body": "c (b (\\u.a))", + "kind": "wrong_interface_arity", + "arity": 1, + "steps": 7 + } + ], + "reference_checks": [ + { + "name": "int165", + "bits": 165, + "lambdas": 17, + "leaves": 26, + "index_sum": 29, + "width": 4, + "nonlinear": 7, + "normal": false, + "incomparable_nonlinear": true + }, + { + "name": "int204", + "bits": 204, + "lambdas": 21, + "leaves": 30, + "index_sum": 44, + "width": 4, + "nonlinear": 9, + "normal": true, + "incomparable_nonlinear": true + }, + { + "name": "int584", + "bits": 584, + "lambdas": 69, + "leaves": 68, + "index_sum": 176, + "width": 7, + "nonlinear": 2, + "normal": false, + "incomparable_nonlinear": true + }, + { + "name": "int672", + "bits": 672, + "lambdas": 29, + "leaves": 85, + "index_sum": 276, + "width": 6, + "nonlinear": 10, + "normal": true, + "incomparable_nonlinear": true + }, + { + "name": "int742", + "bits": 742, + "lambdas": 64, + "leaves": 62, + "index_sum": 368, + "width": 10, + "nonlinear": 2, + "normal": true, + "incomparable_nonlinear": true + }, + { + "name": "int168", + "bits": 168, + "lambdas": 16, + "leaves": 27, + "index_sum": 30, + "width": 4, + "nonlinear": 7, + "normal": false, + "incomparable_nonlinear": true + }, + { + "name": "int170", + "bits": 170, + "lambdas": 16, + "leaves": 25, + "index_sum": 40, + "width": 4, + "nonlinear": 7, + "normal": false, + "incomparable_nonlinear": true + } + ], + "remainder_checks": { + "near_miss_bits": 24, + "identity_suffix_I_nf": "\\a\\b.b b", + "finite_clauses": 8 + }, + "lean_clauses": 152, + "seconds": 0.023 +} diff --git a/docs/STATUS.md b/docs/STATUS.md index 6bc6dd85..f18aebba 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -197,12 +197,27 @@ with all features (three opt-in tests ignored) and 328 with default features. (`classical/self-interpreter/cheap-tail-bound.md`, `classical/self-interpreter/protocol-obstructions.md`). The zero arm ≥ 14, APP lift ≥ 19, reader/handler knot-tree and cell/APP - exclusions remain as specified in §5. + exclusions remain as specified in §5. `SelfintKnot` kernel-checks that + an opaque fixed point costs at least `18 + 2k` bits, so the 165's 31 bits + of recursion overhead (knot, parser binder, two calls at depths 2 and 3) + are minimal in its frame. Codex's handwritten proofs keep the cell at 24 + bits under only the two Boolean lookup laws and the lift at 19 on actual + values, with raw quotation data borrowable (not yet independently + reviewed). The reasoning consults in + `data/self-interpreter/reasoning_floor/` built about forty further + correct interpreters of 166–220 bits, the smallest new shape a 168 that + passes NEXT as the reader's third operand; none goes below 165 at its + optimal let structure, and letopt only shrinks recorded variants (the + spine3 repair 178→174, tag replay 189→186 and 199→194). - **Unconditional structure** (`classical/self-interpreter/structural-bounds.md`): Lean proves that every interpreter has at least two syntactically nonlinear binders, and that an explicit `λc s.B` needs two inside `B`. - The normalization argument gives the small numerical floor 18, not a - 165-bit bound. A 584-bit witness has exactly two nonlinear binders, both + The normalization argument gives the small numerical floor 18; the + `SelfintFloor*` modules raise the kernel-checked floor to 27 without + Statman's theorem (`selfintSizeBound_27`, using `Classical.choice`): + three live binders, an argument with two free variables, an abstraction + body that is not an application, and a classification of minimal + application-rooted interpreters below 27 bits. A 584-bit witness has exactly two nonlinear binders, both closed in isolation; a kernel-replayed 71-step reduction reaches the literal 165. A 742-bit β-normal witness also has exactly two closed nonlinear binders, with its contract kernel-checked as β-joinability. @@ -219,11 +234,19 @@ with all features (three opt-in tests ignored) and 328 with default features. beta-normal interpreter, needs three such internal variables and two internal captures, plus the public stream binder's capture of the continuation. Together with the incomparable-binder theorem these give - handwritten bit floors 34 globally and 46 for literal interfaces; - the Lean numerical floor remains 18. The three live binders on the width + handwritten bit floors 34 globally and 46 for literal interfaces. + The three live binders on the width witness's ancestor chain cannot contain the incomparable pair, so a fourth live binder is necessary. This gives a preliminary global floor - of 33; analytical exclusion of its equality cases raises it to 34. + of 33; analytical exclusion of its equality cases raises it to 34, and + `classical/self-interpreter/global-floor.md` excludes 34–36 the same way: + **every interpreter has at least 37 bits**. This is Codex's handwritten + proof; two independent adversarial reviews (a fresh Codex consult and + Gemini) found it correct, the Codex review replaying all 102 finite + refutations with its own reducer. `Blc/SelfintFloor37.lean` kernel-checks + its 144 fixed reduction clauses; `tools/self-interpreter/theory/floor37/` + regenerates them and checks the 108 residual layouts in 0.05 seconds + (`data/self-interpreter/theory/floor37.json`). A shared-S construction attains width three, two nonlinear binders, and the required capture counts simultaneously, even in the beta-normal fragment with every zero-based index at most two. @@ -252,7 +275,13 @@ with all features (three opt-in tests ignored) and 328 with default features. values. Each payload of a literal continuation-headed interpreter needs at least two nonlinear binders and a stream occurrence. Such a head form therefore has at least five nonlinear binders in total and - costs at least 55 bits. This prices the displayed form only; + costs at least 55 bits. Codex's handwritten argument, independently + reviewed, prices the payloads further: the value payload holds the + width-three witness and the incomparable pair internally (at least 37 + bits), and substituting the stream for the continuation turns the + remainder payload into an extractor (at least `25 + q` bits for `q` + continuation occurrences), so a literal continuation-headed source costs + at least 73. This prices the displayed form only; head normalization is not size-monotone even for fully affine terms. The literal 165 expands to a 755-bit head form in four contractions; its two lambdas, stream head, and two @@ -279,7 +308,19 @@ with all features (three opt-in tests ignored) and 328 with default features. sources, and every suffix. The fixed source/wire and symbolic-clause check takes 0.004 seconds (`data/self-interpreter/theory/remainder.json`). This is an unrestricted upper bound for a parser projection, not a - self-interpreter or a beta-normal remainder bound. `SelfintZero` + self-interpreter or a beta-normal remainder bound. Every closed-source + exact extractor has at least 27 bits (Codex's handwritten proof, + independently reviewed), so the minimum lies in 27..70. + `SelfintRemainderChain` kernel-checks that an extractor's nonlinear + binders lie in incomparable branches and the transfer `|E| ≥ Rmin − 8`, + worth at most 62 because rem70 exists; `SelfintTower45` gives a 45-bit + reader for every λ-tower and index that meets every zero-stream + obligation the known proofs use. After an application's left child the + residual must distinguish one pending source from none and every pending + depth from every other (`SelfintResidualControl`), but a 647-bit + extractor with exactly two nonlinear binders, two live captures and one + width-three subterm (`SelfintSharedS647`) shows that this obligation + forces no further such count in the original source. `SelfintZero` proves that every exact remainder extractor needs two nonlinear binders, including two inside the body of an explicit stream lambda. Only closed-source, closed-suffix beta-join correctness is needed. @@ -307,14 +348,17 @@ with all features (three opt-in tests ignored) and 328 with default features. infinite-execution synthesis are checked. The colored ordinary-term realization counts precisely residual copies of the original reader, including on divergent suffixes; input lambdas are excluded. - Integrated `lake build Blc` passes all 48 jobs; a seventeen-theorem - audit across `SelfintZero`, `SelfintProjections`, and `SelfintInert` uses only + A seventeen-theorem audit across `SelfintZero`, `SelfintProjections`, and `SelfintInert` uses only `propext` and `Quot.sound`, as does a separate four-theorem `WeakHeadClock` audit. The twenty-two growth-support theorems use at most those axioms after constructive event extraction. A fourteen-theorem final synthesis/transfer audit has nine using at most those axioms and five additionally using `Classical.choice` for counter stabilization and classical event selection; the final valid-source theorem is among them. + Integrated `lake build Blc` passes all 62 jobs. The floor, knot and + remainder-control modules' headline theorems use only + `propext` and `Quot.sound`, except `selfintSizeBound_27` and its + supporting floor lemmas, which also use `Classical.choice`. - **Normal and typed witnesses** (`classical/self-interpreter/normal.md`, `typed-normal.md`): the β-normal interpreter is 204 bits (`int204_normal`, L 21, A 29, X 44). Lean proves its exact wire, @@ -469,13 +513,18 @@ GHC 9.10.3; `uni.rs` with rustc), all three harnesses in 11 minutes: and build prefix-tree conditional predictions under `m` and `S`. Infinite streams belong to the separate monotone-machine `ref/AIT` lane. 9. **The self-interpreter below 165** (`classical/self-interpreter/interpreter.md` - §7): joint reader/skip changes, exploitation of actual NEXT/parser - behaviour, a changed NEXT protocol that can use the reader's diagonal, - and the capped fills of the reader searches. Look for another shared computation of the kind the - reader is, by reasoning first. The two-nonlinear count is sharp even - though the current witness is large; a stronger lower bound must price - connections, captures, and protected quotation origins. Upstreaming the 165, 175 and 187 - to tromp/AIT is a9's call (`contrib/PR_KIT.md`). + §7). Constructive: a protocol change at an interface NEXT shares with + the rest (the `r next` handoff, the value and continuation protocols), + the knot × NEXT coupling through the reader's diagonal, and the capped + fills of the reader searches; NEXT-internal fusions and second-bit + dispatch placements are catalogued and lose. Look for another shared + computation of the kind the reader is, by reasoning first. Proof: the + floor is 37 handwritten and 27 kernel-checked; the next steps are an + application-sensitive charge for residual control (`remainder.md`), + which no structural count supplies, and a formalization of residual + tracing that would mechanize the conditional reader and NEXT bounds. + Upstreaming the 165, 175 and 187 to tromp/AIT is a9's call + (`contrib/PR_KIT.md`). 10. **`blam uni` throughput:** within 4× of `uni.c` on byte streams. The next lever is allocation: a slab with index-based reference counts (or the open global-allocator decision) would remove most of malloc/free and the diff --git a/docs/classical/self-interpreter/capture-width.md b/docs/classical/self-interpreter/capture-width.md index 656c236f..5fe7814d 100644 --- a/docs/classical/self-interpreter/capture-width.md +++ b/docs/classical/self-interpreter/capture-width.md @@ -10,8 +10,9 @@ The width lower bound uses a published theorem of Rick Statman and Codex's handwritten interface argument below. The incomparable-nonlinear-binder obstruction is kernel-checked; the numerical counting and exclusion arguments and the sharpness constructions are handwritten. Together they -give 34 bits globally and 46 for literal or beta-normal interpreters, -without establishing 165-bit optimality. +give 34 bits globally and 46 for literal or beta-normal interpreters; +`global-floor.md` extends the global count to 37. None of this establishes +165-bit optimality. ## The source measure @@ -272,6 +273,9 @@ obstruction and the 33-bit exclusion below gives hence also when E is beta-normal. ``` +The global count is the base of `global-floor.md`, which excludes 34–36 +and gives 37. + Let `L,V,X` count abstractions, variable leaves, and the sum of zero-based de Bruijn indices. The BLC size identity is @@ -308,7 +312,7 @@ width three, and two incomparable nonlinear binders; the literal Neither term is an interpreter. These are witnesses for the syntax counts, not proofs that either numerical interpreter bound is optimal. -The repository's kernel-checked numerical lower bound remains the weaker +The repository's kernel-checked numerical lower bound is the weaker 18-bit theorem in `structural-bounds.md`. The 34- and 46-bit consequences also use the published width theorem and handwritten interface, counting, and exclusion arguments here. @@ -471,9 +475,9 @@ exhaustive classification: `λc z.c N (z J(N))`. The first payload is the fixed normal `N`, distinct from the required `λe x.x`; source `I` again excludes it. -Every possible 33-bit minimum interpreter is therefore excluded. The -unrestricted numerical lower bound is 34 bits. This last exclusion is -handwritten, not a new Lean theorem. +Every possible 33-bit minimum interpreter is therefore excluded. This +exclusion is handwritten, not a Lean theorem; `global-floor.md` continues +the same analysis through 36 bits. ## Joint sharpness by one shared S diff --git a/docs/classical/self-interpreter/global-floor.md b/docs/classical/self-interpreter/global-floor.md new file mode 100644 index 00000000..520c0bfc --- /dev/null +++ b/docs/classical/self-interpreter/global-floor.md @@ -0,0 +1,560 @@ +# An unconditional 37-bit floor + +**Theorem.** Every closed interpreter for the repository's beta-exact, +closed-source contract has BLC length at least **37**. + +This is Codex's handwritten proof. Two independent adversarial reviews (a +separate Codex consult and Gemini) found it correct; each re-derived the +counting, the width-loss lemma and the six divergence invariants, and the +Codex review replayed every finite refutation with its own reducer +(`data/self-interpreter/reasoning_floor/verify/`). The classification and its +use of Statman's width theorem are handwritten. `Blc/SelfintFloor37.lean` +kernel-checks the 144 fixed head-reduction clauses the case analysis cites, +including the loop clauses and fixed instances of the six parametric +divergence invariants, plus eight clauses for remainder extractors +(`remainder.md`). It does **not** prove the 37-bit theorem itself. The +parametric invariants are proved below; no fuel cap is used as a refutation. +`tools/self-interpreter/theory/floor37/verify.py` regenerates those clauses +and checks the 108 residual layouts in 0.05 seconds +(`data/self-interpreter/theory/floor37.json`). + +The counting argument of `capture-width.md` gives 33 and excludes it. This +proof excludes 34, 35 and 36 using semantic consequences of the exact +contract (head arity, internal width, internal nonlinearity, and exact +identity-source outputs). It is not an additive parser-module argument and +does not approach a proof of 165-bit optimality. + +## 1. Dependencies and conventions + +Write `L,V,X` for the number of abstractions, variable leaves, and total +zero-based de Bruijn index. Then + +``` +|E| = 2L + 4V - 2 + X. +``` + +The following established consequences are used. + +1. `width(E) >= 3`. Here width is the maximum number of distinct variables + free relative to a source subterm. This uses Statman's theorem that a + closed term beta-convertible to `S` has width at least three (printed + p. 406), applied to `E K (stream(S,I)) I`. The interface argument is in + `capture-width.md`. +2. Two nonlinear binders of `E` are incomparable in the source ancestor + order. This is `SelfintNonlinearChain.selfInterpreter_not_chain`. +3. An interpreter has head normal form with exactly two leading lambdas. + If its head is the continuation, that head has exactly two arguments. + A beta reduct with three leading lambdas is already impossible, whether + or not its body head-normalizes. See `head-decomposition.md`. +4. An interpreter literally `lambda c s.B` has two nonlinear binders in + `B`, and a subterm of `B` with three free variables bound **inside B**. + The first is kernel-checked; the second is the internal form of (1). + A literal interface costs at least 46 bits. +5. Every beta reduct of a closed interpreter is an interpreter. Hence + every redex of a globally minimum interpreter is nonshrinking. In + particular no source redex erases its argument, and a linear redex + whose argument has at most one free occurrence strictly shrinks. + These follow from the exact formula in `SelfintWireCost`: + + ``` + delta_bits = (k-1)|A| + (f-1)D - 2k - 4 - g. + ``` + +6. No interpreter has length at most 33: the counting argument and the + twelve-layout equality-case exclusion in `capture-width.md`. + +All uses of reduction here are beta reduction. Some of the inherited +33-bit exclusions use beta-eta confluence to prove impossibility, as the +existing document explicitly explains; that does not change the beta-exact +contract. + +For every divergence argument below, defined global weak-head steps +survive capture-avoiding substitution for the free placeholders: the +contracted lambda and its application remain on the same head spine. +Thus an infinite symbolic head trace with a placeholder stream remains +an infinite head trace when that placeholder is replaced by `stream(I,N)`. +This contradicts the exact contract on the normal source I. It is not +necessary to assert correctness on an arbitrary rigid object supplied +as the stream. + +Let `Delta = lambda x.x x`, and write `K T` as shorthand for the literal +vacuous abstraction `lambda u.T` with fresh `u`. Thus a displayed box `K T` +is already a lambda term, not an extra application of an inlined K. + +## 2. The inventory below 37 bits + +Assume a minimum interpreter has size at most 36. A width witness supplies +three distinct live binders on a chain, called `a,b,c` from outside to +inside. The incomparable nonlinear pair needs a fourth live binder. +There are at least six leaves and index sum at least three. Consequently + +``` +(L,V) = (4,6) or (5,6), X <= 6 or X <= 4 respectively. +``` + +In either case exactly four binders are live. Exactly two are nonlinear, +each used twice; the other two are used once. For `L=5` the additional +binder is vacuous. One nonlinear binder is on the width chain and the +other, called `d`, is incomparable with it. + +The `d` abstraction cannot contain any of `a,b,c`: that would make it an +ancestor of the nonlinear binder on their chain. Nor can it capture a +chain variable. Its possible enclosing chain binders are affine, and +their sole occurrences are already needed in the width witness outside +`d`. Thus `d` is closed in isolation, with precisely two own occurrences +and at most the one vacuous binder. + +There are at most one leading source lambda: two are ruled out by the +46-bit literal-interface bound, and three by head arity. If there is one, +call it `y`. It is live (otherwise the supplied rigid continuation could +never occur in the output), affine (a nonlinear root would be comparable +with all binders), and one of the width-chain binders. Follow the function +spine, under this possible lambda, to its first source redex. A neutral +head here would already be an impossible zero/one-lambda head normal form. + +Write this redex `(lambda x.B) A`. An affine `x` would shrink: the only +possible free variable of its argument is `y`, used at most once globally. +A vacuous `x` also shrinks. Therefore `x` is one of the two nonlinear +binders. + +### The width-chain binder cannot be this contractor + +If `x` is on the three-binder chain, the width witness lies in `B`, as do +all nonleading binders on that chain. All four chain-bound leaves lie in +`B`: its nonlinear variable's two occurrences, and the two affine +variables' required occurrences. The argument must be closed, since a +possible `y` occurrence is already used in that witness. Its only possible +live binder is `d`; an argument with only vacuous binders and no free +variables is impossible. Thus the argument contains all of `d` and its +two leaves. There are no leaves available for a pending spine argument. + +The argument is closed and has width one: its only live variable is `d`. +Contracting substitutes copies of this closed width-one term and removes +one of the three chain binders. Every remaining source subterm therefore +has at most two distinct free variables. Vacuous binders supply no free +variable. The reduct has width at most two, contradicting (1), since it +is still an interpreter. + +The contractor is excluded by **loss of necessary width**, regardless of +whether this particular contraction grows its wire length. + +### The source has one of two diagonal forms + +The first contractor is consequently `d`. All nonleading chain binders +and their four leaves belong to its argument; a pending argument would +have no possible leaf. Up to the possible leading `y`, + +``` +E = D N, or E = lambda y.D A(y). +``` + +`D` is closed, contains the nonlinear binder `d`, and has exactly two +leaves. `N`, or `A` with `y` counted as the outermost chain variable, has +three live variables on a chain and exactly four leaves. At most one +vacuous lambda occurs in the two operands together. + +Both operands are beta-normal. For the four-leaf argument, a redex with +a live contractor used `k` times has at least `k+2` body leaves: the `k` +own occurrences and the other two variables required by the width witness. +At most `2-k` leaves remain for its argument. `k=2` is impossible; `k=1` +leaves at most one free argument occurrence and would shrink. A vacuous +redex shrinks. The same conclusion is immediate for the two-leaf `D`. + +## 3. No extra vacuous binder: all four-lambda cases + +Here `D=Delta`. A normal four-leaf term with three live binders on one +chain has the following exhaustive six shapes. `T3(a,b,c)` ranges over +the twelve linear application trees on its three displayed leaves; +`T4` ranges over the sixty trees on the displayed multiset. + +| Duplicated variable and location of its extra occurrence | Closed argument N | X | +|---|---|---:| +| outer, before the middle binder | `lambda a.a (lambda b c.T3(a,b,c))` | 3 | +| outer, between the middle and inner binders | `lambda a b.a (lambda c.T3(a,b,c))` | 4 | +| outer, below all three binders | `lambda a b c.T4(a,a,b,c)` | 5 | +| middle, before the inner binder | `lambda a b.b (lambda c.T3(a,b,c))` | 3 | +| middle, below the inner binder | `lambda a b c.T4(a,b,b,c)` | 4 | +| inner | `lambda a b c.T4(a,b,c,c)` | 3 | + +Proof of completeness: one occurrence of each variable lies below all +three binders and costs indices `2+1+0`. The only remaining leaf repeats +one of them. If it is above a later lambda block, normality forces that +leaf to be the function and the block its argument; the reverse orientation +would be a redex. Otherwise all four leaves are below the last binder. +This also shows `X<=5`; an alleged four-lambda minimum with `X=6` has no +possible shape. + +The open argument `A(y)` has only the latter three shapes, with `a=y` +and the `a` lambda omitted: `y` is affine, so it cannot be the repeated +variable. + +The `X=3` closed cases, and the open middle-before-inner case, are already +excluded by the established 33-bit bound. The open inner case also reduces +to a literal two-lambda interface with at most one nonlinear binder inside +the body. +The closed middle-below-inner case also has only one internal nonlinear +binder after `N N -> lambda b c.T4(N,b,b,c)`. + +For the open middle-below-inner case, + +``` +lambda y.A A -> lambda y c.T4(y,A,A,c). +``` + +The body contains two copies of `A`, each with only two internal binders; +`y,c` are public. No subterm has three free variables bound inside the +body. This contradicts (4). Thus only the second and third closed rows +need new finite analysis. + +### 3a. The twelve 34-bit layouts + +Let + +``` +N = lambda a b.a (lambda c.T3(a,b,c)), +J(a,b) = lambda c.T3(a,b,c), +B = J(J(N,b),d). +``` + +Four head steps, including `Delta N -> N N`, give + +``` +Delta N ->* lambda b d.T3(N,b,B). +``` + +The twelve possibilities are: + +| T3 | Refutation | +|---|---| +| `(a b) c` | Head form has two lambdas, continuation with one argument. | +| `a (b c)` | A reduct has three leading lambdas. | +| `(a c) b` | Advancing-wrapper divergence invariant below. | +| `a (c b)` | A reduct has three leading lambdas. | +| `(b a) c` | Continuation's first payload is fixed normal `N`, not `K I`. | +| `b (a c)` | Continuation has one argument. | +| `(b c) a` | Continuation's second payload is fixed normal `N`, not the rigid suffix. | +| `b (c a)` | Continuation has one argument. | +| `(c a) b` | Pair-pumping divergence invariant below. | +| `c (a b)` | Continuation has one argument. | +| `(c b) a` | Continuation has three arguments. | +| `c (b a)` | Continuation's first payload is fixed normal `N`, not `K I`. | + +For `(a c) b`, put + +``` +J_t(X) = lambda u.X u t, +N = lambda a b.a (J_b(a)). +``` + +A nonempty wrapper word `W=J_t1(...J_tk(N))` satisfies + +``` +W U ->* N U tk ... t1. +N W P rest... ->* N (J_P(W)) tk ... t1 rest.... +``` + +Every macro consists of head contractions. The new wrapper word is +nonempty and there is still at least one pending argument. Starting +`N N C S ->* N (J_C(N)) S` reaches this invariant. It gives infinitely +many weak-head contractions, never a head normal form. This is a proof +for all finite wrapper lengths, not a conclusion from the capped trace. + +For `(c a) b`, put `P(X,Y)=lambda u.u X Y` and +`N=lambda a b.a P(a,b)`. With `W=P(N,C)` and `L=N W S`, + +``` +N N C S ->* L, +L ->^4 L C. +``` + +Iterating the four head contractions, in their growing application +contexts, proves weak-head divergence. + +### 3b. The sixty 35-bit layouts + +Now `N=lambda a b c.T4(a,a,b,c)`, and + +``` +Delta N ->^2 lambda b c.T4(N,N,b,c). +``` + +The multiset has twelve distinct orders and five application trees. +Separate by the leftmost/head leaf of `T4`. + +**Thirty a-headed layouts.** Twenty-four have a reduct with at least +three leading lambdas (the four non-left-spine shapes for each ordering +of the other three leaves). Of the six remaining left spines: + +| T4 | Refutation | +|---|---| +| `a a b c` | Exact head cycle, period three after a two-step prefix. | +| `a a c b` | Exact head cycle, period six after a two-step prefix. | +| `a b a c` | Two leading lambdas, continuation with three arguments. | +| `a b c a` | Same. | +| `a c a b` | On source `I`, the rigid continuation has four arguments. | +| `a c b a` | On source `I`, the result is `C K stream(I,Ntail)`, with wrong value and remainder. | + +For the first two cycles one can also inspect directly the equations +`N N B C ->* N N B C` and `N N B C ->* N N C B ->* N N B C`. + +**Fifteen b-headed layouts.** Nine have one or three arguments at the +continuation. The six two-argument cases give respectively + +``` +C N (N S), C (N N) S, C N (S N), +C (N S) N, C S (N N), C (S N) N, +``` + +with `S=stream(I,Ntail)`. The first or second payload visibly disagrees +with `K I` or the rigid `Ntail`: `N` is a fixed closed normal three-lambda +term, and `S` is a nonempty normal Scott stream. No normalization of +`N N` is needed. + +**Fifteen c-headed layouts.** Direct identity-source head reduction gives: + +| T4 | Result obstruction on source I | +|---|---| +| `c (a (a b))` | `C` has one argument. | +| `c ((a a) b)` | An extra leading lambda. | +| `(c a) (a b)` | `C` has three arguments. | +| `(c (a a)) b` | Rigid suffix, rather than `C`, is the head. | +| `c a a b` | An extra leading lambda. | +| `c (a (b a))` | `C` has four arguments. | +| `c ((a b) a)` | Result `C N C`, with the wrong rigid remainder. | +| `(c a) (b a)` | `C` has three arguments. | +| `(c (a b)) a` | `C` has five arguments. | +| `c a b a` | `C` has four arguments. | +| `c (b (a a))` | `C` has three arguments. | +| `c ((b a) a)` | `C` has four arguments. | +| `(c b) (a a)` | `C` has three arguments. | +| `(c (b a)) a` | `C` has four arguments. | +| `c b a a` | `C` has four arguments. | + +All these finite reductions are among the kernel-checked clauses. + +## 4. One extra vacuous lambda: the five-lambda cases + +Here `X<=4`. First suppose the vacuous lambda belongs to `D`. Its two +own `d` leaves already have index zero. Placing the vacuous lambda around +both would spend two index units, leaving fewer than the required three +for the width witness. Placing it above `d` makes `D` vacuous-headed, +contrary to source minimality. Placing it around one leaf gives either +an erasing source redex or the single normal possibility + +``` +D = deltaK = lambda d.d (K d), |D|=11. +``` + +This uses the one available index unit beyond the width witness. Its +four-leaf argument is consequently one of the `X=3` shapes in section 3. +Since `deltaK A -> A (K A)`, these fail uniformly: + +| Argument | Consequence | +|---|---| +| closed outer-duplicate-before-middle | `A (K A) ->* A`, a strictly smaller interpreter if it worked. | +| closed middle-duplicate-before-inner | One-lambda head normal form. | +| closed inner duplicate | Two-lambda interface with only one internal nonlinear binder. | +| open middle duplicate | `lambda y.A (K A) ->* lambda y.A`; its body has no internal nonlinear binder after the interface lambdas. | +| open inner duplicate | Two-lambda interface with only one internal nonlinear binder. | + +### If the vacuous lambda belongs to the four-leaf argument + +Then `D=Delta`. Delete the vacuous lambda, decrementing the affected +indices, to obtain `N0` or `A0`. Deleting a vacuous lambda from a normal +term preserves normality: it was not in function position of an +application, since that would already be a redex. It also preserves the +width-three witness and all live-binder occurrence counts. + +Reinserting the lambda around a subterm `U` costs exactly + +``` +2 + freeLeaves(U). +``` + +The base diagonal has at least 33 bits. Thus at size at most 36 there +are only two possibilities: + +* A zero-free-leaf insertion into a base of 33 or 34 bits. The only closed + subterm of a closed four-leaf argument in the six-shape classification + is the whole argument. An open argument has none. Therefore this gives + `A=K N0`, and `Delta A -> A A -> N0`, contradicting minimality. +* A one-free-leaf insertion into a 33-bit base. A subterm with one free + occurrence is either a variable leaf or the block containing the two + innermost live binders and the single free occurrence of the outer one. + There is no other possibility in these normal four-leaf trees. + +Inserting around that two-binder block gives, for the closed arguments, + +``` +lambda a.a (lambda u b c.T3(a,b,c)), +lambda a u b.b (lambda c.T3(a,b,c)), +lambda a u b c.T4(a,b,c,c). +``` + +After diagonal application the first has two interface lambdas with +only one internal nonlinear binder; the second ignores its public +continuation; the third leaves three leading lambdas. In the open forms, +the corresponding reduction gives either zero internal nonlinear binders +or three leading lambdas. + +For insertion at a variable leaf, boxing the exposed duplicate before its +lambda block creates an erasing source redex. Boxing any leaf inside the +block leaves the closed middle family with one-lambda head form, and the +inner families with one internal nonlinear binder. A vacuous box introduces +no nonlinearity and does not duplicate the one inserted copy in the inner +families. The open middle family needs its own analysis in section 4b: +its diagonal can create more than one residual copy of the argument. + +The remaining closed family is **outer-duplicate-before-middle**: + +``` +N = lambda a.a (lambda b c.T3(a,b,c) with one leaf boxed). +``` + +The exposed outer `a` cannot be boxed: that is an erasing source redex. +Inside `T3`, a box cannot be the function of an application. Exactly +eighteen normal layouts remain. + +### 4a. The eighteen normal boxed layouts at 36 bits + +The following table writes `Kx` for the literal box `lambda u.x`. + +| Boxed body | Refutation of `Delta N` | +|---|---| +| `(a Kb) c` | Two-lambda head form with zero arguments at C. | +| `(a b) Kc` | Forward-wrapper divergence below. | +| `a (b Kc)` | First payload is `K S`, not `K I`, on source I. | +| `(a c) Kb` | One-lambda head form. | +| `(a Kc) b` | One-lambda head form. | +| `a (c Kb)` | One-lambda head form. | +| `(b Ka) c` | One-lambda head form. | +| `(b a) Kc` | Reverse-wrapper divergence below. | +| `b (a Kc)` | Two-lambda head form with one argument at C. | +| `(b c) Ka` | One-lambda head form. | +| `(b Kc) a` | One-lambda head form. | +| `b (c Ka)` | Fixed normal first payload `lambda u v.v (lambda p q.p (q (K v)))`, not K I. | +| `(c Ka) b` | One-lambda head form. | +| `(c a) Kb` | One-lambda head form. | +| `c (a Kb)` | One-lambda head form. | +| `(c b) Ka` | One-lambda head form. | +| `(c Kb) a` | One-lambda head form. | +| `c (b Ka)` | One-lambda head form. | + +For the forward case put + +``` +F(X) = lambda b c.X b (K c), +N = lambda a.a (F(a)). +``` + +Induction on `k` gives, for `k>=1`, + +``` +F^k(N) U V ->* N U (K^k V), +N F^k(N) P ->* N F^(k+1)(N) (K^k P). +``` + +Each macro is a nonempty finite head-reduction sequence. Starting +`N N C S` reaches `N F^2(N) (K C) S`. The displayed invariant gives +infinitely many weak-head contractions with `S` still pending. + +For the reverse case put + +``` +G(X) = lambda b c.b X (K c), +N = lambda a.a (G(a)), +Y = N G(N). +``` + +Then `N N -> Y`, and the exact head macro is + +``` +Y P ->^5 Y (K (K P)). +``` + +Again the invariant iterates indefinitely. These arguments work for +arbitrary rigid public arguments; in particular they fail on quoted I. + +### 4b. The eighteen open middle-duplicate boxed layouts + +The second family is + +``` +E = lambda a.Delta A_a, +A_a = lambda b.b (lambda c.T3(a,b,c) with one leaf boxed). +``` + +It has the same eighteen normal boxed bodies listed in section 4a. +For **sixteen**, the head normal form of E has exactly one leading lambda; +the exact finite reductions are in `g36open_*` in `Blc/SelfintFloor37.lean`. +The only exceptions are `(b c) Ka` and `(c b) Ka`. Their nontermination +does not rely on the capped exploratory traces. + +For `(b c) Ka`, fix the outer parameter a and put + +``` +T = K a, +J(X) = lambda c.X c T, +A = lambda b.b J(b). +``` + +For every `k>=1`, + +``` +J^k(A) U ->* A U T ... T (k pending copies of T), +A J^k(A) ->* A J^(k+1)(A) T ... T. +``` + +The second identity uses `1+k` head contractions. `A A -> A J(A)` +enters this invariant. The active recursive argument always precedes +every pending T and the eventual stream argument, so neither reaches +the head. This proves weak-head divergence for each rigid a. + +For `(c b) Ka`, put + +``` +T = K a, +P(X) = lambda c.c X T, +A = lambda b.b P(b), +L = A P(A). +``` + +Then `A A -> L` and + +``` +L ->^3 L T T. +``` + +This is another head-pumping invariant. Both exceptions are excluded, +completing the vacuous-lambda case split. + +## 5. Conclusion and checking boundary + +Every minimum interpreter of at most 36 bits would have one of the two +inventories in section 2. Sections 3 and 4 exclude both. Since the known +165 supplies existence, well-ordering gives a minimum; therefore every +interpreter has at least **37 bits**. + +`verify.py` checks exactly 108 residual layouts (12+60+18+18), and never +treats a cap as a result. It produces exact repeated-state certificates +for the two 35-bit loops. The six growing families have the handwritten +parametric invariants above; their fixed macro clauses are additionally +checked in Python and Lean. The global syntax classification, width +argument, and infinitary invariants remain handwritten. + +The live 165, exact pinned 168, 170 inlined-NEXT variant, 204 normal, +584 two-nonlinear, 672 typed-normal, and 742 two-nonlinear-normal +references satisfy the used structural constraints (`floor37.json`; +`verify.py --battery` also reruns their batteries); no syntactic-redex or +untypability assumption is made. + +The next inventory is qualitatively more permissive: seven leaves can +support a third nonlinear binder, or allow the off-chain nonlinear binder +to capture a variable whose other occurrence lies in the width witness. +The closed width-one operand argument above then stops applying. This +proof establishes 37, not a claim that a few more leaf counts will bridge +the gap to 165. + +Source for the external theorem: Rick Statman, *Two Variables Are Not +Enough*, ICTCS 2005, printed pp. 406-409, +https://doi.org/10.1007/11560586_32 . diff --git a/docs/classical/self-interpreter/head-decomposition.md b/docs/classical/self-interpreter/head-decomposition.md index 7e21b10b..77a75b6b 100644 --- a/docs/classical/self-interpreter/head-decomposition.md +++ b/docs/classical/self-interpreter/head-decomposition.md @@ -147,7 +147,7 @@ The two semantic projections can contain copies descended from shared code in the original `E`. The following bound prices their syntax only when the interpreter is already in the displayed form. -## A continuation-headed interpreter needs five nonlinear binders +## A literal continuation-headed interpreter costs at least 73 bits `Blc.SelfintProjections` kernel-checks the rigid projections above without assuming that either payload normalizes. It then proves, for any exact @@ -185,7 +185,35 @@ Finally, the established wire inequality for an arbitrary open term `T` is `10 nonlinear(T) + 4 freeLeaves(T) ≤ |T|+2`. Each payload has at least two nonlinear binders and one free stream occurrence, so each costs at least 22 bits. The two interface lambdas, two root applications, and -the continuation variable cost 11 bits, giving `22+22+11=55`. +the continuation variable cost 11 bits, giving the kernel-checked +`22+22+11=55`. + +Codex's handwritten argument prices each payload further; two independent +reviews found it correct (`data/self-interpreter/reasoning_floor/`). + +- **The value payload costs at least 37.** Its two incomparable nonlinear + binders lie in `A` itself: the quotation of `Ω` with a rigid tail is + binder-affine, so substituting it for `s` preserves the chain property + of `SelfintNonlinearChain`, while the required value `λz.Ω` violates it + and reduces only to itself. Statman's width obstruction applies to the + unreduced closed term `A[K/c, stream(S,I)/s] I`, which is + beta-convertible to `S`: its inserted arguments are closed of width + one, so the three free variables of the witness are bound inside `A`. + The three width binders form one ancestor chain and cannot hold both + members of the incomparable pair, so `A` has four live internal binders, + six internally bound leaves and a seventh, distinct stream leaf, and + the witness occurrences have indices at least `2,1,0`: + `|A| ≥ 2·4 + 4·7 − 2 + 3 = 37`. +- **The remainder payload costs at least `25 + q`**, where `q` counts the + continuation's free occurrences in `B`. The projection law holds for + every substituted continuation, in particular for the stream itself, so + `λs. B[s/c]` is a closed exact remainder extractor. Each replaced + occurrence loses one index bit and nothing else changes, so it has + `2 + |B| − q` bits, and the 27-bit remainder floor (`remainder.md`) + gives `|B| ≥ 25 + q`. + +`A` and `B` are disjoint source subtrees, so a literal continuation-headed +interpreter has at least `11 + 37 + 25 = 73` bits. These bounds allow arbitrary internal redexes, continuation uses, and whole-stream access in `A,B`. They do not apply to the syntax of an diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index 77c574ca..b49e8e4c 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -220,9 +220,17 @@ smaller (`component_168_contextual*.log`). The 165 is the η-handler with its skip hoisted and both arms η-reduced: the component is blind to it because the hoisted skip is not β-equal to the 168's on arbitrary streams. -The knot: with the body opaque, the only weak-head self-reproducing context -through 20 bits is the 168's own `(\a.a a)(\a.H(a a))` -(`tools/self-interpreter/search_fix.py`). +The knot: with the body opaque, every fixed-point context costs at least +20 bits, and the 168's own `(\a.a a)(\a.H(a a))` attains it. +`Blc/SelfintKnot.lean` (Codex) proves that any `t =β h t`, with the hole `h` +priced at zero, has two nonlinear binders and so at least `18 + 2k` bits for +`k` hole occurrences; adding the parser binder and two recursive calls at +zero-based depths `d1, d2` costs at least `26 + d1 + d2`, which is 31 at the +165's depths 2 and 3 and is attained there. Through 20 bits that context is +the only weak-head self-reproducing one (`tools/self-interpreter/search_fix.py`). +Sinking the shared `x x` let inward never pays when it has two uses: each +crossed binder changes the size by `2 − r + m ≥ 0` for `r = 2` uses and `m` +captured occurrences (`data/self-interpreter/reasoning_floor/knot/`). ### Slots @@ -315,11 +323,17 @@ the contraction's removed syntax. `remainder.md` gives a separate exact syntactic remainder extractor, with its all-source contract proved in `Blc/SelfintRemainder.lean`. `Blc/SelfintZero.lean` proves that an exact remainder body needs two -nonlinear binders, excluding its stream binder. Together with the +nonlinear binders, excluding its stream binder, and +`Blc/SelfintRemainderChain.lean` that they lie in incomparable branches. +Exact remainder extractors cost between 27 and 70 bits; since `E (λv r. r)` +is one, any remainder floor `n` gives `|E| ≥ n − 8` (kernel-checked +transfer). Together with the value projection's independent two-binder requirement, `Blc/SelfintProjections.lean` proves that a literal continuation-headed interpreter has four nonlinear binders inside its payloads and a fifth -at its public stream binder. The corresponding wire floor is 55 bits. +at its public stream binder, a kernel-checked wire floor of 55 bits. +Pricing the value payload by its internal width and the remainder payload +by the remainder floor raises it to 73 (`head-decomposition.md`). This prices that displayed head form, not the source that expands into it; STATUS records the construction's size and current checks. @@ -361,7 +375,12 @@ incomparable-nonlinear theorem, these give handwritten wire floors of interpreters. The three binders on the width witness's ancestor chain cannot contain the incomparable pair, forcing a fourth live binder and a preliminary global floor of 33; analytical exclusion of the equality -cases raises that floor to 34. +cases raises that floor to 34. `global-floor.md` excludes 34, 35 and 36 the +same way: **every interpreter has at least 37 bits** (Codex's handwritten +proof, found correct by two independent reviews; its 144 fixed reduction +clauses are kernel-checked in `Blc/SelfintFloor37.lean`). Without Statman's +theorem the kernel-checked floor is 27 (`selfintSizeBound_27`, +`structural-bounds.md`). `capture-width.md` states the published result and the interface proof, and gives a shared-S construction attaining these structural minima simultaneously, including in the beta-normal fragment with all zero-based @@ -462,6 +481,14 @@ These are Codex's handwritten proofs, with targeted reduction checks in independent rigid variables, with no syntax restriction: its unique normal form costs 19, and a non-normal representative needs two λs, three applications and one index bit for `f`. +- **The cell and the lift keep 24 and 19 bits under weaker laws.** A uniform + cell replacement in the actual ABS frame costs at least 24 under only the + two lookup laws `C K n = a` and `C F r = r e`, with the actual `intL` and + `x` usable and raw quotation data borrowable; the uniformity across parsed + bodies is necessary, since a 17-bit term built from one favourable body + meets both laws for that body alone. The lift costs at least 19 on the + 165's actual values and environments. Codex's handwritten proofs, not yet + independently reviewed (`data/self-interpreter/reasoning_floor/env/`). ### Exclusions at every size @@ -575,6 +602,7 @@ Unless marked, each passes the battery and is larger than the 168. | **Values and environments** | | | | Bare leaky cell | 166, *fails* | `λx.x` alone leaks the rigid `N` | | Function environment `\s. s (\b. b (\u.a) e)`, value `\e. e list1` | 177 | no lookup helper needed; the value adapter costs 7 | +| Designed from scratch without seeing an interpreter: CPS environment functions, input bits reused as environment selectors | 220 | never reaches raw-code variable values or the hoisted skip; trie environments read by their own application 299, a two-state single decoder 251 | | Scott cells with a shared lookup (two orders) | 236 / 243 | a 12-bit cheaper cell, a recursive lookup | | Indices parsed into Scott selectors by `intL` | 222 | zero/successor parsing and accessors | | Absolute de Bruijn levels | 449 | depth state and runtime append | @@ -601,9 +629,11 @@ Unless marked, each passes the battery and is larger than the 168. ### Variants of the 165 -Codex's constructions, each written from a derivation rather than found by -search; sources and proofs are in `data/self-interpreter/reasoning_165/`, and -`merges.py` re-measures every one. Each passes the battery unless marked. +Constructions written from a derivation rather than found by search, Codex's +unless credited; sources and proofs are in +`data/self-interpreter/reasoning_165/` and `reasoning_floor/`, and `merges.py` +re-measures the former. Each passes the battery unless marked. Sizes are at +their optimal let structure (`blam golf letopt`, at most three cuts). | idea | bits | note | |---|---:|---| @@ -613,11 +643,14 @@ search; sources and proofs are in `data/self-interpreter/reasoning_165/`, and | Balanced skip `(s s) (s s)` | 169 | `s s = K N`, so both forms reduce to `N` | | `Δ = λx. x x` shared between the knot and `s s` | 176 | the let costs 11 | | Zero arm replaced by its bit, `next` as a third outer argument | 158, *fails* | variables return `C r N next`, three arguments at `C` | -| The same, with the variable arm discarding the extra argument | 178 | the 165's reader equations in both arms | +| The same, with the variable arm discarding the extra argument | 174 | the 165's reader equations in both arms | +| NEXT as the reader's third operand: `list H NEXT`, `H = \b \r. b r (\t. cont r (r r t))` (Grok) | 168 | the zero arm `r NEXT` is free; the variable arm's force `(r r) t` turns `K N` into `N` and costs the four bits, and NEXT sits one binder deeper | | Duplicate tail discarded after the second cell elimination | 181 | | -| Tag replayed after the first parse, `bit0`'s `K` discarding `bit1` | 188 / 189 / 199 | the redundant tag costs more than the hoist saves | +| Tag replayed after the first parse, `bit0`'s `K` discarding `bit1` | 186 / 188 / 194 | the redundant tag costs more than the hoist saves | +| Curried cell borrowing ABS's tag, `\b. b (bit1 arg) (\r. r args)` | 171 | `bit1 = K` in ABS; +6 over the canonical cell | | Constant stream as ABS's return instruction, `R (K (K X)) = X` | 191 / 207 | capturing the real remainder | -| Reader-carried knot `W = λx. x I x Z_x`: the only self-application is the skip's | 192 | +27 for the carrier; `R Z_t → t t` drives it | +| Reader-carried knot `W = λx. x I x Z_x`: the only self-application is the skip's | 192 | +27 for the carrier; `R Z_t → t t` drives it. With the carrier's diagonal law, `Z_t` (12 bits) is the unique minimum, so this template is exactly 192 | +| Reset bootstraps: skip `s s c` with driver `λx. x I x F x`, or `s s x` with `λx. x x x F x` | 192 / 192 | the input `F` resets the provisional recursion; the cheaper driver is paid back by the deeper erased operand | | ABS constructor shared with the recursion driver | 193 | β-equivalent to the 165; the sharing costs 28 | | Reader diagonal `Q g g (λu r. r g)` as the outer knot | 199 | reconstructs `G G`; the helper costs 34 | | Optional second value in a solvable wrapper | 203 | the escape from the mode-free builder exclusion | @@ -648,13 +681,19 @@ Open: current `next` and parser doing it unchanged; - the capped fills of §3 (4,052,176 in the joint reader search, 7,790 in the handler, 218 in whole APP) and of §4; -- an unconditional lower bound beyond small sizes: §5 states the structure - every interpreter has. The minimum nonlinear-binder count two is attained, - so counting more such binders cannot close the gap. A quantitative theorem - must account for their connections, live captures, and quotation-origin - restrictions without incorrectly adding costs of computations that share. - Code copying is necessary, but different output binding roles can all - descend from one original binder (`structural-bounds.md`). +- an unconditional lower bound beyond 37 bits (`global-floor.md`). The + minimum nonlinear-binder count two is attained, so counting more such + binders cannot close the gap, and the 37-bit argument's next inventory + (seven leaves) admits a third nonlinear binder or a capture across the + width witness. The remainder projection gives at most 62 even if its own + minimum were 70, and a 45-bit partial reader meets every zero-stream + obligation the known proofs use (`remainder.md`). A quantitative theorem + must account for connections, live captures, and quotation-origin + restrictions without incorrectly adding costs of computations that share, + in particular an application-sensitive charge for the residual control + that consumes exactly one more source after a left child. Code copying is + necessary, but different output binding roles can all descend from one + original binder (`structural-bounds.md`). ## 8. Reproduce @@ -662,6 +701,9 @@ Open: |---|---| | `tools/self-interpreter/battery.py` | the exact contract on 668 programs (`--max-bits`, `--uni`, `--strict`) | | `tools/self-interpreter/merges.py` | the 165, its nearest variants, the 168's protocol variants, and the variants of §6 | +| `tools/self-interpreter/polish.py` | battery, then the optimal let structure (`blam golf letopt`) of a candidate; a new algorithm's size is its letopt minimum | +| `tools/self-interpreter/theory/floor37/verify.py` | the 108 residual layouts and the kernel-checked clauses of `global-floor.md` | +| `data/self-interpreter/reasoning_floor/` | the second round of reasoning lanes: floors, knot and remainder theorems, and the variants of §6 they built | | `data/self-interpreter/reasoning_165/` | the proofs and checks behind §2's identities, §5's shape bounds and exclusions, and §6's variants | | `blam golf letopt`, `blam golf component` (lab) | let structure and βη component (`--contextual`) | | `blam selfint hole` (lab), `tools/self-interpreter/sketches.py` | one- and two-hole searches, including the 165's reader slots | diff --git a/docs/classical/self-interpreter/remainder.md b/docs/classical/self-interpreter/remainder.md index bd425d53..b8125435 100644 --- a/docs/classical/self-interpreter/remainder.md +++ b/docs/classical/self-interpreter/remainder.md @@ -17,7 +17,8 @@ named source and exact wire are `data/self-interpreter/machines/rem70.lam` and `rem70.blc`. This is an upper bound, not an optimality result for remainder extraction. The term contains a beta redex, so it does not give this upper bound for -the beta-normal fragment. +the beta-normal fragment. Every exact extractor on closed sources has at +least 27 bits (below), so the minimum lies between 27 and 70. ## Construction @@ -183,6 +184,48 @@ obstruction, not a sharp bit-length lower bound for remainder extraction or an additive lower bound for arbitrary self-interpreters. +### The two nonlinear binders lie in incomparable branches + +`Blc/SelfintRemainderChain.lean`, Codex's proof, establishes +`remainder_not_chain` and +`literal_remainder_body_not_chain`. Hypotheses are closedness and exact +closed-source/closed-suffix beta joinability. The latter theorem puts the +incomparable pair inside the body of a literal one-lambda interface. + +The interpreter's Omega-output argument (`structural-bounds.md`) cannot +be reused: putting Omega in an extractor's suffix puts its two nonlinear +binders in the input already. This proof instead extends the labelled-zero argument. + +Use the existing extended syntax Q with program lambdas and affine data +K,Z_i. Define ChainQ by the existing `Chain` predicate on its binder-count +erasure. All extended steps preserve ChainQ and preserve affineness when +the initial term is affine. Data phases normalize finitely and do not +increase either nonlinear-binder count or program-lambda count. + +At a global program head contraction: + +* An affine binder decreases program-lambda count and does not increase + nonlinear count. +* A nonlinear binder, by the chain property, has an affine argument. + Its contraction therefore decreases nonlinear count by one, regardless + of how many affine program lambdas get copied. + +The lexicographic pair `(nonlinear count, program-lambda count)` decreases +between completed data phases. Thus every closed chain-shaped extended +term reaches a lambda-like answer. This permits arbitrarily many nested +nonlinear binders; it is stronger than assuming their count at most one. + +Simulate the resulting finite trace of R Z0 on a sufficiently long even +zero prefix ending in `stream(I,Omega)`. It is the quotation of a closed +lambda tower followed by Omega. The trace produces an outer lambda, +whereas correctness says it beta-joins Omega. Confluence contradicts this: +all reducts of an outer lambda remain lambdas, and Omega's only reduct is +itself. Hence R is not chain-shaped. + +Lean checks the preservation lemmas, lexicographic termination, finite +simulation, and contradiction. Both theorems use only `propext` and `Quot.sound`; there are no admitted +proofs. + ## Source code must grow on a head trace **Handwritten theorem.** Let `R` be closed and suppose @@ -519,3 +562,313 @@ architecture, normal form, typing discipline, or bound on source size. Natural-counter stabilization and event selection use ordinary classical reasoning. Current build and axiom-audit results are recorded in `docs/STATUS.md`. + +## At least 27 bits + +This is Codex's handwritten proof. This proof concerns arbitrary closed sources for R, including beta-redexes. +It assumes neither a normal-form source nor a parser architecture. The +syntax classification below is analytical, not a term enumeration. +`data/self-interpreter/reasoning_floor/remainder/audit.py` replays 33 fixed +equations used here in about 0.003 s; the exhaustiveness comes from the +following count argument, not those tests. Table entries are beta reducts, +some reached by contracting an argument first; the exclusions use them +through confluence. + +### Three live binders, hence at least 24 bits + +Call a binder live when its own variable occurs. An extractor R weak-head +normalizes to a lambda: apply it to a fixed quoted closed source with +normal suffix I, and use head-normalization reflection to its function. +The exposed binder must be live, since otherwise the result would be +independent of the suffix (take closed suffixes I and F). +The reduct remains an extractor by confluence, so `SelfintZero` says that +the exposed lambda's body contains at least two nonlinear binders. + +Suppose the original R had at most two live binders. There must be two, +both nonlinear, and the chain theorem above makes them incomparable. +Each is consequently closed in isolation: every ancestor is vacuous. +Neither body contains another live binder. During weak-head evaluation, +copies of these closed live lambdas retain their original bodies, since +substitution cannot change a closed subterm and no step is taken under a +lambda. Every other original binder is vacuous and remains so under +capture-avoiding substitution. Thus a live exposed lambda would have no +nonlinear binder in its body, the required contradiction. + +R has at least three live binders and two nonlinear binders. Write L,V,X +for lambda nodes, variable leaves, and the sum of zero-based indices. +There are at least five leaves, and + +``` +|R| = 2L + 4V - 2 + X ≥ 2·3 + 4·5 - 2 = 24. +``` + +### The entire allocation through 26 bits + +If |R|≤26, necessarily V=5, exactly three binders are live, exactly two +are nonlinear, and each nonlinear binder occurs exactly twice. The third +live binder is affine. Either + +``` +L=3, X≤2, or L=4, X=0. +``` + +In the second case the fourth lambda is vacuous. Put `D=λx.x x`. + +### Zero index sum + +When X=0 every lambda subterm is closed in isolation. Any lambda exposed +by weak-head evaluation is therefore an unchanged original lambda subterm. +To have two internal nonlinear binders it must be the affine binder, +containing both nonlinear binders. These consume all five source leaves. +There can be no application outside this lambda, because its other operand +would require a leaf. An outer vacuous lambda would itself receive and +discard the public stream. Thus R is literally this affine lambda. + +With three lambdas it has form `λs.T(s,D,D)`, where T is a three-leaf +binary application tree. On any `s=[K,r]`, its six layouts give: + +| Body | Reduct after substituting s | +| --- | --- | +| `(s D) D` | `K D` | +| `(D s) D` | `r` | +| `(D D) s` | `Omega s` | +| `s (D D)` | `Omega K r` | +| `D (s D)` | `K K` | +| `D (D s)` | `r` | + +Take `s=stream(I,n)`, with rigid n; r is a nonempty Scott stream. None +returns n. + +With a fourth, vacuous lambda, its body must be closed because X=0. +It cannot surround an occurrence bound by s or D. It therefore wraps +one D, giving `J=λz.D`, or wraps `D D`. In the latter case the only +layouts are `s(λz.Omega)` and `(λz.Omega)s`, both head-divergent. +In the former case take `s=[K,r]`, `r=[K,u]` (as for source I): + +| Body | Reduct | +| --- | --- | +| `(s D) J` | `K J` | +| `(s J) D` | `u` | +| `(D s) J` | `r` | +| `(D J) s` | `K r` | +| `(J s) D` | `Omega` | +| `(J D) s` | `K r` | +| `s(D J)` | `K` | +| `s(J D)` | `K` | +| `D(s J)` | `u` | +| `D(J s)` | `Omega` | +| `J(s D)` | `D` | +| `J(D s)` | `D` | + +Here u is also a nonempty Scott stream. Again none is n. This excludes +all zero-index allocations through 26 bits. + +### Three lambdas and a positive index sum: literal interface + +If R starts with a lambda, it is the affine binder; a nonlinear root +would be comparable with the only other nonlinear binder. Its sole +stream occurrence must lie inside one of the incomparable nonlinear +binders, or X would be zero. Thus + +``` +R = λs.H_s D, or R = λs.D H_s, +H_s = λx.T(x,x,s). +``` + +The first reduces to the already excluded three-leaf layout. For the +second, the six choices of T give the following on +`s=stream(I,n)=[K,r]`, `r=[K,u]`: + +| T | Behavior of H_s H_s | +| --- | --- | +| `(x x)s` | `H_s H_s → H_s H_s s`, an infinite head expansion | +| `(x s)x` | `I` | +| `(s x)x` | `K H_s` | +| `x(x s)` | `u` | +| `x(s x)` | `K K` | +| `s(x x)` | `H_s H_s →² H_s H_s K r`, an infinite head expansion | + +No choice returns n. The two recurrence equations preserve the head +redex while appending arguments; they are divergence proofs, not fuel caps. + +### Three lambdas and a positive index sum: application root + +A positive index requires two nested live binders in one subtree. The +other nonlinear binder is incomparable, closed, and has no other binder, +so is D. Closure and the five-leaf inventory leave exactly + +``` +R = N D, or R = D N, +``` + +where N contains one affine and one binary nonlinear binder and three +leaves. + +If the affine binder is outermost, positivity forces +`N=λa b.T(a,b,b)`. Both N D and D N reduce to a literal interface whose +body contains exactly one nonlinear binder: respectively D or one copy +of N. The public b binder does not count. `SelfintZero` excludes them. + +If the nonlinear binder is outermost and the affine binder is leading, +`N=λx y.T(x,x,y)`. N D reduces to the excluded 24-bit literal form. +For D N, first reduce to N N: + +| T | Obstruction | +| --- | --- | +| `(x x)y` | `(N N)s →² (N N)s`, a head cycle | +| `(x y)x` | `N N →* λy.y N y`, only one internal nonlinear binder | +| `(y x)x` | `(N N)(stream(I,n)) →* K` | +| `x(x y)` | `N N →* λy z.(N y)((N y)z)`, two leading lambdas | +| `x(y x)` | `N N →* λy z.(y N)(z(y N))`, two leading lambdas | +| `y(x x)` | With X=N N, `X[K,r] →⁷ X`; X already has a lambda head | + +For the fifth row, expanding N once gives +`λy.N(y N) → λy z.(y N)(z(y N))`. Two leading lambdas leave a lambda +after the one public input and cannot yield rigid n. In the last row, +`X → λy.y X`, so the returned X also cannot yield n. + +Finally suppose the inner affine binder is nonleading. It has one own +occurrence and, by positivity, exactly one captured x; the other x is +outside it. The only forms are + +``` +λx.(λy.x y)x, λx.(λy.y x)x, +λx.x(λy.x y), λx.x(λy.y x). +``` + +The first two beta-reduce to D, yielding Omega in either outer order. +For the third let `J(A)=λy.A y` and `N=λx.x J(x)`. N D reaches the +two-step cycle `D J(D) → J(D) J(D) → D J(D)`. For N N the infinite +head progression is + +``` +N J^k(N) → J^k(N) J^(k+1)(N) →* N J^(k+1)(N). +``` + +For the fourth use `J(A)=λy.y A`. N D reduces to Omega, and N N enters +the three-step cycle + +``` +N J(N) → J(N) J(J(N)) → J(J(N)) N → N J(N). +``` + +This exhausts the positive-index allocation. Hence no closed exact +remainder extractor has size at most 26, and **Rmin ≥ 27**. + +The reduction tables and representative recurrence equations pass the +fixed audit; an independent review replayed them, and 52 further fixed +equations, with its own reducer and found the argument correct +(`data/self-interpreter/reasoning_floor/verify/`). The three-live-binder +argument and the allocation classification are handwritten, not +formalized; the kernel-checked numerical remainder floor is 18 +(`remainder_bound_eighteen`). + +## The zero-stream obligations stop at 45 bits + +The exact source is + +``` +λs.(λd.s d d) (λb r d.r (b d r) d). +``` + +Let `D0=λb r d.r(b d r)d` and `P0(s)=s D0 D0`. Its two laws are + +``` +P0([K,r]) →* r D0 D0 = P0(r) +P0([F,r]) →* r r D0. +``` + +Therefore, for every k≥0, m≥1, and arbitrary N, + +``` +R45 (0^k 1^m 0 ++ N) →* N. +``` + +Induct on k and then use unary self-skip. This includes every closed +lambda tower `λ^n.I` and every well-scoped `λ^k.var m`. It even accepts +odd zero prefixes, which need not be a source encoding. +`Blc/SelfintTower45.lean` checks the literal 45-bit length, closedness, both symbolic clauses, and +the all-k/all-index/all-suffix theorem, including the tower corollary. +Both public contracts depend only on `propext` and `Quot.sound`. + +It fails, for example, on `λx.x x` (wire `00011010`): it returns +`10 ++ N`, the encoding of the second variable followed by N. +This is a partial reader, not an improvement to Rmin. + +It also realizes the growth mechanism concretely. In one zero-cell cycle +`P0([K,r]) →* P0(r)`, the active D0 consumes its b and r binders. Its +last d contraction then duplicates the other three-lambda D0 twice and +consumes one lambda, increasing the program-origin lambda count by +`(2−1)·3−1 = 2`. Before/after counts in the cycle are 6,5,4,6. This +happens at every zero cell, arbitrarily late in the infinite-zero trace. + +The source has five live binders, three nonlinear binders, and an +incomparable nonlinear pair (the sharing lambda against binders in D0). +Thus two nonlinear binders, incomparable branches, unary skipping, and +arbitrarily late code growth are jointly compatible with 45 bits. +Any sound bound using only these obligations is at most 45 and transfers +at most 37 bits to interpreters, the floor `global-floor.md` already +proves. A stronger bound has to use genuine application parsing: after a +left child's whole encoding is discarded, a still-live obligation must +consume exactly one further source, uniformly in the suffix. + +## Pending sources after an application's left child + +These results are Codex's; `Blc/SelfintResidualControl.lean`, +`SelfintSharedS647` and `SelfintFixedResiduals` check them, using only +`propext` and `Quot.sound`. Write `D_p(S) = R (p ++ S)` for an extractor `R` +and a finite word `p`. For closed `M`, `Q`, + +``` +D_code(M)(S) =β S, +D_(01 code(M))(code(Q) ++ N) =β N, +``` + +and the two residual operations cannot coincide: on `code(I) ++ n` the first +returns a nonempty Scott stream and the second the rigid `n` +(`pending_ne_done`). With `w = code(I)` and `p_k = (01)^k code(M)`, for +`i < j`, `D_p_i(w^j ++ n) =β w^(j−i) ++ n` while `D_p_j(w^j ++ n) =β n`, so +pending depths never collapse to finitely many residual operations +(`pending_depths_distinct`, for every `i` and every `k > 0`). + +If a residual body `B` with only its tail free satisfies +`R (01 code(M) ++ S) =β B[S]` for every `S`, then `λs.B` is itself an +extractor, so `B` has two incomparable nonlinear binders +(`clean_cut_body_not_chain`). Colouring the reader's lambdas red and the +prefix's quotation lambdas blue, those binders are of reader origin in any +colour-preserving trace (`marked_pending_has_code`). They may be copies of +the same original pair that processed the left child, so this is not an +additive charge on the original source. + +Three such charges are false. `intL584 F` (592 bits) is a complete +extractor with exactly two nonlinear binders, both closed in isolation +(`rem592_*`). `SelfintSharedS647` compiles `rem70` by β-exact SKI +abstraction through one shared `S`: a 647-bit complete extractor with +exactly two nonlinear binders, two live capturing binders and one +width-three subterm, its contract checked through all 413 reductions to +`rem70`'s normal form. Applications therefore force neither a third +nonlinear binder, nor a third live capture, nor a second width witness. +`SelfintFixedResiduals` kernel-checks the failures of the nearest broken +extractors: the 45-bit tower reader stops before a closed left child +(`tower45 (010 ++ r) →* r`), a 66-bit `rem70` with one context operand +dropped returns `K N` on `λx.x x`, and two 65-bit attempts to pack the +pending pair into one argument fail. + +Within `rem70`'s own frame the two sequential skips are priced exactly +(handwritten): with `Q = λt u d. H`, `H` built from applications and +variables, and the rigid laws `Q K u d = u d d`, `Q F u d = u d d d d`, the +leaf counts force `|Q| ≥ 36`, so `|R| ≥ 70`, uniquely attained by `rem70`. +These restrictions are not consequences of the general contract. + +## Transfer to interpreters + +Substituting `F=λv r.r` for the rigid continuation in the self-interpreter +contract shows that `E F` is a closed exact remainder extractor on closed +sources, of `|E|+8` bits. `SelfintRemainderChain.remainder_bound_transfers` +kernel-checks the consequence: a universal remainder floor `n` gives +`SelfintSizeBound (n−8)`. The 27-bit floor transfers only 19, below the +37 of `global-floor.md`, and because `rem70` exists +(`remainder_bound_at_most_seventy`) no remainder floor can transfer more +than 62. The same substitution, applied to the remainder payload of a +literal continuation-headed interpreter, prices that payload in +`head-decomposition.md`. diff --git a/docs/classical/self-interpreter/structural-bounds.md b/docs/classical/self-interpreter/structural-bounds.md index 6927d8e1..45aef309 100644 --- a/docs/classical/self-interpreter/structural-bounds.md +++ b/docs/classical/self-interpreter/structural-bounds.md @@ -67,8 +67,18 @@ The kernel also proves the syntax inequality 10 nonlinear(t) + 4 freeLeaves(0,t) <= |t|_BLC + 2, ``` -giving `selfintSizeBound_eighteen : SelfintSizeBound 18`. This is a small -numeric consequence, not a useful approximation to a 165-bit bound. +giving `selfintSizeBound_eighteen : SelfintSizeBound 18`. The +`SelfintFloor*` modules raise the kernel-checked floor to +`selfintSizeBound_27 : SelfintSizeBound 27` without Statman's theorem: the +incomparable pair and a live capture give three live binders (25 bits); a +β-invariant (every application argument mentions at most one free variable) +fails for interpreters, which must also expose an abstraction body that is +not an application; abstraction-rooted interpreters then need four +abstractions (27 bits), and minimal application-rooted ones below 27 bits +are classified and refuted by finite head reduction. The proof uses +`Classical.choice`. A literal `λc s.B` costs at least 31 there. These are +small numeric consequences, not approximations to a 165-bit bound; the +handwritten floor is 37 (`global-floor.md`). The nonlinear count is sharp, even among beta-normal interpreters. `Blc.SelfintSharp` gives a 584-bit interpreter reducing to the literal 165 @@ -134,10 +144,11 @@ floors, respectively: the three live binders on the width witness's ancestor chain cannot contain both incomparable nonlinear binders, requiring a fourth live binder. The resulting 33-bit global floor rises to 34 by analytically -excluding its equality cases. The same document proves simultaneous -sharpness of the width, capture, and nonlinear -counts by a shared-S construction. These additions are handwritten; they -do not strengthen the kernel-checked numerical theorem above. +excluding its equality cases, and `global-floor.md` excludes 34–36 the +same way, giving 37. The same document proves simultaneous sharpness of +the width, capture, and nonlinear counts by a shared-S construction. These +additions are handwritten; they do not strengthen the kernel-checked +numerical theorem above. ## Quotation-origin binders cannot provide arbitrary binding structure diff --git a/lean/Blc.lean b/lean/Blc.lean index f7dc2d38..b16a4de6 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -43,3 +43,11 @@ import Blc.SelfintGrowthCounters import Blc.SelfintGrowthSequence import Blc.SelfintGrowth import Blc.SelfintGrowthColored +import Blc.SelfintKnot +import Blc.SelfintRemainderChain +import Blc.SelfintTower45 +import Blc.SelfintFloor37 +import Blc.SelfintFloorApp +import Blc.SelfintResidualControl +import Blc.SelfintSharedS647 +import Blc.SelfintFixedResiduals diff --git a/lean/Blc/SelfintFixedResiduals.lean b/lean/Blc/SelfintFixedResiduals.lean new file mode 100644 index 00000000..1826696c --- /dev/null +++ b/lean/Blc/SelfintFixedResiduals.lean @@ -0,0 +1,59 @@ +/- Fixed beta-exact failure witnesses for application parsing. -/ +import Blc.SelfintResidualControl + +namespace Blc.SelfintFixedResiduals +open Term SelfintControl SelfintRemainderChain SelfintResidualControl SelfintSharp +set_option maxRecDepth 100000 +set_option maxHeartbeats 4000000 + +def dupSource : Term := .lam (.app (.var 0) (.var 0)) + + +def tower : Term := (.lam (.app (.lam (.app (.app (.var 1) (.var 0)) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.app (.var 2) (.var 0)) (.var 1))) (.var 0))))))) +def towerResult : Term := (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 2))))) +def towerTrace : List (List Direction) := [[], [], [.left], [.left, .left], [.left], [], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left], [], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left], [], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left], [], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left, .left, .left], [.left, .left], [.left], [.left, .left], [.left, .left, .left], [.left, .left], [.left], []] +theorem tower_checked : replay towerTrace + (.app tower (streamOf (blcCode dupSource) (.var 0))) = some towerResult := by decide +theorem tower_not_remainder : ¬ IsRemainder tower := by + intro h + have hs := h.2 dupSource (by decide) (.var 0) + have ht := join_of_betas (replay_sound tower_checked) + exact lam_not_join_var _ _ (join_trans (join_symm ht) hs) + + +def near66 : Term := (.lam (.app (.lam (.app (.app (.var 1) (.var 0)) (.var 0))) (.lam (.lam (.app (.var 0) (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.app (.app (.var 2) (.var 1)) (.app (.var 1) (.var 0))) (.var 0)) (.var 0)))))) (.var 0))))))) +def near66Result : Term := (.lam (.var 1)) +def near66Trace : List (List Direction) := [[], [], [.left], [.left, .left], [.left], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left], [], [.left, .left, .left], [.left, .left], [.left], [.left, .left], [.left], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left], [], [.left, .left, .left], [.left, .left], [.left, .left], [.left, .left, .left], [.left, .left], [.left, .left], [.left, .left, .left, .left, .left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left], [], [.left], [], [], [.left, .left, .left], [.left, .left], [.left], [.left, .left], [.left], []] +theorem near66_checked : replay near66Trace + (.app near66 (streamOf (blcCode dupSource) (.var 0))) = some near66Result := by decide +theorem near66_not_remainder : ¬ IsRemainder near66 := by + intro h + have hs := h.2 dupSource (by decide) (.var 0) + have ht := join_of_betas (replay_sound near66_checked) + exact lam_not_join_var _ _ (join_trans (join_symm ht) hs) + + +def tail65 : Term := (.lam (.app (.lam (.app (.app (.var 1) (.var 0)) (.var 0))) (.lam (.lam (.app (.var 0) (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 1) (.var 0)) (.app (.app (.var 2) (.var 0)) (.app (.var 0) (.var 0)))))))) (.var 0))))))) +def tail65Result : Term := (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 2))))) +def tail65Trace : List (List Direction) := [[], [], [.left], [.left, .left], [.left], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left], [], [.left], [.left, .left], [.left], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left], [], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left, .left, .left], [.left, .left], [.left], []] +theorem tail65_checked : replay tail65Trace + (.app tail65 (streamOf (blcCode dupSource) (.var 0))) = some tail65Result := by decide +theorem tail65_not_remainder : ¬ IsRemainder tail65 := by + intro h + have hs := h.2 dupSource (by decide) (.var 0) + have ht := join_of_betas (replay_sound tail65_checked) + exact lam_not_join_var _ _ (join_trans (join_symm ht) hs) + + +def handler65 : Term := (.lam (.app (.lam (.app (.app (.var 1) (.var 0)) (.var 0))) (.lam (.lam (.app (.var 0) (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.app (.var 2) (.var 0)) (.app (.var 0) (.var 0)))) (.var 0)))))) (.var 0))))))) +def handler65Result : Term := (.lam (.app (.app (.app (.app (.var 0) (.var 0)) (.lam (.lam (.var 1)))) (.var 1)) (.var 0))) +def handler65Trace : List (List Direction) := [[], [], [.left], [.left, .left], [.left], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left], [], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left], [.left], [], [.left], [.left, .left, .left, .left], [.left, .left, .left], [.left, .left, .left], [.left, .left], [.left, .left], [.left], [], [.left], [], [], [.left, .left, .left], [.left, .left], [.left], [], [.under, .left], [.under, .left, .left, .left, .left], [.under, .left, .left, .left]] +theorem handler65_checked : replay handler65Trace + (.app handler65 (streamOf (blcCode dupSource) (.var 0))) = some handler65Result := by decide +theorem handler65_not_remainder : ¬ IsRemainder handler65 := by + intro h + have hs := h.2 dupSource (by decide) (.var 0) + have ht := join_of_betas (replay_sound handler65_checked) + exact lam_not_join_var _ _ (join_trans (join_symm ht) hs) + +end Blc.SelfintFixedResiduals diff --git a/lean/Blc/SelfintFloor37.lean b/lean/Blc/SelfintFloor37.lean new file mode 100644 index 00000000..265d1c2c --- /dev/null +++ b/lean/Blc/SelfintFloor37.lean @@ -0,0 +1,323 @@ +/- +Fixed head-reduction clauses supporting the handwritten 37-bit floor +(docs/classical/self-interpreter/global-floor.md) and the remainder +extractor exclusions it cites. Generated by +tools/self-interpreter/theory/floor37/verify.py; this file does not +assert the size theorem itself. +-/ + +import Blc.Step + +namespace Blc.SelfintFloor37 + +open Term + +set_option maxRecDepth 100000 + +set_option maxHeartbeats 4000000 + +theorem g34_0 : headSteps 6 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 1)) (.var 0))))))) = some (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.lam (.app (.app (.lam (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 1)) (.var 0)))))) (.var 4)) (.var 0))) (.var 2)) (.var 0)))) (.var 0)))))) := by decide + +theorem g34_1 : headSteps 5 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.var 2) (.app (.var 1) (.var 0)))))))) = some (.lam (.lam (.lam (.app (.app (.var 2) (.lam (.app (.lam (.app (.lam (.lam (.app (.var 1) (.lam (.app (.var 2) (.app (.var 1) (.var 0))))))) (.app (.var 4) (.var 0)))) (.app (.var 2) (.var 0))))) (.lam (.app (.app (.var 3) (.lam (.app (.lam (.app (.lam (.lam (.app (.var 1) (.lam (.app (.var 2) (.app (.var 1) (.var 0))))))) (.app (.var 5) (.var 0)))) (.app (.var 3) (.var 0))))) (.app (.var 1) (.var 0)))))))) := by decide + +theorem g34_3 : headSteps 5 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.var 2) (.app (.var 0) (.var 1)))))))) = some (.lam (.lam (.lam (.app (.app (.lam (.app (.lam (.app (.lam (.lam (.app (.var 1) (.lam (.app (.var 2) (.app (.var 0) (.var 1))))))) (.app (.var 0) (.var 4)))) (.app (.var 0) (.var 2)))) (.var 2)) (.lam (.app (.app (.lam (.app (.lam (.app (.lam (.lam (.app (.var 1) (.lam (.app (.var 2) (.app (.var 0) (.var 1))))))) (.app (.var 0) (.var 5)))) (.app (.var 0) (.var 3)))) (.var 3)) (.app (.var 0) (.var 1)))))))) := by decide + +theorem g34_4 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 1) (.var 2)) (.var 0))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 1) (.var 2)) (.var 0))))))) (.lam (.app (.app (.var 1) (.lam (.app (.app (.var 3) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 1) (.var 2)) (.var 0))))))) (.var 0)))) (.var 0)))))) := by decide + +theorem g34_4_I : headSteps 6 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 1) (.var 2)) (.var 0))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 1) (.var 2)) (.var 0))))))) (.lam (.app (.app (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 5))))))))) (.lam (.app (.app (.var 3) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 1) (.var 2)) (.var 0))))))) (.var 0)))) (.var 0)))))) := by decide + +theorem g34_5 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.var 1) (.app (.var 2) (.var 0)))))))) = some (.lam (.lam (.app (.var 1) (.app (.lam (.lam (.app (.var 1) (.lam (.app (.var 1) (.app (.var 2) (.var 0))))))) (.lam (.app (.var 1) (.app (.lam (.app (.var 3) (.app (.lam (.lam (.app (.var 1) (.lam (.app (.var 1) (.app (.var 2) (.var 0))))))) (.var 0)))) (.var 0)))))))) := by decide + +theorem g34_6 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 1) (.var 0)) (.var 2))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.app (.app (.var 3) (.var 0)) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 1) (.var 0)) (.var 2))))))))))) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 1) (.var 0)) (.var 2))))))))) := by decide + +theorem g34_6_I : headSteps 6 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 1) (.var 0)) (.var 2))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.app (.app (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 5))))))))) (.var 0)) (.lam (.app (.app (.var 3) (.var 0)) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 1) (.var 0)) (.var 2))))))))))) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 1) (.var 0)) (.var 2))))))))) := by decide + +theorem g34_7 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.var 1) (.app (.var 0) (.var 2)))))))) = some (.lam (.lam (.app (.var 1) (.app (.lam (.app (.var 1) (.app (.var 0) (.lam (.app (.var 3) (.app (.var 0) (.lam (.lam (.app (.var 1) (.lam (.app (.var 1) (.app (.var 0) (.var 2))))))))))))) (.lam (.lam (.app (.var 1) (.lam (.app (.var 1) (.app (.var 0) (.var 2))))))))))) := by decide + +theorem g34_9 : headSteps 7 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.var 0) (.app (.var 2) (.var 1)))))))) = some (.lam (.lam (.app (.var 1) (.lam (.app (.var 0) (.app (.var 2) (.app (.lam (.app (.var 0) (.app (.lam (.lam (.app (.var 1) (.lam (.app (.var 0) (.app (.var 2) (.var 1))))))) (.var 3)))) (.var 1)))))))) := by decide + +theorem g34_10 : headSteps 5 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 0) (.var 1)) (.var 2))))))) = some (.lam (.lam (.app (.app (.app (.var 1) (.var 0)) (.lam (.app (.app (.var 0) (.var 2)) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 0) (.var 1)) (.var 2))))))))) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 0) (.var 1)) (.var 2))))))))) := by decide + +theorem g34_11 : headSteps 5 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.var 0) (.app (.var 1) (.var 2)))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.app (.var 1) (.lam (.app (.var 0) (.app (.var 1) (.var 2)))))))) (.app (.var 0) (.lam (.app (.var 0) (.app (.var 2) (.lam (.lam (.app (.var 1) (.lam (.app (.var 0) (.app (.var 1) (.var 2)))))))))))))) := by decide + +theorem g34_11_I : headSteps 7 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.lam (.app (.var 0) (.app (.var 1) (.var 2)))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.app (.var 1) (.lam (.app (.var 0) (.app (.var 1) (.var 2)))))))) (.app (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4))))))))) (.lam (.app (.var 0) (.app (.var 2) (.lam (.lam (.app (.var 1) (.lam (.app (.var 0) (.app (.var 1) (.var 2)))))))))))))) := by decide + +theorem g35_12 : headSteps 3 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 2) (.app (.var 2) (.app (.var 1) (.var 0)))))))) = some (.lam (.lam (.lam (.lam (.app (.app (.lam (.lam (.lam (.app (.var 2) (.app (.var 2) (.app (.var 1) (.var 0))))))) (.app (.var 3) (.var 2))) (.app (.app (.lam (.lam (.lam (.app (.var 2) (.app (.var 2) (.app (.var 1) (.var 0))))))) (.app (.var 3) (.var 2))) (.app (.var 1) (.var 0)))))))) := by decide + +theorem g35_13 : headSteps 3 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 2) (.var 1)) (.var 0))))))) = some (.lam (.lam (.lam (.lam (.app (.app (.app (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 2) (.var 1)) (.var 0)))))) (.var 3)) (.var 2)) (.app (.app (.app (.app (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 2) (.var 1)) (.var 0)))))) (.var 3)) (.var 2)) (.var 1)) (.var 0))))))) := by decide + +theorem g35_14 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 2) (.var 2)) (.app (.var 1) (.var 0))))))) = some (.lam (.lam (.lam (.app (.app (.lam (.lam (.lam (.app (.app (.var 2) (.var 2)) (.app (.var 1) (.var 0)))))) (.lam (.lam (.lam (.app (.app (.var 2) (.var 2)) (.app (.var 1) (.var 0))))))) (.app (.app (.var 2) (.var 1)) (.var 0)))))) := by decide + +theorem g35_15 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 2) (.var 1))) (.var 0)))))) = some (.lam (.lam (.lam (.app (.app (.app (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 2) (.var 1))) (.var 0))))) (.var 2)) (.app (.app (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 2) (.var 1))) (.var 0))))) (.var 2)) (.var 1))) (.var 0))))) := by decide + +theorem g35_16_prefix : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 1)) (.var 0)))))) = some (.lam (.lam (.app (.app (.app (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 1)) (.var 0))))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 1)) (.var 0)))))) (.var 1)) (.var 0)))) := by decide + +theorem g35_16_cycle : headSteps 3 (.lam (.lam (.app (.app (.app (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 1)) (.var 0))))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 1)) (.var 0)))))) (.var 1)) (.var 0)))) = some (.lam (.lam (.app (.app (.app (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 1)) (.var 0))))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 1)) (.var 0)))))) (.var 1)) (.var 0)))) := by decide + +theorem g35_17 : headSteps 3 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 2) (.app (.var 2) (.app (.var 0) (.var 1)))))))) = some (.lam (.lam (.lam (.lam (.app (.app (.lam (.lam (.lam (.app (.var 2) (.app (.var 2) (.app (.var 0) (.var 1))))))) (.app (.var 2) (.var 3))) (.app (.app (.lam (.lam (.lam (.app (.var 2) (.app (.var 2) (.app (.var 0) (.var 1))))))) (.app (.var 2) (.var 3))) (.app (.var 0) (.var 1)))))))) := by decide + +theorem g35_18 : headSteps 3 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 2) (.var 0)) (.var 1))))))) = some (.lam (.lam (.lam (.lam (.app (.app (.app (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.var 2)) (.var 3)) (.app (.app (.app (.app (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.var 2)) (.var 3)) (.var 0)) (.var 1))))))) := by decide + +theorem g35_19 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 2) (.var 2)) (.app (.var 0) (.var 1))))))) = some (.lam (.lam (.lam (.app (.app (.lam (.lam (.lam (.app (.app (.var 2) (.var 2)) (.app (.var 0) (.var 1)))))) (.lam (.lam (.lam (.app (.app (.var 2) (.var 2)) (.app (.var 0) (.var 1))))))) (.app (.var 0) (.app (.var 1) (.var 2))))))) := by decide + +theorem g35_20 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 2) (.var 0))) (.var 1)))))) = some (.lam (.lam (.lam (.app (.app (.app (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 2) (.var 0))) (.var 1))))) (.var 1)) (.app (.app (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 2) (.var 0))) (.var 1))))) (.var 1)) (.var 0))) (.var 2))))) := by decide + +theorem g35_21_prefix : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 0)) (.var 1)))))) = some (.lam (.lam (.app (.app (.app (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 0)) (.var 1))))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 0)) (.var 1)))))) (.var 0)) (.var 1)))) := by decide + +theorem g35_21_cycle : headSteps 6 (.lam (.lam (.app (.app (.app (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 0)) (.var 1))))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 0)) (.var 1)))))) (.var 0)) (.var 1)))) = some (.lam (.lam (.app (.app (.app (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 0)) (.var 1))))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 2)) (.var 0)) (.var 1)))))) (.var 0)) (.var 1)))) := by decide + +theorem g35_22 : headSteps 3 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 2) (.app (.var 1) (.app (.var 2) (.var 0)))))))) = some (.lam (.lam (.lam (.lam (.app (.app (.var 3) (.app (.lam (.lam (.lam (.app (.var 2) (.app (.var 1) (.app (.var 2) (.var 0))))))) (.var 2))) (.app (.var 1) (.app (.app (.var 3) (.app (.lam (.lam (.lam (.app (.var 2) (.app (.var 1) (.app (.var 2) (.var 0))))))) (.var 2))) (.var 0)))))))) := by decide + +theorem g35_23 : headSteps 3 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 1) (.var 2)) (.var 0))))))) = some (.lam (.lam (.lam (.lam (.app (.app (.app (.var 3) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 1) (.var 2)) (.var 0))))))) (.var 2)) (.app (.app (.var 1) (.app (.app (.var 3) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 1) (.var 2)) (.var 0))))))) (.var 2))) (.var 0))))))) := by decide + +theorem g35_24 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 2) (.var 1)) (.app (.var 2) (.var 0))))))) = some (.lam (.lam (.lam (.app (.app (.var 2) (.app (.lam (.lam (.lam (.app (.app (.var 2) (.var 1)) (.app (.var 2) (.var 0)))))) (.var 1))) (.app (.var 2) (.var 0)))))) := by decide + +theorem g35_25 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 1) (.var 2))) (.var 0)))))) = some (.lam (.lam (.lam (.app (.app (.app (.var 2) (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 1) (.var 2))) (.var 0)))))) (.app (.var 1) (.app (.var 2) (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 1) (.var 2))) (.var 0)))))))) (.var 0))))) := by decide + +theorem g35_26 : headSteps 5 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 1)) (.var 2)) (.var 0)))))) = some (.lam (.lam (.app (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 1)) (.var 2)) (.var 0)))))) (.var 1)) (.var 0)))) := by decide + +theorem g35_27 : headSteps 3 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 2) (.app (.var 1) (.app (.var 0) (.var 2)))))))) = some (.lam (.lam (.lam (.lam (.app (.app (.var 3) (.app (.var 2) (.lam (.lam (.lam (.app (.var 2) (.app (.var 1) (.app (.var 0) (.var 2))))))))) (.app (.var 1) (.app (.var 0) (.app (.var 3) (.app (.var 2) (.lam (.lam (.lam (.app (.var 2) (.app (.var 1) (.app (.var 0) (.var 2)))))))))))))))) := by decide + +theorem g35_28 : headSteps 3 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 1) (.var 0)) (.var 2))))))) = some (.lam (.lam (.lam (.lam (.app (.app (.app (.var 3) (.var 2)) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 1) (.var 0)) (.var 2))))))) (.app (.app (.var 1) (.var 0)) (.app (.app (.var 3) (.var 2)) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 1) (.var 0)) (.var 2))))))))))))) := by decide + +theorem g35_29 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 2) (.var 1)) (.app (.var 0) (.var 2))))))) = some (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 2) (.var 1)) (.app (.var 0) (.var 2)))))))) (.app (.var 0) (.var 2)))))) := by decide + +theorem g35_30 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 1) (.var 0))) (.var 2)))))) = some (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 1)) (.app (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 1) (.var 0))) (.var 2))))) (.var 0))) (.app (.var 2) (.var 1)))))) := by decide + +theorem g35_31 : headSteps 5 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 1)) (.var 0)) (.var 2)))))) = some (.lam (.lam (.app (.app (.app (.var 1) (.var 0)) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 1)) (.var 0)) (.var 2)))))) (.var 1)))) := by decide + +theorem g35_32 : headSteps 3 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 2) (.app (.var 0) (.app (.var 2) (.var 1)))))))) = some (.lam (.lam (.lam (.lam (.app (.app (.var 2) (.app (.lam (.lam (.lam (.app (.var 2) (.app (.var 0) (.app (.var 2) (.var 1))))))) (.var 3))) (.app (.var 0) (.app (.app (.var 2) (.app (.lam (.lam (.lam (.app (.var 2) (.app (.var 0) (.app (.var 2) (.var 1))))))) (.var 3))) (.var 1)))))))) := by decide + +theorem g35_33 : headSteps 3 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 0) (.var 2)) (.var 1))))))) = some (.lam (.lam (.lam (.lam (.app (.app (.app (.var 2) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 0) (.var 2)) (.var 1))))))) (.var 3)) (.app (.app (.var 0) (.app (.app (.var 2) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 0) (.var 2)) (.var 1))))))) (.var 3))) (.var 1))))))) := by decide + +theorem g35_34 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 2) (.var 0)) (.app (.var 2) (.var 1))))))) = some (.lam (.lam (.lam (.app (.app (.var 1) (.var 0)) (.app (.var 1) (.app (.lam (.lam (.lam (.app (.app (.var 2) (.var 0)) (.app (.var 2) (.var 1)))))) (.var 2))))))) := by decide + +theorem g35_35 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 0) (.var 2))) (.var 1)))))) = some (.lam (.lam (.lam (.app (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 0) (.var 2))) (.var 1)))))) (.app (.var 0) (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 0) (.var 2))) (.var 1)))))))) (.var 2))))) := by decide + +theorem g35_36 : headSteps 5 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 0)) (.var 2)) (.var 1)))))) = some (.lam (.lam (.app (.app (.app (.var 0) (.var 1)) (.var 0)) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 0)) (.var 2)) (.var 1)))))))) := by decide + +theorem g35_36_I : headSteps 8 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 0)) (.var 2)) (.var 1)))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.app (.app (.var 1) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 3)))))))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 0)) (.var 2)) (.var 1)))))))) := by decide + +theorem g35_37 : headSteps 3 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 2) (.app (.var 0) (.app (.var 1) (.var 2)))))))) = some (.lam (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 3) (.lam (.lam (.lam (.app (.var 2) (.app (.var 0) (.app (.var 1) (.var 2))))))))) (.app (.var 0) (.app (.var 1) (.app (.var 2) (.app (.var 3) (.lam (.lam (.lam (.app (.var 2) (.app (.var 0) (.app (.var 1) (.var 2)))))))))))))))) := by decide + +theorem g35_38 : headSteps 3 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 0) (.var 1)) (.var 2))))))) = some (.lam (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 3)) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 0) (.var 1)) (.var 2))))))) (.app (.app (.var 0) (.var 1)) (.app (.app (.var 2) (.var 3)) (.lam (.lam (.lam (.app (.var 2) (.app (.app (.var 0) (.var 1)) (.var 2))))))))))))) := by decide + +theorem g35_39 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 2) (.var 0)) (.app (.var 1) (.var 2))))))) = some (.lam (.lam (.lam (.app (.app (.var 1) (.var 0)) (.app (.app (.var 2) (.lam (.lam (.lam (.app (.app (.var 2) (.var 0)) (.app (.var 1) (.var 2))))))) (.var 1)))))) := by decide + +theorem g35_40 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 0) (.var 1))) (.var 2)))))) = some (.lam (.lam (.lam (.app (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.lam (.lam (.lam (.app (.app (.var 2) (.app (.var 0) (.var 1))) (.var 2))))))) (.app (.var 1) (.var 2)))))) := by decide + +theorem g35_41 : headSteps 5 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 0)) (.var 1)) (.var 2)))))) = some (.lam (.lam (.app (.app (.app (.var 0) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 0)) (.var 1)) (.var 2)))))) (.var 1)) (.var 0)))) := by decide + +theorem g35_41_I : headSteps 13 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 2) (.var 0)) (.var 1)) (.var 2)))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) := by decide + +theorem g35_42 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 1) (.app (.var 2) (.app (.var 2) (.var 0)))))))) = some (.lam (.lam (.app (.var 1) (.app (.lam (.lam (.lam (.app (.var 1) (.app (.var 2) (.app (.var 2) (.var 0))))))) (.app (.lam (.lam (.lam (.app (.var 1) (.app (.var 2) (.app (.var 2) (.var 0))))))) (.var 0)))))) := by decide + +theorem g35_43 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 1) (.app (.app (.var 2) (.var 2)) (.var 0))))))) = some (.lam (.lam (.app (.var 1) (.app (.app (.lam (.lam (.lam (.app (.var 1) (.app (.app (.var 2) (.var 2)) (.var 0)))))) (.lam (.lam (.lam (.app (.var 1) (.app (.app (.var 2) (.var 2)) (.var 0))))))) (.var 0))))) := by decide + +theorem g35_44 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 2) (.var 0))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 2) (.var 0))))))) (.app (.lam (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 2) (.var 0)))))) (.var 0))))) := by decide + +theorem g35_44_I : headSteps 4 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 2) (.var 0))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 2) (.var 0))))))) (.app (.lam (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 2) (.var 0)))))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4))))))))))))) := by decide + +theorem g35_45 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 2) (.var 2))) (.var 0)))))) = some (.lam (.lam (.app (.app (.var 1) (.app (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 2) (.var 2))) (.var 0))))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 2) (.var 2))) (.var 0))))))) (.var 0)))) := by decide + +theorem g35_45_I : headSteps 4 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 2) (.var 2))) (.var 0)))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.app (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 2) (.var 2))) (.var 0))))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 2) (.var 2))) (.var 0))))))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) := by decide + +theorem g35_46 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 1) (.var 2)) (.var 2)) (.var 0)))))) = some (.lam (.lam (.app (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.app (.var 1) (.var 2)) (.var 2)) (.var 0)))))) (.lam (.lam (.lam (.app (.app (.app (.var 1) (.var 2)) (.var 2)) (.var 0)))))) (.var 0)))) := by decide + +theorem g35_47 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 1) (.app (.var 2) (.app (.var 0) (.var 2)))))))) = some (.lam (.lam (.app (.var 1) (.app (.lam (.lam (.lam (.app (.var 1) (.app (.var 2) (.app (.var 0) (.var 2))))))) (.app (.var 0) (.lam (.lam (.lam (.app (.var 1) (.app (.var 2) (.app (.var 0) (.var 2)))))))))))) := by decide + +theorem g35_48 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 1) (.app (.app (.var 2) (.var 0)) (.var 2))))))) = some (.lam (.lam (.app (.var 1) (.app (.app (.lam (.lam (.lam (.app (.var 1) (.app (.app (.var 2) (.var 0)) (.var 2)))))) (.var 0)) (.lam (.lam (.lam (.app (.var 1) (.app (.app (.var 2) (.var 0)) (.var 2)))))))))) := by decide + +theorem g35_49 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 2))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 2))))))) (.app (.var 0) (.lam (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 2)))))))))) := by decide + +theorem g35_49_I : headSteps 4 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 2))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 2))))))) (.app (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4))))))))) (.lam (.lam (.lam (.app (.app (.var 1) (.var 2)) (.app (.var 0) (.var 2)))))))))) := by decide + +theorem g35_50 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 2) (.var 0))) (.var 2)))))) = some (.lam (.lam (.app (.app (.var 1) (.app (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 2) (.var 0))) (.var 2))))) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 2) (.var 0))) (.var 2)))))))) := by decide + +theorem g35_50_I : headSteps 4 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 2) (.var 0))) (.var 2)))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.app (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 2) (.var 0))) (.var 2))))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4))))))))))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 2) (.var 0))) (.var 2)))))))) := by decide + +theorem g35_51 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 1) (.var 2)) (.var 0)) (.var 2)))))) = some (.lam (.lam (.app (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.app (.var 1) (.var 2)) (.var 0)) (.var 2)))))) (.var 0)) (.lam (.lam (.lam (.app (.app (.app (.var 1) (.var 2)) (.var 0)) (.var 2)))))))) := by decide + +theorem g35_52 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 1) (.app (.var 0) (.app (.var 2) (.var 2)))))))) = some (.lam (.lam (.app (.var 1) (.app (.var 0) (.app (.lam (.lam (.lam (.app (.var 1) (.app (.var 0) (.app (.var 2) (.var 2))))))) (.lam (.lam (.lam (.app (.var 1) (.app (.var 0) (.app (.var 2) (.var 2)))))))))))) := by decide + +theorem g35_53 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 1) (.app (.app (.var 0) (.var 2)) (.var 2))))))) = some (.lam (.lam (.app (.var 1) (.app (.app (.var 0) (.lam (.lam (.lam (.app (.var 1) (.app (.app (.var 0) (.var 2)) (.var 2))))))) (.lam (.lam (.lam (.app (.var 1) (.app (.app (.var 0) (.var 2)) (.var 2)))))))))) := by decide + +theorem g35_54 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.var 0)) (.app (.var 2) (.var 2))))))) = some (.lam (.lam (.app (.app (.var 1) (.var 0)) (.app (.lam (.lam (.lam (.app (.app (.var 1) (.var 0)) (.app (.var 2) (.var 2)))))) (.lam (.lam (.lam (.app (.app (.var 1) (.var 0)) (.app (.var 2) (.var 2)))))))))) := by decide + +theorem g35_54_I : headSteps 4 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.var 0)) (.app (.var 2) (.var 2))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))) (.app (.lam (.lam (.lam (.app (.app (.var 1) (.var 0)) (.app (.var 2) (.var 2)))))) (.lam (.lam (.lam (.app (.app (.var 1) (.var 0)) (.app (.var 2) (.var 2)))))))))) := by decide + +theorem g35_55 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 0) (.var 2))) (.var 2)))))) = some (.lam (.lam (.app (.app (.var 1) (.app (.var 0) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 0) (.var 2))) (.var 2))))))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 0) (.var 2))) (.var 2)))))))) := by decide + +theorem g35_55_I : headSteps 4 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 0) (.var 2))) (.var 2)))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.app (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4))))))))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 0) (.var 2))) (.var 2))))))) (.lam (.lam (.lam (.app (.app (.var 1) (.app (.var 0) (.var 2))) (.var 2)))))))) := by decide + +theorem g35_56 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 1) (.var 0)) (.var 2)) (.var 2)))))) = some (.lam (.lam (.app (.app (.app (.var 1) (.var 0)) (.lam (.lam (.lam (.app (.app (.app (.var 1) (.var 0)) (.var 2)) (.var 2)))))) (.lam (.lam (.lam (.app (.app (.app (.var 1) (.var 0)) (.var 2)) (.var 2)))))))) := by decide + +theorem g35_57 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.app (.var 2) (.app (.var 2) (.var 1)))))))) = some (.lam (.lam (.app (.var 0) (.app (.lam (.lam (.lam (.app (.var 0) (.app (.var 2) (.app (.var 2) (.var 1))))))) (.app (.lam (.lam (.lam (.app (.var 0) (.app (.var 2) (.app (.var 2) (.var 1))))))) (.var 1)))))) := by decide + +theorem g35_57_I : headSteps 14 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.app (.var 2) (.app (.var 2) (.var 1)))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.var 1) (.app (.var 1) (.app (.app (.lam (.lam (.lam (.app (.var 0) (.app (.var 2) (.app (.var 2) (.var 1))))))) (.var 1)) (.lam (.lam (.var 1)))))))) := by decide + +theorem g35_58 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 2) (.var 2)) (.var 1))))))) = some (.lam (.lam (.app (.var 0) (.app (.app (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 2) (.var 2)) (.var 1)))))) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 2) (.var 2)) (.var 1))))))) (.var 1))))) := by decide + +theorem g35_58_I : headSteps 12 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 2) (.var 2)) (.var 1))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.lam (.app (.var 0) (.app (.app (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 2) (.var 2)) (.var 1)))))) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 2) (.var 2)) (.var 1))))))) (.var 2)))))) := by decide + +theorem g35_59 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 0) (.var 2)) (.app (.var 2) (.var 1))))))) = some (.lam (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.app (.var 0) (.var 2)) (.app (.var 2) (.var 1))))))) (.app (.lam (.lam (.lam (.app (.app (.var 0) (.var 2)) (.app (.var 2) (.var 1)))))) (.var 1))))) := by decide + +theorem g35_59_I : headSteps 14 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 0) (.var 2)) (.app (.var 2) (.var 1))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.app (.var 1) (.lam (.lam (.var 1)))) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 2)))))))) := by decide + +theorem g35_60 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 2) (.var 2))) (.var 1)))))) = some (.lam (.lam (.app (.app (.var 0) (.app (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 2) (.var 2))) (.var 1))))) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 2) (.var 2))) (.var 1))))))) (.var 1)))) := by decide + +theorem g35_60_I : headSteps 20 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 2) (.var 2))) (.var 1)))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.app (.app (.app (.app (.var 0) (.app (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 2) (.var 2))) (.var 1))))) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 2) (.var 2))) (.var 1))))))) (.lam (.lam (.var 1)))) (.lam (.lam (.var 0)))) (.lam (.lam (.var 1)))) (.lam (.lam (.var 1)))) (.var 1)))) := by decide + +theorem g35_61 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 2)) (.var 2)) (.var 1)))))) = some (.lam (.lam (.app (.app (.app (.var 0) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 2)) (.var 2)) (.var 1)))))) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 2)) (.var 2)) (.var 1)))))) (.var 1)))) := by decide + +theorem g35_61_I : headSteps 17 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 2)) (.var 2)) (.var 1)))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.lam (.var 2)))) := by decide + +theorem g35_62 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.app (.var 2) (.app (.var 1) (.var 2)))))))) = some (.lam (.lam (.app (.var 0) (.app (.lam (.lam (.lam (.app (.var 0) (.app (.var 2) (.app (.var 1) (.var 2))))))) (.app (.var 1) (.lam (.lam (.lam (.app (.var 0) (.app (.var 2) (.app (.var 1) (.var 2)))))))))))) := by decide + +theorem g35_62_I : headSteps 9 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.app (.var 2) (.app (.var 1) (.var 2)))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.app (.app (.var 1) (.lam (.lam (.lam (.app (.var 0) (.app (.var 2) (.app (.var 1) (.var 2)))))))) (.app (.lam (.lam (.var 1))) (.app (.var 1) (.lam (.lam (.lam (.app (.var 0) (.app (.var 2) (.app (.var 1) (.var 2)))))))))) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 2)))))))) := by decide + +theorem g35_63 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 2) (.var 1)) (.var 2))))))) = some (.lam (.lam (.app (.var 0) (.app (.app (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 2) (.var 1)) (.var 2)))))) (.var 1)) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 2) (.var 1)) (.var 2)))))))))) := by decide + +theorem g35_63_I : headSteps 10 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 2) (.var 1)) (.var 2))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 2) (.var 1)) (.var 2))))))) (.var 1)))) := by decide + +theorem g35_64 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 0) (.var 2)) (.app (.var 1) (.var 2))))))) = some (.lam (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.app (.var 0) (.var 2)) (.app (.var 1) (.var 2))))))) (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 0) (.var 2)) (.app (.var 1) (.var 2)))))))))) := by decide + +theorem g35_64_I : headSteps 8 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 0) (.var 2)) (.app (.var 1) (.var 2))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 0) (.var 2)) (.app (.var 1) (.var 2))))))) (.lam (.lam (.var 1)))) (.app (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 3))))))) (.lam (.lam (.var 1))))))) := by decide + +theorem g35_65 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 2) (.var 1))) (.var 2)))))) = some (.lam (.lam (.app (.app (.var 0) (.app (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 2) (.var 1))) (.var 2))))) (.var 1))) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 2) (.var 1))) (.var 2)))))))) := by decide + +theorem g35_65_I : headSteps 9 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 2) (.var 1))) (.var 2)))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.app (.app (.app (.var 1) (.lam (.lam (.var 1)))) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 2)))))) (.var 1)) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 2) (.var 1))) (.var 2)))))))) := by decide + +theorem g35_66 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 2)) (.var 1)) (.var 2)))))) = some (.lam (.lam (.app (.app (.app (.var 0) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 2)) (.var 1)) (.var 2)))))) (.var 1)) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 2)) (.var 1)) (.var 2)))))))) := by decide + +theorem g35_66_I : headSteps 8 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 2)) (.var 1)) (.var 2)))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.app (.app (.var 1) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 3)))))))) (.lam (.lam (.var 1)))) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 2)) (.var 1)) (.var 2)))))))) := by decide + +theorem g35_67 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.app (.var 1) (.app (.var 2) (.var 2)))))))) = some (.lam (.lam (.app (.var 0) (.app (.var 1) (.app (.lam (.lam (.lam (.app (.var 0) (.app (.var 1) (.app (.var 2) (.var 2))))))) (.lam (.lam (.lam (.app (.var 0) (.app (.var 1) (.app (.var 2) (.var 2)))))))))))) := by decide + +theorem g35_67_I : headSteps 5 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.app (.var 1) (.app (.var 2) (.var 2)))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.app (.var 1) (.app (.lam (.lam (.lam (.app (.var 0) (.app (.var 1) (.app (.var 2) (.var 2))))))) (.lam (.lam (.lam (.app (.var 0) (.app (.var 1) (.app (.var 2) (.var 2))))))))) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 3)))))))))) := by decide + +theorem g35_68 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 1) (.var 2)) (.var 2))))))) = some (.lam (.lam (.app (.var 0) (.app (.app (.var 1) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 1) (.var 2)) (.var 2))))))) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 1) (.var 2)) (.var 2)))))))))) := by decide + +theorem g35_68_I : headSteps 5 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 1) (.var 2)) (.var 2))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.app (.app (.var 1) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 1) (.var 2)) (.var 2))))))) (.lam (.lam (.lam (.app (.var 0) (.app (.app (.var 1) (.var 2)) (.var 2))))))) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 3)))))))))) := by decide + +theorem g35_69 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 0) (.var 1)) (.app (.var 2) (.var 2))))))) = some (.lam (.lam (.app (.app (.var 0) (.var 1)) (.app (.lam (.lam (.lam (.app (.app (.var 0) (.var 1)) (.app (.var 2) (.var 2)))))) (.lam (.lam (.lam (.app (.app (.var 0) (.var 1)) (.app (.var 2) (.var 2)))))))))) := by decide + +theorem g35_69_I : headSteps 5 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 0) (.var 1)) (.app (.var 2) (.var 2))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.app (.var 1) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 3)))))))) (.app (.lam (.lam (.lam (.app (.app (.var 0) (.var 1)) (.app (.var 2) (.var 2)))))) (.lam (.lam (.lam (.app (.app (.var 0) (.var 1)) (.app (.var 2) (.var 2)))))))))) := by decide + +theorem g35_70 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 1) (.var 2))) (.var 2)))))) = some (.lam (.lam (.app (.app (.var 0) (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 1) (.var 2))) (.var 2))))))) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 1) (.var 2))) (.var 2)))))))) := by decide + +theorem g35_70_I : headSteps 5 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 1) (.var 2))) (.var 2)))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.app (.app (.var 1) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 1) (.var 2))) (.var 2)))))) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 3)))))))) (.lam (.lam (.lam (.app (.app (.var 0) (.app (.var 1) (.var 2))) (.var 2)))))))) := by decide + +theorem g35_71 : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 1)) (.var 2)) (.var 2)))))) = some (.lam (.lam (.app (.app (.app (.var 0) (.var 1)) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 1)) (.var 2)) (.var 2)))))) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 1)) (.var 2)) (.var 2)))))))) := by decide + +theorem g35_71_I : headSteps 5 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 1)) (.var 2)) (.var 2)))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.app (.app (.var 1) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 3)))))))) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 1)) (.var 2)) (.var 2)))))) (.lam (.lam (.lam (.app (.app (.app (.var 0) (.var 1)) (.var 2)) (.var 2)))))))) := by decide + +theorem g36_72 : headSteps 12 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.lam (.var 2))) (.var 0))))))) = some (.lam (.lam (.var 1))) := by decide + +theorem g36_74 : headSteps 10 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.var 2) (.app (.var 1) (.lam (.var 1))))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.var 1))) (.lam (.lam (.app (.app (.app (.lam (.var 4)) (.lam (.lam (.lam (.app (.app (.lam (.lam (.app (.lam (.lam (.app (.lam (.app (.var 0) (.lam (.lam (.app (.var 2) (.app (.var 1) (.lam (.var 1)))))))) (.app (.var 1) (.lam (.var 1)))))) (.app (.var 1) (.lam (.var 1)))))) (.lam (.var 7))) (.app (.var 1) (.lam (.var 1)))))))) (.lam (.var 3))) (.app (.var 1) (.lam (.var 1))))))))) := by decide + +theorem g36_74_I : headSteps 12 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.var 2) (.app (.var 1) (.lam (.var 1))))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 5))))))))))) (.lam (.lam (.app (.app (.app (.lam (.var 4)) (.lam (.lam (.lam (.app (.app (.lam (.lam (.app (.lam (.lam (.app (.lam (.app (.var 0) (.lam (.lam (.app (.var 2) (.app (.var 1) (.lam (.var 1)))))))) (.app (.var 1) (.lam (.var 1)))))) (.app (.var 1) (.lam (.var 1)))))) (.lam (.var 7))) (.app (.var 1) (.lam (.var 1)))))))) (.lam (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 7))))))))))) (.app (.var 1) (.lam (.var 1))))))))) := by decide + +theorem g36_75 : headSteps 5 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 0)) (.lam (.var 2)))))))) = some (.lam (.app (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 0)) (.lam (.var 2)))))) (.lam (.lam (.lam (.app (.app (.lam (.lam (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 0)) (.lam (.var 2))))))) (.var 0)) (.lam (.var 2))))) (.var 0)) (.lam (.var 2)))))))) := by decide + +theorem g36_76 : headSteps 6 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.lam (.var 1))) (.var 1))))))) = some (.lam (.app (.var 0) (.lam (.lam (.app (.app (.lam (.lam (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.lam (.var 1))) (.var 1)))))) (.lam (.var 1))) (.var 1)))) (.lam (.var 1))) (.var 1)))))) := by decide + +theorem g36_77 : headSteps 5 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.var 2) (.app (.var 0) (.lam (.var 2))))))))) = some (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.lam (.lam (.app (.lam (.app (.var 0) (.lam (.lam (.app (.var 2) (.app (.var 0) (.lam (.var 2)))))))) (.app (.var 0) (.lam (.var 2)))))) (.app (.var 0) (.lam (.var 2)))))))) (.lam (.lam (.app (.app (.var 2) (.lam (.lam (.lam (.app (.lam (.lam (.app (.lam (.app (.var 0) (.lam (.lam (.app (.var 2) (.app (.var 0) (.lam (.var 2)))))))) (.app (.var 0) (.lam (.var 2)))))) (.app (.var 0) (.lam (.var 2)))))))) (.app (.var 0) (.lam (.var 2)))))))) := by decide + +theorem g36_78 : headSteps 8 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 1) (.lam (.var 3))) (.var 0))))))) = some (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 1) (.lam (.var 3))) (.var 0)))))) := by decide + +theorem g36_80 : headSteps 7 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.var 1) (.app (.var 2) (.lam (.var 1))))))))) = some (.lam (.lam (.app (.var 1) (.app (.lam (.lam (.app (.var 1) (.app (.lam (.app (.var 0) (.lam (.lam (.app (.var 1) (.app (.var 2) (.lam (.var 1)))))))) (.lam (.var 1)))))) (.lam (.var 1)))))) := by decide + +theorem g36_81 : headSteps 6 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 3)))))))) = some (.lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 3))))))))) (.lam (.lam (.lam (.app (.app (.var 1) (.var 0)) (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 3)))))))))))))) := by decide + +theorem g36_82 : headSteps 7 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 1) (.lam (.var 1))) (.var 2))))))) = some (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 1) (.lam (.var 1))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 1) (.lam (.var 1))) (.var 2))))))))))) := by decide + +theorem g36_83 : headSteps 5 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.var 1) (.app (.var 0) (.lam (.var 3))))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.var 1) (.app (.var 0) (.lam (.var 3)))))))))) (.app (.var 0) (.lam (.lam (.lam (.app (.var 1) (.app (.var 0) (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.var 1) (.app (.var 0) (.lam (.var 3)))))))))))))))))) := by decide + +theorem g36_83_I : headSteps 7 (.lam (.lam (.app (.app (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.var 1) (.app (.var 0) (.lam (.var 3))))))))) (.var 1)) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4)))))))))))) = some (.lam (.lam (.app (.app (.var 1) (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.var 1) (.app (.var 0) (.lam (.var 3)))))))))) (.app (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 0)))) (.lam (.app (.app (.var 0) (.lam (.lam (.var 1)))) (.var 4))))))))) (.lam (.lam (.lam (.app (.var 1) (.app (.var 0) (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.var 1) (.app (.var 0) (.lam (.var 3)))))))))))))))))) := by decide + +theorem g36_84 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1))))))) = some (.lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1)))))))) (.lam (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1)))))))) (.var 1)))))) (.var 1)))))) := by decide + +theorem g36_85 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.var 2)) (.lam (.var 2)))))))) = some (.lam (.app (.app (.var 0) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.var 2)) (.lam (.var 2)))))))) (.lam (.lam (.lam (.app (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.var 2)) (.lam (.var 2)))))))) (.lam (.var 2)))))) (.lam (.var 2)))))))) := by decide + +theorem g36_86 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.var 0) (.app (.var 2) (.lam (.var 2))))))))) = some (.lam (.app (.var 0) (.app (.lam (.app (.var 0) (.lam (.lam (.app (.var 0) (.app (.var 2) (.lam (.var 2)))))))) (.lam (.lam (.lam (.app (.var 0) (.app (.lam (.lam (.app (.var 0) (.app (.lam (.app (.var 0) (.lam (.lam (.app (.var 0) (.app (.var 2) (.lam (.var 2)))))))) (.lam (.var 2)))))) (.lam (.var 2)))))))))) := by decide + +theorem g36_87 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.var 1)) (.lam (.var 3)))))))) = some (.lam (.app (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.var 1)) (.lam (.lam (.lam (.app (.app (.var 0) (.var 1)) (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.var 1)) (.lam (.var 3)))))))))))))))) (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.var 1)) (.lam (.var 3)))))))))) := by decide + +theorem g36_88 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.lam (.var 2))) (.var 2))))))) = some (.lam (.app (.app (.var 0) (.lam (.lam (.lam (.app (.app (.var 0) (.lam (.var 2))) (.lam (.lam (.app (.app (.var 0) (.lam (.var 2))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.lam (.var 2))) (.var 2)))))))))))))) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 0) (.lam (.var 2))) (.var 2)))))))) := by decide + +theorem g36_89 : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.lam (.app (.var 0) (.app (.var 1) (.lam (.var 3))))))))) = some (.lam (.app (.var 0) (.app (.lam (.lam (.app (.var 0) (.app (.var 1) (.lam (.lam (.lam (.app (.var 0) (.app (.var 1) (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.var 0) (.app (.var 1) (.lam (.var 3)))))))))))))))))) (.lam (.lam (.app (.var 0) (.lam (.lam (.app (.var 0) (.app (.var 1) (.lam (.var 3)))))))))))) := by decide + +theorem g36open_90 : headSteps 4 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.app (.var 2) (.lam (.var 2))) (.var 0))))))) = some (.lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (.lam (.app (.app (.var 3) (.lam (.var 2))) (.var 0))))))) (.lam (.app (.app (.var 1) (.lam (.lam (.app (.app (.var 3) (.lam (.lam (.app (.var 0) (.lam (.app (.app (.var 6) (.lam (.var 2))) (.var 0))))))) (.var 0))))) (.var 0))))) := by decide + +theorem g36open_91 : headSteps 4 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1)))))))) = some (.lam (.app (.app (.var 0) (.lam (.app (.var 0) (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.lam (.lam (.app (.app (.var 2) (.lam (.app (.app (.var 3) (.lam (.app (.var 0) (.lam (.app (.app (.var 5) (.var 1)) (.lam (.var 1))))))) (.lam (.var 1))))) (.lam (.var 1))))))) := by decide + +theorem g36open_92 : headSteps 4 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.var 2) (.app (.var 1) (.lam (.var 1))))))))) = some (.lam (.app (.var 0) (.app (.lam (.app (.var 0) (.lam (.app (.var 2) (.app (.var 1) (.lam (.var 1))))))) (.lam (.lam (.app (.var 2) (.app (.lam (.app (.var 3) (.app (.lam (.app (.var 0) (.lam (.app (.var 5) (.app (.var 1) (.lam (.var 1))))))) (.lam (.var 1))))) (.lam (.var 1))))))))) := by decide + +theorem g36open_93 : headSteps 4 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.app (.var 2) (.var 0)) (.lam (.var 2)))))))) = some (.lam (.app (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.lam (.app (.app (.var 3) (.var 0)) (.lam (.lam (.app (.var 0) (.lam (.app (.app (.var 6) (.var 0)) (.lam (.var 2))))))))))))) (.lam (.lam (.app (.var 0) (.lam (.app (.app (.var 3) (.var 0)) (.lam (.var 2))))))))) := by decide + +theorem g36open_94 : headSteps 4 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.app (.var 2) (.lam (.var 1))) (.var 1))))))) = some (.lam (.app (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.lam (.var 1))) (.lam (.app (.app (.var 3) (.lam (.var 1))) (.lam (.app (.var 0) (.lam (.app (.app (.var 5) (.lam (.var 1))) (.var 1))))))))))) (.lam (.app (.var 0) (.lam (.app (.app (.var 2) (.lam (.var 1))) (.var 1))))))) := by decide + +theorem g36open_95 : headSteps 4 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.var 2) (.app (.var 0) (.lam (.var 2))))))))) = some (.lam (.app (.var 0) (.app (.lam (.app (.var 1) (.app (.var 0) (.lam (.lam (.app (.var 3) (.app (.var 0) (.lam (.lam (.app (.var 0) (.lam (.app (.var 6) (.app (.var 0) (.lam (.var 2))))))))))))))) (.lam (.lam (.app (.var 0) (.lam (.app (.var 3) (.app (.var 0) (.lam (.var 2))))))))))) := by decide + +theorem g36open_96 : headSteps 6 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.lam (.var 3))) (.var 0))))))) = some (.lam (.app (.var 0) (.lam (.app (.app (.lam (.app (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.lam (.var 5))) (.var 0))))) (.lam (.var 3))) (.var 0))) (.lam (.var 2))) (.var 0))))) := by decide + +theorem g36open_97 : headSteps 5 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 2)) (.lam (.var 1)))))))) = some (.lam (.app (.app (.var 0) (.lam (.app (.app (.var 1) (.var 1)) (.lam (.var 1))))) (.lam (.lam (.app (.app (.lam (.app (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 5)) (.lam (.var 1)))))) (.var 3)) (.lam (.var 1)))) (.var 2)) (.lam (.var 1))))))) := by decide + +theorem g36open_98 : headSteps 5 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.var 1) (.app (.var 2) (.lam (.var 1))))))))) = some (.lam (.app (.app (.var 0) (.lam (.lam (.app (.lam (.app (.lam (.app (.var 0) (.lam (.app (.var 1) (.app (.var 5) (.lam (.var 1))))))) (.app (.var 3) (.lam (.var 1))))) (.app (.var 2) (.lam (.var 1))))))) (.lam (.app (.app (.var 1) (.lam (.lam (.app (.lam (.app (.lam (.app (.var 0) (.lam (.app (.var 1) (.app (.var 6) (.lam (.var 1))))))) (.app (.var 4) (.lam (.var 1))))) (.app (.var 3) (.lam (.var 1))))))) (.app (.var 1) (.lam (.var 1))))))) := by decide + +theorem g36open_100 : headSteps 11 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.lam (.var 1))) (.var 2))))))) = some (.lam (.app (.var 0) (.var 0))) := by decide + +theorem g36open_101 : headSteps 9 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.var 1) (.app (.var 0) (.lam (.var 3))))))))) = some (.lam (.app (.app (.app (.var 0) (.lam (.var 1))) (.lam (.app (.app (.app (.lam (.var 2)) (.lam (.var 2))) (.lam (.var 2))) (.app (.var 0) (.lam (.var 2)))))) (.lam (.app (.app (.lam (.app (.lam (.app (.lam (.app (.var 0) (.lam (.app (.var 1) (.app (.var 0) (.lam (.var 6))))))) (.app (.var 0) (.lam (.var 4))))) (.app (.var 0) (.lam (.var 3))))) (.lam (.var 2))) (.app (.var 0) (.lam (.var 2))))))) := by decide + +theorem g36open_102 : headSteps 6 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1))))))) = some (.lam (.app (.app (.var 0) (.lam (.app (.app (.var 0) (.lam (.var 2))) (.lam (.app (.var 0) (.lam (.app (.app (.var 0) (.lam (.var 4))) (.var 1)))))))) (.lam (.app (.var 0) (.lam (.app (.app (.var 0) (.lam (.var 3))) (.var 1))))))) := by decide + +theorem g36open_103 : headSteps 5 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.app (.var 0) (.var 2)) (.lam (.var 2)))))))) = some (.lam (.app (.app (.app (.var 0) (.var 0)) (.lam (.lam (.app (.app (.var 0) (.var 2)) (.lam (.lam (.app (.var 0) (.lam (.app (.app (.var 0) (.var 5)) (.lam (.var 2))))))))))) (.lam (.lam (.app (.var 0) (.lam (.app (.app (.var 0) (.var 3)) (.lam (.var 2))))))))) := by decide + +theorem g36open_104 : headSteps 5 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.var 0) (.app (.var 2) (.lam (.var 2))))))))) = some (.lam (.app (.app (.var 0) (.lam (.lam (.app (.var 0) (.lam (.app (.var 0) (.app (.var 3) (.lam (.var 2))))))))) (.app (.var 0) (.lam (.lam (.app (.var 0) (.app (.var 2) (.lam (.lam (.app (.var 0) (.lam (.app (.var 0) (.app (.var 5) (.lam (.var 2))))))))))))))) := by decide + +theorem g36open_106 : headSteps 7 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.app (.var 0) (.lam (.var 2))) (.var 2))))))) = some (.lam (.app (.app (.var 0) (.lam (.app (.app (.var 0) (.lam (.var 2))) (.var 1)))) (.var 0))) := by decide + +theorem g36open_107 : headSteps 7 (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.app (.var 0) (.app (.var 1) (.lam (.var 3))))))))) = some (.lam (.app (.var 0) (.app (.lam (.app (.var 0) (.app (.lam (.app (.var 0) (.lam (.app (.var 0) (.app (.var 1) (.lam (.var 4))))))) (.lam (.var 2))))) (.lam (.var 1))))) := by decide + +theorem macro34_chain_1 : headSteps 3 (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.lam (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.var 0)) (.var 2)))) (.var 0)) = some (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.lam (.app (.app (.lam (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.var 0)) (.var 3))) (.var 0)) (.var 1)))) (.var 1)) := by decide + +theorem macro34_chain_2 : headSteps 4 (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.lam (.app (.app (.lam (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.var 0)) (.var 4))) (.var 0)) (.var 2)))) (.var 0)) = some (.app (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.lam (.app (.app (.lam (.app (.app (.lam (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.var 0)) (.var 5))) (.var 0)) (.var 3))) (.var 0)) (.var 1)))) (.var 2)) (.var 1)) := by decide + +theorem macro34_chain_3 : headSteps 5 (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.lam (.app (.app (.lam (.app (.app (.lam (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.var 0)) (.var 6))) (.var 0)) (.var 4))) (.var 0)) (.var 2)))) (.var 0)) = some (.app (.app (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.lam (.app (.app (.lam (.app (.app (.lam (.app (.app (.lam (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 2) (.var 0)) (.var 1)))))) (.var 0)) (.var 7))) (.var 0)) (.var 5))) (.var 0)) (.var 3))) (.var 0)) (.var 1)))) (.var 3)) (.var 2)) (.var 1)) := by decide + +theorem macro34_pair_pump : headSteps 4 (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 0) (.var 2)) (.var 1)))))) (.lam (.app (.app (.var 0) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 0) (.var 2)) (.var 1))))))) (.var 1)))) (.var 1)) = some (.app (.app (.app (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 0) (.var 2)) (.var 1)))))) (.lam (.app (.app (.var 0) (.lam (.lam (.app (.var 1) (.lam (.app (.app (.var 0) (.var 2)) (.var 1))))))) (.var 1)))) (.var 1)) (.var 0)) := by decide + +theorem macro36_forward_1 : headSteps 3 (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.lam (.lam (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.var 1)) (.lam (.var 1)))))) (.var 0)) = some (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.lam (.lam (.app (.app (.lam (.lam (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.var 1)) (.lam (.var 1))))) (.var 1)) (.lam (.var 1)))))) (.lam (.var 1))) := by decide + +theorem macro36_forward_2 : headSteps 5 (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.lam (.lam (.app (.app (.lam (.lam (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.var 1)) (.lam (.var 1))))) (.var 1)) (.lam (.var 1)))))) (.var 0)) = some (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.lam (.lam (.app (.app (.lam (.lam (.app (.app (.lam (.lam (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.var 1)) (.lam (.var 1))))) (.var 1)) (.lam (.var 1))))) (.var 1)) (.lam (.var 1)))))) (.lam (.lam (.var 2)))) := by decide + +theorem macro36_forward_3 : headSteps 7 (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.lam (.lam (.app (.app (.lam (.lam (.app (.app (.lam (.lam (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.var 1)) (.lam (.var 1))))) (.var 1)) (.lam (.var 1))))) (.var 1)) (.lam (.var 1)))))) (.var 0)) = some (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.lam (.lam (.app (.app (.lam (.lam (.app (.app (.lam (.lam (.app (.app (.lam (.lam (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 2) (.var 1)) (.lam (.var 1))))))) (.var 1)) (.lam (.var 1))))) (.var 1)) (.lam (.var 1))))) (.var 1)) (.lam (.var 1))))) (.var 1)) (.lam (.var 1)))))) (.lam (.lam (.lam (.var 3))))) := by decide + +theorem macro36_reverse_pump : headSteps 5 (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 1) (.var 2)) (.lam (.var 1))))))) (.lam (.lam (.app (.app (.var 1) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 1) (.var 2)) (.lam (.var 1)))))))) (.lam (.var 1)))))) (.var 0)) = some (.app (.app (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 1) (.var 2)) (.lam (.var 1))))))) (.lam (.lam (.app (.app (.var 1) (.lam (.app (.var 0) (.lam (.lam (.app (.app (.var 1) (.var 2)) (.lam (.var 1)))))))) (.lam (.var 1)))))) (.lam (.lam (.var 2)))) := by decide + +theorem macro36_open_chain_1 : headSteps 2 (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 3)))))) (.lam (.app (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 4)))))) (.var 0)) (.lam (.var 2))))) = some (.app (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 3)))))) (.lam (.app (.app (.lam (.app (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 5)))))) (.var 0)) (.lam (.var 3)))) (.var 0)) (.lam (.var 2))))) (.lam (.var 1))) := by decide + +theorem macro36_open_chain_2 : headSteps 3 (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 3)))))) (.lam (.app (.app (.lam (.app (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 5)))))) (.var 0)) (.lam (.var 3)))) (.var 0)) (.lam (.var 2))))) = some (.app (.app (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 3)))))) (.lam (.app (.app (.lam (.app (.app (.lam (.app (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 6)))))) (.var 0)) (.lam (.var 4)))) (.var 0)) (.lam (.var 3)))) (.var 0)) (.lam (.var 2))))) (.lam (.var 1))) (.lam (.var 1))) := by decide + +theorem macro36_open_chain_3 : headSteps 4 (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 3)))))) (.lam (.app (.app (.lam (.app (.app (.lam (.app (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 6)))))) (.var 0)) (.lam (.var 4)))) (.var 0)) (.lam (.var 3)))) (.var 0)) (.lam (.var 2))))) = some (.app (.app (.app (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 3)))))) (.lam (.app (.app (.lam (.app (.app (.lam (.app (.app (.lam (.app (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 1) (.var 0)) (.lam (.var 7)))))) (.var 0)) (.lam (.var 5)))) (.var 0)) (.lam (.var 4)))) (.var 0)) (.lam (.var 3)))) (.var 0)) (.lam (.var 2))))) (.lam (.var 1))) (.lam (.var 1))) (.lam (.var 1))) := by decide + +theorem macro36_open_pair_pump : headSteps 3 (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 0) (.var 1)) (.lam (.var 3)))))) (.lam (.app (.app (.var 0) (.lam (.app (.var 0) (.lam (.app (.app (.var 0) (.var 1)) (.lam (.var 4))))))) (.lam (.var 2))))) = some (.app (.app (.app (.lam (.app (.var 0) (.lam (.app (.app (.var 0) (.var 1)) (.lam (.var 3)))))) (.lam (.app (.app (.var 0) (.lam (.app (.var 0) (.lam (.app (.app (.var 0) (.var 1)) (.lam (.var 4))))))) (.lam (.var 2))))) (.lam (.var 1))) (.lam (.var 1))) := by decide + +theorem rem_d_kd : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 0) (.var 0))))) = some (.lam (.app (.var 0) (.var 0))) := by decide + +theorem rem_dk_d : headSteps 3 (.app (.lam (.app (.var 0) (.lam (.var 1)))) (.lam (.app (.var 0) (.var 0)))) = some (.lam (.app (.var 0) (.var 0))) := by decide + +theorem rem_d_dk : headSteps 4 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.lam (.var 1))))) = some (.lam (.app (.var 0) (.lam (.var 1)))) := by decide + +theorem rem_d_kkd : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.lam (.app (.var 0) (.var 0)))))) = some (.lam (.lam (.app (.var 0) (.var 0)))) := by decide + +theorem rem_d_kdk : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 0) (.lam (.var 1)))))) = some (.lam (.app (.var 0) (.lam (.var 1)))) := by decide + +theorem rem_dk_kd : headSteps 2 (.app (.lam (.app (.var 0) (.lam (.var 1)))) (.lam (.lam (.app (.var 0) (.var 0))))) = some (.lam (.app (.var 0) (.var 0))) := by decide + +theorem rem_v_d : headSteps 1 (.app (.lam (.lam (.app (.var 1) (.var 1)))) (.lam (.app (.var 0) (.var 0)))) = some (.lam (.app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.var 0))))) := by decide + +theorem rem_d_v : headSteps 2 (.app (.lam (.app (.var 0) (.var 0))) (.lam (.lam (.app (.var 1) (.var 1))))) = some (.lam (.app (.lam (.lam (.app (.var 1) (.var 1)))) (.lam (.lam (.app (.var 1) (.var 1)))))) := by decide + +end Blc.SelfintFloor37 diff --git a/lean/Blc/SelfintFloorApp.lean b/lean/Blc/SelfintFloorApp.lean new file mode 100644 index 00000000..b1447244 --- /dev/null +++ b/lean/Blc/SelfintFloorApp.lean @@ -0,0 +1,735 @@ +/- +Application-rooted interpreters below 27 bits. + +A minimal application-rooted self-interpreter is headed by a redex +`(λx. B') A₁ …` whose argument is closed, so by `minimal_linear_free_count` +its binder is nonlinear. At most 26 bits the exact size identity forces +three abstractions, five leaves and index sum at most two. The shape +analysis then leaves only `(λx. x x) (λr. λq. B)` with `B` a three-leaf +tree over `q, r`; one `r` leads by two head steps to an abstraction-rooted +interpreter with three abstractions (impossible by `lam_rooted_four_lams`), +two `r`s give six concrete terms refuted by finite head reduction. With +`lam_rooted_bound`, strong induction on the wire gives `SelfintSizeBound 27`. +-/ +import Blc.SelfintFloorLambda + +namespace Blc.SelfintFloor +open Term SelfintLowerBound SelfintNonlinearChain SelfintCapture SelfintWireCost + +/-! ### Shape lemmas for terms with few abstractions -/ + +theorem closed_lamCount_pos (t : Term) (h : FreeUnder 0 t) : 1 ≤ lamCount t := by + induction t with + | var n => exact absurd h (Nat.not_lt_zero n) + | lam b => simp [lamCount] + | app f a ihf _ => have := ihf h.1; simp only [lamCount]; omega + +theorem lamfree_indexSum (t : Term) (h0 : lamCount t = 0) (hf : FreeUnder 1 t) : + indexSum t = 0 := by + induction t with + | var n => have : n < 1 := hf; simp only [indexSum]; omega + | lam b => simp [lamCount] at h0 + | app f a ihf iha => + simp only [lamCount] at h0 + simp only [indexSum, ihf (by omega) hf.1, iha (by omega) hf.2] + +theorem lamfree_indexSum_eq_occ1 (t : Term) (h0 : lamCount t = 0) (hf : FreeUnder 2 t) : + indexSum t = occ 1 t := by + induction t with + | var n => + have : n < 2 := hf + simp only [indexSum, occ] + split <;> omega + | lam b => simp [lamCount] at h0 + | app f a ihf iha => + simp only [lamCount] at h0 + simp only [indexSum, occ, ihf (by omega) hf.1, iha (by omega) hf.2] + +theorem lamfree_live (t : Term) (h0 : lamCount t = 0) : live t = 0 := by + induction t with + | var n => rfl + | lam b => simp [lamCount] at h0 + | app f a ihf iha => + simp only [lamCount] at h0 + simp only [live, ihf (by omega), iha (by omega)] + +theorem lamfree_appBodies (t : Term) (h0 : lamCount t = 0) : AppBodies t := by + induction t with + | var n => trivial + | lam b => simp [lamCount] at h0 + | app f a ihf iha => + simp only [lamCount] at h0 + exact ⟨ihf (by omega), iha (by omega)⟩ + +theorem leafCount_pos (t : Term) : 1 ≤ leafCount t := by + induction t with + | var n => simp [leafCount] + | lam b ih => simpa [leafCount] using ih + | app f a ihf iha => simp only [leafCount]; omega + +theorem lamfree_leaf1 (t : Term) (h0 : lamCount t = 0) (h1 : leafCount t = 1) : + ∃ n, t = .var n := by + cases t with + | var n => exact ⟨n, rfl⟩ + | lam b => simp [lamCount] at h0 + | app f a => + exfalso + simp only [leafCount] at h1 + have hf := leafCount_pos f + have ha := leafCount_pos a + omega + +theorem lamfree_isApp (t : Term) (h0 : lamCount t = 0) (h2 : 2 ≤ leafCount t) : IsApp t := by + cases t with + | var n => simp [leafCount] at h2 + | lam b => simp [lamCount] at h0 + | app f a => trivial + +theorem lamfree_leaf2 (t : Term) (h0 : lamCount t = 0) (h2 : leafCount t = 2) : + ∃ n m, t = .app (.var n) (.var m) := by + cases t with + | var n => simp [leafCount] at h2 + | lam b => simp [lamCount] at h0 + | app f a => + simp only [lamCount] at h0 + simp only [leafCount] at h2 + have hf := leafCount_pos f + have ha := leafCount_pos a + obtain ⟨n, rfl⟩ := lamfree_leaf1 f (by omega) (by omega) + obtain ⟨m, rfl⟩ := lamfree_leaf1 a (by omega) (by omega) + exact ⟨n, m, rfl⟩ + +/-- A closed term with exactly one abstraction is that abstraction over an +abstraction-free body. -/ +theorem closed_lam_one (t : Term) (hc : FreeUnder 0 t) (h1 : lamCount t = 1) : + ∃ T, t = .lam T ∧ lamCount T = 0 := by + cases t with + | var n => exact absurd hc (Nat.not_lt_zero n) + | lam b => exact ⟨b, rfl, by simp [lamCount] at h1; omega⟩ + | app f a => + exfalso + have hf := closed_lamCount_pos f hc.1 + have ha := closed_lamCount_pos a hc.2 + simp only [lamCount] at h1 + omega + +/-- A term with exactly one abstraction and free variables below 1: either +every body is an application, or all indices are zero, or the abstraction is +vacuous. -/ +theorem single_lam_shape (t : Term) (h1 : lamCount t = 1) (hf : FreeUnder 1 t) : + AppBodies t ∨ indexSum t = 0 ∨ live t = 0 := by + induction t with + | var n => simp [lamCount] at h1 + | lam b _ => + have hb : lamCount b = 0 := by simp [lamCount] at h1; omega + have hfb : FreeUnder 2 b := hf + cases b with + | var m => + have hm : m < 2 := hfb + by_cases hm0 : m = 0 + · subst hm0 + exact Or.inr (Or.inl rfl) + · have hm1 : m = 1 := by omega + subst hm1 + right; right + simp [live, occ] + | lam b' => simp [lamCount] at hb + | app g h => exact Or.inl ⟨trivial, lamfree_appBodies _ hb⟩ + | app f a ihf iha => + simp only [lamCount] at h1 + by_cases hlf : lamCount f = 1 + · have ha0 : lamCount a = 0 := by omega + rcases ihf hlf hf.1 with h | h | h + · exact Or.inl ⟨h, lamfree_appBodies a ha0⟩ + · right; left + simp only [indexSum, h, lamfree_indexSum a ha0 hf.2] + · right; right + simp only [live, h, lamfree_live a ha0] + · have hf0 : lamCount f = 0 := by omega + have hla : lamCount a = 1 := by omega + rcases iha hla hf.2 with h | h | h + · exact Or.inl ⟨lamfree_appBodies f hf0, h⟩ + · right; left + simp only [indexSum, h, lamfree_indexSum f hf0 hf.1] + · right; right + simp only [live, h, lamfree_live f hf0] + +theorem lamCount_shift (t : Term) (d c : Nat) : lamCount (shift d c t) = lamCount t := by + induction t generalizing c with + | var n => simp only [shift]; split <;> rfl + | lam b ih => simp [shift, lamCount, ih] + | app f a ihf iha => simp [shift, lamCount, ihf, iha] + +theorem lamCount_subst (t s : Term) (j : Nat) : + lamCount (substDec j s t) = lamCount t + occ j t * lamCount s := by + induction t generalizing s j with + | var n => + simp only [substDec, occ, lamCount] + split <;> simp_all + split <;> simp [lamCount] + | lam b ih => + simp only [substDec, lamCount, occ, ih, lamCount_shift] + omega + | app f a ihf iha => + simp only [substDec, lamCount, occ, ihf, iha, Nat.add_mul] + omega + +theorem occ_le_leafCount (t : Term) (j : Nat) : occ j t ≤ leafCount t := by + induction t generalizing j with + | var n => simp only [occ, leafCount]; split <;> omega + | lam b ih => exact ih (j + 1) + | app f a ihf iha => simp only [occ, leafCount]; have := ihf j; have := iha j; omega + +theorem lamfree_leafCount_eq (t : Term) (h0 : lamCount t = 0) (hf : FreeUnder 2 t) : + leafCount t = occ 0 t + occ 1 t := by + induction t with + | var n => + have : n < 2 := hf + simp only [leafCount, occ] + split <;> split <;> omega + | lam b => simp [lamCount] at h0 + | app f a ihf iha => + simp only [lamCount] at h0 + simp only [leafCount, occ, ihf (by omega) hf.1, iha (by omega) hf.2] + omega + +theorem lamfree_nonlinear (t : Term) (h0 : lamCount t = 0) : nonlinear t = 0 := by + have := nonlinear_le_lamCount t + omega + +theorem chain_of_le_one (t : Term) (h : nonlinear t ≤ 1) : Chain t := by + apply Classical.byContradiction + intro hc + have := not_chain_two_nonlinear t hc + omega + +theorem freeLeaves_closed (t : Term) (c : Nat) (h : FreeUnder c t) : freeLeaves c t = 0 := by + induction t generalizing c with + | var n => have : n < c := h; simp only [freeLeaves]; split <;> omega + | lam b ih => exact ih (c + 1) h + | app f a ihf iha => simp only [freeLeaves, ihf c h.1, iha c h.2] + +/-- The head redex of a minimal application-rooted interpreter is nonlinear: +its argument is closed, so an affine contraction would shrink the wire. -/ +theorem minimal_head_nonlinear {B' A : Term} (hm : MinimalInterpreter (.app (.lam B') A)) + (hA : Closed A) : 2 ≤ occ 0 B' := by + have h1 := minimal_no_erasing Context.hole B' A hm + by_cases h : occ 0 B' = 1 + · have h2 := minimal_linear_free_count Context.hole B' A hm h + rw [freeLeaves_closed A 0 hA] at h2 + omega + · omega + +/-- The three-leaf abstraction-free trees over `q = var 0` (once) and +`r = var 1` (twice). -/ +theorem three_leaf_enum (t : Term) (h0 : lamCount t = 0) (hf : FreeUnder 2 t) + (h3 : leafCount t = 3) (h1 : occ 1 t = 2) (hq : occ 0 t = 1) : + t = .app (.app (.var 1) (.var 1)) (.var 0) ∨ t = .app (.var 1) (.app (.var 1) (.var 0)) ∨ + t = .app (.app (.var 1) (.var 0)) (.var 1) ∨ t = .app (.var 1) (.app (.var 0) (.var 1)) ∨ + t = .app (.app (.var 0) (.var 1)) (.var 1) ∨ t = .app (.var 0) (.app (.var 1) (.var 1)) := by + cases t with + | var n => simp [leafCount] at h3 + | lam b => simp [lamCount] at h0 + | app f a => + simp only [lamCount] at h0 + simp only [leafCount] at h3 + have hpf := leafCount_pos f + have hpa := leafCount_pos a + by_cases hf1 : leafCount f = 1 + · obtain ⟨n, rfl⟩ := lamfree_leaf1 f (by omega) hf1 + obtain ⟨m, k, rfl⟩ := lamfree_leaf2 a (by omega) (by omega) + have hn : n < 2 := hf.1 + have hm : m < 2 := hf.2.1 + have hk : k < 2 := hf.2.2 + have hn' : n = 0 ∨ n = 1 := by omega + have hm' : m = 0 ∨ m = 1 := by omega + have hk' : k = 0 ∨ k = 1 := by omega + rcases hn' with rfl | rfl <;> rcases hm' with rfl | rfl <;> rcases hk' with rfl | rfl <;> + first | decide | (simp [occ] at h1 hq) + · have hf2 : leafCount f = 2 := by omega + obtain ⟨n, m, rfl⟩ := lamfree_leaf2 f (by omega) hf2 + obtain ⟨k, rfl⟩ := lamfree_leaf1 a (by omega) (by omega) + have hn : n < 2 := hf.1.1 + have hm : m < 2 := hf.1.2 + have hk : k < 2 := hf.2 + have hn' : n = 0 ∨ n = 1 := by omega + have hm' : m = 0 ∨ m = 1 := by omega + have hk' : k = 0 ∨ k = 1 := by omega + rcases hn' with rfl | rfl <;> rcases hm' with rfl | rfl <;> rcases hk' with rfl | rfl <;> + first | decide | (simp [occ] at h1 hq) + +/-! ### Finite refutation tools -/ + +/-- The identity-source invocation of `E`. -/ +def idCall (E : Term) : Term := + .app (.app E (.var 0)) (streamOf (blcCode (.lam (.var 0))) (.var 1)) + +theorem interpreter_idCall_betas {E : Term} (hE : IsSelfInterpreter E) : + Betas (idCall E) idOutput := by + obtain ⟨w, hw, ho⟩ := hE.2 (.lam (.var 0)) (by decide) + have heq := normalForm_betas_eq idOutput_normal ho + subst heq + exact hw + +theorem interpreter_landing {E s : Term} {k : Nat} (hE : IsSelfInterpreter E) + (hs : headSteps k (idCall E) = some s) (hsn : headStep s = none) : Betas s idOutput := + headLanding_nf hs hsn (interpreter_idCall_betas hE) idOutput_normal + +theorem var_betas_eq {n : Nat} {g : Term} (h : Betas (.var n) g) : g = .var n := + normalForm_betas_eq (fun _ hb => nft_no_beta (show NFt (.var n) from trivial) hb) h + +/-- A rigid landing with one argument cannot reach the two-argument output. -/ +theorem no_one_arg (U : Term) (h : Betas (.app (.var 0) U) idOutput) : False := by + obtain ⟨g, b, he, hg, _⟩ := rigid_betas_shape (Rigid.var 0) h + have := var_betas_eq hg + subst this + simp [idOutput] at he + +/-- A rigid landing with three arguments cannot reach the two-argument output. -/ +theorem no_three_args (U₁ U₂ U₃ : Term) + (h : Betas (.app (.app (.app (.var 0) U₁) U₂) U₃) idOutput) : False := by + obtain ⟨g, b, he, hg, _⟩ := rigid_betas_shape (Rigid.app _ (Rigid.app _ (Rigid.var 0))) h + simp only [idOutput, Term.app.injEq] at he + obtain ⟨he1, _⟩ := he + rw [← he1] at hg + obtain ⟨g', b', he', hg', _⟩ := rigid_betas_shape (Rigid.app _ (Rigid.var 0)) hg + simp only [Term.app.injEq] at he' + obtain ⟨he1', _⟩ := he' + rw [← he1'] at hg' + obtain ⟨g'', b'', he'', _, _⟩ := rigid_betas_shape (Rigid.var 0) hg' + cases he'' + +/-- With two arguments, the first must reduce to the quoted identity's value. -/ +theorem two_args_first (U₁ U₂ : Term) (h : Betas (.app (.app (.var 0) U₁) U₂) idOutput) : + Betas U₁ (.lam (.lam (.var 0))) := by + obtain ⟨g, b, he, hg, _⟩ := rigid_betas_shape (Rigid.app _ (Rigid.var 0)) h + simp only [idOutput, Term.app.injEq] at he + obtain ⟨he1, _⟩ := he + rw [← he1] at hg + obtain ⟨g', b', he', _, hb'⟩ := rigid_betas_shape (Rigid.var 0) hg + simp only [Term.app.injEq] at he' + obtain ⟨_, rfl⟩ := he' + exact hb' + +theorem headSteps_comp {a b : Nat} {t u v : Term} (h1 : headSteps a t = some u) + (h2 : headSteps b u = some v) : headSteps (a + b) t = some v := + headSteps_of_headReds (headReds_trans (headReds_of_headSteps a h1) (headReds_of_headSteps b h2)) + +theorem cycle_diverges {m p : Nat} {t u : Term} (hm : headSteps m t = some u) + (hp : headSteps p u = some u) (hp0 : 0 < p) : HeadDiverges t := by + apply headDiverges_of_unbounded + intro n + have hiter : ∀ i, headSteps (p * i) u = some u := by + intro i + induction i with + | zero => rfl + | succ i ih => rw [Nat.mul_succ]; exact headSteps_comp ih hp + refine ⟨m + p * (n + 1), u, ?_, headSteps_comp hm (hiter (n + 1))⟩ + have : 1 * (n + 1) ≤ p * (n + 1) := Nat.mul_le_mul_right (n + 1) hp0 + omega + +/-- Executable shape probes, so that `decide` can certify a landing. -/ +def headShape : Term → Option (Nat × Nat) + | .var n => some (n, 0) + | .app f _ => (headShape f).map fun p => (p.1, p.2 + 1) + | .lam _ => none + +theorem headShape_one {s : Term} (h : headShape s = some (0, 1)) : ∃ U, s = .app (.var 0) U := by + cases s with + | var n => simp [headShape] at h + | lam b => simp [headShape] at h + | app f a => + cases f with + | var n => + simp [headShape] at h + obtain ⟨rfl, _⟩ := h + exact ⟨a, rfl⟩ + | lam b => simp [headShape] at h + | app g x => + simp only [headShape, Option.map_map, Option.map_eq_some_iff] at h + obtain ⟨p, _, hp⟩ := h + simp at hp + +theorem headShape_two {s : Term} (h : headShape s = some (0, 2)) : + ∃ U₁ U₂, s = .app (.app (.var 0) U₁) U₂ := by + cases s with + | var n => simp [headShape] at h + | lam b => simp [headShape] at h + | app f a => + simp only [headShape, Option.map_eq_some_iff] at h + obtain ⟨p, hp, hpe⟩ := h + have : p = (0, 1) := by + cases p; simp at hpe; obtain ⟨h1, h2⟩ := hpe; simp [h1]; omega + subst this + obtain ⟨U, rfl⟩ := headShape_one hp + exact ⟨U, a, rfl⟩ + +theorem headShape_three {s : Term} (h : headShape s = some (0, 3)) : + ∃ U₁ U₂ U₃, s = .app (.app (.app (.var 0) U₁) U₂) U₃ := by + cases s with + | var n => simp [headShape] at h + | lam b => simp [headShape] at h + | app f a => + simp only [headShape, Option.map_eq_some_iff] at h + obtain ⟨p, hp, hpe⟩ := h + have : p = (0, 2) := by + cases p; simp at hpe; obtain ⟨h1, h2⟩ := hpe; simp [h1]; omega + subst this + obtain ⟨U₁, U₂, rfl⟩ := headShape_two hp + exact ⟨U₁, U₂, a, rfl⟩ + +def firstArg : Term → Option Term + | .app (.app (.var 0) u) _ => some u + | _ => none + +theorem firstArg_some {s u : Term} (h : firstArg s = some u) : ∃ U₂, s = .app (.app (.var 0) u) U₂ := by + cases s with + | var n => simp [firstArg] at h + | lam b => simp [firstArg] at h + | app f a => + cases f with + | var n => simp [firstArg] at h + | lam b => simp [firstArg] at h + | app g x => + cases g with + | var n => + cases n with + | zero => simp [firstArg] at h; subst h; exact ⟨a, rfl⟩ + | succ n => simp [firstArg] at h + | lam b => simp [firstArg] at h + | app _ _ => simp [firstArg] at h + +/-- Landing certificate: `k` head steps land on a head-normal form of the given shape. -/ +theorem landing_shape (E : Term) (k : Nat) (hv : Nat) + (hs : ((headSteps k (idCall E)).bind fun s => if headStep s = none then headShape s else none) = + some (0, hv)) : + ∃ s, headSteps k (idCall E) = some s ∧ headStep s = none ∧ headShape s = some (0, hv) := by + cases h : headSteps k (idCall E) with + | none => simp [h] at hs + | some s => + simp only [h, Option.bind_some] at hs + split at hs + · exact ⟨s, rfl, by assumption, hs⟩ + · simp at hs + +/-! ### The six concrete 26-bit candidates -/ + +def cand (B : Term) : Term := .app (.lam (.app (.var 0) (.var 0))) (.lam (.lam B)) + +def cycleCheck (t : Term) (m p : Nat) : Bool := + match headSteps m t with + | some u => decide (headSteps p u = some u) + | none => false + +theorem cycleCheck_spec {t : Term} {m p : Nat} (h : cycleCheck t m p = true) : + ∃ u, headSteps m t = some u ∧ headSteps p u = some u := by + unfold cycleCheck at h + split at h + · rename_i u hu + exact ⟨u, hu, of_decide_eq_true h⟩ + · exact absurd h (by simp) + +theorem refute_cycle : ¬ IsSelfInterpreter (cand (.app (.app (.var 1) (.var 1)) (.var 0))) := by + intro hE + have hb := interpreter_idCall_betas hE + obtain ⟨u, hu, hcyc⟩ := cycleCheck_spec + (t := idCall (cand (.app (.app (.var 1) (.var 1)) (.var 0)))) (m := 1) (p := 2) (by decide) + have hdiv := cycle_diverges hu hcyc (by decide) + exact headDiverges_not_hasNormalForm hdiv ⟨_, hb, idOutput_normal⟩ + +theorem refute_one_arg : ¬ IsSelfInterpreter (cand (.app (.var 1) (.app (.var 1) (.var 0)))) := by + intro hE + obtain ⟨s, hs, hsn, hsh⟩ := landing_shape (cand (.app (.var 1) (.app (.var 1) (.var 0)))) 7 1 (by decide) + obtain ⟨U, rfl⟩ := headShape_one hsh + exact no_one_arg U (interpreter_landing hE hs hsn) + +theorem refute_three_args_a : ¬ IsSelfInterpreter (cand (.app (.app (.var 1) (.var 0)) (.var 1))) := by + intro hE + obtain ⟨s, hs, hsn, hsh⟩ := landing_shape (cand (.app (.app (.var 1) (.var 0)) (.var 1))) 5 3 (by decide) + obtain ⟨U₁, U₂, U₃, rfl⟩ := headShape_three hsh + exact no_three_args U₁ U₂ U₃ (interpreter_landing hE hs hsn) + +theorem refute_three_args_b : ¬ IsSelfInterpreter (cand (.app (.app (.var 0) (.var 1)) (.var 1))) := by + intro hE + obtain ⟨s, hs, hsn, hsh⟩ := landing_shape (cand (.app (.app (.var 0) (.var 1)) (.var 1))) 3 3 (by decide) + obtain ⟨U₁, U₂, U₃, rfl⟩ := headShape_three hsh + exact no_three_args U₁ U₂ U₃ (interpreter_landing hE hs hsn) + +theorem refute_normal_first : ¬ IsSelfInterpreter (cand (.app (.var 1) (.app (.var 0) (.var 1)))) := by + intro hE + have hfa : ((headSteps 5 (idCall (cand (.app (.var 1) (.app (.var 0) (.var 1)))))).bind + fun s => if headStep s = none then firstArg s else none) = + some (.lam (.lam (.app (.var 1) (.app (.var 0) (.var 1))))) := by decide + cases h : headSteps 5 (idCall (cand (.app (.var 1) (.app (.var 0) (.var 1))))) with + | none => simp [h] at hfa + | some s => + simp only [h, Option.bind_some] at hfa + split at hfa + · rename_i hsn + obtain ⟨U₂, rfl⟩ := firstArg_some hfa + have hb := two_args_first _ U₂ (interpreter_landing hE h hsn) + have := normalForm_betas_eq (fun _ hb => nft_no_beta (by decide) hb) hb + cases this + · simp at hfa + +theorem refute_redex_first : ¬ IsSelfInterpreter (cand (.app (.var 0) (.app (.var 1) (.var 1)))) := by + intro hE + have hfa : ((headSteps 3 (idCall (cand (.app (.var 0) (.app (.var 1) (.var 1)))))).bind + fun s => if headStep s = none then firstArg s else none) = + some (.app (.lam (.lam (.app (.var 0) (.app (.var 1) (.var 1))))) + (.lam (.lam (.app (.var 0) (.app (.var 1) (.var 1)))))) := by decide + cases h : headSteps 3 (idCall (cand (.app (.var 0) (.app (.var 1) (.var 1))))) with + | none => simp [h] at hfa + | some s => + simp only [h, Option.bind_some] at hfa + split at hfa + · rename_i hsn + obtain ⟨U₂, rfl⟩ := firstArg_some hfa + have hb := two_args_first _ U₂ (interpreter_landing hE h hsn) + -- the first argument is a redex whose only reduct is `λq. q (A A)`, rigid under the lambda + have hstep : Beta (Term.app (.lam (.lam (.app (.var 0) (.app (.var 1) (.var 1))))) + (.lam (.lam (.app (.var 0) (.app (.var 1) (.var 1)))))) + (.lam (.app (.var 0) (.app (.lam (.lam (.app (.var 0) (.app (.var 1) (.var 1))))) + (.lam (.lam (.app (.var 0) (.app (.var 1) (.var 1)))))))) := by + have := Beta.beta (.lam (.app (.var 0) (.app (.var 1) (.var 1)))) + (.lam (.lam (.app (.var 0) (.app (.var 1) (.var 1))))) + simpa [contract, substDec, shift] using this + have hjoin := betas_preserve_nf (Betas.head hstep (Betas.refl _)) hb + (fun _ hb => nft_no_beta (by decide) hb) + obtain ⟨n, hn, hbody⟩ := lam_betas_shape hjoin + cases hn + obtain ⟨g, b, he, _, _⟩ := rigid_betas_shape (Rigid.var 0) hbody + cases he + · simp at hfa + +/-! ### The classification of minimal application-rooted interpreters below 27 bits -/ + +/-- Shared descent step: `(λx. B') A →β B'[x := A]` keeps the interpreter contract. -/ +theorem descend_interpreter {B' A : Term} (hE : IsSelfInterpreter (.app (.lam B') A)) : + IsSelfInterpreter (contract B' A) := + selfInterpreter_beta hE (Beta.beta B' A) + +theorem contract_lam_closed (B A : Term) (hA : Closed A) : + contract (.lam B) A = .lam (substDec 1 A B) := by + simp only [contract, substDec, shift_closed 1 0 hA] + +theorem contract_self (A : Term) : contract (.app (.var 0) (.var 0)) A = .app A A := by + simp [contract, substDec] + +/-- A minimal application-rooted self-interpreter has at least 27 bits. -/ +theorem app_rooted_min_bound {f a : Term} (hm : MinimalInterpreter (.app f a)) : + 27 ≤ wire (.app f a) := by + have hE := hm.1 + have hclosed : FreeUnder 0 (Term.app f a) := hE.1 + have hL := live_le_lamCount (Term.app f a) + have hV := leaves_bound (Term.app f a) + have hfl : freeLeaves 0 (Term.app f a) = 0 := freeLeaves_closed _ 0 hclosed + have hn := selfInterpreter_two_nonlinear hE + have hl := selfInterpreter_three_live hE + have hx := selfinterpreter_indexSum_pos _ hE + have hw := wire_identity (Term.app f a) + apply Classical.byContradiction + intro hlt + have hL3 : lamCount (Term.app f a) = 3 := by omega + have hV5 : leafCount (Term.app f a) = 5 := by omega + have hX2 : indexSum (Term.app f a) ≤ 2 := by omega + cases f with + | var n => exact absurd hclosed.1 (Nat.not_lt_zero n) + | app f₂ a₂ => + cases f₂ with + | var n => exact absurd hclosed.1.1 (Nat.not_lt_zero n) + | app f₃ a₃ => + have h1 := closed_lamCount_pos f₃ hclosed.1.1.1 + have h2 := closed_lamCount_pos a₃ hclosed.1.1.2 + have h3 := closed_lamCount_pos a₂ hclosed.1.2 + have h4 := closed_lamCount_pos a hclosed.2 + simp only [lamCount] at hL3 + omega + | lam B' => + have h3 := closed_lamCount_pos a₂ hclosed.1.2 + have h4 := closed_lamCount_pos a hclosed.2 + simp only [lamCount] at hL3 + have hB0 : lamCount B' = 0 := by omega + obtain ⟨T₂, rfl, hT₂⟩ := closed_lam_one a₂ hclosed.1.2 (by omega) + obtain ⟨T, rfl, hT⟩ := closed_lam_one a hclosed.2 (by omega) + have hfB : FreeUnder 1 B' := hclosed.1.1 + have hfT₂ : FreeUnder 1 T₂ := hclosed.1.2 + have hfT : FreeUnder 1 T := hclosed.2 + have hz : indexSum (Term.app (Term.app (Term.lam B') (Term.lam T₂)) (Term.lam T)) = 0 := by + simp only [indexSum, lamfree_indexSum B' hB0 hfB, lamfree_indexSum T₂ hT₂ hfT₂, + lamfree_indexSum T hT hfT] + omega + | lam B' => + have hfB : FreeUnder 1 B' := hclosed.1 + have hca : Closed a := hclosed.2 + have hocc : 2 ≤ occ 0 B' := minimal_head_nonlinear hm hca + have ha1 := closed_lamCount_pos a hca + simp only [lamCount] at hL3 + have hc := selfInterpreter_not_chain hE + by_cases hB0 : lamCount B' = 0 + · -- the body of the head redex is abstraction-free: `(λx. x x) A` with `A` two abstractions + have ha2 : lamCount a = 2 := by omega + have hliveB : live B' = 0 := lamfree_live B' hB0 + have hnlB : nonlinear B' = 0 := lamfree_nonlinear B' hB0 + have hlE : live (Term.app (Term.lam B') a) = 1 + live a := by + simp only [live, hliveB, if_pos (show 0 < occ 0 B' by omega)] + have hla := live_le_lamCount a + have hlive_a : live a = 2 := by omega + have hna : 1 ≤ nonlinear a := by + by_cases h : nonlinear a = 0 + · exfalso + exact hc ⟨chain_of_affine B' hnlB, chain_of_affine a h, Or.inr h⟩ + · omega + have hfa : freeLeaves 0 a = 0 := freeLeaves_closed a 0 hca + have hVa := leaves_bound a + have hleafB : leafCount B' ≤ 2 := by simp only [leafCount] at hV5; omega + have hoccle := occ_le_leafCount B' 0 + obtain ⟨n, m, rfl⟩ := lamfree_leaf2 B' hB0 (by omega) + have hn0 : n = 0 := by have : n < 1 := hfB.1; omega + have hm0 : m = 0 := by have : m < 1 := hfB.2; omega + subst hn0 hm0 + have hleafa : leafCount a = 3 := by simp only [leafCount] at hV5; omega + have hXa : indexSum a ≤ 2 := by simp only [indexSum] at hX2; omega + have hXa1 : 1 ≤ indexSum a := by simp only [indexSum] at hx; omega + cases a with + | var n => exact absurd hca (Nat.not_lt_zero n) + | app g h => + have hg := closed_lamCount_pos g hca.1 + have hh := closed_lamCount_pos h hca.2 + simp only [lamCount] at ha2 + obtain ⟨Tg, rfl, hTg⟩ := closed_lam_one g hca.1 (by omega) + obtain ⟨Th, rfl, hTh⟩ := closed_lam_one h hca.2 (by omega) + have hz : indexSum (Term.app (Term.lam Tg) (Term.lam Th)) = 0 := by + simp only [indexSum, lamfree_indexSum Tg hTg hca.1, lamfree_indexSum Th hTh hca.2] + omega + | lam B_r => + have hfr : FreeUnder 1 B_r := hca + have hBr1 : lamCount B_r = 1 := by simp only [lamCount] at ha2; omega + have hliveBr := live_le_lamCount B_r + have hBr_live : live B_r = 1 ∧ 0 < occ 0 B_r := by + simp only [live] at hlive_a + split at hlive_a <;> omega + cases B_r with + | var n => simp [lamCount] at hBr1 + | app g h => + rcases single_lam_shape _ hBr1 hfr with hA | hX0 | hl0 + · exact appBodies_not_selfInterpreter + (Term.app (Term.lam (Term.app (Term.var 0) (Term.var 0))) (Term.lam (Term.app g h))) + ⟨⟨trivial, trivial, trivial⟩, trivial, hA⟩ hE + · simp only [indexSum] at hX0 hXa1 + omega + · omega + | lam B_q => + have hBq0 : lamCount B_q = 0 := by simp only [lamCount] at hBr1; omega + have hfq : FreeUnder 2 B_q := hfr + have hleafq : leafCount B_q = 3 := by simpa [leafCount] using hleafa + have hr : 0 < occ 1 B_q := hBr_live.2 + have hq : 0 < occ 0 B_q := by + have := hBr_live.1 + simp only [live, lamfree_live B_q hBq0] at this + split at this <;> omega + have hXq : indexSum B_q = occ 1 B_q := lamfree_indexSum_eq_occ1 B_q hBq0 hfq + have hsum := lamfree_leafCount_eq B_q hBq0 hfq + simp only [indexSum, hXq] at hXa hXa1 + by_cases h1 : occ 1 B_q = 1 + · -- two head steps reach an abstraction-rooted interpreter with three abstractions + have hs1 := descend_interpreter hE + rw [contract_self] at hs1 + have hs2 := descend_interpreter hs1 + rw [contract_lam_closed _ _ hca] at hs2 + have h4 := lam_rooted_four_lams hs2 + simp only [lamCount, lamCount_subst, hBq0, h1] at h4 + omega + · have h2 : occ 1 B_q = 2 := by omega + have hq1 : occ 0 B_q = 1 := by omega + rcases three_leaf_enum B_q hBq0 hfq hleafq h2 hq1 with rfl | rfl | rfl | rfl | rfl | rfl + · exact refute_cycle hE + · exact refute_one_arg hE + · exact refute_three_args_a hE + · exact refute_normal_first hE + · exact refute_three_args_b hE + · exact refute_redex_first hE + · -- one abstraction in the body, one in the closed argument + have hB1 : lamCount B' = 1 := by omega + have ha1' : lamCount a = 1 := by omega + obtain ⟨Tw, rfl, hTw⟩ := closed_lam_one a hca ha1' + have hfw : FreeUnder 1 Tw := hca + have hna : 2 ≤ occ 0 Tw := by + apply Classical.byContradiction + intro hlt2 + apply hc + have hnlTw : nonlinear Tw = 0 := lamfree_nonlinear Tw hTw + have hnla : nonlinear (Term.lam Tw) = 0 := by + simp only [nonlinear, hnlTw] + split <;> omega + exact ⟨chain_of_le_one B' (by have := nonlinear_le_lamCount B'; omega), + chain_of_affine _ hnla, Or.inr hnla⟩ + have hleafTw : 2 ≤ leafCount Tw := Nat.le_trans hna (occ_le_leafCount Tw 0) + have hleafB : leafCount B' ≤ 3 := by simp only [leafCount] at hV5; omega + have hliveE : live (Term.app (Term.lam B') (Term.lam Tw)) = live B' + 2 := by + simp only [live, lamfree_live Tw hTw, if_pos (show 0 < occ 0 B' by omega), + if_pos (show 0 < occ 0 Tw by omega)] + have hliveB : live B' = 1 := by have := live_le_lamCount B'; omega + cases B' with + | var n => simp [lamCount] at hB1 + | lam T => + have hT0 : lamCount T = 0 := by simp only [lamCount] at hB1; omega + have hfT : FreeUnder 2 T := hfB + have hoccT : 2 ≤ occ 1 T := hocc + have hliveT : 0 < occ 0 T := by + have := hliveB + simp only [live, lamfree_live T hT0] at this + split at this <;> omega + have hleafT := lamfree_leafCount_eq T hT0 hfT + have hleafT3 : leafCount T ≤ 3 := by simpa [leafCount] using hleafB + have hT1 : occ 1 T = 2 := by omega + have hs := descend_interpreter hE + rw [contract_lam_closed _ _ hca] at hs + have h4 := lam_rooted_four_lams hs + simp only [lamCount, lamCount_subst, hT0, hT1, hTw] at h4 + omega + | app g h => + rcases single_lam_shape _ hB1 hfB with hA | hX0 | hl0 + · exact appBodies_not_selfInterpreter (Term.app (Term.lam (Term.app g h)) (Term.lam Tw)) + ⟨⟨trivial, hA⟩, lamfree_isApp Tw hTw hleafTw, lamfree_appBodies Tw hTw⟩ hE + · have hz : indexSum (Term.app (Term.lam (Term.app g h)) (Term.lam Tw)) = 0 := by + simp only [indexSum, lamfree_indexSum Tw hTw hfw] at hX0 ⊢ + omega + omega + · omega + +/-- Every minimal self-interpreter has at least 27 bits. -/ +theorem minimal_bound {E : Term} (hm : MinimalInterpreter E) : 27 ≤ wire E := by + cases E with + | var n => exact absurd hm.1.1 (Nat.not_lt_zero n) + | lam B => exact lam_rooted_bound hm.1 + | app f a => exact app_rooted_min_bound hm + +/-- Every self-interpreter has at least 27 bits: a smaller one would contain +a minimal one, which the shape analysis excludes. -/ +theorem selfintSizeBound_27 : SelfintSizeBound 27 := by + have key : ∀ n, ∀ E : Term, IsSelfInterpreter E → wire E = n → 27 ≤ n := by + intro n + induction n using Nat.strongRecOn with + | ind n ih => + intro E hE hn + by_cases hmin : ∀ E', IsSelfInterpreter E' → wire E ≤ wire E' + · have := minimal_bound ⟨hE, hmin⟩ + omega + · apply Classical.byContradiction + intro hlt + have : ∃ E', IsSelfInterpreter E' ∧ wire E' < wire E := by + apply Classical.byContradiction + intro hno + apply hmin + intro E' hE' + apply Classical.byContradiction + intro hle + exact hno ⟨E', hE', by omega⟩ + obtain ⟨E', hE', hlt'⟩ := this + have := ih (wire E') (by omega) E' hE' rfl + omega + intro E hE + exact key _ E hE rfl + +end Blc.SelfintFloor diff --git a/lean/Blc/SelfintFloorArg.lean b/lean/Blc/SelfintFloorArg.lean new file mode 100644 index 00000000..2e6469ef --- /dev/null +++ b/lean/Blc/SelfintFloorArg.lean @@ -0,0 +1,259 @@ +/- +Wide arguments. + +`ArgOne t` says every application argument in `t` mentions at most one +distinct free variable. The property is preserved by full beta reduction: +a contracted argument is itself an argument, so substituting it for a +variable never widens another argument's support. Scott quotation cells, +K and F satisfy it, and so does the public invocation `E C (⌜S⌝ ++ N)` +whenever `E` does. The required normal output for the closed source +`S = λf g x. f x (g x)` violates it at the argument `g x`. Hence every +self-interpreter contains an application whose argument mentions two +distinct variables. +-/ +import Blc.SelfintProof +import Blc.Confluence +import Blc.SelfintCapture + +namespace Blc.SelfintFloor +open Term SelfintCapture + +/-- At most one distinct free variable. -/ +def NoTwo (t : Term) : Prop := ∀ i j, 0 < occ i t → 0 < occ j t → i = j + +/-- Every application argument has at most one distinct free variable. -/ +def ArgOne : Term → Prop + | .var _ => True + | .lam b => ArgOne b + | .app f a => ArgOne f ∧ ArgOne a ∧ NoTwo a + +theorem occ_of_freeUnder (t : Term) (k i : Nat) (h : FreeUnder k t) (hi : k ≤ i) : + occ i t = 0 := by + induction t generalizing k i with + | var n => + have hn : n < k := h + simp only [occ] + split <;> omega + | lam b ih => exact ih (k + 1) (i + 1) h (by omega) + | app f a ihf iha => simp only [occ, ihf k i h.1 hi, iha k i h.2 hi] + +theorem noTwo_of_closed (t : Term) (h : Closed t) : NoTwo t := by + intro i j hi _ + rw [occ_of_freeUnder t 0 i h (Nat.zero_le i)] at hi + exact absurd hi (Nat.lt_irrefl 0) + +theorem noTwo_var (n : Nat) : NoTwo (.var n) := by + intro i j hi hj + simp only [occ] at hi hj + split at hi <;> split at hj <;> omega + +/-- Reduction cannot introduce an absent free variable. -/ +theorem noTwo_beta {t u : Term} (h : Beta t u) (ht : NoTwo t) : NoTwo u := by + intro i j hi hj + apply ht i j + · by_cases hz : occ i t = 0 + · have := occ_beta_zero h i hz; omega + · omega + · by_cases hz : occ j t = 0 + · have := occ_beta_zero h j hz; omega + · omega + +/-- Occurrence count of `i` in `shift 1 c t`, as one expression. -/ +theorem occ_shift_cases (t : Term) (i c : Nat) : + occ i (shift 1 c t) = + if i < c then occ i t else if i = c then 0 else occ (i - 1) t := by + by_cases h1 : i < c + · rw [if_pos h1, occ_shift_lt t i c h1] + · rw [if_neg h1] + by_cases h2 : i = c + · rw [if_pos h2, h2, occ_shift_eq] + · rw [if_neg h2] + have hi : i = (i - 1) + 1 := by omega + rw [hi, occ_shift_ge t (i - 1) c (by omega)] + simp + +theorem noTwo_shift (t : Term) (c : Nat) (h : NoTwo t) : NoTwo (shift 1 c t) := by + intro i j hi hj + rw [occ_shift_cases] at hi hj + by_cases hic : i < c + · rw [if_pos hic] at hi + by_cases hjc : j < c + · rw [if_pos hjc] at hj + exact h i j hi hj + · rw [if_neg hjc] at hj + by_cases hjc' : j = c + · rw [if_pos hjc'] at hj; omega + · rw [if_neg hjc'] at hj + have := h i (j - 1) hi hj + omega + · rw [if_neg hic] at hi + by_cases hic' : i = c + · rw [if_pos hic'] at hi; omega + · rw [if_neg hic'] at hi + by_cases hjc : j < c + · rw [if_pos hjc] at hj + have := h (i - 1) j hi hj + omega + · rw [if_neg hjc] at hj + by_cases hjc' : j = c + · rw [if_pos hjc'] at hj; omega + · rw [if_neg hjc'] at hj + have := h (i - 1) (j - 1) hi hj + omega + +/-- Occurrence count of `i` in `substDec j s t`, as one expression. -/ +theorem occ_substDec_cases (t s : Term) (i j : Nat) : + occ i (substDec j s t) = + occ (if i < j then i else i + 1) t + occ j t * occ i s := by + by_cases h : i < j + · rw [if_pos h, occ_substDec_lt t s i j h] + · rw [if_neg h, occ_substDec_ge t s i j (by omega)] + +theorem noTwo_subst (t s : Term) (j : Nat) (ht : NoTwo t) (hs : NoTwo s) : + NoTwo (substDec j s t) := by + intro i k hi hk + rw [occ_substDec_cases] at hi hk + have hi' : 0 < occ (if i < j then i else i + 1) t ∨ (0 < occ j t ∧ 0 < occ i s) := by + by_cases h1 : 0 < occ (if i < j then i else i + 1) t + · exact Or.inl h1 + · right + have hm : 0 < occ j t * occ i s := by omega + exact ⟨Nat.pos_of_mul_pos_right hm, Nat.pos_of_mul_pos_left hm⟩ + have hk' : 0 < occ (if k < j then k else k + 1) t ∨ (0 < occ j t ∧ 0 < occ k s) := by + by_cases h1 : 0 < occ (if k < j then k else k + 1) t + · exact Or.inl h1 + · right + have hm : 0 < occ j t * occ k s := by omega + exact ⟨Nat.pos_of_mul_pos_right hm, Nat.pos_of_mul_pos_left hm⟩ + rcases hi' with hi' | ⟨hjt, his⟩ <;> rcases hk' with hk' | ⟨hjt', hks⟩ + · have := ht _ _ hi' hk' + split at this <;> split at this <;> omega + · have := ht _ _ hi' hjt' + split at this <;> omega + · have := ht _ _ hjt hk' + split at this <;> omega + · exact hs i k his hks + +theorem argOne_shift (t : Term) (c : Nat) (h : ArgOne t) : ArgOne (shift 1 c t) := by + induction t generalizing c with + | var n => simp only [shift]; split <;> trivial + | lam b ih => exact ih (c + 1) h + | app f a ihf iha => + exact ⟨ihf c h.1, iha c h.2.1, noTwo_shift a c h.2.2⟩ + +/-- Substituting a narrow argument for a variable keeps every argument narrow. -/ +theorem argOne_subst (t s : Term) (j : Nat) (ht : ArgOne t) (hs : ArgOne s) + (hn : NoTwo s) : ArgOne (substDec j s t) := by + induction t generalizing s j with + | var n => + simp only [substDec] + split + · exact hs + · split <;> trivial + | lam b ih => exact ih (shift 1 0 s) (j + 1) ht (argOne_shift s 0 hs) (noTwo_shift s 0 hn) + | app f a ihf iha => + exact ⟨ihf s j ht.1 hs hn, iha s j ht.2.1 hs hn, noTwo_subst a s j ht.2.2 hn⟩ + +theorem argOne_beta {t u : Term} (h : Beta t u) (ht : ArgOne t) : ArgOne u := by + induction h with + | beta b a => exact argOne_subst b a 0 ht.1 ht.2.1 ht.2.2 + | appL a h ih => exact ⟨ih ht.1, ht.2.1, ht.2.2⟩ + | appR f h ih => exact ⟨ht.1, ih ht.2.1, noTwo_beta h ht.2.2⟩ + | lam h ih => exact ih ht + +theorem argOne_betas {t u : Term} (h : Betas t u) (ht : ArgOne t) : ArgOne u := by + induction h with + | refl => exact ht + | head hb _ ih => exact ih (argOne_beta hb ht) + +/-- A cell with closed data mentions exactly the variables of its tail. -/ +theorem occ_pairT_closed (a r : Term) (ha : Closed a) (i : Nat) : + occ i (pairT a r) = occ i r := by + simp only [pairT, occ, shift_closed 1 0 ha, occ_of_freeUnder a 0 (i + 1) ha (by omega), + occ_shift_ge r i 0 (by omega)] + simp + +/-- Quotation cells with closed argument-narrow data keep every argument +narrow, and mention no variable beyond those of their tail. -/ +theorem argOne_pair (a r : Term) (ha : Closed a) (haa : ArgOne a) + (hr : ArgOne r) (hn : NoTwo r) : + ArgOne (pairT a r) ∧ NoTwo (pairT a r) := by + refine ⟨⟨⟨trivial, argOne_shift a 0 haa, noTwo_shift a 0 (noTwo_of_closed a ha)⟩, + argOne_shift r 0 hr, noTwo_shift r 0 hn⟩, ?_⟩ + intro i j hi hj + rw [occ_pairT_closed a r ha] at hi hj + exact hn i j hi hj + +theorem argOne_bit (b : Bool) : ArgOne (churchBit b) := by + cases b <;> exact trivial + +theorem argOne_stream (bs : List Bool) (r : Term) (hr : ArgOne r) (hn : NoTwo r) : + ArgOne (streamOf bs r) ∧ NoTwo (streamOf bs r) := by + induction bs with + | nil => exact ⟨hr, hn⟩ + | cons b bs ih => + exact argOne_pair (churchBit b) (streamOf bs r) (churchBit_closed b) (argOne_bit b) + ih.1 ih.2 + +/-- The closed source `S = λf g x. f x (g x)`. -/ +def sTerm : Term := + .lam (.lam (.lam (.app (.app (.var 2) (.var 0)) (.app (.var 1) (.var 0))))) + +/-- The required normal output `C (λz. S) N`. -/ +def sOutput : Term := .app (.app (.var 0) (.lam sTerm)) (.var 1) + +theorem sOutput_normal : NormalForm sOutput := + fun _ hb => nft_no_beta (by decide : NFt sOutput) hb + +/-- The argument `g x` of the output mentions two distinct variables. -/ +theorem sOutput_not_argOne : ¬ ArgOne sOutput := by + intro h + have h1 : NoTwo (.app (.var 1) (.var 0)) := h.1.2.1.2.2 + have := h1 0 1 (by decide) (by decide) + omega + +/-- Unconditional structural necessity: some application argument of +every self-interpreter mentions two distinct variables. The quotation +cannot supply such an argument; the output for `S` requires one. -/ +theorem selfInterpreter_not_argOne (E : Term) (hE : IsSelfInterpreter E) : + ¬ ArgOne E := by + intro hA + obtain ⟨u, hsource, htarget⟩ := hE.2 sTerm (by decide) + have heq : u = sOutput := normalForm_betas_eq sOutput_normal htarget + subst heq + have hstream := argOne_stream (blcCode sTerm) (.var 1) trivial (noTwo_var 1) + have hs : ArgOne (.app (.app E (.var 0)) (streamOf (blcCode sTerm) (.var 1))) := + ⟨⟨hA, trivial, noTwo_var 0⟩, hstream.1, hstream.2⟩ + exact sOutput_not_argOne (argOne_betas hsource hs) + +/-- A concrete wide-argument witness: some application argument mentions +two distinct free variables. -/ +def HasWideArg : Term → Prop + | .var _ => False + | .lam b => HasWideArg b + | .app f a => HasWideArg f ∨ HasWideArg a ∨ ∃ i j, i ≠ j ∧ 0 < occ i a ∧ 0 < occ j a + +theorem hasWideArg_of_not_argOne (t : Term) (h : ¬ ArgOne t) : HasWideArg t := by + induction t with + | var n => exact (h trivial).elim + | lam b ih => exact ih h + | app f a ihf iha => + by_cases hf : ArgOne f + · by_cases ha : ArgOne a + · refine Or.inr (Or.inr ?_) + apply Classical.byContradiction + intro hw + apply h + refine ⟨hf, ha, ?_⟩ + intro i j hi hj + apply Classical.byContradiction + intro hij + exact hw ⟨i, j, hij, hi, hj⟩ + · exact Or.inr (Or.inl (iha ha)) + · exact Or.inl (ihf hf) + +theorem selfInterpreter_hasWideArg (E : Term) (hE : IsSelfInterpreter E) : + HasWideArg E := + hasWideArg_of_not_argOne E (selfInterpreter_not_argOne E hE) + +end Blc.SelfintFloor diff --git a/lean/Blc/SelfintFloorCount.lean b/lean/Blc/SelfintFloorCount.lean new file mode 100644 index 00000000..de6fedde --- /dev/null +++ b/lean/Blc/SelfintFloorCount.lean @@ -0,0 +1,211 @@ +/- +A counting floor from the kernel-checked +incomparable nonlinear pair (`selfInterpreter_not_chain`) and the live +capture witness (`selfinterpreter_has_live_capture`). + +The size identity for an arbitrary (open) term is +`wire t = 2L + 4V - 2 + X`; charging every live binder its lambda and +its bound leaves gives the inductive inequality +`4·nonlinear + 6·live + 4·freeLeaves + indexSum ≤ wire + 2`. +Two incomparable nonlinear binders and a live capture force three live +binders, so with `indexSum ≥ 1` every self-interpreter has at least +25 bits. +-/ +import Blc.SelfintNonlinearChain +import Blc.SelfintCapture +import Blc.SelfintWireCost + +namespace Blc.SelfintFloor +open Term SelfintLowerBound SelfintNonlinearChain SelfintCapture SelfintWireCost + +/-- Number of live binders: abstractions whose own variable occurs. -/ +def live : Term → Nat + | .var _ => 0 + | .lam b => live b + if 0 < occ 0 b then 1 else 0 + | .app f a => live f + live a + +theorem nonlinear_le_live (t : Term) : nonlinear t ≤ live t := by + induction t with + | var n => simp [nonlinear, live] + | lam b ih => + simp only [nonlinear, live] + split <;> split <;> omega + | app f a ihf iha => + simp only [nonlinear, live] + omega + +/-- Every live binder costs its lambda and at least one leaf per bound +occurrence; a nonlinear one costs at least two leaves. Free leaves and +index bits are charged exactly. -/ +theorem count_wire_bound (t : Term) : + 4 * nonlinear t + 6 * live t + 4 * freeLeaves 0 t + indexSum t ≤ wire t + 2 := by + induction t with + | var n => simp [nonlinear, live, freeLeaves, indexSum]; omega + | lam b ih => + have hs := freeLeaves_split b 0 + simp only [nonlinear, live, freeLeaves, indexSum, wire_lam] + split <;> split <;> omega + | app f a ihf iha => + simp only [nonlinear, live, freeLeaves, indexSum, wire_app] + omega + +/-- Number of enclosing local variables (indices below `d`) that occur. -/ +def outerLive : Nat → Term → Nat + | 0, _ => 0 + | d + 1, t => outerLive d t + if 0 < occ d t then 1 else 0 + +theorem outerLive_lam (d : Nat) (b : Term) : + outerLive (d + 1) b = outerLive d (.lam b) + if 0 < occ 0 b then 1 else 0 := by + induction d with + | zero => simp [outerLive] + | succ d ih => + have h1 : outerLive (d + 1 + 1) b = + outerLive (d + 1) b + if 0 < occ (d + 1) b then 1 else 0 := rfl + have h2 : outerLive (d + 1) (.lam b) = + outerLive d (.lam b) + if 0 < occ (d + 1) b then 1 else 0 := rfl + rw [h1, h2, ih] + omega + +theorem outerLive_app_left (d : Nat) (f a : Term) : + outerLive d f ≤ outerLive d (.app f a) := by + induction d with + | zero => exact Nat.le_refl _ + | succ d ih => + simp only [outerLive, occ] + split <;> split <;> omega + +theorem outerLive_app_right (d : Nat) (f a : Term) : + outerLive d a ≤ outerLive d (.app f a) := by + induction d with + | zero => exact Nat.le_refl _ + | succ d ih => + simp only [outerLive, occ] + split <;> split <;> omega + +theorem outerLive_pos (d i : Nat) (t : Term) (hi : i < d) (h : 0 < occ i t) : + 1 ≤ outerLive d t := by + induction d with + | zero => omega + | succ d ih => + simp only [outerLive] + by_cases hid : i = d + · subst hid + rw [if_pos h] + omega + · have := ih (by omega) + omega + +/-- A live capture supplies a live binder and a second variable, bound +either inside the term or by an enclosing local binder. -/ +theorem capture_live (d : Nat) (t : Term) (h : HasLiveCapture d t) : + 2 ≤ live t + outerLive d t := by + induction t generalizing d with + | var n => exact h.elim + | lam b ih => + rcases h with h | ⟨hl, i, hi, hc⟩ + · have := ih (d + 1) h + rw [outerLive_lam] at this + simp only [live] + omega + · have h1 : 1 ≤ outerLive d (.lam b) := + outerLive_pos d i (.lam b) hi (by simpa only [occ] using hc) + simp only [live, if_pos hl] + omega + | app f a ihf iha => + rcases h with h | h + · have := ihf d h + have := outerLive_app_left d f a + simp only [live] + omega + · have := iha d h + have := outerLive_app_right d f a + simp only [live] + omega + +theorem not_chain_two_nonlinear (t : Term) (h : ¬ Chain t) : 2 ≤ nonlinear t := by + induction t with + | var n => exact (h trivial).elim + | lam b ih => + have := ih h + simp only [nonlinear] + omega + | app f a ihf iha => + by_cases hf : Chain f + · by_cases ha : Chain a + · have hz : ¬ (nonlinear f = 0 ∨ nonlinear a = 0) := fun hz => h ⟨hf, ha, hz⟩ + simp only [nonlinear] + omega + · have := iha ha + simp only [nonlinear] + omega + · have := ihf hf + simp only [nonlinear] + omega + +/-- Two incomparable nonlinear binders and a live capture need three live +binders, counting an enclosing captured local as live. -/ +theorem not_chain_capture_live (d : Nat) (t : Term) (hc : ¬ Chain t) + (hl : HasLiveCapture d t) : 3 ≤ live t + outerLive d t := by + induction t generalizing d with + | var n => exact hl.elim + | lam b ih => + rcases hl with hl | ⟨hlive, i, hi, hocc⟩ + · have := ih (d + 1) hc hl + rw [outerLive_lam] at this + simp only [live] + omega + · have h2 := not_chain_two_nonlinear b hc + have h3 := nonlinear_le_live b + simp only [live, if_pos hlive] + omega + | app f a ihf iha => + have hlf := outerLive_app_left d f a + have hla := outerLive_app_right d f a + have hnf := nonlinear_le_live f + have hna := nonlinear_le_live a + by_cases hcf : Chain f + · by_cases hca : Chain a + · have hz : ¬ (nonlinear f = 0 ∨ nonlinear a = 0) := fun hz => hc ⟨hcf, hca, hz⟩ + rcases hl with hl | hl + · have := capture_live d f hl + simp only [live] + omega + · have := capture_live d a hl + simp only [live] + omega + · have h2 := not_chain_two_nonlinear a hca + rcases hl with hl | hl + · have := capture_live d f hl + simp only [live] + omega + · have := iha d hca hl + simp only [live] + omega + · have h2 := not_chain_two_nonlinear f hcf + rcases hl with hl | hl + · have := ihf d hcf hl + simp only [live] + omega + · have := capture_live d a hl + simp only [live] + omega + +theorem selfInterpreter_three_live {E : Term} (hE : IsSelfInterpreter E) : + 3 ≤ live E := by + have h := not_chain_capture_live 0 E (selfInterpreter_not_chain hE) + (selfinterpreter_has_live_capture E hE) + simpa [outerLive] using h + +/-- Every self-interpreter has at least 25 bits: two nonlinear binders +(20 bits), a third live binder with its leaf (6 bits), and one unit of +de Bruijn index, less the two-bit endpoint correction. -/ +theorem selfintSizeBound_25 : SelfintSizeBound 25 := by + intro E hE + have h1 := count_wire_bound E + have h2 := selfInterpreter_two_nonlinear hE + have h3 := selfInterpreter_three_live hE + have h4 := selfinterpreter_indexSum_pos E hE + simp only [wire] at h1 + omega + +end Blc.SelfintFloor diff --git a/lean/Blc/SelfintFloorEmerge.lean b/lean/Blc/SelfintFloorEmerge.lean new file mode 100644 index 00000000..a22b8798 --- /dev/null +++ b/lean/Blc/SelfintFloorEmerge.lean @@ -0,0 +1,228 @@ +/- +The stream must be consumed by an emerging +abstraction, so some abstraction body of every self-interpreter is not an +application. + +`E C (⌜I⌝ ++ N)` reduces to the normal rigid form `C (λz.I) N`. Head +factorization lands on a head-normal form reducing to it; that form is not +an abstraction, so every head step along the way is a weak-head step on an +application-rooted term. If `E C` never head-reduces to an abstraction, all +those steps happen inside `E C`, the landing is `R Q` with `R` rigid, and +the Scott cell `Q` would have to reduce to the variable `N`. Hence +`E C` head-reduces to an abstraction. + +If every abstraction body in `E` is an application (`AppBodies`), weak-head +steps preserve that and keep the root an application: contracting +`(λx.B) A` yields `B[x := A]`, whose root is `B`'s application root. So no +abstraction can emerge and `E` is not a self-interpreter. Consequently a +self-interpreter contains an abstraction whose body is an abstraction or a +variable (`HasNonAppBody`). +-/ +import Blc.SelfintProof +import Blc.Confluence +import Blc.NormalOrder + +namespace Blc.SelfintFloor +open Term + +def IsApp : Term → Prop + | .app _ _ => True + | _ => False + +/-- Every abstraction body is an application. -/ +def AppBodies : Term → Prop + | .var _ => True + | .lam b => IsApp b ∧ AppBodies b + | .app f a => AppBodies f ∧ AppBodies a + +theorem isApp_shift (t : Term) (d c : Nat) (h : IsApp t) : IsApp (shift d c t) := by + cases t with + | app f a => trivial + | var n => exact h.elim + | lam b => exact h.elim + +theorem isApp_substDec (t s : Term) (j : Nat) (h : IsApp t) : IsApp (substDec j s t) := by + cases t with + | app f a => trivial + | var n => exact h.elim + | lam b => exact h.elim + +theorem appBodies_shift (t : Term) (d c : Nat) (h : AppBodies t) : + AppBodies (shift d c t) := by + induction t generalizing c with + | var n => simp only [shift]; split <;> trivial + | lam b ih => exact ⟨isApp_shift b d (c + 1) h.1, ih (c + 1) h.2⟩ + | app f a ihf iha => exact ⟨ihf c h.1, iha c h.2⟩ + +theorem appBodies_substDec (t s : Term) (j : Nat) (ht : AppBodies t) (hs : AppBodies s) : + AppBodies (substDec j s t) := by + induction t generalizing s j with + | var n => + simp only [substDec] + split + · exact hs + · split <;> trivial + | lam b ih => + exact ⟨isApp_substDec b _ _ ht.1, ih (shift 1 0 s) (j + 1) ht.2 (appBodies_shift s 1 0 hs)⟩ + | app f a ihf iha => exact ⟨ihf s j ht.1 hs, iha s j ht.2 hs⟩ + +/-- A weak-head step on an application-rooted term with application bodies +yields an application-rooted term with application bodies. -/ +theorem appBodies_headStep {t u : Term} (ht : AppBodies t) (hi : IsApp t) + (h : headStep t = some u) : AppBodies u ∧ IsApp u := by + induction t generalizing u with + | var n => exact hi.elim + | lam b ih => exact hi.elim + | app f a ihf iha => + cases f with + | lam b => + simp only [headStep, Option.some.injEq] at h + subst h + exact ⟨appBodies_substDec b a 0 ht.1.2 ht.2, isApp_substDec b a 0 ht.1.1⟩ + | var n => simp [headStep] at h + | app g x => + simp only [headStep, Option.map_eq_some_iff] at h + obtain ⟨f', hf', rfl⟩ := h + obtain ⟨hA, hI⟩ := ihf ht.1 trivial hf' + exact ⟨⟨hA, ht.2⟩, trivial⟩ + +theorem appBodies_headSteps (k : Nat) {t u : Term} (ht : AppBodies t) (hi : IsApp t) + (h : headSteps k t = some u) : AppBodies u ∧ IsApp u := by + induction k generalizing t with + | zero => + simp only [headSteps, Option.some.injEq] at h + subst h + exact ⟨ht, hi⟩ + | succ k ih => + simp only [headSteps, Option.bind_eq_some_iff] at h + obtain ⟨v, hv, hrest⟩ := h + obtain ⟨hA, hI⟩ := appBodies_headStep ht hi hv + exact ih hA hI hrest + +/-- While the function never becomes an abstraction, head steps of `f a` +are head steps of `f`. -/ +theorem headSteps_app_of_noLam (k : Nat) (f a p : Term) + (hno : ∀ j f', headSteps j f = some f' → ¬ IsLam f') + (h : headSteps k (.app f a) = some p) : + ∃ f', headSteps k f = some f' ∧ p = .app f' a := by + induction k generalizing f with + | zero => + simp only [headSteps, Option.some.injEq] at h + exact ⟨f, rfl, h.symm⟩ + | succ k ih => + simp only [headSteps, Option.bind_eq_some_iff] at h + obtain ⟨v, hv, hrest⟩ := h + have hfl : ¬ IsLam f := hno 0 f rfl + have hstep : ∃ f₁, headStep f = some f₁ ∧ v = .app f₁ a := by + cases f with + | lam b => exact (hfl trivial).elim + | var n => simp [headStep] at hv + | app g x => + simp only [headStep, Option.map_eq_some_iff] at hv + obtain ⟨f₁, hf₁, rfl⟩ := hv + exact ⟨f₁, hf₁, rfl⟩ + obtain ⟨f₁, hf₁, rfl⟩ := hstep + have hno' : ∀ j f', headSteps j f₁ = some f' → ¬ IsLam f' := by + intro j f' hj + apply hno (j + 1) f' + simp [headSteps, hf₁, hj] + obtain ⟨f', hf', rfl⟩ := ih f₁ hno' hrest + refine ⟨f', ?_, rfl⟩ + simp [headSteps, hf₁, hf'] + +theorem rigid_of_headStep_none {t : Term} (h : headStep t = none) (hl : ¬ IsLam t) : + Rigid t := by + induction t with + | var n => exact .var n + | lam b ih => exact (hl trivial).elim + | app f a ihf iha => + apply Rigid.app a + cases f with + | var n => exact .var n + | lam b => simp [headStep] at h + | app g x => + apply ihf + · simpa only [headStep, Option.map_eq_none_iff] using h + · exact fun h => h + +/-- The stream argument of the identity's quotation is a Scott cell. -/ +theorem quoteI_cell (R : Term) : ∃ b', streamOf (blcCode (.lam (.var 0))) R = .lam b' := by + rw [show blcCode (.lam (.var 0)) = false :: false :: blcCode (.var 0) from rfl, streamOf_cons] + exact ⟨_, rfl⟩ + +/-- The required output for the identity. -/ +def idOutput : Term := .app (.app (.var 0) (.lam (.lam (.var 0)))) (.var 1) + +theorem idOutput_normal : NormalForm idOutput := + fun _ hb => nft_no_beta (by decide : NFt idOutput) hb + +/-- `E C` head-reduces to an abstraction: the public stream must be consumed +by an emerging binder, since a rigid `E C` would leave the Scott cell pending +where the rigid output carries the variable `N`. -/ +theorem selfInterpreter_stream_consumed {E : Term} (hE : IsSelfInterpreter E) : + ∃ k f', headSteps k (.app E (.var 0)) = some f' ∧ IsLam f' := by + apply Classical.byContradiction + intro hcon + have hno : ∀ j f', headSteps j (.app E (.var 0)) = some f' → ¬ IsLam f' := by + intro j f' hj hl + exact hcon ⟨j, f', hj, hl⟩ + obtain ⟨w, hsource, htarget⟩ := hE.2 (.lam (.var 0)) (by decide) + have heq : w = idOutput := normalForm_betas_eq idOutput_normal htarget + subst heq + obtain ⟨k, p, hk, hpn, hp⟩ := headFactorizes_nf hsource idOutput_normal + obtain ⟨f', hf', rfl⟩ := headSteps_app_of_noLam k _ _ p hno hk + have hfl : ¬ IsLam f' := hno k f' hf' + have hrig : Rigid f' := by + apply rigid_of_headStep_none _ hfl + cases f' with + | lam b => exact (hfl trivial).elim + | var n => rfl + | app g x => + simpa only [headStep, Option.map_eq_none_iff] using hpn + obtain ⟨g, b, hout, _, hQ⟩ := rigid_betas_shape hrig hp + simp only [idOutput, Term.app.injEq] at hout + obtain ⟨_, rfl⟩ := hout + obtain ⟨b', hb'⟩ := quoteI_cell (.var 1) + rw [hb'] at hQ + obtain ⟨n, hn, _⟩ := lam_betas_shape hQ + cases hn + +/-- If every abstraction body is an application, no abstraction can emerge +at the root under weak-head reduction, so the stream is never consumed. -/ +theorem appBodies_not_selfInterpreter (E : Term) (hA : AppBodies E) : + ¬ IsSelfInterpreter E := by + intro hE + obtain ⟨k, f', hk, hl⟩ := selfInterpreter_stream_consumed hE + have h := appBodies_headSteps k (t := .app E (.var 0)) ⟨hA, trivial⟩ trivial hk + cases f' with + | lam b => exact h.2 + | var n => exact hl + | app f a => exact hl + +/-- Witness form: some abstraction body is a variable or an abstraction. -/ +def HasNonAppBody : Term → Prop + | .var _ => False + | .lam b => ¬ IsApp b ∨ HasNonAppBody b + | .app f a => HasNonAppBody f ∨ HasNonAppBody a + +theorem hasNonAppBody_of_not_appBodies (t : Term) (h : ¬ AppBodies t) : + HasNonAppBody t := by + induction t with + | var n => exact (h trivial).elim + | lam b ih => + by_cases hb : IsApp b + · exact Or.inr (ih (fun hA => h ⟨hb, hA⟩)) + · exact Or.inl hb + | app f a ihf iha => + by_cases hf : AppBodies f + · exact Or.inr (iha (fun ha => h ⟨hf, ha⟩)) + · exact Or.inl (ihf hf) + +/-- Every self-interpreter has an abstraction whose body is an abstraction +or a variable: a literal two-lambda interface, an identity, or an inner +`λx. λy. …` from which the stream binder can emerge. -/ +theorem selfInterpreter_hasNonAppBody {E : Term} (hE : IsSelfInterpreter E) : + HasNonAppBody E := + hasNonAppBody_of_not_appBodies E (fun hA => appBodies_not_selfInterpreter E hA hE) + +end Blc.SelfintFloor diff --git a/lean/Blc/SelfintFloorLambda.lean b/lean/Blc/SelfintFloorLambda.lean new file mode 100644 index 00000000..1a2dd64a --- /dev/null +++ b/lean/Blc/SelfintFloorLambda.lean @@ -0,0 +1,295 @@ +/- +Abstraction-rooted interpreters have at least +four abstractions and 27 bits. + +Exact accounting: `wire t + 2 = 2·lamCount t + 4·leafCount t + indexSum t` +for every term. A term with two incomparable nonlinear binders and an +abstraction whose body is not an application has at least three +abstractions (`not_chain_nonAppBody_three_lams`). For `E = λy. B` with `B` +an application, the non-application body of `selfInterpreter_hasNonAppBody` +lies inside `B`, so `E` has at least four abstractions; with five leaves and +one index unit this is 27 bits. The two other abstraction-rooted shapes are +the identity (not an interpreter) and the literal interface (31 bits). + +For application-rooted interpreters the head is a redex whose binder is +nonlinear when the interpreter is minimal: the argument is closed, so an +affine head redex would shrink the wire. +-/ +import Blc.SelfintFloorLiteral +import Blc.SelfintFloorEmerge +import Blc.SelfintControl + +namespace Blc.SelfintFloor +open Term SelfintLowerBound SelfintNonlinearChain SelfintCapture SelfintWireCost + +def lamCount : Term → Nat + | .var _ => 0 + | .lam b => lamCount b + 1 + | .app f a => lamCount f + lamCount a + +def leafCount : Term → Nat + | .var _ => 1 + | .lam b => leafCount b + | .app f a => leafCount f + leafCount a + +/-- The BLC size identity for arbitrary terms. -/ +theorem wire_identity (t : Term) : + wire t + 2 = 2 * lamCount t + 4 * leafCount t + indexSum t := by + induction t with + | var n => simp [lamCount, leafCount, indexSum]; omega + | lam b ih => simp only [wire_lam, lamCount, leafCount, indexSum]; omega + | app f a ihf iha => simp only [wire_app, lamCount, leafCount, indexSum]; omega + +theorem live_le_lamCount (t : Term) : live t ≤ lamCount t := by + induction t with + | var n => simp [live, lamCount] + | lam b ih => simp only [live, lamCount]; split <;> omega + | app f a ihf iha => simp only [live, lamCount]; omega + +/-- Every live binder owns a leaf, a nonlinear one owns two. -/ +theorem leaves_bound (t : Term) : + nonlinear t + live t + freeLeaves 0 t ≤ leafCount t := by + induction t with + | var n => simp [nonlinear, live, freeLeaves, leafCount] + | lam b ih => + have hs := freeLeaves_split b 0 + simp only [nonlinear, live, freeLeaves, leafCount] + split <;> split <;> omega + | app f a ihf iha => + simp only [nonlinear, live, freeLeaves, leafCount] + omega + +/-- Some abstraction body is itself an abstraction. -/ +def HasLamBody : Term → Prop + | .var _ => False + | .lam b => IsLam b ∨ HasLamBody b + | .app f a => HasLamBody f ∨ HasLamBody a + +/-- Some abstraction body is a variable. -/ +def HasVarBody : Term → Prop + | .var _ => False + | .lam b => (∃ n, b = .var n) ∨ HasVarBody b + | .app f a => HasVarBody f ∨ HasVarBody a + +theorem hasNonAppBody_split (t : Term) (h : HasNonAppBody t) : HasLamBody t ∨ HasVarBody t := by + induction t with + | var n => exact h.elim + | lam b ih => + rcases h with h | h + · cases b with + | var n => exact Or.inr (Or.inl ⟨n, rfl⟩) + | lam b' => exact Or.inl (Or.inl trivial) + | app f a => exact (h trivial).elim + · rcases ih h with h' | h' + · exact Or.inl (Or.inr h') + · exact Or.inr (Or.inr h') + | app f a ihf iha => + rcases h with h | h + · rcases ihf h with h' | h' + · exact Or.inl (Or.inl h') + · exact Or.inr (Or.inl h') + · rcases iha h with h' | h' + · exact Or.inl (Or.inr h') + · exact Or.inr (Or.inr h') + +theorem hasLamBody_two (t : Term) (h : HasLamBody t) : 2 ≤ lamCount t := by + induction t with + | var n => exact h.elim + | lam b ih => + rcases h with h | h + · cases b with + | lam b' => simp only [lamCount]; omega + | var n => exact h.elim + | app f a => exact h.elim + · have := ih h; simp only [lamCount]; omega + | app f a ihf iha => + rcases h with h | h + · have := ihf h; simp only [lamCount]; omega + · have := iha h; simp only [lamCount]; omega + +theorem nonlinear_le_lamCount (t : Term) : nonlinear t ≤ lamCount t := + Nat.le_trans (nonlinear_le_live t) (live_le_lamCount t) + +/-- A variable-bodied abstraction is affine, so it is an extra abstraction +beyond the nonlinear ones. -/ +theorem hasVarBody_extra (t : Term) (h : HasVarBody t) : nonlinear t + 1 ≤ lamCount t := by + induction t with + | var n => exact h.elim + | lam b ih => + rcases h with ⟨n, rfl⟩ | h + · simp only [nonlinear, lamCount, occ] + split <;> split <;> omega + · have := ih h + simp only [nonlinear, lamCount] + split <;> omega + | app f a ihf iha => + have hf := nonlinear_le_lamCount f + have ha := nonlinear_le_lamCount a + rcases h with h | h + · have := ihf h; simp only [nonlinear, lamCount]; omega + · have := iha h; simp only [nonlinear, lamCount]; omega + +/-- Two incomparable nonlinear binders cannot both lie on one nested pair +`λx. λy. …`, so a lambda-bodied abstraction forces a third abstraction. -/ +theorem not_chain_hasLamBody_three (t : Term) (hc : ¬ Chain t) (h : HasLamBody t) : + 3 ≤ lamCount t := by + induction t with + | var n => exact h.elim + | lam b ih => + rcases h with h | h + · cases b with + | lam b' => + have h2 := not_chain_two_nonlinear b' hc + have h3 := nonlinear_le_lamCount b' + simp only [lamCount] + omega + | var n => exact h.elim + | app f a => exact h.elim + · have := ih hc h + simp only [lamCount] + omega + | app f a ihf iha => + have hnf := nonlinear_le_lamCount f + have hna := nonlinear_le_lamCount a + by_cases hcf : Chain f + · by_cases hca : Chain a + · have hz : ¬ (nonlinear f = 0 ∨ nonlinear a = 0) := fun hz => hc ⟨hcf, hca, hz⟩ + rcases h with h | h + · have := hasLamBody_two f h; simp only [lamCount]; omega + · have := hasLamBody_two a h; simp only [lamCount]; omega + · have h2 := not_chain_two_nonlinear a hca + rcases h with h | h + · have := hasLamBody_two f h; simp only [lamCount]; omega + · have := iha hca h; simp only [lamCount]; omega + · have h2 := not_chain_two_nonlinear f hcf + rcases h with h | h + · have := ihf hcf h; simp only [lamCount]; omega + · have := hasLamBody_two a h; simp only [lamCount]; omega + +theorem not_chain_nonAppBody_three_lams (t : Term) (hc : ¬ Chain t) (h : HasNonAppBody t) : + 3 ≤ lamCount t := by + rcases hasNonAppBody_split t h with h | h + · exact not_chain_hasLamBody_three t hc h + · have := hasVarBody_extra t h + have := not_chain_two_nonlinear t hc + omega + +/-- The identity is not a self-interpreter: `I C Q` is rigid with one +argument where the output has two. -/ +theorem identity_not_selfInterpreter : ¬ IsSelfInterpreter (.lam (.var 0)) := by + intro hE + obtain ⟨w, hw, ho⟩ := hE.2 (.lam (.var 0)) (by decide) + have hred : Betas (.app (.app (.lam (.var 0)) (.var 0)) + (streamOf (blcCode (.lam (.var 0))) (.var 1))) + (.app (.var 0) (streamOf (blcCode (.lam (.var 0))) (.var 1))) := + Betas.head (Beta.appL _ (Beta.beta (.var 0) (.var 0))) (Betas.refl _) + obtain ⟨v, hv, hwv⟩ := betas_confluent hred hw + have hout := betas_trans ho hwv + obtain ⟨g, b, hv', hg, _⟩ := rigid_betas_shape (Rigid.var 0) hv + subst hv' + have hg0 : g = .var 0 := + normalForm_betas_eq (fun _ hb => nft_no_beta (show NFt (.var 0) from trivial) hb) hg + subst hg0 + obtain ⟨g', b', he, hg', _⟩ := rigid_betas_shape (Rigid.app _ (Rigid.var 0)) hout + simp only [Term.app.injEq] at he + obtain ⟨he1, _⟩ := he + obtain ⟨g'', b'', he'', _, _⟩ := rigid_betas_shape (Rigid.var 0) hg' + rw [← he1] at he'' + cases he'' + +/-- An abstraction-rooted self-interpreter has at least four abstractions. -/ +theorem lam_rooted_four_lams {B : Term} (hE : IsSelfInterpreter (.lam B)) : + 4 ≤ lamCount (.lam B) := by + cases B with + | var n => + have hc : FreeUnder 1 (Term.var n) := hE.1 + have hn : n = 0 := by + have : n < 1 := hc + omega + subst hn + exact (identity_not_selfInterpreter hE).elim + | lam B' => + have hc : ¬ Chain B' := selfInterpreter_body_not_chain hE + have h2 := not_chain_two_nonlinear B' hc + have h3 := nonlinear_le_lamCount B' + simp only [lamCount] + omega + | app f a => + have hn := selfInterpreter_hasNonAppBody hE + have hb : HasNonAppBody (.app f a) := by + rcases hn with hn | hn + · exact (hn trivial).elim + · exact hn + have hc : ¬ Chain (.app f a) := selfInterpreter_not_chain (E := .lam (.app f a)) hE + have := not_chain_nonAppBody_three_lams _ hc hb + simp only [lamCount] at this ⊢ + omega + +/-- Abstraction-rooted self-interpreters have at least 27 bits. -/ +theorem lam_rooted_bound {B : Term} (hE : IsSelfInterpreter (.lam B)) : + 27 ≤ wire (.lam B) := by + have hL := lam_rooted_four_lams hE + have hV := leaves_bound (.lam B) + have hn := selfInterpreter_two_nonlinear hE + have hl := selfInterpreter_three_live hE + have hx := selfinterpreter_indexSum_pos _ hE + have hw := wire_identity (.lam B) + omega + +/-- Leftmost leaf of the application spine. -/ +def spineHead : Term → Term + | .app f _ => spineHead f + | t => t + +theorem rigid_of_spineHead_var (t : Term) (n : Nat) (h : spineHead t = .var n) : Rigid t := by + induction t with + | var m => simp only [spineHead] at h; cases h; exact .var n + | lam b => simp [spineHead] at h + | app f a ih => exact .app a (ih h) + +theorem rigid_headSteps (k : Nat) {t u : Term} (hr : Rigid t) (h : headSteps k t = some u) : + Rigid u := by + induction k generalizing t with + | zero => simp only [headSteps, Option.some.injEq] at h; subst h; exact hr + | succ k ih => + simp only [headSteps, Option.bind_eq_some_iff] at h + obtain ⟨v, hv, hrest⟩ := h + exact ih (rigid_beta hr (beta_of_headStep (headStep_sound hv))) hrest + +/-- A self-interpreter itself head-reduces to an abstraction. -/ +theorem selfInterpreter_headsToLam {E : Term} (hE : IsSelfInterpreter E) : + ∃ k f', headSteps k E = some f' ∧ IsLam f' := by + apply Classical.byContradiction + intro hcon + have hno : ∀ j f', headSteps j E = some f' → ¬ IsLam f' := by + intro j f' hj hl + exact hcon ⟨j, f', hj, hl⟩ + obtain ⟨k, f', hk, hl⟩ := selfInterpreter_stream_consumed hE + obtain ⟨g, _, rfl⟩ := headSteps_app_of_noLam k E (.var 0) f' hno hk + exact hl + +/-- An application-rooted self-interpreter is headed by a redex. -/ +theorem app_rooted_head_redex {f a : Term} (hE : IsSelfInterpreter (.app f a)) : + ∃ B', spineHead (.app f a) = .lam B' := by + cases hs : spineHead (.app f a) with + | lam B' => exact ⟨B', rfl⟩ + | var n => + exfalso + have hr := rigid_of_spineHead_var _ n hs + obtain ⟨k, f', hk, hl⟩ := selfInterpreter_headsToLam hE + have := rigid_headSteps k hr hk + cases f' with + | lam b => cases this + | var m => exact hl + | app g x => exact hl + | app g x => + exfalso + have : ∀ t, ¬ ∃ g x, spineHead t = .app g x := by + intro t + induction t with + | var n => rintro ⟨g, x, h⟩; simp [spineHead] at h + | lam b => rintro ⟨g, x, h⟩; simp [spineHead] at h + | app f a ih => rintro ⟨g, x, h⟩; exact ih ⟨g, x, h⟩ + exact this _ ⟨g, x, hs⟩ + +end Blc.SelfintFloor diff --git a/lean/Blc/SelfintFloorLiteral.lean b/lean/Blc/SelfintFloorLiteral.lean new file mode 100644 index 00000000..a8315eed --- /dev/null +++ b/lean/Blc/SelfintFloorLiteral.lean @@ -0,0 +1,122 @@ +/- +The literal two-lambda interface costs at +least 31 bits. + +For `E = λc s. B`: the body has two incomparable nonlinear binders +(`selfInterpreter_body_not_chain`), and both public variables occur in it, +since the required output `C (λz.I) N` mentions both `C` and `N` and beta +reduction cannot introduce an absent variable. Charging the body's binders +and free leaves gives `wire B ≥ 27`, hence `wire E ≥ 31`. +This complements `SelfintProjections.headForm_fifty_five` (55 bits for the +continuation-headed display form) and is the literal-interface analogue of +`selfintSizeBound_25`. +-/ +import Blc.SelfintFloorCount +import Blc.SelfintFloorArg + +namespace Blc.SelfintFloor +open Term SelfintLowerBound SelfintNonlinearChain SelfintCapture SelfintWireCost + +theorem indexSum_ge_occ (t : Term) (j : Nat) : occ j t * j ≤ indexSum t := by + induction t generalizing j with + | var n => + simp only [occ, indexSum] + split <;> omega + | lam b ih => + have := ih (j + 1) + simp only [occ, indexSum] + have h2 : occ (j + 1) b * j ≤ occ (j + 1) b * (j + 1) := + Nat.mul_le_mul_left _ (Nat.le_succ j) + omega + | app f a ihf iha => + have := ihf j + have := iha j + simp only [occ, indexSum, Nat.add_mul] + omega + +theorem occ_betas_zero {t u : Term} (h : Betas t u) (j : Nat) (ht : occ j t = 0) : + occ j u = 0 := by + induction h with + | refl => exact ht + | head hb _ ih => exact ih (occ_beta_zero hb j ht) + +theorem occ_stream_var (bits : List Bool) (n i : Nat) : + occ i (streamOf bits (.var n)) = occ i (.var n) := by + induction bits with + | nil => rfl + | cons b bs ih => + rw [streamOf_cons, occ_pairT_closed _ _ (churchBit_closed b), ih] + +/-- The two interface contractions of `λc s. B` on `C = var 0` and the stream. -/ +theorem interface_betas (B Q : Term) : + Betas (.app (.app (.lam (.lam B)) (.var 0)) Q) + (substDec 0 Q (substDec 1 (.var 1) B)) := by + refine Betas.head (Beta.appL Q (Beta.beta (.lam B) (.var 0))) ?_ + have h : contract (.lam B) (.var 0) = .lam (substDec 1 (.var 1) B) := rfl + rw [h] + exact Betas.head (Beta.beta _ Q) (Betas.refl _) + +private def idOut : Term := .app (.app (.var 0) (.lam (.lam (.var 0)))) (.var 1) + +private theorem idOut_normal : NormalForm idOut := + fun _ hb => nft_no_beta (by decide : NFt idOut) hb + +/-- Both public variables occur in a literal two-lambda interface body. -/ +theorem literal_public_occ {B : Term} (hE : IsSelfInterpreter (.lam (.lam B))) : + 1 ≤ occ 0 B ∧ 1 ≤ occ 1 B := by + have hfree : FreeUnder 2 B := hE.1 + have h2 : occ 2 B = 0 := occ_of_freeUnder B 2 2 hfree (Nat.le_refl 2) + have h3 : occ 3 B = 0 := occ_of_freeUnder B 2 3 hfree (by omega) + obtain ⟨w, hw, ho⟩ := hE.2 (.lam (.var 0)) (by decide) + have hweq : w = idOut := normalForm_betas_eq idOut_normal ho + subst hweq + have hR := betas_preserve_nf (interface_betas B (streamOf (blcCode (.lam (.var 0))) (.var 1))) + hw idOut_normal + have hQ0 : occ 0 (streamOf (blcCode (.lam (.var 0))) (.var 1)) = 0 := by + rw [occ_stream_var]; decide + have hQ1 : occ 1 (streamOf (blcCode (.lam (.var 0))) (.var 1)) = 1 := by + rw [occ_stream_var]; decide + have hT0 : occ 0 (substDec 1 (.var 1) B) = occ 0 B := by + rw [occ_substDec_lt B (.var 1) 0 1 (by omega)] + simp [occ] + have hT1 : occ 1 (substDec 1 (.var 1) B) = occ 1 B := by + rw [occ_substDec_ge B (.var 1) 1 1 (Nat.le_refl 1), h2] + simp [occ] + have hT2 : occ 2 (substDec 1 (.var 1) B) = 0 := by + rw [occ_substDec_ge B (.var 1) 2 1 (by omega), h3] + simp [occ] + have hR0 : occ 0 (substDec 0 (streamOf (blcCode (.lam (.var 0))) (.var 1)) + (substDec 1 (.var 1) B)) = occ 1 B := by + rw [occ_substDec_ge _ _ 0 0 (Nat.le_refl 0), hT1, hQ0] + simp + have hR1 : occ 1 (substDec 0 (streamOf (blcCode (.lam (.var 0))) (.var 1)) + (substDec 1 (.var 1) B)) = occ 0 B := by + rw [occ_substDec_ge _ _ 1 0 (by omega), hT2, hT0, hQ1] + simp + constructor + · by_cases hz : occ 0 B = 0 + · have := occ_betas_zero hR 1 (by rw [hR1, hz]) + simp [idOut, occ] at this + · omega + · by_cases hz : occ 1 B = 0 + · have := occ_betas_zero hR 0 (by rw [hR0, hz]) + simp [idOut, occ] at this + · omega + +/-- A literal two-lambda interface has at least 31 bits: two nonlinear +binders, two live public leaves, and one index unit for `c` beneath `s`. -/ +theorem literal_interface_bound {B : Term} (hE : IsSelfInterpreter (.lam (.lam B))) : + 31 ≤ wire (.lam (.lam B)) := by + have hc := selfInterpreter_body_not_chain hE + have hn := not_chain_two_nonlinear B hc + have hl := nonlinear_le_live B + obtain ⟨h0, h1⟩ := literal_public_occ hE + have hf0 := freeLeaves_split B 0 + have hf1 := freeLeaves_split B 1 + simp only [Nat.zero_add] at hf0 + have hx := indexSum_ge_occ B 1 + have hw := count_wire_bound B + simp only [wire_lam] + omega + +end Blc.SelfintFloor diff --git a/lean/Blc/SelfintKnot.lean b/lean/Blc/SelfintKnot.lean new file mode 100644 index 00000000..8b44ddb3 --- /dev/null +++ b/lean/Blc/SelfintKnot.lean @@ -0,0 +1,162 @@ +/- +Opaque fixed-point overhead, independent of a particular knot syntax. +Free variables are zero-cost opaque holes. Bound variables retain their BLC +wire costs. For the intended one-hole reading, impose FreeUnder 1 t. +This does not assert a global lower bound for self-interpreters. +-/ +import Blc.SelfintLowerBound +import Blc.SelfintCapture + +namespace Blc.SelfintKnot +open Term SelfintLowerBound + +/-- BLC source cost with all variables free at cutoff c priced as holes. -/ +def ghostCost (c : Nat) : Term → Nat + | .var n => if n < c then n + 2 else 0 + | .lam b => 2 + ghostCost (c + 1) b + | .app f a => 2 + ghostCost c f + ghostCost c a + +theorem nonlinear_nodes_bound (t : Term) : + 10 * nonlinear t + 4 * freeLeaves 0 t ≤ 2 * nodes t + 2 := by + induction t with + | var n => simp [nonlinear, freeLeaves, nodes] + | lam b ih => + have hs := freeLeaves_split b 0 + simp only [nonlinear, freeLeaves, nodes] + split <;> omega + | app f a ihf iha => + simp only [nonlinear, freeLeaves, nodes] + omega + +theorem nodes_ghost_bound (t : Term) (c : Nat) : + 2 * nodes t ≤ ghostCost c t + 2 * freeLeaves c t := by + induction t generalizing c with + | var n => simp only [nodes, ghostCost, freeLeaves]; split <;> split <;> omega + | lam b ih => + have hb := ih (c + 1) + simp only [nodes, ghostCost, freeLeaves] + omega + | app f a ihf iha => + have hf := ihf c + have ha := iha c + simp only [nodes, ghostCost, freeLeaves] + omega + +theorem nonlinear_ghost_bound (t : Term) : + 10 * nonlinear t + 2 * freeLeaves 0 t ≤ ghostCost 0 t + 2 := by + have h1 := nonlinear_nodes_bound t + have h2 := nodes_ghost_bound t 0 + omega + +theorem var_app_betas {s u : Term} (h : Betas s u) : + ∀ {n t}, s = .app (.var n) t → + ∃ v, u = .app (.var n) v ∧ Betas t v := by + induction h with + | refl s => intro n t hs; exact ⟨t, hs, .refl t⟩ + | head hb hs ih => + intro n t heq + subst heq + cases hb with + | appL a hbad => cases hbad + | appR f harg => + obtain ⟨v, hv, htv⟩ := ih rfl + exact ⟨v, hv, .head harg htv⟩ + +theorem occ_betas_zero {t u : Term} (h : Betas t u) (j : Nat) + (ht : occ j t = 0) : occ j u = 0 := by + induction h with + | refl => exact ht + | head hb hs ih => exact ih (SelfintCapture.occ_beta_zero hb j ht) + +/-- A fixed point of a rigid unary head cannot have a finite normal form. -/ +theorem fixedpoint_no_nf {t : Term} (h : BetaJoin t (.app (.var 0) t)) : + ¬ HasNormalForm t := by + rintro ⟨n, htn, hnf⟩ + obtain ⟨u, htu, hhu⟩ := h + have hun := betas_preserve_nf htu htn hnf + have hhn : Betas (.app (.var 0) t) n := betas_trans hhu hun + have hh : Betas (.app (.var 0) t) (.app (.var 0) n) := + betas_app (.refl _) htn + have hhnf : NormalForm (.app (.var 0) n) := by + intro w hw + cases hw with + | appL a hbad => cases hbad + | appR f hbad => exact hnf _ hbad + have heq := normalForm_unique hhn hh hnf hhnf + have hnodes := congrArg nodes heq + simp only [nodes] at hnodes + omega + +theorem fixedpoint_two_nonlinear {t : Term} + (h : BetaJoin t (.app (.var 0) t)) : 2 ≤ nonlinear t := by + by_cases hsmall : nonlinear t ≤ 1 + · obtain ⟨n, htn, hnf⟩ := one_nonlinear_normalizes t hsmall + exact (fixedpoint_no_nf h ⟨n, htn, fun _ hb => nft_no_beta hnf hb⟩).elim + · omega + +theorem fixedpoint_has_hole {t : Term} + (h : BetaJoin t (.app (.var 0) t)) : 1 ≤ freeLeaves 0 t := by + obtain ⟨u, htu, hhu⟩ := h + obtain ⟨v, hv, _⟩ := var_app_betas hhu rfl + have hocc : 0 < occ 0 t := by + by_cases hz : occ 0 t = 0 + · have hu := occ_betas_zero htu 0 hz + rw [hv] at hu + simp [occ] at hu + · omega + have hs := freeLeaves_split t 0 + omega + +/-- Any opaque beta fixed-point context costs at least 20 bits, even when +it uses multiple free holes, arbitrary beta redexes, and no prescribed +weak-head self-reproduction path. -/ +theorem opaque_knot_twenty {t : Term} + (h : BetaJoin t (.app (.var 0) t)) : 20 ≤ ghostCost 0 t := by + have hn := fixedpoint_two_nonlinear h + have hf := fixedpoint_has_hole h + have hc := nonlinear_ghost_bound t + omega + +theorem fixedpoint_hole_multiplicity {t : Term} + (h : BetaJoin t (.app (.var 0) t)) : + 18 + 2 * freeLeaves 0 t ≤ ghostCost 0 t := by + have hn := fixedpoint_two_nonlinear h + have hc := nonlinear_ghost_bound t + omega + +def delta : Term := .lam (.app (.var 0) (.var 0)) +def generator : Term := .lam (.app (.var 1) (.app (.var 0) (.var 0))) +def knot : Term := .app delta generator + +theorem knot_unfold : BetaJoin knot (.app (.var 0) knot) := by + have h1 : Beta knot (.app generator generator) := Beta.beta _ _ + have h2 : Beta (.app generator generator) + (.app (.var 0) (.app generator generator)) := Beta.beta _ _ + exact ⟨_, .head h1 (.head h2 (.refl _)), + .head (.appR (.var 0) h1) (.refl _)⟩ + +theorem knot_cost : ghostCost 0 knot = 20 := by decide +theorem knot_one_hole : freeLeaves 0 knot = 1 := by decide +theorem knot_scope : FreeUnder 1 knot := by decide + +/-- Add the body parameter lambda (2 bits) and two parameter occurrences +at zero-based depths d1 and d2. The semantic call applications themselves +are part of the body, not charged a second time here. -/ +theorem two_call_overhead {t : Term} + (h : BetaJoin t (.app (.var 0) t)) (d1 d2 : Nat) : + 26 + d1 + d2 ≤ ghostCost 0 t + 2 + (d1 + 2) + (d2 + 2) := by + have hc := opaque_knot_twenty h + omega + +theorem current_frame_thirty_one {t : Term} + (h : BetaJoin t (.app (.var 0) t)) (d1 d2 : Nat) + (hd1 : 2 ≤ d1) (hd2 : 3 ≤ d2) : + 31 ≤ ghostCost 0 t + 2 + (d1 + 2) + (d2 + 2) := by + have hc := two_call_overhead h d1 d2 + omega + +theorem current_frame_attains : + ghostCost 0 knot + 2 + (2 + 2) + (3 + 2) = 31 := by decide + + +end Blc.SelfintKnot diff --git a/lean/Blc/SelfintRemainderChain.lean b/lean/Blc/SelfintRemainderChain.lean new file mode 100644 index 00000000..996b1b33 --- /dev/null +++ b/lean/Blc/SelfintRemainderChain.lean @@ -0,0 +1,219 @@ +/- +Closed-source exact remainder extractors need incomparable nonlinear binders. +This is an independent extension of SelfintZero, not a transfer of the +interpreter's output-Omega argument (the suffix already contains its Omega). +-/ +import Blc.SelfintZero +import Blc.SelfintNonlinearChain +import Blc.SelfintControl +import Blc.SelfintRemainder + +namespace Blc.SelfintRemainderChain +open Term SelfintLowerBound SelfintZero SelfintNonlinearChain + +def ChainQ (t : Q) : Prop := Chain (erase t) + +theorem step_affine {t u : Q} (h : Step t u) (hn : nl t = 0) : nl u = 0 := by + induction h with + | beta b a => + have hb : nl b = 0 := by simp only [nl_app, nl_lam] at hn; omega + have ha : nl a = 0 := by simp only [nl_app, nl_lam] at hn; omega + simp only [nl_subst, hb, ha, Nat.mul_zero, Nat.add_zero] + | k a b => simp only [nl_app, nl_k] at hn; omega + | z i a => simpa only [nl_app, nl_k, nl_z, Nat.zero_add, Nat.add_zero] using hn + | @left f g a h ih => + have hf : nl f = 0 := by simp only [nl_app] at hn; omega + have hh := ih hf + simp only [nl_app] at hn ⊢ + omega + | @right f a b h ih => + have ha : nl a = 0 := by simp only [nl_app] at hn; omega + have hh := ih ha + simp only [nl_app] at hn ⊢ + omega + +theorem step_chain {t u : Q} (h : Step t u) (hc : ChainQ t) : ChainQ u := by + induction h with + | beta b a => + unfold ChainQ + rw [erase_subst] + exact chain_beta (.beta (erase b) (erase a)) hc + | k a b => exact hc.1.2.1 + | z i a => + exact ⟨⟨hc.2.1, trivial, Or.inr rfl⟩, trivial, Or.inr rfl⟩ + | left a h ih => + refine ⟨ih hc.1, hc.2.1, ?_⟩ + rcases hc.2.2 with hf | ha + · exact Or.inl (step_affine h hf) + · exact Or.inr ha + | right f h ih => + refine ⟨hc.1, ih hc.2.1, ?_⟩ + rcases hc.2.2 with hf | ha + · exact Or.inl hf + · exact Or.inr (step_affine h ha) + +theorem steps_chain {t u : Q} (h : Steps t u) (hc : ChainQ t) : ChainQ u := by + induction h with + | refl => exact hc + | head h _ ih => exact ih (step_chain h hc) + +/-- A nonlinear head contractor has an affine argument, so consumes one +nonlinear binder. An affine contractor decreases the program-lambda count. -/ +theorem red_chain_progress {t u : Q} (h : RStep t u) (hc : ChainQ t) : + nl u < nl t ∨ (nl u ≤ nl t ∧ red u < red t) := by + induction h with + | beta b a => + by_cases ho : oc 0 b ≤ 1 + · right + rcases Nat.le_one_iff_eq_zero_or_eq_one.mp ho with hz | hz + · simp only [nl_subst, red_subst, nl_app, nl_lam, red, + hz, Nat.zero_mul, Nat.add_zero] + constructor <;> omega + · simp only [nl_subst, red_subst, nl_app, nl_lam, red, + hz, Nat.one_mul] + constructor <;> omega + · left + have hn : 1 < oc 0 b := by omega + have ha : nl a = 0 := by + rcases hc.2.2 with hl | ha + · change nl (.lam b) = 0 at hl + simp only [nl_lam, if_pos hn] at hl + omega + · exact ha + simp only [nl_subst, nl_app, nl_lam, if_pos hn, ha, + Nat.mul_zero, Nat.add_zero] + omega + | left a h ih => + rcases ih hc.1 with hn | ⟨hn, hr⟩ + · left; simp only [nl_app]; omega + · right; simp only [nl_app, red]; constructor <;> omega + +/-- No assumption on the number of binders on the one chain is needed. -/ +theorem chain_terminates (t : Q) (hclosed : ClosedQ t) (hc : ChainQ t) : + ∃ u, Steps t u ∧ Done u := by + have hb := blue_sound t + have hbr := blue_red t + have hbn := blue_nl t + have hbc := steps_chain hb hc + rcases val_progress (blue t) (steps_closed hb hclosed) with hd | ⟨u, hu⟩ + · exact ⟨_, hb, hd⟩ + · have hp := red_chain_progress hu hbc + have hc' := step_chain hu.step hbc + have hclosed' := step_closed hu.step (steps_closed hb hclosed) + obtain ⟨v, hv, hd⟩ := chain_terminates u hclosed' hc' + exact ⟨v, SelfintZero.trans hb (Steps.head hu.step hv), hd⟩ +termination_by (nl t, red t) +decreasing_by + simp_wf + rcases hp with hn | ⟨hn, hr⟩ + · exact Prod.Lex.left _ _ (by omega) + · by_cases he : nl u < nl t + · exact Prod.Lex.left _ _ he + · have heq : nl u = nl t := by omega + rw [heq] + exact Prod.Lex.right _ (by omega) + +private def omegaTerm : Term := + .app (.lam (.app (.var 0) (.var 0))) (.lam (.app (.var 0) (.var 0))) + +private theorem omega_beta_eq {u : Term} (h : Beta omegaTerm u) : u = omegaTerm := by + have hs := headStep_complete (spine_beta_head (Spine.redex (by decide) (by decide)) h) + exact Option.some.inj hs.symm + +private theorem omega_betas_eq {u : Term} (h : Betas omegaTerm u) : u = omegaTerm := by + have aux : ∀ t v, Betas t v → t = omegaTerm → v = omegaTerm := by + intro t v hs + induction hs with + | refl => exact id + | head hb _ ih => + intro ht + apply ih + subst ht + exact omega_beta_eq hb + exact aux _ _ h rfl + +private theorem omega_not_lam {B : Term} : ¬ BetaJoin (.lam B) omegaTerm := by + rintro ⟨u, hu, ho⟩ + have he := omega_betas_eq ho + subst u + obtain ⟨v, hv, _⟩ := lam_betas_shape hu + cases hv + +theorem remainder_not_chain (R : Term) (hclosed : Closed R) + (hR : ∀ M, Closed M → ∀ N, Closed N → + BetaJoin (.app R (streamOf (blcCode M) N)) N) : ¬ Chain R := by + intro hc + let t : Q := .app (embed R) (.z 0) + have htclosed : ClosedQ t := by + change Closed (.app (erase (embed R)) (.lam (.var 0))) + rw [erase_embed] + exact ⟨hclosed, by decide⟩ + have htchain : ChainQ t := by + change Chain (.app (erase (embed R)) (.lam (.var 0))) + rw [erase_embed] + exact ⟨hc, trivial, Or.inr (by decide)⟩ + obtain ⟨u, hu, hd⟩ := chain_terminates t htclosed htchain + obtain ⟨a, ha⟩ := steps_sim hu + obtain ⟨b, hb⟩ := done_sim hd + let m := 2 * max a b + let T := streamOf (blcCode (.lam (.var 0))) omegaTerm + have hT : Closed T := by decide + obtain ⟨B, hB⟩ := hb m (by dsimp [m]; omega) T + have hsim := betas_trans (ha m (by dsimp [m]; omega) T hT) hB + have he : realize m T t = + .app R (streamOf (blcCode (SelfintZero.tower (max a b))) omegaTerm) := by + rw [SelfintZero.tower_stream] + simp only [realize, t, interp, interp_embed, Nat.sub_zero, m, T] + rw [he] at hsim + obtain ⟨v, hv, ho⟩ := hR (SelfintZero.tower (max a b)) (SelfintZero.tower_closed _) omegaTerm (by decide) + obtain ⟨w, hw, hw'⟩ := betas_confluent hsim hv + exact omega_not_lam ⟨w, hw, betas_trans ho hw'⟩ + +theorem literal_remainder_body_not_chain (B : Term) (hclosed : Closed (.lam B)) + (hR : ∀ M, Closed M → ∀ N, Closed N → + BetaJoin (.app (.lam B) (streamOf (blcCode M) N)) N) : ¬ Chain B := + remainder_not_chain (.lam B) hclosed hR + + +/-- Closed-source exact remainder extraction, with arbitrary suffixes. +The rigid-tail law entails this by substitution. -/ +def IsRemainder (R : Term) : Prop := Closed R ∧ + ∀ M, Closed M → ∀ N, BetaJoin (.app R (streamOf (blcCode M) N)) N + +def RemainderSizeBound (n : Nat) : Prop := + ∀ R, IsRemainder R → n ≤ (blcCode R).length + +theorem projection_remainder {E : Term} (hE : IsSelfInterpreter E) : + IsRemainder (.app E churchFalse) := by + refine ⟨⟨hE.1, by decide⟩, ?_⟩ + intro M hM N + exact SelfintControl.join_trans (SelfintControl.contract_join hE hM churchFalse N) + (SelfintControl.join_of_betas (betas_of_spineReds (spine_false2 (.lam M) N))) + +theorem projection_size (E : Term) : + (blcCode (.app E churchFalse)).length = (blcCode E).length + 8 := by + simp [blcCode, churchFalse, List.length_append, Nat.add_comm, Nat.add_left_comm] + +/-- No normalization or separate-module assumption is used in the transfer. -/ +theorem remainder_bound_transfers (n : Nat) (hn : RemainderSizeBound n) : + SelfintSizeBound (n - 8) := by + intro E hE + have h := hn (.app E churchFalse) (projection_remainder hE) + rw [projection_size] at h + omega + +theorem remainder_bound_eighteen : RemainderSizeBound 18 := by + intro R hR + have hn := SelfintZero.remainder_two_nonlinear R hR.1 (fun M hm N _ => hR.2 M hm N) + have hs := nonlinear_wire_bound R + omega + +theorem remainder_bound_at_most_seventy (n : Nat) (hn : RemainderSizeBound n) : + n ≤ 70 := by + have h := hn SelfintRemainder.rem70 + ⟨SelfintRemainder.rem70_closed, fun M _ N => + SelfintControl.join_of_betas (SelfintRemainder.rem70_contract M N)⟩ + simpa only [SelfintRemainder.rem70_size] using h + + +end Blc.SelfintRemainderChain diff --git a/lean/Blc/SelfintResidualControl.lean b/lean/Blc/SelfintResidualControl.lean new file mode 100644 index 00000000..95da25be --- /dev/null +++ b/lean/Blc/SelfintResidualControl.lean @@ -0,0 +1,224 @@ +/- +Application-sensitive semantic derivatives of exact remainder extraction. +These are obligations on residual behavior, not a source-size lower bound. +-/ +import Blc.SelfintRemainderChain +import Blc.SelfintTower45 +import Blc.SelfintSharp +import Blc.SelfintOrigins + +namespace Blc.SelfintResidualControl +open Term SelfintControl SelfintRemainderChain + +def ident : Term := .lam (.var 0) + +/-- Apply the reader after a fixed, possibly incomplete, bit prefix. -/ +def derivative (R : Term) (p : List Bool) (S : Term) : Term := + .app R (streamOf p S) + +theorem completed {R M : Term} (hR : IsRemainder R) (hM : Closed M) + (S : Term) : BetaJoin (derivative R (blcCode M) S) S := hR.2 M hM S + +/-- After APP and its left child, precisely one source remains pending. -/ +theorem one_pending {R M : Term} (hR : IsRemainder R) (hM : Closed M) + (Q : Term) (hQ : Closed Q) (N : Term) : + BetaJoin (derivative R ([false, true] ++ blcCode M) + (streamOf (blcCode Q) N)) N := by + have h := hR.2 (.app M Q) ⟨hM, hQ⟩ N + simpa only [derivative, blcCode, List.cons_append, List.nil_append, + streamOf_cons, streamOf_append] using h + +theorem lam_not_join_var (B : Term) (n : Nat) : + ¬ BetaJoin (.lam B) (.var n) := by + rintro ⟨v, hl, hv⟩ + have he := normalForm_betas_eq + (fun _ hb => nft_no_beta (by simp [NFt] : NFt (.var n)) hb) hv + subst v + obtain ⟨w, hw, _⟩ := lam_betas_shape hl + cases hw + +/-- In particular the two states cannot be flat: the same continuation +cannot represent both 'done' and 'one closed source pending'. -/ +theorem pending_ne_done {R M : Term} (hR : IsRemainder R) (hM : Closed M) : + ¬ BetaJoin + (derivative R (blcCode M) (streamOf (blcCode ident) (.var 0))) + (derivative R ([false, true] ++ blcCode M) + (streamOf (blcCode ident) (.var 0))) := by + intro he + have h0 := completed hR hM (streamOf (blcCode ident) (.var 0)) + have h1 := one_pending hR hM ident (by decide) (.var 0) + have hj := join_trans (join_symm h0) (join_trans he h1) + exact lam_not_join_var _ _ hj + +/-- The family of unfinished left spines carries arbitrarily many +pending right children. Each right child used below is the closed I. -/ +def tags : Nat → List Bool + | 0 => [] + | n + 1 => false :: true :: tags n + +def tails : Nat → List Bool + | 0 => [] + | n + 1 => blcCode ident ++ tails n + +def comb (M : Term) : Nat → Term + | 0 => M + | n + 1 => .app (comb M n) ident + +theorem tails_add (i j : Nat) : tails (i + j) = tails i ++ tails j := by + induction i with + | zero => simp only [Nat.zero_add, tails, List.nil_append] + | succ i ih => simp only [Nat.succ_add, tails, ih, List.append_assoc] + +theorem tails_snoc (i : Nat) : tails (i + 1) = tails i ++ blcCode ident := by + simpa only [tails, List.append_nil] using tails_add i 1 + +theorem comb_closed {M : Term} (hM : Closed M) (k : Nat) : Closed (comb M k) := by + induction k with + | zero => exact hM + | succ k ih => exact ⟨ih, by decide⟩ + +theorem code_comb (M : Term) (k : Nat) : + blcCode (comb M k) = tags k ++ blcCode M ++ tails k := by + induction k with + | zero => simp only [comb, tags, tails, List.nil_append, List.append_nil] + | succ k ih => + simp only [comb, blcCode, ih, tags, tails_snoc, List.cons_append, + List.append_assoc] + +theorem k_pending {R M : Term} (hR : IsRemainder R) (hM : Closed M) + (k : Nat) (N : Term) : + BetaJoin (derivative R (tags k ++ blcCode M) (streamOf (tails k) N)) N := by + have h := hR.2 (comb M k) (comb_closed hM k) N + simpa only [derivative, code_comb, streamOf_append] using h + +theorem fewer_pending {R M : Term} (hR : IsRemainder R) (hM : Closed M) + (i k : Nat) (N : Term) : + BetaJoin (derivative R (tags i ++ blcCode M) (streamOf (tails (i + k)) N)) + (streamOf (tails k) N) := by + simpa only [tails_add, streamOf_append] using + k_pending hR hM i (streamOf (tails k) N) + +/-- Arbitrarily many pairwise distinguishable pending-depth states. +Both readers are supplied the identical remaining stream. -/ +theorem pending_depths_distinct {R M : Term} (hR : IsRemainder R) + (hM : Closed M) (i k : Nat) (hk : 0 < k) : + ¬ BetaJoin + (derivative R (tags i ++ blcCode M) (streamOf (tails (i + k)) (.var 0))) + (derivative R (tags (i + k) ++ blcCode M) + (streamOf (tails (i + k)) (.var 0))) := by + intro he + have h0 := fewer_pending hR hM i k (.var 0) + have h1 := k_pending hR hM (i + k) (.var 0) + have hj := join_trans (join_symm h0) (join_trans he h1) + cases k with + | zero => omega + | succ k => exact lam_not_join_var _ _ hj + +/-- If a clean cut has a literal residual body B, it is itself an exact +remainder extractor. This prices the residual, not its source ancestor. -/ +theorem clean_cut_body_two_nonlinear {R M B : Term} + (hR : IsRemainder R) (hM : Closed M) (hB : FreeUnder 1 B) + (hcut : ∀ S, BetaJoin + (derivative R ([false, true] ++ blcCode M) S) (contract B S)) : + 2 ≤ SelfintLowerBound.nonlinear B := by + apply SelfintZero.remainder_body_two_nonlinear B hB + intro Q hQ N _ + exact join_trans (join_symm (hcut _)) (one_pending hR hM Q hQ N) + +theorem clean_cut_body_not_chain {R M B : Term} + (hR : IsRemainder R) (hM : Closed M) (hB : FreeUnder 1 B) + (hcut : ∀ S, BetaJoin + (derivative R ([false, true] ++ blcCode M) S) (contract B S)) : + ¬ SelfintNonlinearChain.Chain B := by + apply literal_remainder_body_not_chain B hB + intro Q hQ N _ + exact join_trans (join_of_betas (.head (.beta _ _) (.refl _))) + (join_trans (join_symm (hcut _)) (one_pending hR hM Q hQ N)) + +open QuoteOrigins + +theorem marked_steps_erase {t u : Marked} (h : Marked.Steps t u) : + Betas (Marked.erase t) (Marked.erase u) := by + induction h with + | refl => exact .refl _ + | step hs _ ih => exact .head (Marked.step_erase hs) ih + +/-- At any uniform colored residual after APP + a closed left child, +the two required nonlinear binders have program origin. This applies +whether or not some irrelevant prefix data is still retained. It does +not assert that every reader reaches a prefix-free syntactic cut. -/ +theorem marked_pending_has_code {R M : Term} (hR : IsRemainder R) + (hM : Closed M) (b : Marked) (hb : FreeUnder 1 (Marked.erase b)) + (hs : Marked.Steps + (.app (Marked.red R) (Marked.stream ([false, true] ++ blcCode M) (.var 0))) b) : + 2 ≤ Marked.redCount b ∧ ¬ SelfintNonlinearChain.Chain (Marked.erase b) := by + have he : Betas (derivative R ([false, true] ++ blcCode M) (.var 0)) + (Marked.erase b) := by + simpa only [derivative, Marked.erase, Marked.erase_red, Marked.erase_stream] + using marked_steps_erase hs + have hcut : ∀ S, BetaJoin + (derivative R ([false, true] ++ blcCode M) S) (contract (Marked.erase b) S) := by + intro S + have hx := betas_subst he 0 S + simpa only [derivative, contract, substDec, subst_streamOf, + substDec_closed 0 S hR.1, if_true] using join_of_betas hx + have hn := clean_cut_body_two_nonlinear hR hM hb hcut + have hg := Marked.good_steps hs + (show Marked.Good (.app (Marked.red R) + (Marked.stream ([false, true] ++ blcCode M) (.var 0))) from + ⟨Marked.red_good R, Marked.stream_good _ trivial⟩) + exact ⟨Nat.le_trans hn (Marked.nonlinear_le_redCount (Marked.good_blueAffine hg)), + clean_cut_body_not_chain hR hM hb hcut⟩ + +/-- The fixed rem70 syntax frame, leaving only its closed Q handler open. -/ +def frame (q : Term) : Term := .lam + (.app (.lam (.app (.app (.var 1) (.var 0)) (.var 0))) + (.lam (.lam (.app (.var 0) (.app (.app (.var 1) q) (.var 0)))))) + +theorem frame_size (q : Term) : + (blcCode (frame q)).length = (blcCode q).length + 34 := by + simp [frame, blcCode, List.length_append, Nat.add_comm, Nat.add_left_comm] + +theorem next_size : (blcCode SelfintRemainder.next).length = 36 := by decide + +/-- Arithmetic part only. The semantic leaf-count premises for an opaque, +lambda-free handler body are proved in REPORT.md, not in this theorem. -/ +theorem opaque_leaf_price (t u d : Nat) (ht : 1 ≤ t) (hu : 1 ≤ u) + (hd : 4 ≤ d) (hbranch : 2 ≤ u ∨ 3 ≤ t) : + 36 ≤ 4 + 6 * t + 5 * u + 4 * d := by + rcases hbranch with h | h <;> omega + +/-- On an application with a zero-headed left child, tower45 returns +after removing only the first bit of that child. It has not reached the +left-child boundary, let alone preserved a right-child obligation. -/ +theorem tower45_app_zero (r : Term) : + Betas (.app SelfintTower45.reader (streamOf [false, true, false] r)) r := by + refine betas_trans (betas_of_spineReds (SelfintTower45.unfold_reader _)) ?_ + refine betas_trans (SelfintTower45.zero _) ?_ + refine betas_trans (SelfintTower45.one _) ?_ + refine betas_trans + (betas_appL SelfintTower45.context (betas_of_spineReds (skip_self 0 r))) ?_ + have h := spine_beta (shift 1 0 r) SelfintTower45.context + have he : contract (shift 1 0 r) SelfintTower45.context = r := substDec_shift r _ 0 + rw [he] at h + exact betas_of_spineReds h + +/-- A complete extractor with exactly two nonlinear binders, even though +both nonlinear lambda subterms are closed in isolation. -/ +def rem592 : Term := .app SelfintSharp.intL584 churchFalse + +theorem rem592_contract : IsRemainder rem592 := + projection_remainder SelfintSharp.isSelfInterpreter_intL584 + +theorem rem592_size : (blcCode rem592).length = 592 := by + rw [rem592, projection_size, SelfintSharp.intL584_length] + +theorem rem592_two_nonlinear : SelfintLowerBound.nonlinear rem592 = 2 := by + simp only [rem592, SelfintLowerBound.nonlinear, + SelfintSharp.intL584_two_nonlinear] + decide + +theorem rem592_nonlinear_closed : SelfintSharp.NonlinearClosed rem592 := by + exact ⟨SelfintSharp.intL584_nonlinear_closed, by decide⟩ + +end Blc.SelfintResidualControl diff --git a/lean/Blc/SelfintSharedS647.lean b/lean/Blc/SelfintSharedS647.lean new file mode 100644 index 00000000..eaf73588 --- /dev/null +++ b/lean/Blc/SelfintSharedS647.lean @@ -0,0 +1,478 @@ +/- +647-bit exact remainder extractor with two nonlinear binders, two live +capturing binders, and exactly one width-three subterm. The generated trace +is checked by Lean's kernel; the Python generator is not trusted. +-/ +import Blc.SelfintRemainderChain +import Blc.SelfintSharp + +namespace Blc.SelfintSharedS647 +open Term SelfintControl SelfintRemainderChain SelfintSharp +set_option maxRecDepth 100000 +set_option maxHeartbeats 16000000 + +def body : Term := (.app (.app (.var 0) (.app (.app (.var 0) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.var 0))) (.app (.app (.var 0) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.var 0))) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.lam (.lam (.var 1))))) (.lam (.var 0))))) (.app (.lam (.lam (.var 1))) (.lam (.var 0)))))) (.app (.lam (.lam (.var 1))) (.lam (.var 0))))) (.app (.lam (.lam (.var 1))) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.app (.var 0) (.lam (.var 0))))) (.app (.app (.var 0) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.var 0))) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.lam (.lam (.var 1))))) (.app (.app (.var 0) (.lam (.var 0))) (.app (.lam (.lam (.var 1))) (.app (.app (.var 0) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.var 0))) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.app (.var 0) (.app (.lam (.lam (.var 1))) (.var 0))))) (.app (.app (.var 0) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.var 0))) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.app (.var 0) (.app (.lam (.lam (.var 1))) (.var 0))))) (.app (.app (.var 0) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.var 0))) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.app (.var 0) (.app (.lam (.lam (.var 1))) (.var 0))))) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.app (.var 0) (.app (.lam (.lam (.var 1))) (.lam (.lam (.var 1))))))) (.app (.app (.var 0) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.var 0))) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.lam (.lam (.var 1))))) (.lam (.var 0))))) (.app (.lam (.lam (.var 1))) (.lam (.var 0)))))))) (.app (.lam (.lam (.var 1))) (.app (.app (.var 0) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.var 0))) (.app (.app (.var 0) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.var 0))) (.app (.app (.var 0) (.app (.lam (.lam (.var 1))) (.lam (.lam (.var 1))))) (.lam (.var 0))))) (.app (.lam (.lam (.var 1))) (.lam (.var 0)))))) (.app (.lam (.lam (.var 1))) (.lam (.var 0))))))))) (.app (.lam (.lam (.var 1))) (.app (.lam (.lam (.var 1))) (.lam (.var 0)))))))) (.app (.lam (.lam (.var 1))) (.app (.lam (.lam (.var 1))) (.lam (.var 0)))))))))) (.app (.lam (.lam (.var 1))) (.lam (.var 0))))))) +def sComb : Term := (.lam (.lam (.lam (.app (.app (.var 2) (.var 0)) (.app (.var 1) (.var 0)))))) +def reader : Term := .app (.lam body) sComb +def common : Term := .lam (.app (.app (.var 0) SelfintRemainder.context) + SelfintRemainder.context) +def trace : List (List Direction) := [[], + [.left], + [], + [.under, .left, .left, .left], + [.under, .left, .left], + [.under, .left], + [.under, .left, .left, .left, .left], + [.under, .left, .left, .left], + [.under, .left, .left], + [.under, .left, .left, .left, .left], + [.under, .left, .left, .left], + [.under, .left, .left], + [.under, .left], + [.under], + [.under, .left, .left, .left, .left], + [.under, .left, .left, .left], + [.under, .left, .left], + [.under, .left, .left, .left, .left, .left], + [.under, .left, .left, .left, .left], + [.under, .left, .left, .left], + [.under, .left, .left, .left, .left, .left], + [.under, .left, .left, .left, .left], + [.under, .left, .left, .left], + [.under, .left, .left], + [.under, .left], + [.under, .left, .left, .left, .left, .left], + [.under, .left, .left, .left, .left], + [.under, .left, .left, .left], + [.under, .left, .left, .left, .left, .left], + [.under, .left, .left, .left, .left], + [.under, .left, .left, .left], + [.under, .left, .left], + [.under, .left, .left], + [.under, .left, .right, .left, .left], + [.under, .left, .right, .left], + [.under, .left, .right], + [.under, .left, .right, .left], + [.under, .left, .right], + [.under, .left, .right, .left], + [.under, .left, .right], + [.under, .left, .right, .under, .left, .left], + [.under, .left, .right, .under, .left], + [.under, .left, .right, .under, .left], + [.under, .left, .right, .under], + [.under, .left, .right, .under, .under, .left], + [.under, .left, .right, .under, .under, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left], + [.under, .left, .right, .under, .under, .right], + [.under, .left, .right, .under, .under, .right, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .right], + [.under, .left, .right, .under, .under, .right, .left, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .right], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .right], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .right], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .right], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .right], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .right, .left, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .right, .left], + [.under, .left, .right, .under, .under, .right, .left, .right, .under, .under, .under, .right], + [.under, .left, .right, .under, .under, .right, .right, .left, .left], + [.under, .left, .right, .under, .under, .right, .right, .left], + [.under, .left, .right, .under, .under, .right, .right], + [.under, .right, .left, .left], + [.under, .right, .left], + [.under, .right], + [.under, .right, .left], + [.under, .right], + [.under, .right, .left], + [.under, .right], + [.under, .right, .under, .left, .left], + [.under, .right, .under, .left], + [.under, .right, .under, .left], + [.under, .right, .under], + [.under, .right, .under, .under, .left], + [.under, .right, .under, .under, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .left], + [.under, .right, .under, .under, .right, .left], + [.under, .right, .under, .under, .right, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .left], + [.under, .right, .under, .under, .right, .left], + [.under, .right, .under, .under, .right], + [.under, .right, .under, .under, .right, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .left], + [.under, .right, .under, .under, .right, .left], + [.under, .right, .under, .under, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .left], + [.under, .right, .under, .under, .right, .left], + [.under, .right, .under, .under, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .left], + [.under, .right, .under, .under, .right, .left, .right], + [.under, .right, .under, .under, .right, .left, .right, .left], + [.under, .right, .under, .under, .right, .left, .right], + [.under, .right, .under, .under, .right, .left, .right, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .left], + [.under, .right, .under, .under, .right, .left, .right, .under], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .right, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .left, .right], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .right, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .left, .right], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .right, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .left, .right, .right], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .right, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .left, .right], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .right, .left, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .right, .left, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .right, .left], + [.under, .right, .under, .under, .right, .left, .right, .under, .under, .under, .right], + [.under, .right, .under, .under, .right, .right, .left, .left], + [.under, .right, .under, .under, .right, .right, .left], + [.under, .right, .under, .under, .right, .right]] + +theorem checked_trace : replay trace reader = some common := by decide +theorem reader_reduces : Betas reader common := replay_sound checked_trace +theorem reference_reduces : Betas SelfintRemainder.rem70 common := + replay_sound (by decide : replay [[.under]] SelfintRemainder.rem70 = some common) + +theorem reader_closed : Closed reader := by decide +theorem reader_size : (blcCode reader).length = 647 := by decide +theorem reader_two_nonlinear : SelfintLowerBound.nonlinear reader = 2 := by decide + +/-- A live lambda captures when it is not closed as a standalone subterm. -/ +def liveCaptures : Term → Nat + | .var _ => 0 + | .app f a => liveCaptures f + liveCaptures a + | .lam b => liveCaptures b + + if 0 < occ 0 b ∧ ¬ Closed (.lam b) then 1 else 0 + +/-- Distinct free de Bruijn indices, relative to this subterm. -/ +def freeVars : Term → List Nat + | .var n => [n] + | .app f a => (freeVars f ++ freeVars a).eraseDups + | .lam b => (freeVars b).filterMap (fun n => if n = 0 then none else some (n - 1)) + +def widthWitnesses : Term → Nat + | .var _ => 0 + | .lam b => widthWitnesses b + if 3 ≤ (freeVars (.lam b)).length then 1 else 0 + | .app f a => widthWitnesses f + widthWitnesses a + + if 3 ≤ (freeVars (.app f a)).length then 1 else 0 + +theorem reader_two_live_captures : liveCaptures reader = 2 := by decide +theorem reader_one_width_three_subterm : widthWitnesses reader = 1 := by decide +theorem body_no_width_three_subterm : widthWitnesses body = 0 := by decide +theorem sComb_one_width_three_subterm : widthWitnesses sComb = 1 := by decide + +/-- Full beta-exact contract, with open sources and arbitrary suffixes. -/ +theorem reader_contract (M N : Term) : + BetaJoin (.app reader (streamOf (blcCode M) N)) N := by + have hsame : BetaJoin reader SelfintRemainder.rem70 := + ⟨common, reader_reduces, reference_reduces⟩ + exact join_trans (join_appL _ hsame) + (join_of_betas (SelfintRemainder.rem70_contract M N)) + +theorem reader_isRemainder : IsRemainder reader := + ⟨reader_closed, fun M _ N => reader_contract M N⟩ + + +end Blc.SelfintSharedS647 diff --git a/lean/Blc/SelfintTower45.lean b/lean/Blc/SelfintTower45.lean new file mode 100644 index 00000000..aa056677 --- /dev/null +++ b/lean/Blc/SelfintTower45.lean @@ -0,0 +1,96 @@ +/- +A 45-bit exact reader for all-zero prefixes followed by a unary variable +code. This handles every lambda tower, but is NOT a general remainder +extractor. It limits lower bounds using only the infinite-zero execution. +-/ +import Blc.SelfintRemainder +import Blc.SelfintZero + +namespace Blc.SelfintTower45 +open Term SelfintZero + +/-- D = λb r d. r (b d r) d. -/ +def context : Term := .lam (.lam (.lam + (.app (.app (.var 1) (.app (.app (.var 2) (.var 0)) (.var 1))) (.var 0)))) + +def parse (s : Term) : Term := .app (.app s context) context + +def reader : Term := .lam + (.app (.lam (.app (.app (.var 1) (.var 0)) (.var 0))) context) + +theorem context_closed : Closed context := by decide +theorem reader_closed : Closed reader := by decide +theorem reader_size : (blcCode reader).length = 45 := by decide + +theorem subst_context (j : Nat) (s : Term) : substDec j s context = context := + substDec_closed j s context_closed +theorem subst_reader (j : Nat) (s : Term) : substDec j s reader = reader := + substDec_closed j s reader_closed + +theorem run_unfold : spineSteps 2 (.app reader (.var 0)) = + some (parse (.var 0)) := by decide + +theorem unfold_reader (s : Term) : SpineReds (.app reader s) (parse s) := by + have h := spineReds_instN [s] 0 (spineReds_of_spineSteps _ run_unfold) + simpa [instN, parse, substDec, shift, subst_reader, subst_context, shift_zero] using h + +theorem run_bit (b : Bool) : spineSteps 4 (parse (pairT (churchBit b) (.var 0))) = + some (.app (.app (.var 0) (.app (.app (churchBit b) context) (.var 0))) context) := by + cases b <;> decide + +theorem bit_clause (b : Bool) (r : Term) : + Betas (parse (pairT (churchBit b) r)) + (.app (.app r (.app (.app (churchBit b) context) r)) context) := by + have h := spineReds_instN [r] 0 (spineReds_of_spineSteps _ (run_bit b)) + have h' : SpineReds (parse (pairT (churchBit b) r)) + (.app (.app r (.app (.app (churchBit b) context) r)) context) := by + cases b <;> + simpa [churchBit, instN, parse, pairT, substDec, shift, subst_context, + shift_churchTrue, substDec_churchTrue, shift_churchFalse, + substDec_churchFalse, substDec_shift0, shift_zero] using h + exact betas_of_spineReds h' + +theorem zero (r : Term) : Betas (parse (pairT churchTrue r)) (parse r) := + betas_trans (bit_clause false r) + (betas_appL context (betas_appR r (betas_of_spineReds (spine_true2 context r)))) + +theorem one (r : Term) : Betas (parse (pairT churchFalse r)) (.app (.app r r) context) := + betas_trans (bit_clause true r) + (betas_appL context (betas_appR r (betas_of_spineReds (spine_false2 context r)))) + +theorem variable_clause (i : Nat) (N : Term) : + Betas (parse (streamOf (blcCode (.var i)) N)) N := by + rw [code_var, streamOf_cons] + refine betas_trans (one _) ?_ + refine betas_trans (betas_of_spineReds (spineReds_appL context (skip_self i N))) ?_ + have h := spine_beta (shift 1 0 N) context + have e : contract (shift 1 0 N) context = N := substDec_shift N _ 0 + rw [e] at h + exact betas_of_spineReds h + +/-- No parity, closedness, or suffix restriction: 0^k 1^(i+1) 0 ++ N. -/ +theorem parse_zeros_variable (k i : Nat) (N : Term) : + Betas (parse (zeros k (streamOf (blcCode (.var i)) N))) N := by + induction k with + | zero => exact variable_clause i N + | succ k ih => exact betas_trans (zero _) ih + +theorem reader_zeros_variable (k i : Nat) (N : Term) : + Betas (.app reader (zeros k (streamOf (blcCode (.var i)) N))) N := + betas_trans (betas_of_spineReds (unfold_reader _)) (parse_zeros_variable k i N) + +/-- In particular every closed source λ^n.I, the family used by the +zero-stream obstruction, is parsed exactly for every suffix. -/ +theorem reader_towers (n : Nat) (N : Term) : + Betas (.app reader (streamOf (blcCode (SelfintZero.tower n)) N)) N := by + rw [SelfintZero.tower_stream] + have he : zeros (2 * n) (streamOf (blcCode (.lam (.var 0))) N) = + zeros (2 * n + 2) (streamOf (blcCode (.var 0)) N) := by + induction (2 * n) with + | zero => rfl + | succ k ih => simpa only [zeros] using congrArg (pairT churchTrue) ih + rw [he] + exact reader_zeros_variable _ _ _ + + +end Blc.SelfintTower45 diff --git a/lean/README.md b/lean/README.md index 538b5fb2..392f010a 100644 --- a/lean/README.md +++ b/lean/README.md @@ -2,7 +2,8 @@ The kernel-checked BLC formalization behind blam's certificate layer. No mathlib and no `sorry`; every theorem depends at most on `propext` and -`Quot.sound`. +`Quot.sound`, except the remainder-growth synthesis (`SelfintGrowth*`) and the +27-bit floor (`SelfintFloor*`), which also use `Classical.choice`. ``` theorem loop32_noNormalForm : ¬ HasNormalForm loop32 -- axioms: propext @@ -22,6 +23,8 @@ theorem selfint_contract165 : Closed M → -- propext, Quot.sound theorem not_selfintSizeBound_166 : ¬ SelfintSizeBound 166 -- propext, Quot.sound +theorem selfintSizeBound_27 : SelfintSizeBound 27 + -- propext, Classical.choice, Quot.sound ``` The 32-bit term that the reference busy-beaver ledger excludes by hand has no @@ -227,6 +230,28 @@ Self-interpretation: - `Blc/SelfintControl.lean` — arbitrary continuation/suffix instances of the β-joinability contract and the unconditional theorem that `E E` cannot be β-equal to an exact self-interpreter `E`. +- `Blc/SelfintFloorCount.lean`, `SelfintFloorArg`, `SelfintFloorEmerge`, + `SelfintFloorLiteral`, `SelfintFloorLambda`, `SelfintFloorApp` — the + kernel-checked floor `SelfintSizeBound 27`: three live binders from the + incomparable pair and a live capture, a β-invariant forcing an argument + with two free variables, an abstraction body that is not an application, + four abstractions for abstraction-rooted interpreters, and a classification + of minimal application-rooted ones below 27 bits; a literal `λc s.B` costs + at least 31. +- `Blc/SelfintFloor37.lean` — GENERATED by + `tools/self-interpreter/theory/floor37/verify.py`: the fixed head-reduction + clauses cited by the handwritten 37-bit floor + (`docs/classical/self-interpreter/global-floor.md`). +- `Blc/SelfintKnot.lean` — an opaque β fixed point `t =β h t` costs at least + `18 + 2k` bits for `k` hole occurrences; with the parser binder and two + calls, the 165's recursion overhead is at least 31, attained. +- `Blc/SelfintRemainderChain.lean`, `SelfintTower45`, + `SelfintResidualControl`, `SelfintSharedS647`, `SelfintFixedResiduals` — + remainder extractors: incomparable nonlinear binders, the transfer + `|E| ≥ Rmin − 8`, a 45-bit reader for every λ-tower and index, the + pending-depth obligation after an application's left child, a 647-bit + extractor with exactly two nonlinear binders and one width-three subterm, + and kernel-checked failures of the near misses. Generated: diff --git a/tools/self-interpreter/polish.py b/tools/self-interpreter/polish.py new file mode 100644 index 00000000..bcf6ce2f --- /dev/null +++ b/tools/self-interpreter/polish.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Battery, then the optimal let structure, for candidate interpreters. + + polish.py FILE.lam... + +For each file: run battery.py; if the candidate passes, run +`blam golf letopt` (three cuts below 176 bits, two above; a timeout skips +the run) on its core and on the term as written, report the smallest +rendering, and battery-check any rendering below 165. A new algorithm's +size is its letopt minimum, not its first written form. + +Needs target/release/blam with the lab feature. +""" +import os +import re +import subprocess +import sys +import tempfile +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parent.parent +sys.path.insert(0, str(HERE)) +sys.path.insert(0, str(ROOT / "tools")) +import battery + +BLAM = str(ROOT / "target" / "release" / "blam") +BATTERY = str(HERE / "battery.py") + + +def battery_line(*args): + r = subprocess.run([sys.executable, BATTERY, *args], capture_output=True, text=True, cwd=ROOT) + return (r.stdout + r.stderr).strip() + + +def main(): + for f in sys.argv[1:]: + line = battery_line(f) + print(f"{f}: {line}") + if "fail=0" not in line: + continue + bits = battery.enc(battery.compile_lam(open(f).read())) + runs = ((["--max-cuts", "2"],) if len(bits) > 175 + else (["--max-cuts", "3"], ["--no-inline", "--max-cuts", "2"])) + for args in runs: + try: + r = subprocess.run([BLAM, "golf", "letopt", "--bits", bits, "--report-le", "164", + "--threads", "2", *args], + capture_output=True, text=True, timeout=240) + except subprocess.TimeoutExpired: + print(f" letopt {' '.join(args)}: timeout") + continue + m = re.search(r"smallest rendering over .*?: (\d+) bits", r.stdout) + print(f" letopt {' '.join(args)}: smallest {m.group(1) if m else '?'}") + best = re.search(r"best (\d+) ([01]+)", r.stdout) + if best and int(best.group(1)) < 165: + fd, p = tempfile.mkstemp(suffix=".blc", dir=str(Path(f).resolve().parent)) + os.close(fd) + Path(p).write_text(best.group(2) + "\n") + print(f" sub-165 rendering {best.group(1)} -> {p}: {battery_line('--bits', best.group(2))}") + + +if __name__ == "__main__": + main() diff --git a/tools/self-interpreter/theory/floor37/check34.py b/tools/self-interpreter/theory/floor37/check34.py new file mode 100644 index 00000000..da8a1ff4 --- /dev/null +++ b/tools/self-interpreter/theory/floor37/check34.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""The twelve residual 34-bit layouts, after the handwritten reduction. + +No closed-term census. No modification of repository files. +""" +import sys +sys.dont_write_bytecode = True +from pathlib import Path +import itertools +import json + +ROOT = Path(__file__).resolve().parents[4] +sys.path.insert(0, str(ROOT / "tools")) +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import blcc +import lc + +def parse(src): + parser = blcc.P(blcc.strip_comments(src)) + tree = blcc.p_lc(parser) + parser.ws() + assert parser.i == len(parser.t) + return blcc.to_db(tree) + +def head_step(t): + if t[0] == 'L': + u = head_step(t[1]) + return None if u is None else ('L', u) + if t[0] == 'A': + if t[1][0] == 'L': + return lc.beta(t[1], t[2]) + u = head_step(t[1]) + return None if u is None else ('A', u, t[2]) + return None + +def head_trace(t, cap=100): + seen = {t:0} + for n in range(cap): + u = head_step(t) + if u is None: + return 'hnf', n, t + if u in seen: + return 'loop', (seen[u],n+1), u + seen[u] = n+1 + t = u + if lc.size(t) > 100000: + return 'size', n+1, t + return 'cap',cap,t + +def invoke(e, m): + return ('L',('L',('A',('A',lc.shift(2,0,e),('V',1)), + lc.bitlist(lc.enc(m),('V',0))))) + +def main(): + rows = [] + delta = parse('\\x.x x') + ident = parse('\\x.x') + for (a,b,c) in itertools.permutations('abc'): + for tree in (f'({a} {b}) {c}', f'{a} ({b} {c})'): + nsrc = '\\a\\b.a (\\c.' + tree + ')' + n = parse(nsrc) + e = ('A',delta,n) + assert lc.size(e) == 34 + status, steps, hnf = head_trace(e) + pstatus,psteps,phnf = head_trace(invoke(e,ident)) + row = dict(tree=tree, n=nsrc, source_bits=lc.enc(e), + head_status=status, head_steps=steps, + head_result=lc.show(hnf)[:1000], + I_status=pstatus,I_steps=psteps, + I_result=lc.show(phnf)[:1000]) + rows.append(row) + print(json.dumps(row)) + (Path(__file__).parent/'check34.json').write_text(json.dumps(rows,indent=2)+'\n') + +if __name__ == '__main__': + main() diff --git a/tools/self-interpreter/theory/floor37/check35.py b/tools/self-interpreter/theory/floor37/check35.py new file mode 100644 index 00000000..31b7249f --- /dev/null +++ b/tools/self-interpreter/theory/floor37/check35.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +"""Sixty four-leaf layouts forced by the 35-bit, four-lambda allocation.""" +import sys +sys.dont_write_bytecode = True +import itertools +import json +from pathlib import Path +from check34 import parse, head_trace, invoke, lc + +def trees(xs): + if len(xs) == 1: + yield xs[0] + for k in range(1,len(xs)): + for f in trees(xs[:k]): + for a in trees(xs[k:]): + yield f'({f} {a})' + +def spine(t): + binders=0 + while t[0]=='L': + binders+=1 + t=t[1] + args=[] + while t[0]=='A': + args.append(t[2]); t=t[1] + return binders,t,list(reversed(args)) + +def main(): + delta=parse('\\x.x x') + ident=parse('\\x.x') + rows=[] + for p in sorted(set(itertools.permutations('aabc'))): + for body in trees(p): + n=parse('\\a\\b\\c.'+body) + e=('A',delta,n) + assert lc.size(e)==35 + status,steps,h=head_trace(e,48) + ps,pn,ph=head_trace(invoke(e,ident),48) + bs,hd,args=spine(h) + pb,px,pa=spine(ph) + row=dict(body=body,bits=lc.enc(e),head_status=status,head_steps=steps, + head_binders=bs,head=repr(hd),head_arguments=len(args), + I_status=ps,I_steps=pn,I_binders=pb,I_head=repr(px), + I_arguments=len(pa)) + if status=='hnf':row['hnf']=lc.show(h)[:600] + if ps=='hnf':row['I_hnf']=lc.show(ph)[:600] + rows.append(row) + print(body,status,steps,(bs,hd,len(args)),ps,pn,(pb,px,len(pa))) + assert len(rows)==60 + (Path(__file__).parent/'check35.json').write_text(json.dumps(rows,indent=2)+'\n') + +if __name__=='__main__':main() diff --git a/tools/self-interpreter/theory/floor37/verify.py b/tools/self-interpreter/theory/floor37/verify.py new file mode 100644 index 00000000..73c03ed8 --- /dev/null +++ b/tools/self-interpreter/theory/floor37/verify.py @@ -0,0 +1,324 @@ +#!/usr/bin/env python3 +"""Fixed witnesses for the handwritten 37-bit theorem. + +The only finite layout families are 12 + 60 + 18 + 18 analytically forced +application trees. Caps are never refutations. Six infinite families have +separate handwritten invariants; this checks their finite macro identities. +Writes data/self-interpreter/theory/floor37.json and regenerates the kernel-checked +clauses in lean/Blc/SelfintFloor37.lean. The proof is +docs/classical/self-interpreter/global-floor.md. +""" +import sys +sys.dont_write_bytecode = True +from pathlib import Path +import itertools +import json +import time +import re +from check34 import parse, head_step, invoke, lc, ROOT +from check35 import trees, spine + +HERE=Path(__file__).resolve().parent +V=lambda n:('V',n) +L=lambda b:('L',b) +A=lambda f,a:('A',f,a) +I=L(V(0)) +KI=L(I) +DELTA=parse('\\x.x x') +CERTS=[] + +def steps(t,n): + for _ in range(n): + u=head_step(t) + assert u is not None + t=u + return t + +def normal(t): + if t[0]=='V':return True + if t[0]=='L':return normal(t[1]) + return t[1][0]!='L' and normal(t[1]) and normal(t[2]) + +def occ(t,n=0): + if t[0]=='V':return int(t[1]==n) + if t[0]=='L':return occ(t[1],n+1) + return occ(t[1],n)+occ(t[2],n) + +def nonlinear(t): + if t[0]=='V':return 0 + if t[0]=='L':return (occ(t[1])>1)+nonlinear(t[1]) + return nonlinear(t[1])+nonlinear(t[2]) + +def free(t,d=0): + if t[0]=='V':return {t[1]-d} if t[1]>=d else set() + if t[0]=='L':return free(t[1],d+1) + return free(t[1],d)|free(t[2],d) + +def width(t): + if t[0]=='V':return 1 + if t[0]=='L':return max(len(free(t)),width(t[1])) + return max(len(free(t)),width(t[1]),width(t[2])) + +def chain(t): + if t[0]=='V':return True + if t[0]=='L':return chain(t[1]) + return chain(t[1]) and chain(t[2]) and (nonlinear(t[1])==0 or nonlinear(t[2])==0) + +def counts(t): + if t[0]=='V':return 0,1,t[1] + if t[0]=='L': + a,b,c=counts(t[1]); return a+1,b,c + return tuple(x+y for x,y in zip(counts(t[1]),counts(t[2]))) + +def certify(label,t,n,u): + assert steps(t,n)==u,label + CERTS.append((label,t,n,u)) + +def finite_refute(label,e): + """Find only a proved finite wrong shape or an exact repeated head state.""" + seen={} + t=e + for n in range(80): + b,h,args=spine(t) + if b>=3: + certify(label,e,n,t) + return dict(kind='at_least_three_lambdas',steps=n) + if t in seen: + k=seen[t] + certify(label+'_prefix',e,k,t) + certify(label+'_cycle',t,n-k,t) + return dict(kind='exact_head_cycle',prefix=k,period=n-k) + seen[t]=n + u=head_step(t) + if u is None: + certify(label,e,n,t) + if b!=2: + return dict(kind='wrong_interface_arity',arity=b,steps=n) + if h==V(1) and len(args)!=2: + return dict(kind='wrong_continuation_spine',arity=len(args),steps=n) + break + t=u + else: + raise AssertionError((label,'needs a handwritten invariant')) + + # Only the identity source is needed for all remaining finite cases. + q=invoke(e,I);t=q + for n in range(80): + b,h,args=spine(t) + if b>=3: + certify(label+'_I',q,n,t) + return dict(kind='identity_extra_lambda',steps=n) + u=head_step(t) + if u is None: + certify(label+'_I',q,n,t) + if (b,h,len(args))!=(2,V(1),2): + return dict(kind='identity_wrong_spine',binders=b,head=repr(h),arity=len(args),steps=n) + for i,(arg,want) in enumerate(zip(args,(KI,V(0)))): + # A bounded normalization is positive evidence only: it must + # finish, and the resulting normal form must differ. + try:r=lc.nf(arg,[1000]) + except lc.Fuel:continue + if r!=want: + assert normal(r) + return dict(kind='identity_wrong_payload',payload=i, + normal_form=lc.show(r),steps=n) + raise AssertionError((label,'no refutation')) + t=u + raise AssertionError((label,'unresolved identity probe')) + +def case_families(): + rows=[] + for p in itertools.permutations('abc'): + for assoc in (0,1): + a,b,c=p + body=f'({a} {b}) {c}' if assoc==0 else f'{a} ({b} {c})' + n=parse('\\a\\b.a (\\c.'+body+')');e=A(DELTA,n) + label=f'g34_{len(rows)}' + assert lc.size(e)==34 + if body in ('(a c) b','(c a) b'): + result=dict(kind='handwritten_growth_invariant',family=body) + else:result=finite_refute(label,e) + rows.append(dict(group=34,body=body,**result)) + + for p in sorted(set(itertools.permutations('aabc'))): + for body in trees(p): + n=parse('\\a\\b\\c.'+body);e=A(DELTA,n) + assert lc.size(e)==35 + result=finite_refute(f'g35_{len(rows)}',e) + rows.append(dict(group=35,body=body,**result)) + + for p in itertools.permutations('abc'): + for assoc in (0,1): + for box in 'abc': + q=[f'(\\u.{x})' if x==box else x for x in p] + body=f'({q[0]} {q[1]}) {q[2]}' if assoc==0 else f'{q[0]} ({q[1]} {q[2]})' + n=parse('\\a.a (\\b\\c.'+body+')') + if not normal(n):continue + e=A(DELTA,n);assert lc.size(e)==36 + label=f'g36_{len(rows)}' + if body in ('(a b) (\\u.c)','(b a) (\\u.c)'): + result=dict(kind='handwritten_growth_invariant',family=body) + else:result=finite_refute(label,e) + rows.append(dict(group=36,body=body,**result)) + for p in itertools.permutations('abc'): + for assoc in (0,1): + for box in 'abc': + q=[f'(\\u.{x})' if x==box else x for x in p] + body=f'({q[0]} {q[1]}) {q[2]}' if assoc==0 else f'{q[0]} ({q[1]} {q[2]})' + if not normal(parse('\\a\\b.b (\\c.'+body+')')):continue + e=parse('\\a.(\\x.x x) (\\b.b (\\c.'+body+'))') + assert lc.size(e)==36 + label=f'g36open_{len(rows)}' + if body in ('(b c) (\\u.a)','(c b) (\\u.a)'): + result=dict(kind='handwritten_growth_invariant',family=body) + else:result=finite_refute(label,e) + rows.append(dict(group='36open',body=body,**result)) + assert len(rows)==108 + assert sum(r['kind']=='handwritten_growth_invariant' for r in rows)==6 + return rows + +def macro_checks(): + # All C,S,P are rigid in these fixed checks. The report proves the + # invariants for arbitrary finite wrapper words, not only these samples. + n1=parse('\\a\\b.a (\\c.a c b)') + n2=parse('\\a\\b.a (\\c.c a b)') + n3=parse('\\a.a (\\b\\c.a b (\\u.c))') + n4=parse('\\a.a (\\b\\c.b a (\\u.c))') + rigid=V(0) + def j(x,t):return L(A(A(lc.shift(1,0,x),V(0)),lc.shift(1,0,t))) + def pair(x,y):return L(A(A(V(0),lc.shift(1,0,x)),lc.shift(1,0,y))) + def k(x):return L(lc.shift(1,0,x)) + def f(x):return L(L(A(A(lc.shift(2,0,x),V(1)),k(V(0))))) + def g(x):return L(L(A(A(V(1),lc.shift(2,0,x)),k(V(0))))) + for length in (1,2,3): + # W=J_t1(...J_tk(N)); use distinct rigid labels to check ordering. + w=n1 + ts=[V(i+1) for i in range(length)] + for t in reversed(ts):w=j(w,t) + start=A(A(n1,w),rigid) + out=A(n1,j(w,rigid)) + for t in reversed(ts):out=A(out,t) + certify(f'macro34_chain_{length}',start,2+length,out) + w=pair(n2,V(0));ell=A(A(n2,w),V(1)) + certify('macro34_pair_pump',ell,4,A(ell,V(0))) + for power in (1,2,3): + w=n3 + for _ in range(power):w=f(w) + kp=rigid + for _ in range(power):kp=k(kp) + certify(f'macro36_forward_{power}',A(A(n3,w),rigid),1+2*power,A(A(n3,f(w)),kp)) + y=A(n4,g(n4)) + certify('macro36_reverse_pump',A(y,rigid),5,A(y,k(k(rigid)))) + # The open middle-duplicate case: a rigid outer a is boxed, and stays + # permanently behind the active recursive argument. + n5=parse('\\a\\b.b (\\c.b c (\\u.a))')[1] + n6=parse('\\a\\b.b (\\c.c b (\\u.a))')[1] + tail=k(rigid) + w=n5 + for power in (1,2,3): + w=j(w,tail) + out=A(n5,j(w,tail)) + for _ in range(power):out=A(out,tail) + certify(f'macro36_open_chain_{power}',A(n5,w),1+power,out) + def p(x):return L(A(A(V(0),lc.shift(1,0,x)),lc.shift(1,0,tail))) + ell=A(n6,p(n6)) + certify('macro36_open_pair_pump',ell,3,A(A(ell,tail),tail)) + +def remainder_checks(): + k=lambda t:L(lc.shift(1,0,t)) + delta_k=parse('\\x.x (\\u.x)') + vee=parse('\\x\\u.x x') + cases=[ + ('rem_d_kd',A(DELTA,k(DELTA)),2,DELTA), + ('rem_dk_d',A(delta_k,DELTA),3,DELTA), + ('rem_d_dk',A(DELTA,delta_k),4,delta_k), + ('rem_d_kkd',A(DELTA,k(k(DELTA))),2,k(DELTA)), + ('rem_d_kdk',A(DELTA,k(delta_k)),2,delta_k), + ('rem_dk_kd',A(delta_k,k(DELTA)),2,DELTA), + ('rem_v_d',A(vee,DELTA),1,k(A(DELTA,DELTA))), + ('rem_d_v',A(DELTA,vee),2,k(A(vee,vee))), + ] + for label,t,n,u in cases: + assert lc.size(t)<=23 + certify(label,t,n,u) + # Near-minimum syntax attains the 24-bit open-body counting bound but + # fails actual exact-remainder extraction even on source I / suffix I. + r=parse('\\s.s (\\x.x x) (\\x.x x)') + assert lc.size(r)==24 + got=lc.nf(A(r,lc.bitlist(lc.enc(I),I)),[100]) + assert normal(got) and got!=I + return dict(near_miss_bits=24,identity_suffix_I_nf=lc.show(got), + finite_clauses=len(cases)) + +def lean(t): + if t[0]=='V':return f'(.var {t[1]})' + if t[0]=='L':return f'(.lam {lean(t[1])})' + return f'(.app {lean(t[1])} {lean(t[2])})' + +def write_lean(): + out=['/-\nFixed head-reduction clauses supporting the handwritten 37-bit floor\n' + '(docs/classical/self-interpreter/global-floor.md) and the remainder\n' + 'extractor exclusions it cites. Generated by\n' + 'tools/self-interpreter/theory/floor37/verify.py; this file does not\n' + 'assert the size theorem itself.\n-/', + 'import Blc.Step','namespace Blc.SelfintFloor37','open Term', + 'set_option maxRecDepth 100000','set_option maxHeartbeats 4000000'] + for label,t,n,u in CERTS: + out += [f'theorem {label} : headSteps {n} {lean(t)} = some {lean(u)} := by decide'] + out+=['end Blc.SelfintFloor37'] + (ROOT/'lean/Blc/SelfintFloor37.lean').write_text('\n\n'.join(out)+'\n') + +def references(run_battery=False): + import merges + srcs={ + 'int165':ROOT/'data/self-interpreter/machines/int165.lam', + 'int204':ROOT/'data/self-interpreter/machines/int204_normal.lam', + 'int584':ROOT/'data/self-interpreter/machines/int584_two_nonlinear.lam', + 'int672':ROOT/'data/self-interpreter/machines/int672_typed_normal.lam', + 'int742':ROOT/'data/self-interpreter/machines/int742_two_nonlinear_normal.lam', + } + terms={k:parse(p.read_text()) for k,p in srcs.items()} + # The upstream named source is a 220-bit pre-optimization term. Use the + # exact 168-bit wire that the existing Lean theorem pins, not its source. + proof=(ROOT/'lean/Blc/Selfint.lean').read_text() + wire=re.search(r'def intLWire : List Bool := \[([^]]+)\]',proof)[1] + bits=''.join('1' if x.strip()=='true' else '0' for x in wire.split(',')) + assert len(bits)==168 + terms['int168'],end=lc.decode(bits) + assert end==168 + row=next(v for v in merges.VARIANTS if v[0]=='165, next inlined') + terms['int170']=parse(row[1]) + assert lc.size(terms['int170'])==170 + output=[] + if run_battery: + import battery,shutil,tempfile + frozen=Path(tempfile.mkdtemp())/'blam-frozen' + shutil.copy2(ROOT/'target/release/blam',frozen) + battery.BLAM=str(frozen) + for name,t in terms.items(): + nl=nonlinear(t);w=width(t);l,v,x=counts(t) + assert not free(t) and w>=3 and nl>=2 and not chain(t) + assert lc.size(t)==2*l+4*v-2+x and lc.size(t)>=37 + r=dict(name=name,bits=lc.size(t),lambdas=l,leaves=v,index_sum=x, + width=w,nonlinear=nl,normal=normal(t),incomparable_nonlinear=True) + if run_battery: + ok,skip,fail=battery.check(t,threads=2) + assert (ok,skip,len(fail))==(667,1,0),(name,ok,skip,fail[:3]) + r['battery']=f'{lc.size(t)} bits ok={ok} skip={skip} fail={len(fail)}' + print(name,r['battery'],flush=True) + output.append(r) + return output + +def main(): + start=time.monotonic() + rows=case_families() + macro_checks() + rem=remainder_checks() + write_lean() + refs=references('--battery' in sys.argv) + report=dict(layouts=rows,reference_checks=refs,remainder_checks=rem,lean_clauses=len(CERTS), + seconds=round(time.monotonic()-start,3)) + (ROOT/'data/self-interpreter/theory/floor37.json').write_text(json.dumps(report,indent=2)+'\n') + print(json.dumps({k:v for k,v in report.items() if k!='layouts'},indent=2)) + +if __name__=='__main__':main() From f13d3f3323b1e30508ca100311b9eaf148f7b599 Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 05:50:36 -0400 Subject: [PATCH 31/41] Record the reviewed dispatch obstructions and NEXT dispatch catalogue The zero arm's duplicate stream copy is forced for every application-only whole-stream skip; surplus reader arguments reach the rigid continuation; and no closed T makes one re-entrant reader read both tag bits (T (T C) V_n R = C V_(n+1) R fails for every head form). An independent review supplied the induction for the first and a stronger proof of the third, refuted the NEXT shared-argument lemma by a pair-packing construction, and ruled the 92-bit NEXT decomposition a heuristic. The interpreter record gains the 176 without a next let and the second-tag dispatch placements (169-172). --- .../reasoning_floor/README.md | 6 +- .../reasoning_floor/reader-proof/REPORT.md | 228 +++++++--- .../reasoning_floor/verify/vdispatch.md | 23 + .../reasoning_floor/verify/vdispatch_codex.md | 395 ++++++++++++++++++ .../verify/vdispatch_codex_checks.py | 107 +++++ .../reasoning_floor/verify/vreader.md | 37 ++ .../reasoning_floor/verify/vreader_gemini.md | 114 +++++ .../classical/self-interpreter/interpreter.md | 2 + .../self-interpreter/protocol-obstructions.md | 55 +++ 9 files changed, 899 insertions(+), 68 deletions(-) create mode 100644 data/self-interpreter/reasoning_floor/verify/vdispatch.md create mode 100644 data/self-interpreter/reasoning_floor/verify/vdispatch_codex.md create mode 100644 data/self-interpreter/reasoning_floor/verify/vdispatch_codex_checks.py create mode 100644 data/self-interpreter/reasoning_floor/verify/vreader.md create mode 100644 data/self-interpreter/reasoning_floor/verify/vreader_gemini.md diff --git a/data/self-interpreter/reasoning_floor/README.md b/data/self-interpreter/reasoning_floor/README.md index 48687246..8787ac17 100644 --- a/data/self-interpreter/reasoning_floor/README.md +++ b/data/self-interpreter/reasoning_floor/README.md @@ -18,9 +18,9 @@ No lane found an interpreter below 165. What the record keeps: | knot | opaque fixed points cost ≥ 20 bits, so the 165's 31 bits of recursion overhead are minimal (Lean); the generic diagonal carrier ≥ 12; two reset bootstraps at 192 | `interpreter.md` §4, §6; `lean/Blc/SelfintKnot.lean` | | lean-floor | kernel-checked `SelfintSizeBound 27` (from 18) | `structural-bounds.md`; `lean/Blc/SelfintFloor*.lean` | | env | cell ≥ 24 and lift ≥ 19 with borrowed raw data, then under only the Boolean lookup laws (handwritten, unreviewed); a 171 with a curried cell | `interpreter.md` §5, §6 | -| reader-proof | handwritten theorem: with the 165's knot and NEXT fixed, every reader body costs ≥ 43, uniquely attained (under review when archived) | `reader-proof/REPORT.md` | -| nextfuse | a catalogue of second-bit dispatch placements (166–188) and a decomposition argument that NEXT is 92 under the 165's interfaces | `nextfuse/REPORT.md` | -| dispatch | forcing lemmas for the reader and a theorem that the second bit's state cannot ride in the continuation; a 176 without a `next` let | `dispatch/REPORT.md` | +| reader-proof | handwritten theorem: with the 165's knot and NEXT fixed, every reader body costs ≥ 43, uniquely attained; a Gemini review found two local gaps, repaired in the report (a Codex review was pending when archived) | `reader-proof/REPORT.md`, `verify/vreader_gemini.md` | +| nextfuse | a catalogue of second-bit dispatch placements (166–188); its "NEXT is 92" is a measured construction and heuristic, and its shared-argument lemma was refuted by review | `interpreter.md` §6, `verify/vdispatch_codex.md` | +| dispatch | the zero arm's duplicate is forced for every application-only whole-stream skip; surplus reader arguments reach the rigid continuation; one re-entrant reader cannot read both tag bits (proof replaced by the reviewer's stronger one); a 176 without a `next` let | `protocol-obstructions.md`, `interpreter.md` §6, `verify/vdispatch_codex.md` | | grok | a correct 168 passing NEXT as the reader's third operand (proposed as 164; miscounted) | `interpreter.md` §6 | | blind, scratch, gemini | rediscoveries 166–214; an independent from-scratch design at 220 | `interpreter.md` §6 | diff --git a/data/self-interpreter/reasoning_floor/reader-proof/REPORT.md b/data/self-interpreter/reasoning_floor/reader-proof/REPORT.md index 3b47d5be..53207c82 100644 --- a/data/self-interpreter/reasoning_floor/reader-proof/REPORT.md +++ b/data/self-interpreter/reasoning_floor/reader-proof/REPORT.md @@ -38,7 +38,8 @@ realization (§2.2–2.3); the case analysis that remains is over four application is the stream's own node — is where the 165 lives and is priced exactly (`41 + 2d`, so 43 at depth 1); the other shapes are ≥ 46. Part 3 lists the steps whose rigour is weakest; the least formal is the -self-passing-walker bound (Lemma 2.3(c)), which has a ≥ 20-bit margin. +self-passing-walker bound (Lemma 2.3(c)), now a two-case split giving +≥ 47 for any reader with a lambda walk (cheapest construction 85). ### 1. Complete interpreters built @@ -306,12 +307,24 @@ So in case (i) every reader body contains, on its head path, a cell step (an `s`-leaf or `S`-valued leaf, 2 bits, plus its application node, 2), a dispatch lambda `λb` (2), its leaf `b` (2), and the two selection nodes (4; 2 when one is created). Call this the **dispatch**, cost ≥ 12 (≥ 10 -in the created-node shapes). Case (ii) is priced separately in §2.4. The depth `d ≥ 1` of the -selection node is the number of lambdas of `B` enclosing it; every lambda -on the head path encloses it (the handler binders `λb`, `λr`, `λt`, chain -binders, and let binders), so `d` equals the number of head-path λ-steps on -original lambdas, and every free leaf `s, next, cont` inside the arms pays -`d` extra bits. +in the created-node shapes). Case (ii) is priced separately in §2.4. + +**Depth [repaired after review 1].** Let `d` be the number of lambdas of +`B` that enclose the selection node and are contracted on the head path; +`λb` is one of them, so `d ≥ 1`, and every free leaf `s, next, cont` inside +the arms pays `d` extra bits. A head-path λ-step `(λy.M) Q` whose +abstraction does *not* enclose the selection is a let with the selection +inside `Q`: the head then continues through `y` at the head of `M`'s hnf +(`M = λz₁ … z_D. y A⃗`, the `λz` binding `D` operands first), and T10 forces +`fl(Q) ≥ 2` and `(fl(Q)−1)·D ≥ 6 + f(M)` when `y` occurs once (so `D ≥ 1`, +and the scaffolding `λy`, its node, the `λz`'s and the leaf `y` costs +`6 + 3D ≥ 9`, with `D ≥ 3` whenever `fl(Q) ≤ 3`, i.e. ≥ 15), or +`|Q| + (fl(Q)−1)·D ≥ 8 + f(M)` when `y` occurs twice (scaffolding ≥ 8). Such +a let contributes nothing to the arms' depth and is additive to every +cost below (its `Q` is the handler, whose dispatch and arms are charged +as usual, and its `A⃗` are operands); it therefore only raises the bounds. +Below, "operand" means a head-path argument subterm not containing the +selection, and `Z, V` lie in the bodies of all `d` enclosing lambdas. **Definition (arms, operands, environment).** `Z` (zero arm) and `V` (variable arm) are the subterms of `B` at the two argument positions of @@ -419,32 +432,71 @@ steps of the surviving copy that are not cell–cell meetings are each caused by a contraction of a lambda of `B` (an `F`, a `K`, or a receiver of the cell), and we are in case (c). -*(c) Lambda walk.* If no cell–cell meeting occurs on the surviving path, -each of its `n+1` cell contractions is caused by a lambda of `B` (directly, -or through an `F` it produced), and `F`-values are at most `2L + c` in -number, so for `n > 3|B|` some lambda `λ*` of `B` is contracted at least -three times in `ρ_v`, hence copied at least twice. Copies arise only from -nonlinear binders of `B`; following the copying relation among the -finitely many lambdas of `B` yields a *walker*: a lambda `Λ` of `B` -contracted on cells of two different indices, whose body applies the -received tail to a copy of a cycle lambda through a leaf `f` bound by a -nonlinear binder (an affine `f` could pass the copy along only once, and -a syntactic copy inside `Λ` is impossible). Its necessary original syntax: -a lambda receiving the bit (2), one binding the tail (2), the nonlinear -`λf` (2) with two leaves `f` (4), the node applying the tail (2) with its -leaf `r` (2) and the node passing `f` (2), and — since `P_0 Λ → Λ K N` -must return the bare `N` while higher levels continue — a test of the bit -(`b`, 2; two nodes, 4) returning the tail (2): **≥ 24**, all consumed or -erased, none of it the `cont` leaf. If the walker's bit test is the -reader's own dispatch, its two arms must behave differently at the top -level (produce `R next`, `cont P_{n-1} N`) and at the bottom (`N`, -continue), so each needs an extra flag argument and test (≥ 4 each); then -`|B| ≥ 4 + 24 + 4 + 3 + 4 + 8 ≥ 47`. Otherwise `|B| ≥ 24 + 12 + 4 + 3 ≥ -43` from the walker, the dispatch, `cont` and `next` alone. Either way no -reader with a lambda walk is below 43, and this case never attains 10 for -the N-source. The same accounting shows that making the last node of `P_0` -the output node `n_N` (which needs a walker carrying `P_{n-1}`) costs -≥ 24. ∎ +*(c) Lambda walk* **[repaired after review 1]**. If no cell–cell meeting +occurs on the surviving path, each of its `n+1` cell contractions is caused +by a lambda of `B` (directly, or through an `F` it produced), and `F`-values +are at most `2L + c` in number, so for `n > 3|B|` some lambda of `B` is +contracted at least three times in `ρ_v`, hence copied at least twice; the +copies come from a nonlinear binder of `B`, and following the copying +relation among the finitely many lambdas of `B` gives a lambda whose copies +receive cells of different indices — a *walker*. + +Two facts hold at every level `i ≥ 1` of such a walk. First, the tail +`P_{i-1}` must itself be opened (T7), so it is the *function* of some +redex; its node cannot be a created node (a created node's function is +`(Y' β')` or `Y'`, and `Y' →* P_{i-1}` or `Y' β' →* P_{i-1}` would make +that node a cell applied to a bit or to a tail, i.e. a cell–cell step, +excluded here), so **the tail is bound by a lambda `λr` of `B` and applied +at a node of `B` whose function is a leaf `r` of that lambda** (`λr` 2, +`r` 2, node 2). Second, the bit must be tested: at `P_0` the walker +receives `K` and must return the bare `N`, at `P_i` it receives `F` and must +continue; a term that does not select on the bit either returns the tail +unapplied (no recursion) or applies `N` (a rigid head, fatal). The +selection is `b Z C` with `b` a leaf of a `λb` of `B` and **two** nodes of +`B`: the second cannot be a created node, because then the zero arm would +receive the tail as its argument and have to *be* `N` (it is syntax of `B` +with no access to `N` unless a `λr` bound it, which is the other case). +Third, the walker refers to itself: at least two leaves of a nonlinear +binder (one applied or passed, one passed on) and a node (`λf` 2, `f f` 6). +The cases are distinguished by where `λr` sits: + +* **(A) the walker takes `(β, τ)`**, `Y = λb r. b Z C`, and `C` applies + `r` to the next copy: `C = r f f`-like. Zero arm `Z = r` (the leaf, 2) + is the cheapest term returning `N` at the bottom. Pieces: `λb λr λf` (6), + `b`, `r`, `r`, `f`, `f` (10), four nodes — two selection nodes, `(r f)`, + `((r f) f)` — (8): **24**, and the forced binder order `b, r, f` (the + cell supplies `β` then `τ`, the copy comes third) puts `b` at index 2 and + both `r` at index 1: **≥ 28 with indices**. `Y = λb r f. b r (r f f)` + attains 28 and walks (checked: `(λf. P_n f f) Y →* N`, `n ≤ 5`). +* **(B) the walker takes the cell**, `W W = λr. r H`, and the cell's own + second created node applies the selection result to the tail, so + `H = λb. b Z (w w)`; at the bottom `K Z (W W) N → Z N` forces `Z N →* N` + with `Z` syntax of `B` not binding `N`: `Z = I` (4) is the cheapest. + Pieces: `λw λr λb` (6), `r`, `b`, `w`, `w` (8), nodes `(r H)`, two + selection nodes, `(w w)` (8), `I` (4): **26**, and `w` under `λr λb` + carries index 2 twice: **≥ 30 with indices**. `W = λw r. r (λb. b I (w w))` + attains 30 and walks (checked: `W W P_n →* N`, `n ≤ 5`). The 22-bit + `λw b. b I (w w)` is not a walker: `P_i (W W) →* (W W) P_{i-1}` hands the + tail to `W W` as an argument, and `W W P_{i-1} →* W W` loses it + (checked). + +So **every walker costs ≥ 28 bits of original syntax**, consumed or erased +in `ρ_v`, none of it a frame leaf. A walker must also be *started*: its +first copy is referenced from outside itself, so `B` contains a second +syntactic copy (≥ 28) or a nonlinear let `(λg. … g … g …) W` (`λg`, its +node, two leaves: ≥ 8) — in case (B) the let's `g g` is the only way to +form `W W` once. The dispatch cell's `s`-leaf (2; in case (B) its node may +be the walker's `(r H)` node, in case (A) the node `(s g)` is separate), the +`cont` leaf (4), the `next` leaf (3) and the output node `n_N` (2; the only +created node with argument `N` is `P_0`'s, whose function would have to be +`cont P_{n-1}`, i.e. the walker would carry `P_{n-1}` and `cont` down the +walk, ≥ 8 more) are disjoint from all of this. Hence a reader containing a +lambda walk has + + |B| ≥ 28 + 8 + 2 + 4 + 3 + 2 = 47, + +and the N-source in this case is ≥ 36, never 10. (The cheapest walker reader +I can write is 85 bits.) ∎ **Lemma 2.4 (zero-R-source).** Realizations of **z-R** and their costs: (i) a bound leaf (2) whose binder is a head-path `λr` contracted on `τ` @@ -660,14 +712,51 @@ gives `|Z| ≥ 2` (a bound `R`-leaf, `d ≥ 2`) or `|Z| ≥ 4` (`λu. u`). (Row 1: `V` binds `τ`, so `e_V = 1`, `κ_v` costs 6, plus `λr` 2, `r` 2, N-source 10, `n_P n_N` 4. Row 3: `V` binds `τ` and `next`, `e_V = 2`. -Row 4: `V` binds `next`.) Any other operand `O` (`cont`, `s s`, `s F`, -`s K`, a second `next`, …) can serve as an output argument in neither arm -except `cont` for `V` — and `cont` as an operand costs `2 + 4` plus its -consumption by `Z` (2) and binding in `V` (2 + 2) against the `4 + d` -it replaces: a net increase — so it adds at least `2 + |O| + 2 ≥ 8` for -`|O| ≥ 4` over the rows above. A head-path depth `d ≥ 3` adds 2 per extra +Row 4: `V` binds `next`.) A head-path depth `d ≥ 3` adds 2 per extra lambda and one bit on `b` and on each free leaf of the arms (≥ 4 per -lambda). Hence (γ1) gives `|B| ≥ 46`. +lambda). + +**Other operands [repaired after review 1].** An operand `O` that is +neither `N`-valued nor `next` must be bound by a lambda — on the head path +(`d` grows by 1: `+1` on `b`, on `κ_v`, and on `ν_z` or its substitute) or +inside the arm that uses it (`+2` for the lambda, `+1` on that arm's free +leaves), and the other arm must consume `O` too (`≥ 2`) unless it also uses +it. Against this, `O` can replace syntax inside the arms. Case by case, +over the four rows above (base ≥ 46): + +* `O = s s` (spine `2 + 6 = 8`; values `K R`, `K N`). Inside `V` the + N-source becomes `q X` (node, `q`, `X`: 6 instead of 10, saving 4); in + `Z` the value `K R` can at best replace the `R`-leaf by `q u` (`q`, `u` + and a node, 6 instead of 2: a loss), so `Z` just consumes it (`+2`) or + pays a depth bit. Net `≥ 8 + 2 + 2 − 4 = +8`: `|B| ≥ 54`. Cheapest + construction: `s (λb r q. b (r next) (cont r (q r))) (s s)`, 58 bits + (checked). +* `O = s` (spine 4; values `Z_R`, `P_n`). It supplies one more cell-valued + leaf `t` at 2 bits, but the rows already price every cell-valued leaf of + the N-source at 2 (`r r X` with `r` at index 0), so nothing is saved; + net `≥ 4 + 2 + 2 = +8`: `|B| ≥ 54` + (`s (λb r t. b (r next) (cont r (t t t))) s`, 57 bits, checked). +* `O = s F` (spine 12; values `R`, `P_{n-1}`). It can replace the tail + leaf `r` in `V` and the `R`-leaf in `Z` (each 2, each already at its + minimum), so it saves ≤ 4 at the price of 12 + 2: net `≥ +10`: + `|B| ≥ 56` (`s (λb r t. b (t next) (cont t (r r r))) (s F)`, 66 bits, + checked). +* `O = s K` (spine 12; values `K`, `F`): a second bit, which no role + needs; net `≥ +14`. +* `O = cont` (spine 6): `V` may use the bound `t` (2 + index) instead of + `κ_v` (`4 + d + e_V`), saving at most `2 + d + e_V`, which is ≤ 6 in + every configuration below 50 bits (`d + e_V ≤ 4`); the price is + `6 + 2 + 2`: net `≥ +4`: `|B| ≥ 50` + (`s (λb r t. b (r next) (t r (r r t))) cont`, 56 bits, checked). +* a second `next` (spine 5): can only serve as a consumer leaf `X` + (already charged 2): net `≥ +5`. +* any `O` with a lambda, or any compound not listed, costs `≥ 2 + |O| + 2 + ≥ 10` and supplies at most one `R`-, tail-, or `N`-valued leaf (its + value is one term), replacing at most 2 bits in each arm — the dual + (zero/variable) operands of Lemma 2.4/2.5 (iv) cost ≥ 10 themselves: + net `≥ +6`. + +Hence (γ1) gives `|B| ≥ 46`, operands included. **(γ2) An N-valued operand `T`** (`2 + |T| ≥ 12`). If `n_N` is `T`'s spine node, `V[envⁱ]` applied to `τ` (if unbound) reduces to @@ -752,10 +841,10 @@ whose rigour is weakest. | T10 (minimum has no shrinking redex; Δ formula) | the formula is Lean (`wire_beta_delta`), re-checked on 3000 random redexes; the minimality argument is one line | | §2.1 decomposition, Lemma 2.1 (selection leaf) | handwritten residual tracing | | Lemma 2.3 (N-source ≥ 10), cases (a), (b) | handwritten, tight | -| Lemma 2.3 (c) (self-passing walker ≥ 24) | handwritten and coarse (a count of necessary pieces, see 3.2) — the weakest step | +| Lemma 2.3 (c) (self-passing walker: ≥ 28 per walker, reader ≥ 47) | handwritten two-case split, repaired after review 1 (see 3.2); the two attaining walkers checked — still the least formal step | | Lemmas 2.4–2.6 (R-source, tail, stream-node shortcuts) | handwritten exhaustive lists of realizations | | Lemma 2.7 (copies) | handwritten; relies on T10 and on the distinct signatures of the roles | -| §2.4 shapes (α), (β), (β′), (δ), (γ) and extras | handwritten arithmetic; every valid construction measured (`tools/menu.py` and inline checks) is ≥ its shape's bound | +| §2.4 shapes (α), (β), (β′), (δ), (γ) and extras | handwritten arithmetic; the (γ1) operand cases written out per operand after review 1; every valid construction measured (`tools/menu.py` and inline checks) is ≥ its shape's bound | | §2.5 τ-case ≥ 52 | handwritten, coarse | No Lean was written in this lane: the statements pinned down enough to @@ -773,23 +862,30 @@ does not exist in `lean/Blc`. to produce `R`, `P_{n-1}` or `N` from stream material in a way the tables do not cover; the `P_n`-only closure check and the table are the evidence that there is none, but the general claim is handwritten. -2. **The walker bound (Lemma 2.3 (c)).** A lambda of `B` contracted on - cells of two different indices must be copied, and the copying binder - must be nonlinear; I price the receiver's binders (bit, tail), the - application of the tail to a copy, the nonlinear binder with two - leaves, and the bit test with the return of `N`: `2+2+2+2+2+2+2+2+4+2 - = 24`, so even with the dispatch shared (the walker's bit test being - the reader's dispatch) the reader is ≥ `12 + (24 − 8) + 4 + 3 + 2 ≥ - 43`. This is a count of necessary pieces, not a case analysis; it has - a 20-bit margin over the cheapest walker I can write (85-bit reader), - but it is the step most likely to contain an unexamined realization. +2. **The walker bound (Lemma 2.3 (c)) [repaired after review 1].** The + first review found that the original piece count (24) was not tight + for the pieces it named: `λw b. b I (w w)` has 22 bits and the right + first step, but it is not a walker (it loses the tail at the next + level). The repaired lemma proves two facts for every level of a lambda + walk — the tail is bound by a lambda of `B` and applied at a node of + `B`, and the bit is tested with two nodes of `B` — and splits on where + the tail binder sits: (A) `λb r. b r (r f f)`-shaped, ≥ 24 pieces and + ≥ 28 with the forced indices; (B) `λw r. r (λb. b I (w w))`-shaped, + ≥ 26 pieces and ≥ 30 with indices. Both attaining walkers were checked + to walk. With the starter (≥ 8), the `s`-leaf, `cont`, `next` and + `n_N`, any walker reader is ≥ 47. This is still a count of necessary + pieces rather than a case analysis of all syntax; a reviewer should + check that no walker can test the bit with the created node *and* still + recover `N` at the bottom (the lemma argues it cannot, since the zero + arm would then have to be `N` without a binder for it). 3. **Lemma 2.7 (ii)** uses that copies of a let argument have β-equal values. This is true for copies produced by substitution of one argument; for copies produced inside a walker (different arguments at each level) it is not, which is why walkers are priced separately. A reader mixing a walker with cheap arms would have to be re-examined - against both arguments at once; I believe the 24-bit walker cost - closes it, but have not written that case out. + against both arguments at once; the repaired 28-bit walker cost and + the 47-bit reader bound of Lemma 2.3(c) close it with margin, but I + have not written that mixed case out separately. 4. **Depth taxes.** The arms' free leaves are charged `+1` per lambda above them. The Remark in §2.4 shows that a let cannot lift a leaf above an arm's consumption lambdas in the minimum. Data consumers @@ -797,13 +893,14 @@ does not exist in `lean/Blc`. to save at most one depth bit per free leaf; the arms in the tables have at most two free leaves, so this is safe, but shape (γ) rows with several consumptions deserve a re-count. -5. **Shape (γ1) "other operands" and `d ≥ 3`.** These are one-line - dominance arguments (each extra costs more than anything it can - replace). They are correct for the roles as priced, but they are the - kind of step where a clever double use (an operand that is at once a - tail source for `V` and an `R`-source for `Z`, e.g. `s F`) must be - checked: `s F` costs 10 and replaces `r` (2 + binder) in both arms, a - net loss; I checked `s F`, `s s`, `s K`, `next`, `cont`. +5. **Shape (γ1) "other operands" [repaired after review 1].** The first + review found that `O = s s` is half of an N-source (the bound `q = K N` + completes it as `q X`, saving 4 inside `V`), so the one-line dominance + was wrong as written. §2.4 now prices `s s`, `s`, `s F`, `s K`, `cont`, + a second `next`, and arbitrary other operands individually (all + ≥ +4 over the rows, `s s` giving ≥ 54 with a 58-bit construction). + The precision note on `d` (a head-path let whose argument contains + the selection does not enclose it) is closed in §2.1 by T10 pricing. ## 3.3 Residual cases @@ -817,10 +914,11 @@ in an identified family of terms. The honest summary: * **Fully covered with tight arithmetic:** shape (α) — every reader whose variable output node `cont P_{n-1}` is the stream's own node (this is the 165's mechanism; the 165 is the unique minimum there). -* **Covered with margin ≥ 3:** shapes (β), (γ), the τ-case, chains, lets, - data dispatch. -* **Covered with large margin but coarse reasoning:** self-passing - walkers (Lemma 2.3 (c)), rebuilt cells (Lemma 2.5 (iv)). +* **Covered with margin ≥ 3:** shapes (β), (γ) including its operand + cases, the τ-case, chains, lets, data dispatch. +* **Covered with large margin but coarser reasoning:** self-passing + walkers (Lemma 2.3 (c), ≥ 47 by a two-case piece count), rebuilt cells + (Lemma 2.5 (iv)). ## 3.4 Relation to the earlier bounds diff --git a/data/self-interpreter/reasoning_floor/verify/vdispatch.md b/data/self-interpreter/reasoning_floor/verify/vdispatch.md new file mode 100644 index 00000000..ae6fc0d9 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vdispatch.md @@ -0,0 +1,23 @@ +Adversarial verification request. You are a fresh, independent reviewer; find +an error if there is one. Repository: /Users/a9lim/Work/blam. + +Under review: the four handwritten results of +/Users/a9lim/Work/blam/tmp/overnight/dispatch/REPORT.md §3 (3.1 the zero arm +receives the tag-less stream twice; 3.2 trailing reader arguments reach the +rigid continuation; 3.3 uniformity of the variable arm's convention; 3.4 no +single reader can handle both tag bits with the decoding state carried in the +continuation — P k ([0] t) =β P (T k) t is impossible for any closed P, T). +Also /Users/a9lim/Work/blam/tmp/overnight/nextfuse/REPORT.md §3 (the +shared-argument lemma) and §4 (NEXT = 92 under interfaces I1–I4) — say +whether §4 is a proof or a decomposition heuristic, and whether its hypotheses +are stated precisely enough to be a theorem. + +Contract: E C (⌜M⌝ ++ N) =β C (λz. M) N for every closed M, C and N rigid; +⌜λM⌝ = 00⌜M⌝, ⌜M N⌝ = 01⌜M⌝⌜N⌝, var n = 1ⁿ0; K = λab.a (0), F = λab.b (1), +cons b r = λh. h b r. Background: docs/classical/self-interpreter/ +interpreter.md §2, §5, and protocol-obstructions.md. Check 3.4 especially +carefully: the hnf case split on `T k`, the `λⁿ.1` witnesses, the arity +argument `p = ½`, and whether `T k =β λt j. G` is really forced. Small fixed +checks (seconds) fine; no enumeration. Answer: verdict per result (correct / +gap / error), problems with location and counterexample, what you checked. +Write the review to /Users/a9lim/Work/blam/tmp/overnight/verify/vdispatch_codex.md. diff --git a/data/self-interpreter/reasoning_floor/verify/vdispatch_codex.md b/data/self-interpreter/reasoning_floor/verify/vdispatch_codex.md new file mode 100644 index 00000000..8b4a19a6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vdispatch_codex.md @@ -0,0 +1,395 @@ +# Independent review: dispatch and NEXT fusion + +Reviewer: Codex, fresh gaslamp consult, 2026-10-21. No consults back, candidate +enumeration, engine changes, or long runs. All equivalences below are beta, +not beta-eta. + +| Result | Verdict | +|---|---| +| dispatch §3.1 | **Correct.** The table argument needs an induction; a short complete one is supplied below. | +| dispatch §3.2 | **Correct under the fixed NEXT call protocol.** The rigid-head argument works even with an arbitrary skip. The phrase “whatever H” must retain that protocol restriction. | +| dispatch §3.3 | **Gap; its final independent-handler-law corollary is false.** Actual-stream calling conventions and laws on independently rigid operands are different claims. | +| dispatch §3.4 | **Gap in the written proof, but the impossibility conclusion is correct.** A replacement proof below uses only re-entry and the parametric closed-source contract. | +| nextfuse §3 shared-argument lemma | **Error as a complete classification.** An explicit shared-pair construction has neither a dummy argument nor a repeated tag dispatch. | +| nextfuse §4, NEXT = 92 | **Decomposition heuristic, not an established lower-bound theorem.** The literal region costs 92. I1–I4 do not specify the class needed to prove that minimum. | + +## 1. dispatch §3.1: the forcing conclusion is sound + +Location: `dispatch/REPORT.md:73–84`. + +The displayed table alone does not classify arbitrarily large application +trees. However, the needed classification has a short structural proof. +It suffices to test the hypothesis at unary length one. Put + +```text +u = cons F (cons K N), w = cons K N, +``` + +with `N` fresh and rigid. Every application-only tree over `u` reduces to +one of three forms: `u`, `K N`, or `N Q1 ... Qj`. The application cases are: + +```text +u u ->* K N +u (K N) ->* N w +u (N Q1 ... Qj) ->* N Q1 ... Qj F w +(K N) Q ->* N +(N Q1 ... Qj) Q ->* N Q1 ... Qj Q. +``` + +Consequently only the original leaf has the first form, only the syntactic +tree `u u` has the second, and the only way to obtain bare `N` is a root +application whose left subtree is exactly `u u`. Thus the original operand +must be syntactically `(s s) X`, for an arbitrary application-only `X`. +On `s = cons K q`, it reduces to `(K q) X -> q`. + +This proves the claim, including arbitrary tree size, without enumeration. +The hypothesis that the operand has no leaves other than `s` and no lambdas +is essential. The proof establishes the zero-arm input, not a general +lower bound on the implementation of that arm. + +## 2. dispatch §3.2: the rigid arity obstruction is valid in its protocol + +Location: `dispatch/REPORT.md:93–110`. + +On `I = lambda x.x`, the stipulated root ABS continuation is + +```text +k = lambda v. C (A v), +A v = lambda e a. v (lambda b r. b a (r e)). +``` + +The variable reader therefore returns + +```text +k r S T1 ... Tk ->* C (A r) S T1 ... Tk. +``` + +There are `2+k` arguments at rigid head `C`. This cannot be beta-equal to +the two-argument required result when `k >= 1`. In particular, there is +no need to assume `S = N` to obtain the contradiction. I checked the +specific `I` reduction, including `A (cons K N) = F`. + +The scope must say that the root ABS actually delegates its body to this +same reader with the displayed continuation, and that no adapter replaces +the continuation protocol. An arbitrary `H` allowed to implement a separate +parser instead would not be constrained by the displayed execution. Under +the intended fixed NEXT/ABS/APP protocol, the proof is correct. Its corollary +is a requirement to consume the surplus argument on the variable path; +it is not an independent size proof that 178 is optimal. + +## 3. dispatch §3.3: correlated correctness does not force rigid handler laws + +Locations: `dispatch/REPORT.md:119–129`, especially `131–134`. + +The argument correctly shows that a variable return on the `lambda.1` +path cannot forward a thunked or otherwise unequal remainder to the rigid +root. Likewise, the fixed downstream protocol does not absorb surplus +arguments. It does not establish the stated laws for independently rigid +`R,T`, and a single continuation instance does not prove a universal law +over all internal continuations and arbitrary operands. + +Here is an explicit counterexample to the last paragraph. Keep the standard +skip `s s s`, the entire NEXT region, and the usual values. Replace the +handler by + +```text +H = lambda b r t. b (t next) (c r (r r t)). +``` + +On a constructor, `r=t=q`, so `H K q q -> q next`. On a variable, let +`r = 1^(n-1)0 ++ N` and `t=N`. The ordinary unary identity gives +`r r -> K N`, hence + +```text +H F r N ->* c r N. +``` + +These are exactly the original parser clauses on every genuine input, so +the standard structural correctness argument applies unchanged. But for +independently rigid operands, + +```text +H F R T -> c R (R R T) !=beta c R T. +``` + +Both sides are distinct beta-normal forms. The new handler is larger; +this counterexample asserts no bit saving. It retains the correct +value/remainder convention on actual variable streams, so it specifically +refutes the purported transfer to independent rigid laws, not the narrow +claim about the final remainder on those streams. + +I checked both actual-stream clauses, the unequal rigid instance, and the +complete interpreter with this handler on four fixed closed programs. +This distinction agrees with the current boundary in +`interpreter.md:428–444`: actual correlations and independent rigid +interfaces require different arguments. + +## 4. dispatch §3.4: proof defects and a replacement proof + +### Defects in the supplied proof + +1. **Lines 155–157 substitute an unstated variable convention.** Hypothesis + 1 permits an arbitrary value `v`; it yields `(T C) v N'`, not necessarily + `(T C) t N'`. For the APP input, the misread variable indeed has unary + length one because a closed `M` starts with zero. That identifies its + remainder, but does not identify its value with the raw tail `t`. + +2. **Lines 159–162 do not force exactly two initial lambdas.** Merely + obtaining a `C`-headed result after two applications does not do so: + `T = lambda k v.k v` has `T C V R -> C V R`, while `T k` has only one + initial lambda. It is not beta-equal to its two-argument eta expansion. + This example does not satisfy the abstraction law; it refutes the stated + justification for omitting the zero- and one-binder cases. + +3. **The `lambda^n.1` witnesses are appropriate.** The head-`t` branch at + lines 166–170 is correct conditional on the displayed head form. For + large enough `n`, all supplied arguments are erased and a leading lambda + survives. Argument dependence on `V`, `R`, or `T C` does not defeat this. + +4. **Line 179 does not justify `q=1`.** Substitution for a head variable + can expose more lambdas. Even an actual application-code value extractor + can have `q=0`: with an exact interpreter `E`, define + `A_app(t) = E K (cons K (cons F t))`. For + `t = code(M) ++ code(N) ++ R`, it returns `lambda z.M N`. With `t` + rigid, the 165's parser equations expose a `t`-headed form, with no + leading lambda. Thus the application-extraction property does not + imply `q=1`. The particular `I I` example also cannot by itself + establish that number of binders. + +5. **The arithmetic at lines 180–182 is correct under its restrictions, + but those restrictions were not proved.** With general head form + `lambda^q.t B1...Bp`, the actual necessary equation is + `2(q-p)=1`, also impossible. The parity argument can therefore be + repaired without assuming `q=1`. + +6. **Lines 183–186 omit the remainder component's full head analysis.** + Its leading lambdas and bound head need treatment; moreover, the + occurrence called `k` becomes `T C` in the inner substitution, not + immediately rigid `C`. One must use the composed remainder equation, + not just say that the component “must compute the rest.” + +### A stronger obstruction, independent of the variable law + +The following is a complete handwritten head-form argument. It is not +Lean-checked. It repairs the conclusion without the APP argument or any +assumption on the variable-value convention. + +Let + +```text +M_n = lambda^n.1, V_n = lambda^(n+1).1, n >= 1. +``` + +Re-entry twice, followed by the closed-source contract, gives + +```text +T (T C) V_n R =beta C V_(n+1) R. (*) +``` + +Indeed `code(lambda.M_n) = 00 code(M_n)`. Here `C,R` are fresh rigid +variables. I claim no closed `T` can satisfy (*) for every `n`. + +Since an instance of (*) is head-normalizable, `T k` has a head normal +form for fresh `k`: head non-normalizability cannot be repaired by +substitution and further application. Write it as + +```text +lambda x1 ... xa. h Q1 ... Qb, +``` + +where `h` is `k` or one of the displayed bound variables. Choose `n` as +large as needed below; all head forms and their argument counts are fixed +independently of `n`. + +**Classify the outer head form.** + +- If `a>2`, (*) retains a leading lambda, impossible. +- If `h` is the first binder, substituting `V_n` and supplying the fixed + number of arguments leaves a leading lambda for large `n`, impossible. +- If `h` is the second binder, necessarily `a=2` in the remaining cases, + and the result is `R`-headed, impossible. +- Thus `h=k`. For `a=0`, composing twice produces `2b+2` arguments at `C`; + (*) forces `b=0`. Then `T k =beta k`, which leaves `V_n` unchanged, + contradicting (*). +- For `a=1`, composition produces `2b` arguments at `C`, so `b=1`. +- For `a=2`, `b<2` leaves a leading lambda, while `b>=2` produces + `2b-2` arguments at `C`. Thus `b=2`. + +There are only two remaining forms: + +```text +(i) T k =beta lambda t. k A[k,t] +(ii) T k =beta lambda t j. k A[k,t,j] B[k,t,j]. +``` + +**Case (i).** Put `A'=A[T C,V_n]`. The required value equation is + +```text +A[C,A'] =beta V_(n+1). +``` + +The open term `A` has a head normal form `lambda^q.h U1...Up`, since its +displayed substitution is head-normalizable. A bound head has a fixed +number of leading lambdas, and head `k` becomes rigid `C`; neither can +give the unbounded projection family on the right. Hence `h=t`. + +For sufficiently large `n`, projection erasure gives + +```text +A' =beta lambda^(n+1+q-p).1 +A[C,A'] =beta lambda^(n+1+2(q-p)).1. +``` + +Equality with `V_(n+1)` requires `2(q-p)=1`, a contradiction. + +**Case (ii).** Put + +```text +A' = A[T C,V_n,R], B' = B[T C,V_n,R]. +``` + +Rigid-head injectivity in (*) gives both + +```text +A[C,A',B'] =beta V_(n+1), B[C,A',B'] =beta R. (**) +``` + +Again write the head form of `A` as `lambda^q.h U1...Up`. A bound head or +`k` is excluded as in case (i); head `t` gives the same impossible parity +equation. It remains to consider `h=j`: + +```text +A' =beta lambda^q.R U1'...Up'. +``` + +Write the head form of `B` as `lambda^d.g D1...De`. The second equation +of (**) forces `d=0`: an initial lambda cannot disappear from a term +required to equal rigid `R`. Thus `g` is `k,t`, or `j`. + +- `g=k` immediately gives rigid head `C` in that equation, impossible. +- If `g=j`, then `B'=R D1'...De'`, and the composed remainder has `2e` + arguments at `R`. Thus `e=0` and `B=beta j`. The value in (**) then + has `R` as its head beneath `q` lambdas, not the required projection. +- If `g=t`, the composed remainder is `A' D1''...De''`. For `e=q` it is `R`-headed with + `p+e-q` arguments. Equality with bare `R` forces `p=0,e=q`. + Consequently `A=beta lambda^q.j` and + `B'=V_n D1'...Dq'`. For large `n`, this is + `lambda^(n+1-q).1`, so the composed value is + `lambda^q.B' =beta V_n`, contradicting the first equation of (**). + +Every head form is excluded. Therefore (*) is impossible, and hypotheses +2 and 3 of dispatch §3.4 alone already rule out the proposed `P,T`. + +The valid conclusion concerns this uniform, beta-exact re-entry equation +and the transparent parametric contract. It is not an exclusion of every +possible design described informally as “state in a continuation,” such +as designs with different internal values and a public adapter. + +## 5. nextfuse §3: a shared argument need not be discarded or repeat the tag + +Location: `nextfuse/REPORT.md:50`. + +With `X=c`, rigid-head equality really does force `Z=beta V_abs`. With +`Y=P`, it forces `Z=beta k_app`. The fact that these payloads are distinct +normal forms rules out making both heads bare with one unchanged payload. +Distinctness alone does not prove that every possible adapter must erase +its input; that would require a residual or context argument for these +particular payloads. + +More decisively, the proposed exhaustive classification is false. With +rigid `c,P,f,rest`, put + +```text +A = lambda e a.f (lambda b r.b a (r e)) +B = lambda g.c (lambda e.f e (g e)) +Z = lambda h.h A B +X = lambda z.c (z K) +Y = lambda z.P (z F). +``` + +Then + +```text +K X Y Z rest ->* c A rest +F X Y Z rest ->* P B rest. +``` + +Neither `X` nor `Y` is a bare head. Each uses `Z`, and neither contains +the tag bit or repeats its dispatch. The introduced binders are not dummy: +on `Z_uv=lambda h.h u v`, one gets `X Z_uv -> c u` and +`Y Z_uv -> P v`. All four equations were checked with independent rigid +variables by both Python and Rust normalization. + +This construction is not claimed to be cheaper. It disproves “if neither +head is bare, the dispatch is duplicated inside,” the assertion that the +three rows exhaust shared-argument cases, and the universal +dummy-binder-or-second-dispatch dichotomy. A size proof could separately +exclude this family by pricing its packing and projections; that argument +is absent. + +If the intended grammar forbids compound shared payloads, that restriction +must be stated. Neither the lemma nor I1–I4 currently states it. + +## 6. nextfuse §4: 92 is a measured construction, not the proved minimum + +Locations: `nextfuse/REPORT.md:54–61`, and the stronger claims at `76–78`. + +I independently measured the displayed NEXT at **92 bits** in the stated +frame `[cont,intL,x]`. The arithmetic `34+19+6+7+8+2+16=92` is consistent +with that concrete term. It establishes an upper bound. + +The sentence at line 61 calling this a “decomposition argument, not a +theorem over arbitrary terms” is the appropriate evidence boundary. The +claims of exhausted fusion and exact minimality go beyond the argument: + +- The dispatch classification it cites is incomplete, as the preceding + counterexample shows. +- Separate module minima do not add without proving the existence of + disjoint charged pieces in every candidate, or fixing opaque modules + syntactically. Sharing and beta expansion are exactly the issue here. +- I1–I4 specify semantic behavior but do not specify a candidate grammar, + all allowed free variables and their de Bruijn depths, whether actual + `intL` behavior may be exploited, whether values are independent rigid + inputs, or whether the region can introduce lets, pair representations, + extra calls, and alternate handoffs internally. +- In particular, a closed root contract does not by itself give all + independent open-value laws used to price intermediate components. + The report must either assume those laws or prove the transfer under + precise uniformity and context-independence hypotheses. +- “Each priced >=166 in the record so far” reports the measured designs; + it is not a lower bound on all implementations of the corresponding + interface changes. + +A precise conditional theorem could retain the fixed capture frame, +opaque module grammar, and independent rigid module laws from +`interpreter.md:274–294`, then state that the relevant module minima sum +to 92. Proving the stronger fused-region minimum requires a new argument +covering arbitrary terms within an explicitly defined interface. I1–I4 +alone and the present catalogue do not supply it. + +## 7. What was checked + +Read the requested report sections, the current interpreter contract and +module-bound qualifications, the relevant protocol-obstruction sections, +and the current self-interpreter STATUS entry. The reported historical +search minima and whole batteries were not rerun. + +Reproduction: + +```sh +python tmp/overnight/verify/vdispatch_codex_checks.py +python tmp/overnight/nextfuse/checks.py +``` + +The new script passed 16 fixed equality/inequality comparisons through +both the repository Python normalizer and the existing Rust binary, checked +the literal NEXT size and the `q=0` application extractor's weak head, and +checked the correlated-handler interpreter on `I`, `K`, `I I`, and `S`. +The final run took 0.107 seconds. The existing nextfuse fixed-identity +script also reported `ALL PASS`. + +Those computations support the concrete reductions and counterexamples. +The all-size claims in this review are the explicit handwritten arguments +above, not consequences of the finite checks. No sub-165 construction or +counterexample to the repaired §3.4 theorem was found or claimed. diff --git a/data/self-interpreter/reasoning_floor/verify/vdispatch_codex_checks.py b/data/self-interpreter/reasoning_floor/verify/vdispatch_codex_checks.py new file mode 100644 index 00000000..5be9d4ae --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vdispatch_codex_checks.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python3 +"""Fixed reduction checks for vdispatch_codex.md; no enumeration.""" +from pathlib import Path +import sys +import time +import re + +ROOT = Path(__file__).resolve().parents[3] +sys.path.insert(0, str(ROOT / "tmp/overnight/dispatch")) +from lab import parse as parse_raw, nf, enc, size, blam_nf, probe, app, bits, K +import lc + + +def parse(source, free=()): + source = re.sub(r"\\([A-Za-z_]\w*(?:\s+[A-Za-z_]\w*)+)\.", + lambda m: "\\" + "\\".join(m[1].split()) + ".", source) + return parse_raw(source, free=free) + +started = time.perf_counter() +count = 0 + + +def check(label, left, right, equal=True): + global count + a, b = parse(left), parse(right) + na, nb = nf(a, 20000), nf(b, 20000) + assert na is not None and nb is not None, label + assert (na == nb) == equal, label + ra, rb = blam_nf(a, 20000), blam_nf(b, 20000) + assert ra is not None and rb is not None, label + assert ra == enc(na) and rb == enc(nb), label + assert (ra == rb) == equal, label + count += 1 + print(f"PASS {label}") + + +ks = r"(\a b.a)" +fs = r"(\a b.b)" +cons = lambda b, r: rf"(\h.h {b} {r})" +s0 = cons(ks, "N") +s1 = cons(fs, s0) +check("s0 s0 = K N", rf"\N.{s0} {s0}", rf"\N.{ks} N") +check("s1 s1 = K N", rf"\N.{s1} {s1}", rf"\N.{ks} N") +check("s0 (K N) = N N", rf"\N.{s0} ({ks} N)", r"\N.N N") +check("s1 (K N) = N s0", rf"\N.{s1} ({ks} N)", rf"\N.N {s0}") + +A = r"(\e a.f (\b r.b a (r e)))" +B = r"(\g.C (\e.f e (g e)))" +H = r"(\b r t.b (t next) (C r (r r t)))" +check("correlated H: zero law", rf"\C next R.{H} {ks} R R", r"\C next R.R next") +check("correlated H: variable 1", rf"\C next N.{H} {fs} {s0} N", rf"\C next N.C {s0} N") +r3 = cons(fs, cons(fs, s0)) +check("correlated H: variable 3", rf"\C next N.{H} {fs} {r3} N", rf"\C next N.C {r3} N") +check("correlated H fails independent rigid variable law", + rf"\C next R T.{H} {fs} R T", r"\C next R T.C R T", False) + +av = r"(\e a.v (\b r.b a (r e)))" +trailing = rf"\C N T.(\v.C {av}) {s0} N T" +check("trailing argument reaches C on I", trailing, rf"\C N T.C {fs} N T") +check("trailing argument violates contract", trailing, rf"\C N T.C {fs} N", False) + +Z = rf"(\h.h {A} {B})" +X = rf"(\z.C (z {ks}))" +Y = rf"(\z.P (z {fs}))" +check("shared pair: ABS", rf"\C P f rest.{ks} {X} {Y} {Z} rest", rf"\C P f rest.C {A} rest") +check("shared pair: APP", rf"\C P f rest.{fs} {X} {Y} {Z} rest", rf"\C P f rest.P {B} rest") +check("shared pair: X uses its payload", rf"\C P u v.{X} (\h.h u v)", r"\C P u v.C u") +check("shared pair: Y uses its payload", rf"\C P u v.{Y} (\h.h u v)", r"\C P u v.P v") + +V = r"(\a b c d e f g h i.i)" # V_8, nine lambdas. +check("one-binder T is not forced to two binders by two-argument output", + rf"\C R.(\k v.k v) C {V} R", rf"\C R.C {V} R") +check("general q=2,p=1 tower law", + rf"\C R.(\t x y.t C) ((\t x y.t R) {V})", + r"\C R.\a b c d e f g h i j k.k") + +next_src = r"\bit1.intL (\exp.bit1 (cont (\args arg.exp (\zx zy.zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args)))))" +assert size(parse(next_src, free=("cont", "intL", "x"))) == 92 +print("PASS literal NEXT has size 92 in frame [cont,intL,x]") + +source = (ROOT / "data/self-interpreter/machines/int165.lam").read_text() +# E K (01 t) is an actual application-value extractor with zero initial +# lambdas and rigid head t. Only expose its weak head, never normalize +# recursive functions stored in the arguments. +head = app(parse(source), K, bits("01", ("V", 0))) +stack = [] +for _ in range(20000): + if head[0] == "A": + stack.append(head[2]) + head = head[1] + elif head[0] == "L" and stack: + head = lc.beta(head, stack.pop()) + else: + break +else: + raise AssertionError("application extractor weak-head fuel") +assert head == ("V", 0) and len(stack) == 2 +print("PASS actual application-value extractor has q=0, head t") +old = r"(\bit0. bit0 (\unused \r. r next) cont)" +new = r"(\b r t. b (t next) (cont r (r r t)))" +assert source.count(old) == 1 +changed = parse(source.replace(old, new)) +for label, m in (("I", r"\x.x"), ("K", r"\x y.x"), + ("I I", r"(\x.x) (\x.x)"), ("S", r"\x y z.x z (y z)")): + assert probe(changed, parse(m), beta=20000) == "ok", label + print(f"PASS correlated handler in complete interpreter: {label}") +print(f"PASS {count} dual-normalizer comparisons, NEXT size, extractor head, four fixed programs; {time.perf_counter()-started:.3f}s") diff --git a/data/self-interpreter/reasoning_floor/verify/vreader.md b/data/self-interpreter/reasoning_floor/verify/vreader.md new file mode 100644 index 00000000..0a3be524 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreader.md @@ -0,0 +1,37 @@ +Adversarial verification request. You are a fresh, independent reviewer; your +job is to find an error if there is one. Repository: /Users/a9lim/Work/blam. + +Claim under review (handwritten): with the 165-bit BLC self-interpreter's knot +and NEXT region fixed, every reader body B over the frame +[s, next, cont, intL, x] satisfying + + B[cons K R / s] →* R next + B[1ⁿ0 ++ N / s] →* cont (1ⁿ⁻¹0 ++ N) N (all n ≥ 1) + +(next, cont, intL, x, R, N independent rigid; K = λab.a bit 0, F = λab.b bit 1, +cons b r = λh. h b r) has |B| ≥ 43 bits (|M| = 2L + 4A + 2 + X), with equality +only for the 165's `s (λb. b (λu r. r next) cont) (s s s)`. No restriction on +B's shape is assumed (any arity, operands, redexes). + +The proof: /Users/a9lim/Work/blam/tmp/overnight/reader-proof/REPORT.md (Parts +1–3; Part 3 lists the steps the author considers weakest: exhaustiveness of +the realization lists in Lemmas 2.4–2.6, the self-passing walker bound in +Lemma 2.3(c), Lemma 2.7(ii) on copies, the depth taxes, and the shape (γ1) +dominance lines). Its scripts are in tmp/overnight/reader-proof/tools/. +Background: docs/classical/self-interpreter/handler-bound.md and the intro of +cheap-tail-bound.md (earlier, narrower bounds for readers `s H T`), +lean/Blc/SelfintWireCost.lean (the beta wire-cost formula it uses). + +Push hardest on: (1) whether the residual-tracing decomposition really covers +every term, including bodies that create stream nodes in unexpected roles and +bodies with lets/knots; (2) Lemma 2.3(c) — try to construct a cheap reader that +walks the unary code with a self-passing lambda, or a cheap N-source the lemma +misses; (3) the shape (α) arithmetic `41 + 2d` and the uniqueness claim; +(4) whether any realization list omits a case. Try to build a counterexample +reader below 43 bits if you see a gap: test it by splicing it into +data/self-interpreter/machines/int165.lam in place of the reader and running +`python3 tools/self-interpreter/battery.py FILE.lam` (2 s), or by checking the +two laws directly with a small normalizer. No enumeration of reader bodies. +Answer: verdict (correct / gap / error), each problem with exact location and +a counterexample or the failing step, and what you checked fully. Write the +review to /Users/a9lim/Work/blam/tmp/overnight/verify/vreader_codex.md. diff --git a/data/self-interpreter/reasoning_floor/verify/vreader_gemini.md b/data/self-interpreter/reasoning_floor/verify/vreader_gemini.md new file mode 100644 index 00000000..8311f789 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreader_gemini.md @@ -0,0 +1,114 @@ +### Verdict: **gap** (theorem is true and no counterexample $< 43$ bits exists; two localized proof gaps in the text of Part 2, both repairable with $\ge 3$ bits of margin to spare) + +I could not construct any reader body below 43 bits or any second 43-bit reader body. However, pushing hard on the four requested areas uncovered **two localized gaps** in the handwritten argument of [REPORT.md](file:///Users/a9lim/Work/blam/tmp/overnight/reader-proof/REPORT.md): +1. **Gap 1 (Lemma 2.3(c), self-passing walkers):** The 24-bit syntax count for a walker assumes every walker has an explicit tail binder `λr` (2), tail leaf `r` (2), and two selection nodes on the bit `b` (4). An $\eta$/stream-node-compressed walker avoids `λr`/`r` on the bit-test side and uses the stream's own second node `((Y β_i) τ_i)` as the second selection node on `β_i`, reducing the walker core from 24 bits to **22 bits** (verified: `W = λw b. b I (w w)`, size 22, satisfies `P_0 (W W) →* N` and `P_i (W W) →* (W W) P_{i-1}` for $i \ge 1$; a clean working walker is `W2 = λw r. r (λb. b I (w w))` at 30 bits). Because `W W` expects a cell on the next step rather than `(bit, tail)`, turning the 22-bit core into a working multi-step walker requires an adapter, so the theorem's conclusion holds with large margin, but the 24-bit count as written is not tight for the pieces it names. +2. **Gap 2 (§2.4 Shape (γ1) dominance line for "any other operand `O`" when `O = s s`):** Line 664–668 claims that in shape (γ1) (no $N$-valued operand), *"Any other operand `O` (`cont`, `s s`, `s F`, `s K`, a second `next`, …) can serve as an output argument in neither arm except `cont` for `V` … so it adds at least `2 + |O| + 2 ≥ 8` for `|O| ≥ 4` over the rows above."* This overlooks that `O = s s` (`|O| = 6`, reducing to `K R` on the zero stream and `Q = K N` on the variable stream) is **half of the $N$-source**: binding `O = s s` to `q` supplies `Q = K N` to `V` and replaces the 6-bit meeting subterm `s s` (or `r r`) inside `V` by a 2-bit leaf `q` (`q X →* N`), while on the zero stream `q` (`K R`) can even serve as a data consumer `q u next →* R next`. Thus `O = s s` is not purely additive over the rows of the `(γ1)` table—it saves 4 bits inside `V`'s $N$-source. Re-pricing it properly (below) still gives `|B| ≥ 50` (and concrete realization `58` bits), well above 43. + +Below is the detailed adversarial audit across all four target areas, followed by a list of what was checked mechanically. + +--- + +### Detailed Audit of the Four Target Areas + +#### 1. Residual-tracing decomposition (§2.1), unexpected stream-node roles (Lemma 2.6), and lets/knots (Lemma 2.7) + +* **Head-path decomposition (§2.1 & T3):** + * **Checked:** Every reader body $B$ has open HNF `s A_1 … A_k` ($k \ge 1$, T2) and symbolic HNF $B[S/s] \to^* \beta A_1 \dots A_k$ ($k \ge 2$) or $\tau A_1$ (T3). Because $S = \lambda h. h \beta \tau$ is affine and $\beta, \tau$ are fresh rigid variables, head reduction of $B[S/s]$ terminates and consists strictly of cell steps ($S Y \to Y \beta \tau$) and $\lambda$-steps on residuals of lambdas of $B$. + * **Minor precision note on `d` (lines 309–314):** The text states *"every lambda on the head path encloses [the selection node] … so `d` equals the number of head-path $\lambda$-steps on original lambdas"*. Strictly speaking, if a head-path $\lambda$-step is `(λy. M) Q` where the selection node comes from inside $Q$ (rather than $M$), then `λy` does *not* syntactically enclose $Q$ in $B$. However, by T10, a head-path let `(λy. M) Q` in a minimum reader body cannot be affine with $Q$ containing the selection unless `fl(Q) ≥ 2` and costs $\ge 4 + 2m$ extra bits for the let scaffolding, which strictly dominates any depth saving. Making it explicit that $Z, V$ lie in the body of the head-path abstractions (or pricing the let via T10) closes this cleanly. + +* **Stream-node shortcuts (Lemma 2.6):** + * **Checked:** Every cell contraction `S Y → (Y β') τ'` creates exactly two application nodes: $n_1 = (Y \beta')$ with argument $\beta'$ (a bit $K$ or $F$), and $n_2 = ((Y \beta') \tau')$ with argument $\tau'$ (a tail $R$, $P_{j-1}$, or $N$ when $j=0$). + * Could a created node play a role omitted from Lemma 2.6? + * `n_R = (R next)`: argument is rigid `next`; neither $\beta'$ nor $\tau'$ can be `next`. Impossible. + * `n_P = (cont P_{n-1})`: argument is $P_{n-1}$, which can only be $\tau'$ of a $P_n$ cell step where $(Y \beta')^i \to^* \text{cont}$. This is **Shape (α)**. + * `n_N = ((cont P_{n-1}) N)`: argument is rigid $N$, which is $\tau'$ only for the terminal cell $P_0$. For $n_2$ of $P_0$ to become `((cont P_{n-1}) N)`, its function $(Y_0 K)$ must reduce to `cont P_{n-1}`, which requires walking all $n+1$ cells down to $P_0$ while carrying $P_{n-1}$. That is priced under Lemma 2.3(c) (walkers). + * First or second selection node `(β Z)` or `((β Z) V)`: covered by **Shapes (β), (β′), (δ)**. + * Meeting node `(P_i P_i)` or consumer node `(Q X)` inside the $N$-source: covered and priced in **Lemma 2.3(a)** (8 bits instead of 6 for a created meeting node; 6 bits instead of 4 for a created consumer node, tested at 47 bits in `menu.py` line 24: `s (λb. b (λu r. r next) cont) (s (λb. s s))`). + * **Verdict on Lemma 2.6:** Exhaustive. + +* **Lets, knots, and copying (Lemma 2.7):** + * **Checked:** Lemma 2.7(i) uses `wire_beta_delta` (T10) to rule out let-bindings on single leaves (`s`, `next`, `cont`, or bound leaves `r` of size 2: for $|Q|=2$ and $D=0$, $\Delta = 2(m-1) - 2m - 4 - f(M) = -6 - f(M) < 0$, so a let on `s` or a depth-0 bound leaf *always* shrinks). + * **Checked:** Lemma 2.7(ii) observes that if an application node inside a let-argument $Q$ is copied by `(λy. M) Q`, all residuals of that application node outside a recursive walker have $\beta$-equal function and $\beta$-equal argument (up to capture of distinct inner binders if $Q$ had free variables bound inside $M$, which is impossible since $Q$ is outside $M$). Since the charged application roles in $\rho_v$ (`n_P`, `n_N`, meeting `(P_i P_i)`, consumer `(K N X)`, selection nodes, dispatch cell step) have pairwise distinct `(function, argument)` normal-form signatures for large $n$, one application node in a non-walker $Q$ cannot simultaneously realize two distinct roles in $\rho_v$. + +--- + +#### 2. Lemma 2.3(c) — Self-passing walkers and $N$-sources + +* **Location:** [REPORT.md](file:///Users/a9lim/Work/blam/tmp/overnight/reader-proof/REPORT.md#L422-L447), Lemma 2.3(c), lines 422–447 (and §3.2 item 2, lines 776–785). +* **What the proof claims:** + > *"Its necessary original syntax: a lambda receiving the bit (2), one binding the tail (2), the nonlinear `λf` (2) with two leaves `f` (4), the node applying the tail (2) with its leaf `r` (2) and the node passing `f` (2), and — since `P_0 Λ → Λ K N` must return the bare `N` while higher levels continue — a test of the bit (`b`, 2; two nodes, 4) returning the tail (2): **≥ 24**"* +* **What fails in the 24-bit piece count (Gap 1):** + 1. **Created second selection node:** When a cell $P_i$ is applied to $Y = W W$, the cell step `P_i (W W) → (W W b_i) r_i` creates two application nodes. If `W = λw b. b Z (w w)`, then `W W b_i →* b_i Z (W W)`, and the cell's *own* second created node applies `b_i Z (W W)` to the tail $r_i$! Thus `b_i` only needs *one* syntactic selection node inside `W` (or two if `Z` and `w w` are both arguments of `b`, with $r_i$ becoming the third argument), and **no `λr` or `r` leaf is needed on the bit-test side** to pass $r_i$ to the zero branch: + * At $i=0$ ($b_0 = K, r_0 = N$): `K I (W W) N →* I N → N`. + * At $i \ge 1$ ($b_i = F, r_i = P_{i-1}$): `F I (W W) P_{i-1} →* (W W) P_{i-1}`. + * The term `W = λw b. b I (w w)` has size **22 bits** ($L=3, A=3, X=4$: `2(3) + 4(3) + 2 + 4 = 22`). + 2. **Why a working walker still costs $\ge 28$ bits (repairing Gap 1):** + In `F I (W W) P_{i-1} →* (W W) P_{i-1}`, the tail $P_{i-1}$ is passed *as the argument* to `W W` rather than `P_{i-1}` being applied to `W W`. Therefore, for the recursion to continue at $i \ge 1$, `W W` must accept a *cell* `r` as its first argument and apply `r` to the bit handler: + $$W_2 = \lambda w\, r.\; r\, (\lambda b.\; b\, I\, (w\, w))$$ + (verified in Python: `W_2 W_2 P_n →* N` for all $n \ge 1$, and `W_2 W_2 Z_R →* R`). + Let us price $W_2$: it has `λw` (2), `λr` (2), `r` (2), application `r (...)` (2), `λb` (2), `b` (2), two selection nodes on `b` (4), `I` (4), `w w` (6), plus index offsets ($X=6$, so +2 over base leaves) = **30 bits** (and `W_2 W_2 s` is 66 bits; with `(λf. f f) W_2 s` it is $10 + 2 + 30 + 4 = 46$ bits for the $N$-source alone!). + More generally, in *any* self-passing walker: + * Either the walker `W W` takes `(b, r)` directly from `P_i (W W) → W W b_i r_i`, in which case the $F$-branch must actively apply $r_i$ to `W W` (`r (w w)`), forcing `λr` (2), `r` (2), and the application `r (...)` (2), so the piece count in Lemma 2.3(c) holds (`|W| ≥ 24`, minimum concrete `W = λw b r. b r (r (w w))` is **29 bits**); + * Or the walker uses the cell's second created node to apply the $F$-branch `w w` to $r_i$ (`(w w) r_i`), in which case `W W` takes a cell `r` first, applies `r` to a bit-handler `λb. …` (`λr`, `r`, app, `λb`), and at $i=0$ (`K Z (W W) N → Z N`) needs $Z$ to be an identity `I` (4 bits) so `Z N → N`. That costs $\ge 28$ bits for $W$ alone. + * **Can a walker avoid testing the bit $b_i$ using data operations (`P_i b`)?** + I tested whether `P_i` or `b_i` could step without a 2-arm branch: + * `s (λb r. r b)` gives $N$ at $n=1$ (`P_0 F → N`), $K N$ at $n=2$ (`P_1 F → P_0`), and $P_{n-2}$ for $n \ge 3$—it only steps once because $F$ is consumed by $P_{n-1}$. + * Stepping repeatedly with $F$ without testing $b_i$ hits $P_0 F \to N$ at the bottom and then applies $N$ to the next step's continuation, trapping $N$ as a rigid head forever. + * **Conclusion on Lemma 2.3:** The $\ge 10$-bit bound on the $N$-source (and equality only for `s s X` of 3 leaves and 2 apps) is **completely solid**, and any walker reader is well above 50 bits. + +--- + +#### 3. Shape (α) arithmetic `41 + 2d` and the uniqueness claim (§2.4) + +* **Location:** [REPORT.md](file:///Users/a9lim/Work/blam/tmp/overnight/reader-proof/REPORT.md#L552-L585), lines 552–585. +* **Step-by-step verification:** + 1. **Definition of Shape (α):** The output application `n_P = (cont P_{n-1})` is the second created node `((Y β) τ)` of a cell step. For its argument $\tau$ to be $P_{n-1}$, the cell must be a copy of $P_n$ (the dispatch cell), $\tau$ must be unbound by the handler (`rest` starts with $\tau$), and the selection result $(Y \beta)^i = (\beta Z V \dots)^i$ on the variable stream must reduce to `cont` before $\tau$ is applied. + 2. **Minimum `V`:** Since $\kappa_v \in V$ (indirections cost $\ge 10$ vs $4+d$) and $V[\text{env}^i] \to^* \text{cont}$, the unique minimal $V$ is the bare leaf `cont` at depth $d$, costing **`4 + d` bits** (any other $V$ has at least one lambda or application, costing $\ge 6 + d$). + 3. **Operand `T` and `n_N`:** Since $V = \text{cont}$, after the created node applies `cont` to $\tau = P_{n-1}$, the next element of `rest` must be the $N$-source operand $T$ (with $T^i \to^* N$), applied via its spine node $n_N$ (`2` bits). By Lemma 2.3, $|T| \ge 10$, with equality iff $T = s\, s\, X$ at depth 0 where $X$ has 0-based index 0, i.e., **`T = s s s`** (`|T| = 10`; I checked `s s next` = 11 and `s s cont` = 12). There can be no further operand in `rest`, or `cont P_{n-1} N` would receive a third argument. + 4. **Zero arm `Z`:** On the zero stream, `K Z cont R T^0 → Z R T^0`. Here $T = s\, s\, s$ gives $T^0 = Z_R Z_R Z_R \to^* K R Z_R \to R$. Thus $Z$ receives two arguments (`R` and `T^0`) and must reduce to `R next`. + * As shown on lines 564–570, $n_R$ and $\nu_z$ (`next`) must lie inside $Z$ (putting them in $T$ costs $\ge 64$). + * $Z$ must consume two arguments (`R` and `T^0`) and produce `R next`. + * **Two-lambda consumer:** $Z = \lambda u\, r.\; \text{body}$ ($2+2=4$ bits for the two lambdas). Inside `body` (at depth $d+2$), `next` costs $3 + d + 2 = 5 + d$ bits, the application node $n_R$ costs $2$ bits, and the function of $n_R$ is a bound leaf (`r` at index 0 costs $2$ bits; `u` at index 1 costs $3$ bits). Total: + $$|Z| \ge 4 + 2 + (5 + d) + 2 = 13 + d$$ + with equality **uniquely** for `Z = λu r. r next` (since `u` requires $T^0 = R$, which holds for $T = s\, s\, s$, and `λu r. u next` costs $14 + d$, giving 44 bits total—verified in Python). + * **Data consumers in `Z` (Remark, lines 525–534):** What if $Z$ uses the bound bit $b$ (which equals $K$ on the zero stream!) instead of one of the two lambdas to consume an argument? I tested all candidates mechanically: + * `Z = b (λu. u next)`: on the zero stream, $b = K$, so $K (\lambda u.\; u\,\text{next}) R R \to (\lambda u.\; u\,\text{next}) R \to R\,\text{next}$! This is a **valid reader**, `s (λb. b (b (λu. u next)) cont) (s s s)`, and its size is **44 bits** (`|Z| = 15` vs `14` for `λu r. r next`, because replacing `λr` (2 bits) with `(b ...)` (2 bits app + 2 bits leaf `b` = 4 bits) while saving 1 depth bit on `next` is a net $+1$ bit: $+4 - 2 - 1 = +1$). + * `Z = λu. b (u next)`: valid reader, **45 bits** (`|Z| = 16`). + * `Z = K (λr. r next)`: valid reader, **49 bits** (`|Z| = 20`). + 5. **Total for Shape (α):** + $$\text{dispatch } (12) + (\text{spine } 2 + |T|\ 10) + |Z|\ (13 + d) + |V|\ (4 + d) = 41 + 2d \ge 43$$ + Equality holds iff $d = 1$, dispatch is `s (λb. b Z V)`, $T = s\, s\, s$, $Z = \lambda u\, r.\; r\,\text{next}$, and $V = \text{cont}$. +* **Verdict on Shape (α) and uniqueness:** **100% sound and tight.** + +--- + +#### 4. Exhaustiveness of realization lists (Lemmas 2.4–2.6) and Shape (γ1) dominance (§2.4) + +* **Lemmas 2.4 (z-R) and 2.5 (v-tail):** + * **Checked:** $R$ enters $\rho_z$ only as the second argument of `Z_R = λh. h K R`, and $P_{n-1}$ enters $\rho_v$ only as the second argument of `P_n = λh. h F P_{n-1}` (or via $P_n F \to P_{n-1}$, which is a cell contraction with $Y = F$). Because the body of $P_{n-1}$ is closed (for fixed rigid $N$), any output $P_{n-1}$ whose root lambda is not a residual of a stream cell's $\lambda h$ must have its root lambda descending from a lambda of $B$ (rebuilt cell, Lemma 2.5(iv), $\ge 16$ bits). Thus every realization of **z-R** and **v-tail** is covered by (i)–(iv) of Lemmas 2.4 and 2.5. + +* **Gap 2 — Shape (γ1) dominance for operand `O = s s` (lines 664–670):** + * **Location:** [REPORT.md](file:///Users/a9lim/Work/blam/tmp/overnight/reader-proof/REPORT.md#L664-L670), §2.4 Shape (γ1). + * **The oversight:** In Shape (γ1) (where there is no $N$-valued operand $T$, so the $N$-source is completed inside $V$), the proof assumes every non-$N$-valued operand `O` (specifically listing `s s`) leaves the 10-bit internal $N$-source cost inside $V$ unchanged and merely adds its own cost `2 + |O| + 2 ≥ 8`. + * **Why `O = s s` interacts with the $N$-source:** `O = s s` has size 6 bits (`2 + |O| = 8` bits with its spine application). On the variable stream, `s s →* P_n P_n →* Q = K N`. When bound by a handler lambda `λq` (or arm lambda `λq`), the leaf `q` inside $V$ has value $Q = K N$. Thus $V$ completes the $N$-source with just `q X → N` (4 bits: one application node + one leaf `X` + the leaf `q` of size $\ge 2$), **saving 6 bits** inside $V$ (4 bits instead of 10 bits for the $N$-source)! Furthermore, on the zero stream, `s s →* Z_R Z_R →* K R`, so `q` has value `K R`, which can either be consumed by a lambda `λq` or applied to two arguments (`q u next → K R u next → R next`) to supply `R` and consume `u` without a lambda! + * **Exact re-pricing (proving it still cannot beat 43):** + Let `O = s s` (`2 + |O| = 8` bits at spine). + * Inside $V$, the $N$-source is `q X` (costs $2$ for app + $\ge 2$ for leaf `q` + $\ge 2$ for leaf `X` = $6$ bits, vs $10$ bits for an unassisted $N$-source: a maximum saving of **4 bits** inside $V$). + * Meanwhile, `O = s s` adds **8 bits** at the spine (`2 + |s s| = 8`), plus its binding `λq` (**2 bits**), plus either: + * If `λq` is on the head path ($d$ increases by 1): $+1$ bit on `b`, $+1$ bit on `next`, $+1$ bit on `cont` ($\ge +3$ bits), and if $Z$ does not use `q`, `r` or `next` pays depth tax; even if $Z$ uses `q` (`K R`) as `q r next` (saving `λr`? No, if `q = K R`, `q X next → K R X next → R next`, which eliminates the need for `r` in $Z$, costing `2+2+2 = 6` bits for `q X` instead of `2` for `r`, a net loss of 4 bits!). + * If `λq` is inside $V$ ($e_V$ increases by 1): $Z$ must also consume `O^0 = K R` ($\ge 2$ bits), and `cont` inside $V$ pays $+1$ depth bit. + * Consequently, adding `O = s s` pays $\ge 8 \text{ (spine)} + 2 \text{ (binder)} + 2 \text{ (depth/consumption)} = 12$ bits while saving at most $4$ bits inside $V$ (a net increase of $\ge +8$ bits over the $46$-bit `(γ1)` baseline, giving $\ge 54$ bits; the smallest concrete reader of this form is `s (λb r q. b (r next) (cont r (q r))) (s s)` at **58 bits**, checked). + * Similarly, if `O = s` (`2 + |O| = 4` bits at spine), binding `O` to `t` gives $V$ another cell leaf of index $n$ at cost 2, which cannot improve on `r` (already cost 2) or `s` inside $V$, so `O = s` saves 0 bits inside $V$ and adds $\ge 6$ bits (smallest concrete reader `s (λb r t. b (r next) (cont r (t t t))) s` is **57 bits**, checked). + +--- + +### Summary of What Was Checked Fully + +1. **Lean proof (`lean/Blc/SelfintWireCost.lean`):** Read and verified `wire_subst`, `wire_beta_delta`, `erasing_beta_shrinks`, `linear_small_free_beta_shrinks`, and `linear_beta_delta`. Confirmed T10 in `REPORT.md` matches the exact Lean formula. +2. **Mechanical test suites (`tmp/overnight/reader-proof/tools/`):** + * Ran `algebra.py`: verified all cell/cell, cell/bit, cell/Q, cell/I, cell/neutral reduction identities for indices $\le 6$, equal-index vs unequal-index parity fates (T8, T9), and the 5-leaf `P_n`-only application closure (T5). + * Ran `symbolic.py`: verified the symbolic stream $S = \lambda h. h \beta \tau$ identities and T3 instantiations. + * Ran `menu.py` plus custom adversarial scripts: verified sizes and reader laws (`n = 1..5` and zero law) for 30+ reader designs across shapes (α), (β), (γ1), (γ2), τ-head, data-consumer variants in $Z$, `O = s s` / `O = s` / `O = s F` operands, let-shared `s s`, and self-passing walkers (`W`, `W2`). +3. **Part 1 (T1–T10):** Verified every theorem step-by-step. All 10 structural claims are sound. +4. **Part 2 (§2.1–2.6):** Verified the decomposition, role inventory, Lemma 2.1, Lemma 2.3(a,b,c), Lemmas 2.4–2.7, and the minimization across Shapes (α), (β), (β′), (δ), (γ1), (γ2), and the τ-case (§2.5). Confirmed Shape (α)'s `41 + 2d` bound and the uniqueness of the 43-bit reader `s (λb. b (λu r. r next) cont) (s s s)`. +[gaslamp] job: gm-20261021-053126-d080 · session: 005f891d-f2c2-4a1f-8fe7-dfdd40a80be7 · resume: gaslamp gemini --resume 005f891d-f2c2-4a1f-8fe7-dfdd40a80be7 · model: gemini-4-argon · tok: 1880k→15k diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index b49e8e4c..bf117652 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -648,6 +648,8 @@ their optimal let structure (`blam golf letopt`, at most three cuts). | Duplicate tail discarded after the second cell elimination | 181 | | | Tag replayed after the first parse, `bit0`'s `K` discarding `bit1` | 186 / 188 / 194 | the redundant tag costs more than the hoist saves | | Curried cell borrowing ABS's tag, `\b. b (bit1 arg) (\r. r args)` | 171 | `bit1 = K` in ABS; +6 over the canonical cell | +| No `next` let: the zero arm keeps both copies of the stream, parses from one and re-reads the tag from the other through `bit0 = K` | 176 | the smallest interpreter without a `next` binding; NEXT's five references pay four binders of depth | +| Second-tag dispatch elsewhere in NEXT: a shared argument of both arms (three forms), or before the first parse | 169 / 169 / 170 / 172 | a shared argument costs a dummy binder, a second dispatch, or a packing pair | | Constant stream as ABS's return instruction, `R (K (K X)) = X` | 191 / 207 | capturing the real remainder | | Reader-carried knot `W = λx. x I x Z_x`: the only self-application is the skip's | 192 | +27 for the carrier; `R Z_t → t t` drives it. With the carrier's diagonal law, `Z_t` (12 bits) is the unique minimum, so this template is exactly 192 | | Reset bootstraps: skip `s s c` with driver `λx. x I x F x`, or `s s x` with `λx. x x x F x` | 192 / 192 | the input `F` resets the provisional recursion; the cheaper driver is paid back by the deeper erased operand | diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index f3e342bf..d42029b2 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -335,6 +335,61 @@ return instruction, and that instruction performs an already-required semantic operation. An explicit adapter that merely recovers the current parser repays the hoped-for saving. A smaller protocol of this kind remains open. +## Whole-stream skips and the zero arm's duplicate + +Let a reader `s H S` have an application-only operand `S` over `s` alone +that equals the rigid remainder `N` on every variable stream `1ⁿ0 ++ N`. +Then `S` is syntactically `(s s) X` for some application-only `X`, so on a +constructor stream `s = cons K q` it reduces to `q`, and the zero arm +receives the tag-less stream twice. Proof at unary length one: with +`u = cons F (cons K N)` and `w = cons K N`, every application tree over `u` +reduces to `u`, `K N`, or an `N`-headed spine, by + +``` +u u →* K N, u (K N) →* N w, u (N Q⃗) →* N Q⃗ F w, +(K N) Q →* N, (N Q⃗) Q →* N Q⃗ Q, +``` + +and bare `N` arises only at a root application whose left subtree is +exactly `u u`. The duplicate is therefore a property of every +application-only whole-stream skip, not of `s s s`. (The dispatch lane's +lemma, with the induction supplied by an independent review.) + +Under the 165's NEXT/ABS/APP protocol, a reader `s H S T₁ … Tₖ` with +`k ≥ 1` fails for every `H` that keeps the bare variable arm: on `λx.x` the +root ABS continuation receives the variable's return with `k` surplus +arguments, giving `C (A r) S T₁ … Tₖ`, `2 + k` arguments at the rigid `C`. +The surplus must be consumed on the variable path itself. This does not +price that repair. Nor do the actual-stream equations force the handler's +independent rigid laws: `H = λb r t. b (t next) (c r (r r t))` meets the +parser clauses on every genuine input while `H F R T = c R (R R T)` for +rigid `R, T`. + +## Both tag bits through one re-entrant reader + +A natural fusion reads the second tag bit with the same reader, carrying +the decoding state in the continuation: `P k ([0] t) =β P (T k) t`. Codex's +handwritten proof, from an independent review of the dispatch lane, shows +that no closed `T` meets this together with the closed-source contract. With +`M_n = λⁿ.1` and `V_n = λⁿ⁺¹.1`, re-entry twice gives + +``` +T (T C) V_n R =β C V_(n+1) R for every n ≥ 1. (*) +``` + +Write the head normal form of `T k` as `λx₁ … x_a. h Q₁ … Q_b`. A head +among the binders leaves a leading lambda or an `R` head for large `n`, so +`h = k`; arity at `C` forces `T k = λt. k A` or `T k = λt j. k A B`. In the +first, `A`'s head must be `t` and projection erasure gives +`A[C, A'] =β λ^(n+1+2(q−p)).1`, which needs `2(q−p) = 1`. In the second the +same parity kills head `t`; head `j` forces `B`'s head normal form to be +`j` (then the value is `R`-headed) or `t` with `A =β λ^q.j`, which returns +`V_n` instead of `V_(n+1)`. Every head form fails, so the second bit's +state needs a separate object (the 165's `next`, a selector pair, or an +explicit mode flag). The proof covers this uniform, β-exact re-entry +equation with the transparent contract, not every design with different +internal values and a public adapter. + ## APP cannot supply the full parser through an idempotent control response The semantic application `lambda e.f e (g e)` already duplicates an From 94c692c58cfe0f9d9c640051bff62f70d6ab9bce Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 07:02:02 -0400 Subject: [PATCH 32/41] Record the 162-bit self-interpreter, with 172 and 184 universal machines The 165's knot and NEXT around a new reader `list I V NEXT`: `list I` makes the first cell its own selection, so on a 0-tag the zero arm is the tail itself applied to NEXT, the reader's last operand; on a variable `V = \u. list (\q. cont) (list list u)` reopens the stream, hands the tail to cont, and erases NEXT as the skip's junk operand. The next let goes and the reader drops from 43 bits to 40, against +4 for NEXT one binder deeper (L 16, A 24, X 32). The 44-bit reader was built by a Codex review while refuting a step of a reader-optimality proof; NEXT as a reader operand was Grok's idea; letopt inlined NEXT into the operand slot of the resulting 166. - lean/Blc/Selfint162: selfint_contract162, isSelfInterpreter_intL162, not_selfintSizeBound_163, pinned to the wire; the variable residual names the continuation, so not_parses_intL162 shows the 165's uniform parser statement fails and the statement is per continuation. - An independent adversarial review re-derived the contract and the size. Battery 667/1/0, 3341/2/0 through 21 bits; exact suffixes on divergent sources; letopt minimal to three cuts; beta-eta component to slack 24 (12,024,847 terms) and contextual to slack 18: nothing smaller. - Universal machines 172 (non-strict) and 184 (strict) from Tromp's wirings. - interpreter.md rewritten around the 162; the 165's reader kept as its predecessor. STATUS, README, universal.md, merges.py and the Lean README updated; protocol-obstructions.md gains the reviewed NEXT results (any interpreter embeds into the NEXT slot at +44 bits; a conditional 92). --- README.md | 18 +- .../component_162_contextual18.log | 24 + .../component_162_slack24.log | 29 + data/self-interpreter/letopt_162.log | 9 + data/self-interpreter/machines/int162.blc | 1 + data/self-interpreter/machines/int162.lam | 13 + data/self-interpreter/machines/uni172.blc | 1 + data/self-interpreter/machines/uni172.lam | 8 + data/self-interpreter/machines/uni184.blc | 1 + data/self-interpreter/machines/uni184.lam | 8 + .../reasoning_floor/README.md | 19 +- .../reasoning_floor/interface/PROMPT.md | 33 + .../reasoning_floor/interface/REPORT.md | 402 ++++++++ .../interface/archive_initial.py | 18 + .../reasoning_floor/interface/build.py | 76 ++ .../reasoning_floor/interface/checks.json | 44 + .../interface/delayed_drop.best.blc | 1 + .../interface/delayed_drop.best.lam | 1 + .../interface/delayed_drop.blc | 1 + .../interface/delayed_drop.lam | 1 + .../interface/delayed_drop.letopt.log | 5 + .../interface/delayed_drop.polish.log | 3 + .../interface/delayed_drop.render.log | 11 + .../delayed_drop_function_env.best.blc | 1 + .../delayed_drop_function_env.best.lam | 1 + .../interface/delayed_drop_function_env.blc | 1 + .../interface/delayed_drop_function_env.lam | 1 + .../delayed_drop_function_env.letopt.log | 5 + .../delayed_drop_function_env.polish.log | 3 + .../delayed_drop_function_env.render.log | 11 + .../interface/delayed_drop_thunk.best.blc | 1 + .../interface/delayed_drop_thunk.best.lam | 1 + .../interface/delayed_drop_thunk.blc | 1 + .../interface/delayed_drop_thunk.lam | 1 + .../interface/delayed_drop_thunk.letopt.log | 5 + .../interface/delayed_drop_thunk.polish.log | 3 + .../interface/delayed_drop_thunk.render.log | 8 + .../reasoning_floor/interface/identities.json | 311 ++++++ .../reasoning_floor/interface/identities.log | 28 + .../reasoning_floor/interface/identities.py | 106 ++ .../interface/polish_final.log | 18 + .../interface/polish_initial.log | 12 + .../interface/root_next_thunk.best.blc | 1 + .../interface/root_next_thunk.best.lam | 1 + .../interface/root_next_thunk.blc | 1 + .../interface/root_next_thunk.lam | 1 + .../interface/root_next_thunk.letopt.log | 5 + .../interface/root_next_thunk.polish.log | 3 + .../interface/root_next_thunk.render.log | 5 + .../reasoning_floor/interface/run_checks.py | 51 + .../interface/third_operand_thunk.best.blc | 1 + .../interface/third_operand_thunk.best.lam | 1 + .../interface/third_operand_thunk.blc | 1 + .../interface/third_operand_thunk.lam | 1 + .../interface/third_operand_thunk.letopt.log | 5 + .../interface/third_operand_thunk.polish.log | 3 + .../interface/third_operand_thunk.render.log | 8 + .../interface/thunk_input_output.best.blc | 1 + .../interface/thunk_input_output.best.lam | 1 + .../interface/thunk_input_output.blc | 1 + .../interface/thunk_input_output.lam | 1 + .../interface/thunk_input_output.letopt.log | 5 + .../interface/thunk_input_output.polish.log | 3 + .../interface/thunk_input_output.render.log | 8 + .../next-proof-codex/PROMPT.md | 44 + .../next-proof-codex/REPORT.md | 591 +++++++++++ .../next-proof-codex/actual_parser_return.blc | 1 + .../next-proof-codex/actual_parser_return.lam | 3 + .../next-proof-codex/checks.json | 262 +++++ .../next-proof-codex/checks.py | 297 ++++++ .../next-proof-codex/embedded_reference.blc | 1 + .../next-proof-codex/embedded_reference.lam | 5 + .../next-proof-codex/fixed_checks.json | 282 ++++++ .../next-proof-codex/pair_packet.blc | 1 + .../next-proof-codex/pair_packet.lam | 3 + .../next-proof-codex/reference165.blc | 1 + .../next-proof-codex/reference165.lam | 3 + .../reasoning_floor/origin162/b44.lam | 7 + .../reasoning_floor/origin162/int162.blc | 1 + .../reasoning_floor/origin162/int162.lam | 13 + .../reasoning_floor/origin162/suffix_check.py | 14 + .../reasoning_floor/reader-proof/REPORT.md | 535 +++++----- .../reader-proof/REPORT.review1.md | 956 ++++++++++++++++++ .../reasoning_floor/verify/v162.md | 37 + .../reasoning_floor/verify/v162_codex.md | 453 +++++++++ .../verify/v162_codex_checks.json | 410 ++++++++ .../verify/v162_codex_checks.py | 229 +++++ .../reasoning_floor/verify/vnext.md | 33 + .../reasoning_floor/verify/vnext_codex.md | 258 +++++ .../verify/vnext_codex_checks.py | 317 ++++++ .../reasoning_floor/verify/vreaderS.md | 32 + .../reasoning_floor/verify/vreaderS_codex.md | 385 +++++++ .../reasoning_floor/verify/vreader_codex.md | 352 +++++++ .../verify/vreader_codex_acyclic.py | 30 + .../verify/vreader_codex_battery.py | 34 + .../verify/vreader_codex_checks.json | 180 ++++ .../verify/vreader_codex_checks.py | 256 +++++ .../alpha_dual_operand.lam | 13 + .../copied_app_nonshrinking.lam | 13 + .../vreader_codex_splice/rebuilt_tail.lam | 13 + .../vreader_codex_splice/second_cell.lam | 13 + .../walker_reader_shared.lam | 13 + docs/STATUS.md | 71 +- .../self-interpreter/capture-width.md | 4 +- .../self-interpreter/global-floor.md | 2 +- .../self-interpreter/head-decomposition.md | 2 +- .../classical/self-interpreter/interpreter.md | 271 +++-- .../self-interpreter/protocol-obstructions.md | 27 + .../self-interpreter/structural-bounds.md | 4 +- docs/classical/self-interpreter/universal.md | 24 +- lean/Blc.lean | 1 + lean/Blc/Selfint162.lean | 484 +++++++++ lean/Blc/Selfint165.lean | 2 +- lean/README.md | 23 +- tools/self-interpreter/merges.py | 22 +- 115 files changed, 8001 insertions(+), 380 deletions(-) create mode 100644 data/self-interpreter/component_162_contextual18.log create mode 100644 data/self-interpreter/component_162_slack24.log create mode 100644 data/self-interpreter/letopt_162.log create mode 100644 data/self-interpreter/machines/int162.blc create mode 100644 data/self-interpreter/machines/int162.lam create mode 100644 data/self-interpreter/machines/uni172.blc create mode 100644 data/self-interpreter/machines/uni172.lam create mode 100644 data/self-interpreter/machines/uni184.blc create mode 100644 data/self-interpreter/machines/uni184.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/interface/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/interface/archive_initial.py create mode 100644 data/self-interpreter/reasoning_floor/interface/build.py create mode 100644 data/self-interpreter/reasoning_floor/interface/checks.json create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop.best.blc create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop.best.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop.blc create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop.letopt.log create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop.polish.log create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop.render.log create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.best.blc create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.best.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.blc create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.letopt.log create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.polish.log create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.render.log create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.best.blc create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.best.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.blc create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.letopt.log create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.polish.log create mode 100644 data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.render.log create mode 100644 data/self-interpreter/reasoning_floor/interface/identities.json create mode 100644 data/self-interpreter/reasoning_floor/interface/identities.log create mode 100644 data/self-interpreter/reasoning_floor/interface/identities.py create mode 100644 data/self-interpreter/reasoning_floor/interface/polish_final.log create mode 100644 data/self-interpreter/reasoning_floor/interface/polish_initial.log create mode 100644 data/self-interpreter/reasoning_floor/interface/root_next_thunk.best.blc create mode 100644 data/self-interpreter/reasoning_floor/interface/root_next_thunk.best.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/root_next_thunk.blc create mode 100644 data/self-interpreter/reasoning_floor/interface/root_next_thunk.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/root_next_thunk.letopt.log create mode 100644 data/self-interpreter/reasoning_floor/interface/root_next_thunk.polish.log create mode 100644 data/self-interpreter/reasoning_floor/interface/root_next_thunk.render.log create mode 100644 data/self-interpreter/reasoning_floor/interface/run_checks.py create mode 100644 data/self-interpreter/reasoning_floor/interface/third_operand_thunk.best.blc create mode 100644 data/self-interpreter/reasoning_floor/interface/third_operand_thunk.best.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/third_operand_thunk.blc create mode 100644 data/self-interpreter/reasoning_floor/interface/third_operand_thunk.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/third_operand_thunk.letopt.log create mode 100644 data/self-interpreter/reasoning_floor/interface/third_operand_thunk.polish.log create mode 100644 data/self-interpreter/reasoning_floor/interface/third_operand_thunk.render.log create mode 100644 data/self-interpreter/reasoning_floor/interface/thunk_input_output.best.blc create mode 100644 data/self-interpreter/reasoning_floor/interface/thunk_input_output.best.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/thunk_input_output.blc create mode 100644 data/self-interpreter/reasoning_floor/interface/thunk_input_output.lam create mode 100644 data/self-interpreter/reasoning_floor/interface/thunk_input_output.letopt.log create mode 100644 data/self-interpreter/reasoning_floor/interface/thunk_input_output.polish.log create mode 100644 data/self-interpreter/reasoning_floor/interface/thunk_input_output.render.log create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/actual_parser_return.blc create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/actual_parser_return.lam create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/checks.json create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/checks.py create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/embedded_reference.blc create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/embedded_reference.lam create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/fixed_checks.json create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/pair_packet.blc create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/pair_packet.lam create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/reference165.blc create mode 100644 data/self-interpreter/reasoning_floor/next-proof-codex/reference165.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/b44.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/int162.blc create mode 100644 data/self-interpreter/reasoning_floor/origin162/int162.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/suffix_check.py create mode 100644 data/self-interpreter/reasoning_floor/reader-proof/REPORT.review1.md create mode 100644 data/self-interpreter/reasoning_floor/verify/v162.md create mode 100644 data/self-interpreter/reasoning_floor/verify/v162_codex.md create mode 100644 data/self-interpreter/reasoning_floor/verify/v162_codex_checks.json create mode 100644 data/self-interpreter/reasoning_floor/verify/v162_codex_checks.py create mode 100644 data/self-interpreter/reasoning_floor/verify/vnext.md create mode 100644 data/self-interpreter/reasoning_floor/verify/vnext_codex.md create mode 100644 data/self-interpreter/reasoning_floor/verify/vnext_codex_checks.py create mode 100644 data/self-interpreter/reasoning_floor/verify/vreaderS.md create mode 100644 data/self-interpreter/reasoning_floor/verify/vreaderS_codex.md create mode 100644 data/self-interpreter/reasoning_floor/verify/vreader_codex.md create mode 100644 data/self-interpreter/reasoning_floor/verify/vreader_codex_acyclic.py create mode 100644 data/self-interpreter/reasoning_floor/verify/vreader_codex_battery.py create mode 100644 data/self-interpreter/reasoning_floor/verify/vreader_codex_checks.json create mode 100644 data/self-interpreter/reasoning_floor/verify/vreader_codex_checks.py create mode 100644 data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/alpha_dual_operand.lam create mode 100644 data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/copied_app_nonshrinking.lam create mode 100644 data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/rebuilt_tail.lam create mode 100644 data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/second_cell.lam create mode 100644 data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/walker_reader_shared.lam create mode 100644 lean/Blc/Selfint162.lean diff --git a/README.md b/README.md index 5d88dddc..d62dddbb 100644 --- a/README.md +++ b/README.md @@ -117,16 +117,16 @@ proven. and time spectra, with post-certificate open mass below 3.19×10⁻¹² on the β clock. - **The self-interpreter** ([interpreter](docs/classical/self-interpreter/interpreter.md)): - 165 bits, three below Sean Palmer's 168, by computing the variable skip once - on the whole stream, where it is right for both dispatch arms. Lean proves - it, and the 168, a self-interpreter for every closed program. Nothing smaller - appears in its let structure, βη and contextual components, or any slot of - its reader, and the 168's modular lower bound still pins the part the two - share. Every self-interpreter has at least 37 bits by a reviewed handwritten - proof, and at least 27 kernel-checked in Lean + 162 bits, six below Sean Palmer's 168. Its reader applies the input stream + to the identity, so the first cell selects its own tail as the zero branch, + and passes the parser's second-bit stage as an operand that the variable + branch erases. Lean proves it, the previous record's 165 and the 168 + self-interpreters for every closed program. Nothing smaller appears in its + let structure or its βη components. Every self-interpreter has at least 37 + bits by a reviewed handwritten proof, and at least 27 kernel-checked in Lean ([global floor](docs/classical/self-interpreter/global-floor.md)). The same - reader gives universal machines of 175 (non-strict) and 187 - (strict) bits, against Tromp's 178 and 190 + reader gives universal machines of 172 (non-strict) and 184 (strict) bits, + against Tromp's 178 and 190 ([universal](docs/classical/self-interpreter/universal.md)). - **The rest of tromp/AIT** ([golf](docs/classical/golf.md), sent upstream as [tromp/AIT#13](https://github.com/tromp/AIT/pull/13)): 40 programs shrink by diff --git a/data/self-interpreter/component_162_contextual18.log b/data/self-interpreter/component_162_contextual18.log new file mode 100644 index 00000000..f2c8b2d5 --- /dev/null +++ b/data/self-interpreter/component_162_contextual18.log @@ -0,0 +1,24 @@ +start 162 bits, slack 18, au=true eta=true contextual=true descend=false, 4 threads + layer 1: +226 new, 227 total, 0.0s + layer 2: +17811 new, 18038 total, 0.0s + layer 3: +45444 new, 63482 total, 0.7s + layer 4: +109342 new, 172824 total, 2.4s + layer 5: +223045 new, 395869 total, 6.4s + layer 6: +280592 new, 676461 total, 14.6s + layer 7: +423024 new, 1099485 total, 25.0s + layer 8: +351111 new, 1450596 total, 40.6s + layer 9: +371276 new, 1821872 total, 53.2s + layer 10: +214613 new, 2036485 total, 66.0s + layer 11: +143194 new, 2179679 total, 73.4s + layer 12: +56929 new, 2236608 total, 78.2s + layer 13: +18149 new, 2254757 total, 80.1s + layer 14: +5285 new, 2260042 total, 80.7s + layer 15: +1749 new, 2261791 total, 80.9s + layer 16: +799 new, 2262590 total, 81.0s + layer 17: +417 new, 2263007 total, 81.0s + layer 18: +58 new, 2263065 total, 81.0s + layer 19: +35 new, 2263100 total, 81.0s + layer 20: +0 new, 2263100 total, 81.0s +component under the limit: 2263100 states, 575104 distinct terms; size histogram (delta:count) 0:1 1:2 2:2 3:5 4:8 5:10 6:96 7:256 8:399 9:743 10:1296 11:1995 12:4221 13:12774 14:27784 15:47023 16:85033 17:148308 18:245148 +0 term(s) below 162, 0 tie(s) +tmp/overnight/self/blam-frozen golf component --bits $B --slack 18 --threads 316.17s user 1.48s system 388% cpu 1:21.81 total diff --git a/data/self-interpreter/component_162_slack24.log b/data/self-interpreter/component_162_slack24.log new file mode 100644 index 00000000..475c79a5 --- /dev/null +++ b/data/self-interpreter/component_162_slack24.log @@ -0,0 +1,29 @@ +start 162 bits, slack 24, au=true eta=true contextual=false descend=false, 4 threads + layer 1: +224 new, 225 total, 0.0s + layer 2: +25227 new, 25452 total, 0.0s + layer 3: +779468 new, 804920 total, 2.0s + layer 4: +402696 new, 1207616 total, 32.3s + layer 5: +2331386 new, 3539002 total, 49.4s + layer 6: +1151258 new, 4690260 total, 139.0s + layer 7: +3008727 new, 7698987 total, 186.6s + layer 8: +1685214 new, 9384201 total, 302.1s + layer 9: +1737480 new, 11121681 total, 372.1s + layer 10: +396579 new, 11518260 total, 439.6s + layer 11: +34204 new, 11552464 total, 455.3s + layer 12: +133052 new, 11685516 total, 456.8s + layer 13: +37804 new, 11723320 total, 462.2s + layer 14: +125558 new, 11848878 total, 463.8s + layer 15: +43476 new, 11892354 total, 468.9s + layer 16: +61945 new, 11954299 total, 470.5s + layer 17: +30129 new, 11984428 total, 472.9s + layer 18: +33858 new, 12018286 total, 474.0s + layer 19: +2565 new, 12020851 total, 475.2s + layer 20: +1336 new, 12022187 total, 475.3s + layer 21: +1231 new, 12023418 total, 475.4s + layer 22: +1073 new, 12024491 total, 475.4s + layer 23: +353 new, 12024844 total, 475.5s + layer 24: +3 new, 12024847 total, 475.5s + layer 25: +0 new, 12024847 total, 475.5s +component under the limit: 12024847 states, 12024847 distinct terms; size histogram (delta:count) 0:1 2:1 3:2 4:1 5:3 6:84 7:72 8:138 9:271 10:313 11:521 12:4193 13:6812 14:11636 15:21369 16:31597 17:49874 18:125960 19:364590 20:585159 21:1064050 22:1835654 23:2909879 24:5012667 +0 term(s) below 162, 0 tie(s) +tmp/overnight/self/blam-frozen golf component --bits $B --slack $s --threads 1867.52s user 8.73s system 389% cpu 8:01.82 total diff --git a/data/self-interpreter/letopt_162.log b/data/self-interpreter/letopt_162.log new file mode 100644 index 00000000..d99db1ea --- /dev/null +++ b/data/self-interpreter/letopt_162.log @@ -0,0 +1,9 @@ +input 162 bits; core 167 bits (64 nodes); 342 candidate cuts (7 shared) +k=1: 342 valid, 0 invalid, 0.0s; smallest sizes 162:1 164:1 165:2 169:2 171:1 172:1 + 162 [[22, 42]->61] + (\a. a a) (\a. (\b c d. d (\e. e) (\e. d (\f. c) (d d e)) (\e. b (\f. e (c (\g h. f (\i j. i h (j g)))) (b (\g. c (\h. f h (g h))))))) (a a)) + 010001101000010000000101011000100001011100011110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 +k=2: 50693 valid, 7618 invalid, 0.0s; smallest sizes 166:1 168:3 169:18 170:14 171:25 172:54 +k=3: 4543789 valid, 2064791 invalid, 3.1s; smallest sizes 172:2 173:15 174:13 175:59 176:175 177:257 +smallest rendering over 0..=3 cuts: 162 bits +best 162 010001101000010000000101011000100001011100011110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/machines/int162.blc b/data/self-interpreter/machines/int162.blc new file mode 100644 index 00000000..ce926778 --- /dev/null +++ b/data/self-interpreter/machines/int162.blc @@ -0,0 +1 @@ +010001101000010000000101011000100001011100011110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/machines/int162.lam b/data/self-interpreter/machines/int162.lam new file mode 100644 index 00000000..db877833 --- /dev/null +++ b/data/self-interpreter/machines/int162.lam @@ -0,0 +1,13 @@ +-- 162-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- The 165's knot, NEXT, ABS and APP around a new reader. `list I` turns the +-- first cell into its own selection `bit0 list1`, so on a 0-tag the zero arm +-- is the tail list1 itself, applied to NEXT, which is the reader's last +-- operand; on a variable the selection picks the middle operand, which +-- reopens the stream to hand list1 to cont and erases NEXT as the skip's +-- junk operand. +(\x. x x) (\x. (\intL. \cont. \list. + list (\a. a) (\u. list (\q. cont) (list list u)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/machines/uni172.blc b/data/self-interpreter/machines/uni172.blc new file mode 100644 index 00000000..e1a41e87 --- /dev/null +++ b/data/self-interpreter/machines/uni172.blc @@ -0,0 +1 @@ +0101000110100001000000010101100010000101110001111001011101101000011111000010111001111100000011110000001011101110011011110011111100001111110000101111010011101001101000011010 diff --git a/data/self-interpreter/machines/uni172.lam b/data/self-interpreter/machines/uni172.lam new file mode 100644 index 00000000..caa7f460 --- /dev/null +++ b/data/self-interpreter/machines/uni172.lam @@ -0,0 +1,8 @@ +-- 172-bit universal machine (non-strict): U ( ++ N) = M N for closed M. +-- Tromp's intL dbl wiring around the 162's parser. +(\x. x x) (\x. (\intL. \cont. \list. + list (\a. a) (\u. list (\q. cont) (list list u)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) (\x. x x) diff --git a/data/self-interpreter/machines/uni184.blc b/data/self-interpreter/machines/uni184.blc new file mode 100644 index 00000000..63f36564 --- /dev/null +++ b/data/self-interpreter/machines/uni184.blc @@ -0,0 +1 @@ +0100010110000100000001010110001000010111000111100101110110100001111100001011100111110000001111000000101110111001101111001111110000111111000010111101001110100110100001100111011000011010 diff --git a/data/self-interpreter/machines/uni184.lam b/data/self-interpreter/machines/uni184.lam new file mode 100644 index 00000000..e367529d --- /dev/null +++ b/data/self-interpreter/machines/uni184.lam @@ -0,0 +1,8 @@ +-- 184-bit strict universal machine: Tromp's strict wiring (base environment +-- Omega, so applying a free index diverges) around the 162's parser. +(\a. a (\x. (\intL. \cont. \list. + list (\a. a) (\u. list (\q. cont) (list list u)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) (\b. b (a a))) (\a. a a) diff --git a/data/self-interpreter/reasoning_floor/README.md b/data/self-interpreter/reasoning_floor/README.md index 8787ac17..38814809 100644 --- a/data/self-interpreter/reasoning_floor/README.md +++ b/data/self-interpreter/reasoning_floor/README.md @@ -8,7 +8,14 @@ directory keeps its own `PROMPT.md`). Codex ran `global`, `remainder`, `knot`, `dispatch` and `lean-floor`; `gemini` and `grok` are single consults from those vendors. `verify/` holds the independent adversarial reviews. -No lane found an interpreter below 165. What the record keeps: +The night produced the **162-bit self-interpreter** (`origin162/`): a +reviewer refuting a step of the reader-optimality proof built the affine +44-bit reader `s I (λu. s (λq. cont) (s s u)) next` (`verify/vreaderS_codex.md`, +witness B44); spliced into the 165 it gave a correct 166 (`origin162/b44.lam`), +and `tools/self-interpreter/polish.py` (letopt) inlined NEXT into the reader's +operand slot, Grok's idea from `grok/`, giving 162. An independent review +(`verify/v162_codex.md`) re-derived its contract; Lean proves it +(`lean/Blc/Selfint162.lean`). What else the record keeps: | lane | result | where it lives now | |---|---|---| @@ -18,7 +25,7 @@ No lane found an interpreter below 165. What the record keeps: | knot | opaque fixed points cost ≥ 20 bits, so the 165's 31 bits of recursion overhead are minimal (Lean); the generic diagonal carrier ≥ 12; two reset bootstraps at 192 | `interpreter.md` §4, §6; `lean/Blc/SelfintKnot.lean` | | lean-floor | kernel-checked `SelfintSizeBound 27` (from 18) | `structural-bounds.md`; `lean/Blc/SelfintFloor*.lean` | | env | cell ≥ 24 and lift ≥ 19 with borrowed raw data, then under only the Boolean lookup laws (handwritten, unreviewed); a 171 with a curried cell | `interpreter.md` §5, §6 | -| reader-proof | handwritten theorem: with the 165's knot and NEXT fixed, every reader body costs ≥ 43, uniquely attained; a Gemini review found two local gaps, repaired in the report (a Codex review was pending when archived) | `reader-proof/REPORT.md`, `verify/vreader_gemini.md` | +| reader-proof | a residual-tracing attempt to prove that, with the 165's knot and NEXT fixed, every reader body costs ≥ 43. Gemini found two local gaps (repaired); Codex found false steps — one source node can serve several output roles, an uncovered non-dispatch-cell case, a wrong 64-bit sub-bound (a valid 59-bit reader) — so the claim stays a conjecture, with no reader below 43 found by three investigators | `reader-proof/REPORT.md`, `verify/vreader_*.md` | | nextfuse | a catalogue of second-bit dispatch placements (166–188); its "NEXT is 92" is a measured construction and heuristic, and its shared-argument lemma was refuted by review | `interpreter.md` §6, `verify/vdispatch_codex.md` | | dispatch | the zero arm's duplicate is forced for every application-only whole-stream skip; surplus reader arguments reach the rigid continuation; one re-entrant reader cannot read both tag bits (proof replaced by the reviewer's stronger one); a 176 without a `next` let | `protocol-obstructions.md`, `interpreter.md` §6, `verify/vdispatch_codex.md` | | grok | a correct 168 passing NEXT as the reader's third operand (proposed as 164; miscounted) | `interpreter.md` §6 | @@ -30,3 +37,11 @@ here. The 37's checker moved to `tools/self-interpreter/theory/floor37/`. Other scripts ran from the lanes' scratch directories and may need their paths adjusted to rerun; several expect a frozen copy of `target/release/blam` beside them. + +Later lanes: `next-proof-codex` (any interpreter embeds into the NEXT slot +at +44 bits; NEXT ≥ 92 under rigid canonical laws, normal source and two-arm +tag uses; reviewed correct, `verify/vnext_codex.md`; now in +`protocol-obstructions.md`) and `interface` (paired interface changes, +181–240 bits, and a value-collision obstruction). The reader-proof lane's +narrowed "Theorem S" was also refuted in review (`verify/vreaderS_codex.md`), +which is where the 162's reader came from. diff --git a/data/self-interpreter/reasoning_floor/interface/PROMPT.md b/data/self-interpreter/reasoning_floor/interface/PROMPT.md new file mode 100644 index 00000000..c748fd7d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/PROMPT.md @@ -0,0 +1,33 @@ +Lane "interface": the last constructive region. Lane directory: +/Users/a9lim/Work/blam/tmp/overnight/interface/ (write only there). Read +/Users/a9lim/Work/blam/tmp/overnight/BRIEF.md (contract, the 165, how to work), +then docs/classical/self-interpreter/interpreter.md §2, §5, §6 (now updated), +and these reports from tonight's lanes — they narrow where a sub-165 can be: + tmp/overnight/reader-proof/REPORT.md (reader optimal for every shape, given knot + NEXT; under review) + tmp/overnight/nextfuse/REPORT.md (NEXT = 92 under interfaces I1–I4; dispatch catalogue) + tmp/overnight/dispatch/REPORT.md (forcing lemmas; second-bit state cannot ride in the continuation) + tmp/overnight/knot/REPORT.md (recursion overhead 31 minimal for an opaque body; carriers) + tmp/overnight/env/REPORT.md (cell 24 / lift 19 even under weaker laws) + +Every analysis tonight concludes the same thing: within the 165's interfaces +everything is at its floor, and a sub-165 must change an interface that two +regions share. The named candidates are: (1) the handoff `r next` +(18 bits to deliver (bit1, r2) to a 17-bit NEXT header, plus a zero arm that +must drop a duplicate stream copy); (2) the value protocol (I1–I2: values are +functions of environments, variables are raw unary codes); (3) the +continuation protocol (I3: value then rest, rigid binary C at the root, with +every internal continuation uniform with the root's). Nightly lanes priced +the obvious changes to each at ≥ 166 in isolation. + +Your job: design interpreters that change TWO of these interfaces at once, +so that each change pays for the other — the way the 165's reader changed +dispatch and VAR together. Examples of the shape of idea wanted (not +prescriptions): a continuation protocol whose internal continuations receive +something extra that the handoff produces for free; a value representation +whose λ-values can absorb the duplicate stream copy the zero arm now drops; +a root adapter that the always-zero first bit of every closed program +(`every closed program starts with 0`) makes free. For each design, derive +its equations on paper, write it, run `python3 tools/self-interpreter/polish.py +FILE.lam` (battery + optimal let structure), and record the exact size. Prove +an obstruction when a family dies. Light computation only (seconds per check, +2 threads, no enumeration). Report as the brief says (REPORT.md in your lane). diff --git a/data/self-interpreter/reasoning_floor/interface/REPORT.md b/data/self-interpreter/reasoning_floor/interface/REPORT.md new file mode 100644 index 00000000..48515d1f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/REPORT.md @@ -0,0 +1,402 @@ +# Interface lane: paired protocols, exact costs, and a return-arity collision + +**No sub-165 interpreter found.** Four coupled designs and two controls pass +the exact battery. The smallest new pairing is **202 bits**: NEXT is the +reader's outer operand and continuations carry thunked remainders. A second +pairing really does use the otherwise discarded stream copy, as the argument +that forces an APP remainder thunk; it costs **213 bits**. The root shortcut +combined with that remainder convention costs **240 bits**. + +The useful obstruction is an **actual-value collision**: in the ordinary +value protocol, `var n` and `I (var n)` with the same suffix produce +beta-identical closures. Therefore an internal continuation cannot consume an +extra argument only on the variable return while retaining the ordinary +constructor return. This proof does not replace the concrete values by rigid +placeholders. It also identifies its escape: preserve constructor provenance +in the value or continuation, or change both return conventions. + +All new files are in this lane. No consult, subagent, term enumeration, or +tracked-file edit was used. The broad reader and NEXT optimality claims in +the supplied reports are not premises of the arguments below. In particular, +this report does not strengthen their conclusions to unrestricted optimality. + +## 1. Complete interpreter ledger + +Each `NAME.lam` is a readable, complete source generated by `build.py`. +`NAME.best.lam` and `NAME.best.blc` are the materialized minimum from the +requested polish run, and were separately battery checked. + +| NAME | Written bits | Letopt minimum | Exact battery line for the minimum | Idea | +|---|---:|---:|---|---| +| `third_operand_thunk` | 209 | **202** | `202 bits ok=667 skip=1 fail=0` | NEXT is the reader's third argument; variable returns retain `r r = K rest` instead of forcing it. APP consumes the thunk at its parse boundary. | +| `delayed_drop_thunk` | 220 | **213** | `213 bits ok=667 skip=1 fail=0` | Delete a zero-arm binder and return remainder thunks; the extra argument now forces the first child's remainder in APP. | +| `thunk_input_output` | 234 | **223** | `223 bits ok=667 skip=1 fail=0` | Both parser inputs and returned remainders are thunks, so APP passes the returned object directly to the next parse. | +| `root_next_thunk` | 240 | **240** | `240 bits ok=667 skip=1 fail=0` | Knot produces NEXT; root consumes its known-zero first bit and enters NEXT directly, while the private reader returns thunks. | +| `delayed_drop` | 183 | **181** | `181 bits ok=667 skip=1 fail=0` | Control: a three-argument first-child continuation consumes the trailing duplicate. This is the already-recorded late-discard idea, not a new algorithm. | +| `delayed_drop_function_env` | 199 | **197** | `197 bits ok=667 skip=1 fail=0` | Control: combine that continuation with function environments and values `lambda e.e r`. The changes do not amortize one another. | + +"Minimum" here has the precise scope of `polish.py`: the inlined core and +at most two cuts, its prescribed setting for sources above 175 bits. It is +not an all-representatives lower bound. All six minimum renderings also pass +three exact suffix checks, on Omega, lambda.Omega, and Omega Omega with a +suffix-projecting continuation. These finite checks do not prove the full +interpreter contract; the handwritten induction arguments are below. + +The initial versions used a captured value/continuation instead of the thunk +itself as a forcing operand. They are preserved in `initial/`; every one was +also run through the requested polish script: + +| Initial source | Written bits | Initial letopt minimum | Exact source battery line | +|---|---:|---:|---| +| `initial/third_operand_thunk.lam` | 211 | 204 | `211 bits ok=667 skip=1 fail=0` | +| `initial/delayed_drop_thunk.lam` | 221 | 214 | `221 bits ok=667 skip=1 fail=0` | +| `initial/thunk_input_output.lam` | 236 | 230 | `236 bits ok=667 skip=1 fail=0` | +| `initial/root_next_thunk.lam` | 242 | 242 | `242 bits ok=667 skip=1 fail=0` | + +The other two controls did not change. `polish_initial.log` records those +runs; `polish_final.log`, per-candidate logs, and `checks.json` record the final +ones. There were no failed complete interpreters in this lane. + +A tool detail matters when retrieving the minimum: `letopt --report-le 164` +computes the histogram minimum above 164 but its final `best` bitstring need +not be that minimum. In `src/cli/golf/letopt.rs`, `best_t` is updated from +reported hits only. The checker therefore reruns the same two-cut calculation +with `--report-le` equal to the measured minimum, archives `NAME.render.log`, +and battery-checks that exact bitstring. No tool was changed. + +## 2. Equations and correctness of the constructions + +Use `K = lambda a b.a`, `F = lambda a b.b`, `[b]r = lambda h.h b r`, and + +``` +cell(a,e) = lambda b r.b a (r e) +A(f) = lambda e a.f (cell(a,e)) +L(f,g) = lambda e.f e (g e) +D_c = lambda v t.c v (t t). +``` + +These abbreviations are expanded in the sources; they are not extra lets +hidden from the measurement. Every fixed point uses the ordinary shared +Curry diagonal. Write `U_n(R)=1^n 0 ++ R`; a variable's raw value is +`U_(n-1)(R)`. For every such tail `r`, `r r =beta K R`. + +### A. NEXT operand plus thunked returns (202) + +The internal equations are + +``` +P c s = s (lambda b r.b r (lambda u.c r (r r))) J_c +J_c d = P (lambda f.d (c A(f)) + (lambda t.P (lambda g.c L(f,g)) (t t))) +E c = P D_c. +``` + +On a variable, the reader reduces to + +``` +(lambda u.c r (r r)) J_c -> c r (r r) =beta c r (K R). +``` + +On a constructor `[K]q`, its Scott eliminator gives `q J_c`, so with +`q=[d]t` it gives `J_c d t`. The first parse returns its closure f and `K R`. +ABS forwards that thunk: `c A(f) (K R)`. APP forces it with itself and +parses R: `P (lambda g.c L(f,g)) R`. Thus the induction invariant is + +``` +P c (code(M) ++ R) =beta c V_M (K R), +``` + +with the ordinary closure semantics for V_M. At the root, `D_c` turns this +into `c V_M R`; for closed M, `V_M =beta lambda z.M`. + +This couples two changes: the zero arm hands the stream directly to NEXT, +while the variable arm no longer uses that NEXT operand to force its rest. +The local saving is real but small. In the exact frame used in +`identities.py`, + +``` +lambda u.c r (r r u) 27 bits +lambda u.c r (r r) 23 bits. +``` + +The four saved bits are one application and its innermost occurrence. In +NEXT's corresponding frame, the APP parse changes from 37 to 50 bits: + +``` +P (lambda g.c L(f,g)) +lambda t.P (lambda g.c L(f,g)) (t t). +``` + +The latter is the required forcing continuation for this explicit template. +The public adapter `D_c` is another 21 bits in frame `[c]`, before charging +its insertion. These are exact local costs of the displayed terms, not a +claim that every possible adapter or APP implementation has those costs. +The global letopt minimum is 202, the same numerical size as a previously +recorded thunk-rest interpreter; this is no improvement over that record. + +### B. Use the trailing copy as the force operand (213) + +Here the reader uses `s s`, not `s s s`, and the zero arm has one binder: + +``` +P c s = s (lambda b.b (lambda q.q J_c) c) (s s) +J_c d = P (lambda f t q. + d (c A(f) t) + (P (lambda g.c L(f,g)) (t q))) +E c = P D_c. +``` + +On a variable, the result is again `c r (K R)`. On a constructor `[K]q`, +`[K]q ([K]q) = K q`, so the result is + +``` +q J_c (K q) = J_c d body (K q). +``` + +The first recursive parse returns `f, K R`, leaving the final `K q` on the +application spine. The three-argument callback consumes it. In ABS it returns +`c A(f) (K R)`; in APP the same argument forces `(K R) (K q) -> R` and starts +the second parse. The induction invariant and public decoding are the same +as in A. This is an actual joint repair: the extra argument is used at the +site introduced by the changed remainder protocol, rather than being dropped +by an additional standalone wrapper. + +Its limitation is also exact: the forced thunk erases that argument. It does +not convey the constructor tag or any other state beyond that point. The +mode-erasure obstruction in section 3 describes this boundary. + +### C. Thunked input and output (223) + +``` +P c T = (lambda s.s (lambda b.b (lambda q u.q J_c) c) (s s)) (T T) +J_c d r = P (lambda f.d (c A(f)) (P (lambda g.c L(f,g)))) (K r) +E c s = P D_c (K s). +``` + +The internal law is `P c (K(code(M)++R)) =beta c V_M (K R)`. +The parser forces its input once; a constructor's first-child input is +wrapped by `K r`; in APP the returned thunk is already in the parser's input +format. ABS forwards it. The two public adapters establish the ordinary +contract. Moving the force from the APP callback to parser entry is valid, +but now raw first-child inputs and the public input require wrapping. + +### D. Root enters NEXT directly (240) + +Define the two interfaces by + +``` +P k s = s (lambda b r.b r (lambda u.k r (r r))) (N k) +N c d = P (lambda f.d (c A(f)) + (lambda t.P (lambda g.c L(f,g)) (t t))) +E c s = s (lambda zero q.q (N D_c)). +``` + +The implementation puts the fixed point around N and defines P privately +inside that fixed point. For a closed input `s=[K][d]body`, the root equation +reduces directly to `N D_c d body`. The mutually recursive parser/NEXT +induction is exactly A's, so `E c s =beta c V_M R`. The known-zero root bit +really removes the ordinary first-bit dispatch at the entry. It does not +remove the thunked-remainder adapter or the private reader's recursion costs. +The measured combined design is 240. + +### Controls (181 and 197) + +For the ordinary-remainder delayed-drop control, + +``` +P c s = s (lambda b.b (lambda q.q J_c) c) (s s s) +J_c d = P (lambda f r q.d (c A(f)) (P (lambda g.c L(f,g))) r). +``` + +The extra q is consumed only after the first child's value and rest arrive. +This gives the standard parser law, with no root adapter. Its first-child +continuation has a different arity from both its parent and the APP +continuation. It is a concrete witness that those internal arities need not +all be binary when the handoff changes. + +The function-environment control changes variable values to +`lambda e.e r` and the ABS cell to + +``` +E(a,e) = lambda s.s (lambda b.b (K a) e). +``` + +Then `E(a,e) ([K]R) -> a` and `E(a,e) ([F]r) -> e r`. +The usual variable and syntax inductions give correctness with the same APP +lift. Combining it with the delayed-drop callback costs another 16 bits, +both before and after the measured let optimization. This is a control +showing that merely combining two already expensive changes is insufficient; +I do not claim a new function-environment algorithm or a compensating saving. + +All these are beta-reduction arguments, without evaluating the interpreted +program. Consequently their inductive reasoning includes divergent source +programs. None of these interpreter proofs was formalized in Lean here. + +## 3. Exact identities and obstructions + +### 3.1 Actual-value collision forbids a mixed-arity shortcut + +**Hypotheses.** A source M is parsed to a value `V_M` and its actual suffix R. +The continuation used by the enclosing lambda is the same term k when its +body is `var 1` or `I (var 1)`; it does not additionally capture or receive +that body's original code. Variable returns add a nonempty trailing operand +list, while constructor returns use `k V_M R` without it. The canonical +value protocol is retained, or more generally the two values below are +beta-identical. + +**Claim.** This cannot implement the root contract, whatever those trailing +operands are and whatever k's implementation is. + +**Proof.** Let `r_N=[K]N` be the raw closure for `var 1`. The closure parsed +for the closed identity is `K I`, independently of its following code. The +ordinary APP lift therefore gives + +``` +V_(I (var 1)) = lambda e.(K I) e (r_N e) + -> lambda e.r_N e + -> lambda e.e K N + =alpha r_N. +``` + +The final step is beta, not eta: r_N is an actual Scott lambda. The same +identity holds for every unary index, since its raw value is a Scott lambda. + +The closed root programs `lambda x.x` and `lambda x.I x` must both return +`W = C (lambda z.I) N`. The constructor-body case forces +`k r_N N =beta W`. The variable-body case would then be +`k r_N N T1 ... Tm =beta W T1 ... Tm`. A reduct of the latter retains at +least `m+2` arguments at the rigid head C, whereas W has exactly two. +Church--Rosser excludes their equality. Contradiction. + +This proves an all-size exclusion for the stated mixed-return family. It +also applies to the function-environment control: its variable value is a +lambda, and lifting `K I` over that value beta-reduces to it too. + +**Boundary.** A constructor tag retained in the value breaks the collision. +So does a continuation that also receives/captures the original body code. +Changing both caller conventions, as A and B do, is outside the hypothesis. +The result is not a lower bound for arbitrary changed value protocols. + +### 3.2 An outer argument cannot enter a lambda-valued payload + +**Hypothesis.** A return has already become `C V N`, with C rigid, and the +extra stream copy is supplied outside that expression. + +**Claim.** No change confined to V, including adding lambdas that could +ignore the copy, can absorb it. + +**Proof.** The application is `(C V N) Q`, not `C (V Q) N`. +Every reduct retains the C-headed outer spine and its third argument. This +is a statement about application ancestry, independent of whether V has a +normal form. Thus the copy must be consumed before that return, or the +control protocol must change. Construction B consumes it in the first-child +continuation; putting an unused binder inside A(f) would not work. + +This is the general rigid-spine fact behind the earlier failed one-binder +zero arm, not a new unrestricted impossibility theorem. + +### 3.3 Forcing an ordinary remainder thunk cannot carry the mode onward + +**Hypotheses.** The only occurrence of a carrier Q containing the dispatch +mode is as the forcing operand in `T Q`, with `T =beta K R`, and every other +live field is independent of that mode. + +**Claim.** This use of Q cannot distinguish ABS and APP. + +**Proof.** `T Q =beta R` for every Q. Replace every such occurrence by R; +the resulting expression is beta-equal and contains none of the mode. +There are actual closed programs requiring a distinction with the other +fields fixed: take the first parsed operand to be I, and set +`R=code(I)++N`. An ABS input `lambda x.I` with suffix R and an APP input +`I I` with suffix N have the same first closure `K I` and the same remainder +R after that first parse. Their required returns are + +``` +C (lambda z x.I) R +C (lambda z.I) N, +``` + +distinct beta-normal forms. Hence that otherwise identical post-parse state +cannot implement both cases after Q is erased. + +The scope is deliberately narrow: a second use of Q, a different thunk +representation that retains it, or a mode captured in the callback escapes +it. Construction B retains d separately, which is why it is correct and why +its forcing operand does not also pay for the tag binder. + +### 3.4 A unary return needs suffix information somewhere + +**Hypotheses.** The only return field is a canonical closure `V_M`, and the +continuation and all remaining state are independent of the suffix. + +**Claim.** No such interface can satisfy the contract even for M=I. + +**Proof.** `V_I =beta K I` is independent of N. Thus the entire returned +expression is independent of the fresh free N. Reduction cannot create N, +whereas `C (K I) N` contains it at the root. This excludes deleting the +remainder parameter without encoding it in the value, callback, or other +state. The always-zero first bit supplies no suffix information. + +### Mechanical checks and epistemic status + +`identities.py` checks 26 fixed identities/counterexamples (23 equalities, +three inequalities) and 18 divergent-program suffix probes. It also measures +the five displayed module costs. `identities.json` contains the exact closed +probes and normal forms; `identities.log` gives their verdicts. The symbolic +arguments above are handwritten, not Lean proofs and not independently +reviewed. The checks verify the finite witnesses, not the quantification of +the impossibility statements. + +## 4. What remains worth trying + +The mixed-arity observation is more restrictive than "the root is rigid". +A variable return really cannot meet the public continuation directly, but +an ordinary constructor can erase its provenance before reaching exactly the +same internal continuation. `I (var n)` is the minimal witness. A useful +paired change must preserve enough provenance to avoid that collision, or +make every return follow a new convention. + +Uniform thunking is a concrete way to do the latter. The constructions show +why its obvious synergies do not pay here: it removes a four-bit force from +one return site, but introduces forces at parser entry or APP and requires a +public adapter. Using the duplicate as that force operand works, but the +operand is then erased and cannot also carry the second tag. Starting at +NEXT removes an entry dispatch without removing those costs. + +My next constructive target would be a value representation retaining a +cheap constructor discriminator *and* an already needed suffix/continuation +field, with a first-child callback that can use those fields directly. +The discriminator must survive `I (var n)` instead of beta-collapsing to the +variable representation. Merely changing the direction of environment +application does not accomplish that. A viable candidate must price the +public decoder simultaneously; none here makes it free. + +I have no all-size obstruction for that tagged or code-sensitive family, and +no evidence from this lane that it can fit below 165. These constructions +close specific attempted savings, not the last constructive region itself. + +## Reproduce + +From the repository root: + +``` +PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$PWD/tmp/overnight/interface \ +TMPDIR=$PWD/tmp/overnight/interface \ +python3 tmp/overnight/interface/build.py + +PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$PWD/tmp/overnight/interface \ +TMPDIR=$PWD/tmp/overnight/interface \ +python3 tmp/overnight/interface/run_checks.py + +PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$PWD/tmp/overnight/interface \ +TMPDIR=$PWD/tmp/overnight/interface \ +python3 tmp/overnight/interface/identities.py +``` + +The checker invokes `python3 tools/self-interpreter/polish.py FILE.lam` for +each candidate, then materializes the reported minimum and tests it. +`sitecustomize.py` limits the repository battery's otherwise ten-worker +executor to two, sets temporary-file placement, and optionally archives +polish's captured letopt output without changing it. Letopt itself is called +with `--threads 2`. The final per-candidate polish calls took about 2.0--4.3 +seconds each; the fixed identity/suffix checks took less than a second. diff --git a/data/self-interpreter/reasoning_floor/interface/archive_initial.py b/data/self-interpreter/reasoning_floor/interface/archive_initial.py new file mode 100644 index 00000000..e5d7d4da --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/archive_initial.py @@ -0,0 +1,18 @@ +"""Retain the exact pre-self-forcing revisions recorded in polish_initial.log.""" +from pathlib import Path +import sys +LANE=Path(__file__).resolve().parent +sys.path.insert(0,str(LANE.parents[2]/'tools/self-interpreter')) +import battery +out=LANE/'initial' +out.mkdir(exist_ok=True) +for name,size,other in [('third_operand_thunk',211,'f'),('delayed_drop_thunk',221,None), + ('thunk_input_output',236,'c'),('root_next_thunk',242,'f')]: + src=(LANE/(name+'.lam')).read_text() + src=src.replace(r'\v\t. c v (t t)',r'\v\t. c v (t v)') + if other: src=src.replace('(t t)','(t '+other+')') + bits=battery.enc(battery.compile_lam(src)) + assert len(bits)==size,(name,len(bits),size) + (out/(name+'.lam')).write_text(src) + (out/(name+'.blc')).write_text(bits+'\n') + print(name,size) diff --git a/data/self-interpreter/reasoning_floor/interface/build.py b/data/self-interpreter/reasoning_floor/interface/build.py new file mode 100644 index 00000000..95b0392e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/build.py @@ -0,0 +1,76 @@ +"""Hand-derived joint protocol variants; no term search.""" +from pathlib import Path +import sys +import re +ROOT = Path(__file__).resolve().parents[3] +LANE = Path(__file__).resolve().parent +sys.path.insert(0, str(ROOT / 'tools/self-interpreter')) +sys.path.insert(0, str(ROOT / 'tools')) +import battery + +def fix(body): + return rf'(\x. x x) (\x. (\p. {body}) (x x))' + +def let(name, val, body): + return rf'(\{name}. {body}) ({val})' + +va = r'(\e a. f (\b r. b a (r e)))' +lift = r'(\e. f e (g e))' +app = rf'(p (\g. c {lift}))' +abs = rf'(c {va})' + +candidates = {} +# The dropped copy is consumed by the first-parse continuation after its rest. +j = rf'\d. p (\f r q. d {abs} {app} r)' +body = let('j', j, r'\s. s (\b. b (\r. r j) c) (s s s)') +candidates['delayed_drop'] = fix(r'\c. '+body) + +# NEXT is the third operand, while returns carry K(rest). +# A variable's arm consumes that operand without using it to force the rest. +# APP forces the rest once at recursive entry; ABS forwards it unchanged. +jt = rf'\d. p (\f. d {abs} (\t. p (\g. c {lift}) (t t)))' +body = rf'\c s. s (\b r. b r (\u. c r (r r))) ({jt})' +p_thunk = fix(body) +candidates['third_operand_thunk'] = let('p0', p_thunk, r'\c. p0 (\v t. c v (t t))') + +# The trailing zero-arm operand is K(q). It forces a returned tail thunk. +jt2 = rf'\d. p (\f t q. d (c {va} t) (p (\g. c {lift}) (t q)))' +body = let('j', jt2, r'\s. s (\b. b (\r. r j) c) (s s)') +p_thunk2 = fix(r'\c. '+body) +candidates['delayed_drop_thunk'] = let('p0', p_thunk2, r'\c. p0 (\v t. c v (t t))') + +# Directly hand the rest thunk to a parser whose input protocol is thunked. +# First parse takes K(raw tail); root uses an explicit K(input) adapter. +jt3 = rf'\d r. p (\f. d {abs} {app}) (\u. r)' +body3 = let('j', jt3, r'\s. s (\b. b (\r u. r j) c) (s s)') +body3 = rf'\c t. ({body3}) (t t)' +p_thunk3 = fix(body3) +candidates['thunk_input_output'] = let('p0', p_thunk3, + r'\c s. p0 (\v t. c v (t t)) (\u. s)') + +# Change the value/environment interface as well as the delayed-drop handoff. +# Environment functions consume a complete raw unary tail rather than its fields. +va_fun = r'(\e a. f (\r. r (\b. b (\u. a) e)))' +app_fun = rf'(p (\g. c {lift}))' +jf = rf'\d. p (\f r q. d (c {va_fun}) {app_fun} r)' +bodyf = let('j', jf, r'\s. s (\b. b (\r. r j) (\v. c (\e. e v))) (s s s)') +candidates['delayed_drop_function_env'] = fix(r'\c. '+bodyf) + +# Extra operand carries a thunked tail; root is entered directly through NEXT. +# The fixed point produces NEXT. P is private and returns thunked tails. +# N c d r = P (lambda f. d (c VA) (force-then-P kapp)) r. +# E c s = s (lambda zero q. q (N (lambda v t.c v (t t)))). +p_private = r'\k s. s (\b r. b r (\u. k r (r r))) (n k)' +next_body = rf'\c d. p (\f. d (c {va}) (\t. p (\g. c {lift}) (t t)))' +ngen = rf'(\x. x x) (\x. (\n. {let("p", p_private, next_body)}) (x x))' +candidates['root_next_thunk'] = let('n0', ngen, + r'\c s. s (\zero q. q (n0 (\v t. c v (t t))))') + +for name, src in candidates.items(): + src = re.sub(r'\\([a-z0-9 ]+)\.', lambda m: ''.join('\\'+x for x in m[1].split())+'.', src) + path = LANE / (name+'.lam') + path.write_text(src+'\n') + t = battery.compile_lam(src) + bits = battery.enc(t) + path.with_suffix('.blc').write_text(bits+'\n') + print(name, len(bits), flush=True) diff --git a/data/self-interpreter/reasoning_floor/interface/checks.json b/data/self-interpreter/reasoning_floor/interface/checks.json new file mode 100644 index 00000000..109cdaf2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/checks.json @@ -0,0 +1,44 @@ +[ + { + "name": "delayed_drop", + "source_bits": 183, + "best_bits": 181, + "best_battery": "181 bits ok=667 skip=1 fail=0 delayed_drop.best.lam", + "seconds": 2.0284241249974 + }, + { + "name": "third_operand_thunk", + "source_bits": 209, + "best_bits": 202, + "best_battery": "202 bits ok=667 skip=1 fail=0 third_operand_thunk.best.lam", + "seconds": 1.9853833750021295 + }, + { + "name": "delayed_drop_thunk", + "source_bits": 220, + "best_bits": 213, + "best_battery": "213 bits ok=667 skip=1 fail=0 delayed_drop_thunk.best.lam", + "seconds": 2.1018722079970757 + }, + { + "name": "thunk_input_output", + "source_bits": 234, + "best_bits": 223, + "best_battery": "223 bits ok=667 skip=1 fail=0 thunk_input_output.best.lam", + "seconds": 2.187083500000881 + }, + { + "name": "delayed_drop_function_env", + "source_bits": 199, + "best_bits": 197, + "best_battery": "197 bits ok=667 skip=1 fail=0 delayed_drop_function_env.best.lam", + "seconds": 2.031014457999845 + }, + { + "name": "root_next_thunk", + "source_bits": 240, + "best_bits": 240, + "best_battery": "240 bits ok=667 skip=1 fail=0 root_next_thunk.best.lam", + "seconds": 4.318026042004931 + } +] diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop.best.blc b/data/self-interpreter/reasoning_floor/interface/delayed_drop.best.blc new file mode 100644 index 00000000..2d838eb6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop.best.blc @@ -0,0 +1 @@ +0100011010000100000001011000010110000110000111111100001000000011110110010111001111111000000111100000010111011100110111100111111110000111111110000101111010011101011100101101010011010 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop.best.lam b/data/self-interpreter/reasoning_floor/interface/delayed_drop.best.lam new file mode 100644 index 00000000..8fc3370d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop.best.lam @@ -0,0 +1 @@ +((\v0. (v0 v0)) (\v0. ((\v1. (\v2. (\v3. ((v3 (\v4. ((v4 (\v5. (v5 (\v6. (v1 (\v7. ((\v8. (\v9. (\v10. (v8 v9)))) ((v6 (v2 (\v8. (\v9. (v7 (\v10. (\v11. ((v10 v9) (v11 v8))))))))) (v1 (\v8. (v2 (\v9. ((v7 v9) (v8 v9)))))))))))))) v2))) ((v3 v3) v3))))) (v0 v0)))) diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop.blc b/data/self-interpreter/reasoning_floor/interface/delayed_drop.blc new file mode 100644 index 00000000..1c479bfe --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100001101111011110010110101000011110000000010101111100111111000000111111000000101110111001101111001111111000011111110000101111110100111010110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop.lam b/data/self-interpreter/reasoning_floor/interface/delayed_drop.lam new file mode 100644 index 00000000..6d09f10c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\p. \c. (\j. \s. s (\b. b (\r. r j) c) (s s s)) (\d. p (\f\r\q. d (c (\e\a. f (\b\r. b a (r e)))) (p (\g. c (\e. f e (g e)))) r))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop.letopt.log b/data/self-interpreter/reasoning_floor/interface/delayed_drop.letopt.log new file mode 100644 index 00000000..57d05957 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop.letopt.log @@ -0,0 +1,5 @@ +input 183 bits; core 196 bits (67 nodes); 579 candidate cuts (13 shared) +k=1: 579 valid, 0 invalid, 0.0s; smallest sizes 185:1 187:2 188:6 189:2 190:2 192:1 +k=2: 133783 valid, 33548 invalid, 0.1s; smallest sizes 181:2 182:1 183:5 184:10 185:6 186:4 +smallest rendering over 0..=2 cuts: 181 bits +best 183 010001101000010000010000010110000101100001101111011110010110101000011110000000010101111100111111000000111111000000101110111001101111001111111000011111110000101111110100111010110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop.polish.log b/data/self-interpreter/reasoning_floor/interface/delayed_drop.polish.log new file mode 100644 index 00000000..69a9a79b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop.polish.log @@ -0,0 +1,3 @@ +/Users/a9lim/Work/blam/tmp/overnight/interface/delayed_drop.lam: 183 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/interface/delayed_drop.lam + letopt --max-cuts 2: smallest 181 +elapsed_seconds=2.028 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop.render.log b/data/self-interpreter/reasoning_floor/interface/delayed_drop.render.log new file mode 100644 index 00000000..d1b12968 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop.render.log @@ -0,0 +1,11 @@ +input 183 bits; core 196 bits (67 nodes); 579 candidate cuts (13 shared) +k=1: 579 valid, 0 invalid, 0.0s; smallest sizes 185:1 187:2 188:6 189:2 190:2 192:1 +k=2: 133783 valid, 33548 invalid, 0.1s; smallest sizes 181:2 182:1 183:5 184:10 185:6 186:4 + 181 [[42]->46 [9, 29]->64] + (\a. a a) (\a. (\b c d. d (\e. e (\f. f (\g. b (\h. (\i j k. i j) (g (c (\i j. h (\k l. k j (l i)))) (b (\i. c (\j. h j (i j)))))))) c) (d d d)) (a a)) + 0100011010000100000001011000010110000110000111111100001000000011110110010111001111111000000111100000010111011100110111100111111110000111111110000101111010011101011100101101010011010 + 181 [[44]->46 [9, 29]->64] + (\a. a a) (\a. (\b c d. d (\e. e (\f. f (\g. b (\h. (\i j k. i j) (g (c (\i j. h (\k l. k j (l i)))) (b (\i. c (\j. h j (i j)))))))) c) (d d d)) (a a)) + 0100011010000100000001011000010110000110000111111100001000000011110110010111001111111000000111100000010111011100110111100111111110000111111110000101111010011101011100101101010011010 +smallest rendering over 0..=2 cuts: 181 bits +best 181 0100011010000100000001011000010110000110000111111100001000000011110110010111001111111000000111100000010111011100110111100111111110000111111110000101111010011101011100101101010011010 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.best.blc b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.best.blc new file mode 100644 index 00000000..77edd5d0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.best.blc @@ -0,0 +1 @@ +01000110100001000000010110000101100001100001111111000010000000111101100101110011111110000001111000011000010110001111011110011111111000011111111000010111101001110100001111100001101100101101010011010 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.best.lam b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.best.lam new file mode 100644 index 00000000..58cc7642 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.best.lam @@ -0,0 +1 @@ +((\v0. (v0 v0)) (\v0. ((\v1. (\v2. (\v3. ((v3 (\v4. ((v4 (\v5. (v5 (\v6. (v1 (\v7. ((\v8. (\v9. (\v10. (v8 v9)))) ((v6 (v2 (\v8. (\v9. (v7 (\v10. (v10 (\v11. ((v11 (\v12. v9)) v8))))))))) (v1 (\v8. (v2 (\v9. ((v7 v9) (v8 v9)))))))))))))) (\v5. (v2 (\v6. (v6 v5))))))) ((v3 v3) v3))))) (v0 v0)))) diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.blc b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.blc new file mode 100644 index 00000000..ca703635 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.blc @@ -0,0 +1 @@ +0100011010000100000100000101100001011000011011110000111111000011011001011010100001111000000001010111110011111100000011111100001100001011000111101111001111111000011111110000101111110100111010110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.lam b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.lam new file mode 100644 index 00000000..1911ac8f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\p. \c. (\j. \s. s (\b. b (\r. r j) (\v. c (\e. e v))) (s s s)) (\d. p (\f\r\q. d (c (\e\a. f (\r. r (\b. b (\u. a) e)))) (p (\g. c (\e. f e (g e)))) r))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.letopt.log b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.letopt.log new file mode 100644 index 00000000..d8721dac --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.letopt.log @@ -0,0 +1,5 @@ +input 199 bits; core 212 bits (74 nodes); 646 candidate cuts (13 shared) +k=1: 646 valid, 0 invalid, 0.0s; smallest sizes 201:1 203:2 204:6 205:2 206:2 208:1 +k=2: 171863 valid, 36472 invalid, 0.2s; smallest sizes 197:2 198:1 199:5 200:10 201:6 202:4 +smallest rendering over 0..=2 cuts: 197 bits +best 199 0100011010000100000100000101100001011000011011110000111111000011011001011010100001111000000001010111110011111100000011111100001100001011000111101111001111111000011111110000101111110100111010110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.polish.log b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.polish.log new file mode 100644 index 00000000..38646d14 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.polish.log @@ -0,0 +1,3 @@ +/Users/a9lim/Work/blam/tmp/overnight/interface/delayed_drop_function_env.lam: 199 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/interface/delayed_drop_function_env.lam + letopt --max-cuts 2: smallest 197 +elapsed_seconds=2.031 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.render.log b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.render.log new file mode 100644 index 00000000..67324ec8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_function_env.render.log @@ -0,0 +1,11 @@ +input 199 bits; core 212 bits (74 nodes); 646 candidate cuts (13 shared) +k=1: 646 valid, 0 invalid, 0.0s; smallest sizes 201:1 203:2 204:6 205:2 206:2 208:1 +k=2: 171863 valid, 36472 invalid, 0.2s; smallest sizes 197:2 198:1 199:5 200:10 201:6 202:4 + 197 [[43]->47 [9, 30]->71] + (\a. a a) (\a. (\b c d. d (\e. e (\f. f (\g. b (\h. (\i j k. i j) (g (c (\i j. h (\k. k (\l. l (\m. j) i)))) (b (\i. c (\j. h j (i j)))))))) (\f. c (\g. g f))) (d d d)) (a a)) + 01000110100001000000010110000101100001100001111111000010000000111101100101110011111110000001111000011000010110001111011110011111111000011111111000010111101001110100001111100001101100101101010011010 + 197 [[45]->47 [9, 30]->71] + (\a. a a) (\a. (\b c d. d (\e. e (\f. f (\g. b (\h. (\i j k. i j) (g (c (\i j. h (\k. k (\l. l (\m. j) i)))) (b (\i. c (\j. h j (i j)))))))) (\f. c (\g. g f))) (d d d)) (a a)) + 01000110100001000000010110000101100001100001111111000010000000111101100101110011111110000001111000011000010110001111011110011111111000011111111000010111101001110100001111100001101100101101010011010 +smallest rendering over 0..=2 cuts: 197 bits +best 197 01000110100001000000010110000101100001100001111111000010000000111101100101110011111110000001111000011000010110001111011110011111111000011111111000010111101001110100001111100001101100101101010011010 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.best.blc b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.best.blc new file mode 100644 index 00000000..661220cd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.best.blc @@ -0,0 +1 @@ +000101000110100001000001000001011000010110000110111101111001101000011110000000010111110010111111000000111111000000101110111001101111011001011111110000111111100001011111101001110100111010011010000001011110110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.best.lam b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.best.lam new file mode 100644 index 00000000..bbafdbfc --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.best.lam @@ -0,0 +1 @@ +(\v0. (((\v1. (v1 v1)) (\v1. ((\v2. (\v3. ((\v4. (\v5. ((v5 (\v6. ((v6 (\v7. (v7 v4))) v3))) (v5 v5)))) (\v4. (v2 (\v5. (\v6. (\v7. ((v4 ((v3 (\v8. (\v9. (v5 (\v10. (\v11. ((v10 v9) (v11 v8)))))))) v6)) ((v2 (\v8. (v3 (\v9. ((v5 v9) (v8 v9)))))) (v6 v7))))))))))) (v1 v1)))) (\v1. (\v2. ((v0 v1) (v2 v2)))))) diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.blc b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.blc new file mode 100644 index 00000000..1b84406b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.blc @@ -0,0 +1 @@ +0100000111000000101111011001101001000110100001000001000001011000010110000110111101111001101000011110000000010111110010111111000000111111000000101110111001101111011001011111110000111111100001011111101001110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.lam b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.lam new file mode 100644 index 00000000..8df51346 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.lam @@ -0,0 +1 @@ +(\p0. \c. p0 (\v\t. c v (t t))) ((\x. x x) (\x. (\p. \c. (\j. \s. s (\b. b (\r. r j) c) (s s)) (\d. p (\f\t\q. d (c (\e\a. f (\b\r. b a (r e))) t) (p (\g. c (\e. f e (g e))) (t q))))) (x x))) diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.letopt.log b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.letopt.log new file mode 100644 index 00000000..8a714aca --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.letopt.log @@ -0,0 +1,5 @@ +input 220 bits; core 226 bits (80 nodes); 710 candidate cuts (15 shared) +k=1: 710 valid, 0 invalid, 0.0s; smallest sizes 215:1 217:2 218:6 219:2 221:1 223:2 +k=2: 204619 valid, 47076 invalid, 0.2s; smallest sizes 213:1 215:1 216:4 217:2 218:4 219:12 +smallest rendering over 0..=2 cuts: 213 bits +best 220 0100000111000000101111011001101001000110100001000001000001011000010110000110111101111001101000011110000000010111110010111111000000111111000000101110111001101111011001011111110000111111100001011111101001110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.polish.log b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.polish.log new file mode 100644 index 00000000..06aa0b65 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.polish.log @@ -0,0 +1,3 @@ +/Users/a9lim/Work/blam/tmp/overnight/interface/delayed_drop_thunk.lam: 220 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/interface/delayed_drop_thunk.lam + letopt --max-cuts 2: smallest 213 +elapsed_seconds=2.102 diff --git a/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.render.log b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.render.log new file mode 100644 index 00000000..64e2529f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/delayed_drop_thunk.render.log @@ -0,0 +1,8 @@ +input 220 bits; core 226 bits (80 nodes); 710 candidate cuts (15 shared) +k=1: 710 valid, 0 invalid, 0.0s; smallest sizes 215:1 217:2 218:6 219:2 221:1 223:2 +k=2: 204619 valid, 47076 invalid, 0.2s; smallest sizes 213:1 215:1 216:4 217:2 218:4 219:12 + 213 [[53]->65 [9, 31]->66] + \a. (\b. b b) (\b. (\c d. (\e f. f (\g. g (\h. h e) d) (f f)) (\e. c (\f g h. e (d (\i j. f (\k l. k j (l i))) g) (c (\i. d (\j. f j (i j))) (g h))))) (b b)) (\b c. a b (c c)) + 000101000110100001000001000001011000010110000110111101111001101000011110000000010111110010111111000000111111000000101110111001101111011001011111110000111111100001011111101001110100111010011010000001011110110011010 +smallest rendering over 0..=2 cuts: 213 bits +best 213 000101000110100001000001000001011000010110000110111101111001101000011110000000010111110010111111000000111111000000101110111001101111011001011111110000111111100001011111101001110100111010011010000001011110110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/identities.json b/data/self-interpreter/reasoning_floor/interface/identities.json new file mode 100644 index 00000000..9b3a95b3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/identities.json @@ -0,0 +1,311 @@ +{ + "checks": [ + { + "name": "raw variable / I-variable collision n=1", + "equal": true, + "left": "\\N.(\\e.((\\u.(\\a.a)) e) (((\\h.h ((\\a\\b.a)) (N))) e))", + "right": "\\N.(\\h.h ((\\a\\b.a)) (N))", + "left_nf": "00000101100000110110", + "right_nf": "00000101100000110110" + }, + { + "name": "raw variable / I-variable collision n=2", + "equal": true, + "left": "\\N.(\\e.((\\u.(\\a.a)) e) (((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N))))) e))", + "right": "\\N.(\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N))))", + "left_nf": "00000101100000100001011000001101110", + "right_nf": "00000101100000100001011000001101110" + }, + { + "name": "raw variable / I-variable collision n=5", + "equal": true, + "left": "\\N.(\\e.((\\u.(\\a.a)) e) (((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N))))))))))) e))", + "right": "\\N.(\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N))))))))))", + "left_nf": "00000101100000100001011000001000010110000010000101100000100001011000001101111110", + "right_nf": "00000101100000100001011000001000010110000010000101100000100001011000001101111110" + }, + { + "name": "same parent continuation, variable", + "equal": true, + "left": "\\C\\N.(\\v.C (\\e\\a.(v) (\\b\\r.b a (r e)))) ((\\h.h ((\\a\\b.a)) (N))) N", + "right": "\\C\\N.C (\\z.(\\a.a)) N", + "left_nf": "0000010111000001010", + "right_nf": "0000010111000001010" + }, + { + "name": "same parent continuation, I-variable", + "equal": true, + "left": "\\C\\N.(\\v.C (\\e\\a.(v) (\\b\\r.b a (r e)))) (\\e.((\\u.(\\a.a)) e) (((\\h.h ((\\a\\b.a)) (N))) e)) N", + "right": "\\C\\N.C (\\z.(\\a.a)) N", + "left_nf": "0000010111000001010", + "right_nf": "0000010111000001010" + }, + { + "name": "trailing argument cannot disappear", + "equal": false, + "left": "\\C\\N\\T.(\\v.C (\\e\\a.(v) (\\b\\r.b a (r e)))) ((\\h.h ((\\a\\b.a)) (N))) N T", + "right": "\\C\\N\\T.C (\\z.(\\a.a)) N", + "left_nf": "000000010101111000001011010", + "right_nf": "00000001011110000010110" + }, + { + "name": "thunked tail is not the tail at rigid C", + "equal": false, + "left": "\\C\\N.C (\\z.(\\a.a)) (\\u.N)", + "right": "\\C\\N.C (\\z.(\\a.a)) N", + "left_nf": "0000010111000001000110", + "right_nf": "0000010111000001010" + }, + { + "name": "arbitrary forcing operand", + "equal": true, + "left": "\\N\\Q.(\\u.N) Q", + "right": "\\N\\Q.N", + "left_nf": "0000110", + "right_nf": "0000110" + }, + { + "name": "third-operand reader variable n=1", + "equal": true, + "left": "\\c\\j\\N.(\\s.s (\\b\\r.b r (\\u.c r (r r))) j) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N)))))", + "right": "\\c\\j\\N.c ((\\h.h ((\\a\\b.a)) (N))) (\\u.N)", + "left_nf": "0000000101111000010110000011011000110", + "right_nf": "0000000101111000010110000011011000110" + }, + { + "name": "delayed-drop thunk reader variable n=1", + "equal": true, + "left": "\\c\\j\\N.(\\s.s (\\b.b (\\r.r j) c) (s s)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N)))))", + "right": "\\c\\j\\N.c ((\\h.h ((\\a\\b.a)) (N))) (\\u.N)", + "left_nf": "0000000101111000010110000011011000110", + "right_nf": "0000000101111000010110000011011000110" + }, + { + "name": "third-operand reader variable n=2", + "equal": true, + "left": "\\c\\j\\N.(\\s.s (\\b\\r.b r (\\u.c r (r r))) j) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N)))))))", + "right": "\\c\\j\\N.c ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N))))) (\\u.N)", + "left_nf": "0000000101111000010110000010000101100000110111000110", + "right_nf": "0000000101111000010110000010000101100000110111000110" + }, + { + "name": "delayed-drop thunk reader variable n=2", + "equal": true, + "left": "\\c\\j\\N.(\\s.s (\\b.b (\\r.r j) c) (s s)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N)))))))", + "right": "\\c\\j\\N.c ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N))))) (\\u.N)", + "left_nf": "0000000101111000010110000010000101100000110111000110", + "right_nf": "0000000101111000010110000010000101100000110111000110" + }, + { + "name": "third-operand reader variable n=5", + "equal": true, + "left": "\\c\\j\\N.(\\s.s (\\b\\r.b r (\\u.c r (r r))) j) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N)))))))))))))", + "right": "\\c\\j\\N.c ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N))))))))))) (\\u.N)", + "left_nf": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000110111111000110", + "right_nf": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000110111111000110" + }, + { + "name": "delayed-drop thunk reader variable n=5", + "equal": true, + "left": "\\c\\j\\N.(\\s.s (\\b.b (\\r.r j) c) (s s)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N)))))))))))))", + "right": "\\c\\j\\N.c ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N))))))))))) (\\u.N)", + "left_nf": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000110111111000110", + "right_nf": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000110111111000110" + }, + { + "name": "third-operand reader abs", + "equal": true, + "left": "\\c\\j\\t.(\\s.s (\\b\\r.b r (\\u.c r (r r))) j) ((\\h.h ((\\a\\b.a)) ((\\h.h ((\\a\\b.a)) (t)))))", + "right": "\\c\\j\\t.j (\\a\\b.a) t", + "left_nf": "0000000101110000011010", + "right_nf": "0000000101110000011010" + }, + { + "name": "delayed-drop reader abs", + "equal": true, + "left": "\\c\\j\\t.(\\s.s (\\b.b (\\r.r j) c) (s s s)) ((\\h.h ((\\a\\b.a)) ((\\h.h ((\\a\\b.a)) (t)))))", + "right": "\\c\\j\\t.j (\\a\\b.a) t ((\\h.h ((\\a\\b.a)) (t)))", + "left_nf": "000000010101110000011010000101100000110110", + "right_nf": "000000010101110000011010000101100000110110" + }, + { + "name": "delayed-drop thunk reader abs", + "equal": true, + "left": "\\c\\j\\t.(\\s.s (\\b.b (\\r.r j) c) (s s)) ((\\h.h ((\\a\\b.a)) ((\\h.h ((\\a\\b.a)) (t)))))", + "right": "\\c\\j\\t.j (\\a\\b.a) t (\\u.((\\h.h ((\\a\\b.a)) (t))))", + "left_nf": "000000010101110000011010000001011000001101110", + "right_nf": "000000010101110000011010000001011000001101110" + }, + { + "name": "root NEXT entry abs", + "equal": true, + "left": "\\j\\t.((\\h.h ((\\a\\b.a)) ((\\h.h ((\\a\\b.a)) (t))))) (\\zero\\q.q j)", + "right": "\\j\\t.j (\\a\\b.a) t", + "left_nf": "00000101110000011010", + "right_nf": "00000101110000011010" + }, + { + "name": "third-operand reader app", + "equal": true, + "left": "\\c\\j\\t.(\\s.s (\\b\\r.b r (\\u.c r (r r))) j) ((\\h.h ((\\a\\b.a)) ((\\h.h ((\\a\\b.b)) (t)))))", + "right": "\\c\\j\\t.j (\\a\\b.b) t", + "left_nf": "000000010111000001010", + "right_nf": "000000010111000001010" + }, + { + "name": "delayed-drop reader app", + "equal": true, + "left": "\\c\\j\\t.(\\s.s (\\b.b (\\r.r j) c) (s s s)) ((\\h.h ((\\a\\b.a)) ((\\h.h ((\\a\\b.b)) (t)))))", + "right": "\\c\\j\\t.j (\\a\\b.b) t ((\\h.h ((\\a\\b.b)) (t)))", + "left_nf": "0000000101011100000101000010110000010110", + "right_nf": "0000000101011100000101000010110000010110" + }, + { + "name": "delayed-drop thunk reader app", + "equal": true, + "left": "\\c\\j\\t.(\\s.s (\\b.b (\\r.r j) c) (s s)) ((\\h.h ((\\a\\b.a)) ((\\h.h ((\\a\\b.b)) (t)))))", + "right": "\\c\\j\\t.j (\\a\\b.b) t (\\u.((\\h.h ((\\a\\b.b)) (t))))", + "left_nf": "0000000101011100000101000000101100000101110", + "right_nf": "0000000101011100000101000000101100000101110" + }, + { + "name": "root NEXT entry app", + "equal": true, + "left": "\\j\\t.((\\h.h ((\\a\\b.a)) ((\\h.h ((\\a\\b.b)) (t))))) (\\zero\\q.q j)", + "right": "\\j\\t.j (\\a\\b.b) t", + "left_nf": "0000010111000001010", + "right_nf": "0000010111000001010" + }, + { + "name": "function environment lookup zero", + "equal": true, + "left": "\\a\\e\\N.(\\s.s (\\b.b (\\u.a) e)) ((\\h.h ((\\a\\b.a)) (N)))", + "right": "\\a\\e\\N.a", + "left_nf": "0000001110", + "right_nf": "0000001110" + }, + { + "name": "function environment lookup successor", + "equal": true, + "left": "\\a\\e\\r.(\\s.s (\\b.b (\\u.a) e)) ((\\h.h ((\\a\\b.b)) (r)))", + "right": "\\a\\e\\r.e r", + "left_nf": "0000000111010", + "right_nf": "0000000111010" + }, + { + "name": "force erases a carried mode", + "equal": true, + "left": "\\R\\Q1\\Q2.(\\u.R) Q1", + "right": "\\R\\Q1\\Q2.(\\u.R) Q2", + "left_nf": "0000001110", + "right_nf": "0000001110" + }, + { + "name": "same parsed child does not determine the constructor", + "equal": false, + "left": "\\C\\N.C (\\z\\x.(\\a.a)) ((\\h.h ((\\a\\b.a)) ((\\h.h ((\\a\\b.a)) ((\\h.h ((\\a\\b.b)) ((\\h.h ((\\a\\b.a)) (N)))))))))", + "right": "\\C\\N.C (\\z.(\\a.a)) N", + "left_nf": "000001011100000001000010110000011000010110000011000010110000010000101100000110111110", + "right_nf": "0000010111000001010" + } + ], + "module_costs": { + "third_variable_force": 27, + "third_variable_thunk": 23, + "thunk_return_adapter": 21, + "ordinary_second_parse": 37, + "thunk_second_parse": 50 + }, + "suffix_checks": [ + { + "name": "delayed_drop", + "program": "omega", + "exact_tail": true + }, + { + "name": "delayed_drop", + "program": "lambda_omega", + "exact_tail": true + }, + { + "name": "delayed_drop", + "program": "omega_omega", + "exact_tail": true + }, + { + "name": "third_operand_thunk", + "program": "omega", + "exact_tail": true + }, + { + "name": "third_operand_thunk", + "program": "lambda_omega", + "exact_tail": true + }, + { + "name": "third_operand_thunk", + "program": "omega_omega", + "exact_tail": true + }, + { + "name": "delayed_drop_thunk", + "program": "omega", + "exact_tail": true + }, + { + "name": "delayed_drop_thunk", + "program": "lambda_omega", + "exact_tail": true + }, + { + "name": "delayed_drop_thunk", + "program": "omega_omega", + "exact_tail": true + }, + { + "name": "thunk_input_output", + "program": "omega", + "exact_tail": true + }, + { + "name": "thunk_input_output", + "program": "lambda_omega", + "exact_tail": true + }, + { + "name": "thunk_input_output", + "program": "omega_omega", + "exact_tail": true + }, + { + "name": "delayed_drop_function_env", + "program": "omega", + "exact_tail": true + }, + { + "name": "delayed_drop_function_env", + "program": "lambda_omega", + "exact_tail": true + }, + { + "name": "delayed_drop_function_env", + "program": "omega_omega", + "exact_tail": true + }, + { + "name": "root_next_thunk", + "program": "omega", + "exact_tail": true + }, + { + "name": "root_next_thunk", + "program": "lambda_omega", + "exact_tail": true + }, + { + "name": "root_next_thunk", + "program": "omega_omega", + "exact_tail": true + } + ] +} diff --git a/data/self-interpreter/reasoning_floor/interface/identities.log b/data/self-interpreter/reasoning_floor/interface/identities.log new file mode 100644 index 00000000..0f2be9e6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/identities.log @@ -0,0 +1,28 @@ +raw variable / I-variable collision n=1 equal +raw variable / I-variable collision n=2 equal +raw variable / I-variable collision n=5 equal +same parent continuation, variable equal +same parent continuation, I-variable equal +trailing argument cannot disappear distinct +thunked tail is not the tail at rigid C distinct +arbitrary forcing operand equal +third-operand reader variable n=1 equal +delayed-drop thunk reader variable n=1 equal +third-operand reader variable n=2 equal +delayed-drop thunk reader variable n=2 equal +third-operand reader variable n=5 equal +delayed-drop thunk reader variable n=5 equal +third-operand reader abs equal +delayed-drop reader abs equal +delayed-drop thunk reader abs equal +root NEXT entry abs equal +third-operand reader app equal +delayed-drop reader app equal +delayed-drop thunk reader app equal +root NEXT entry app equal +function environment lookup zero equal +function environment lookup successor equal +force erases a carried mode equal +same parsed child does not determine the constructor distinct +module costs {'third_variable_force': 27, 'third_variable_thunk': 23, 'thunk_return_adapter': 21, 'ordinary_second_parse': 37, 'thunk_second_parse': 50} +26 identity/counterexample checks; 18 suffix checks; all passed diff --git a/data/self-interpreter/reasoning_floor/interface/identities.py b/data/self-interpreter/reasoning_floor/interface/identities.py new file mode 100644 index 00000000..9ec11c90 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/identities.py @@ -0,0 +1,106 @@ +"""Fixed beta identities, collision witnesses, and divergent-program suffix checks.""" +from pathlib import Path +import sys,re,json,time +ROOT=Path(__file__).resolve().parents[3] +LANE=Path(__file__).resolve().parent +sys.path.insert(0,str(ROOT/'tools/self-interpreter')) +import battery,lc + +def syntax(src): + return re.sub(r'\\([a-zA-Z0-9 ]+)\.',lambda m: ''.join('\\'+x for x in m[1].split())+'.',src) +def term(src): return battery.compile_lam(syntax(src)) +def normal(src): + out=battery.normalize(battery.enc(term(src)),1<<15) + assert out is not None,src + return out +K=r'(\a b.a)' +F=r'(\a b.b)' +I=r'(\a.a)' +def cons(b,r): return rf'(\h.h ({b}) ({r}))' +def unary(n): + r=cons(K,'N') + for _ in range(n): r=cons(F,r) + return r + +def av(v): return rf'(\e a.({v}) (\b r.b a (r e)))' + +checks=[] +def eq(name,a,b,want=True): + na,nb=normal(a),normal(b) + good=na==nb + assert good==want,(name,lc.show(lc.decode(na)[0]),lc.show(lc.decode(nb)[0])) + checks.append(dict(name=name,equal=good,left=syntax(a),right=syntax(b),left_nf=na,right_nf=nb)) + print(name,'equal' if good else 'distinct',flush=True) + +for n in (1,2,5): + r=unary(n-1) + lift=rf'(\e.((\u.{I}) e) (({r}) e))' + eq(f'raw variable / I-variable collision n={n}',rf'\N.{lift}',rf'\N.{r}') + +r=unary(0) +k=rf'(\v.C {av("v")})' +expected=rf'\C N.C (\z.{I}) N' +eq('same parent continuation, variable',rf'\C N.{k} ({r}) N',expected) +eq('same parent continuation, I-variable',rf'\C N.{k} (\e.((\u.{I}) e) (({r}) e)) N',expected) +eq('trailing argument cannot disappear',rf'\C N T.{k} ({r}) N T',rf'\C N T.C (\z.{I}) N',False) +eq('thunked tail is not the tail at rigid C',rf'\C N.C (\z.{I}) (\u.N)',rf'\C N.C (\z.{I}) N',False) +eq('arbitrary forcing operand',r'\N Q.(\u.N) Q',r'\N Q.N') + +third=r'\s.s (\b r.b r (\u.c r (r r))) j' +delayed=r'\s.s (\b.b (\r.r j) c) (s s s)' +delayed_thunk=r'\s.s (\b.b (\r.r j) c) (s s)' +for n in (1,2,5): + s=unary(n); r=unary(n-1) + eq(f'third-operand reader variable n={n}',rf'\c j N.({third}) ({s})',rf'\c j N.c ({r}) (\u.N)') + eq(f'delayed-drop thunk reader variable n={n}',rf'\c j N.({delayed_thunk}) ({s})',rf'\c j N.c ({r}) (\u.N)') +for label,b in [('abs',K),('app',F)]: + q=cons(b,'t'); s=cons(K,q) + eq('third-operand reader '+label,rf'\c j t.({third}) ({s})',rf'\c j t.j {b} t') + eq('delayed-drop reader '+label,rf'\c j t.({delayed}) ({s})',rf'\c j t.j {b} t ({q})') + eq('delayed-drop thunk reader '+label,rf'\c j t.({delayed_thunk}) ({s})',rf'\c j t.j {b} t (\u.({q}))') + eq('root NEXT entry '+label,rf'\j t.({s}) (\zero q.q j)',rf'\j t.j {b} t') + +cell=r'(\s.s (\b.b (\u.a) e))' +eq('function environment lookup zero',rf'\a e N.{cell} ({cons(K,"N")})',r'\a e N.a') +eq('function environment lookup successor',rf'\a e r.{cell} ({cons(F,"r")})',r'\a e r.e r') + +# A carried mode occurring only as the forcing operand is erased. +eq('force erases a carried mode',r'\R Q1 Q2.(\u.R) Q1',r'\R Q1 Q2.(\u.R) Q2') +# ABS lambda.I with suffix code(I)++N versus APP I I with suffix N. +# The first parsed closure and remaining stream agree in the two cases. +rest=cons(K,cons(K,cons(F,cons(K,'N')))) +eq('same parsed child does not determine the constructor', + rf'\C N.C (\z x.{I}) ({rest})',rf'\C N.C (\z.{I}) N',False) + +# Exact module comparisons in a stated, fixed capture layout. +def cost(src,frame): + import blcc + p=blcc.P(syntax(src)); t=blcc.p_lc(p);p.ws();assert p.i==len(p.t) + return lc.size(blcc.to_db(t,tuple(frame))) +costs={ + 'third_variable_force':cost(r'\u.c r (r r u)',('r','b','s','c','p','x')), + 'third_variable_thunk':cost(r'\u.c r (r r)',('r','b','s','c','p','x')), + 'thunk_return_adapter':cost(r'\v t.c v (t t)',('c',)), + 'ordinary_second_parse':cost(r'p (\g.c (\e.f e (g e)))',('f','d','s','c','p','x')), + 'thunk_second_parse':cost(r'\t.p (\g.c (\e.f e (g e))) (t t)',('f','d','s','c','p','x')), +} +assert costs['third_variable_force']-costs['third_variable_thunk']==4 +print('module costs',costs,flush=True) + +suffix=[] +for row in json.loads((LANE/'checks.json').read_text()): + bits=(LANE/(row['name']+'.best.blc')).read_text().strip() + E=lc.decode(bits)[0] + for label,src in [('omega',r'(\x.x x) (\x.x x)'), + ('lambda_omega',r'\z.(\x.x x) (\x.x x)'), + ('omega_omega',r'((\x.x x) (\x.x x)) ((\x.x x) (\x.x x))')]: + M=term(src) + tail=('V',0) + c=term(r'\v r.r') + probe=('L',('A',('A',battery.shift(E,1),c),battery.bitlist(battery.enc(M),tail))) + got=battery.normalize(battery.enc(probe),1<<16) + want=battery.enc(term(I)) + assert got==want,(row['name'],label,got) + suffix.append(dict(name=row['name'],program=label,exact_tail=True)) +print(f'{len(checks)} identity/counterexample checks; {len(suffix)} suffix checks; all passed') +(LANE/'identities.json').write_text(json.dumps(dict(checks=checks,module_costs=costs,suffix_checks=suffix),indent=2)+'\n') diff --git a/data/self-interpreter/reasoning_floor/interface/polish_final.log b/data/self-interpreter/reasoning_floor/interface/polish_final.log new file mode 100644 index 00000000..4f065240 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/polish_final.log @@ -0,0 +1,18 @@ +/Users/a9lim/Work/blam/tmp/overnight/interface/delayed_drop.lam: 183 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/interface/delayed_drop.lam + letopt --max-cuts 2: smallest 181 +181 bits ok=667 skip=1 fail=0 delayed_drop.best.lam +/Users/a9lim/Work/blam/tmp/overnight/interface/third_operand_thunk.lam: 209 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/interface/third_operand_thunk.lam + letopt --max-cuts 2: smallest 202 +202 bits ok=667 skip=1 fail=0 third_operand_thunk.best.lam +/Users/a9lim/Work/blam/tmp/overnight/interface/delayed_drop_thunk.lam: 220 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/interface/delayed_drop_thunk.lam + letopt --max-cuts 2: smallest 213 +213 bits ok=667 skip=1 fail=0 delayed_drop_thunk.best.lam +/Users/a9lim/Work/blam/tmp/overnight/interface/thunk_input_output.lam: 234 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/interface/thunk_input_output.lam + letopt --max-cuts 2: smallest 223 +223 bits ok=667 skip=1 fail=0 thunk_input_output.best.lam +/Users/a9lim/Work/blam/tmp/overnight/interface/delayed_drop_function_env.lam: 199 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/interface/delayed_drop_function_env.lam + letopt --max-cuts 2: smallest 197 +197 bits ok=667 skip=1 fail=0 delayed_drop_function_env.best.lam +/Users/a9lim/Work/blam/tmp/overnight/interface/root_next_thunk.lam: 240 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/interface/root_next_thunk.lam + letopt --max-cuts 2: smallest 240 +240 bits ok=667 skip=1 fail=0 root_next_thunk.best.lam diff --git a/data/self-interpreter/reasoning_floor/interface/polish_initial.log b/data/self-interpreter/reasoning_floor/interface/polish_initial.log new file mode 100644 index 00000000..2f0e41da --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/polish_initial.log @@ -0,0 +1,12 @@ +tmp/overnight/interface/delayed_drop.lam: 183 bits ok=667 skip=1 fail=0 tmp/overnight/interface/delayed_drop.lam + letopt --max-cuts 2: smallest 181 +tmp/overnight/interface/third_operand_thunk.lam: 211 bits ok=667 skip=1 fail=0 tmp/overnight/interface/third_operand_thunk.lam + letopt --max-cuts 2: smallest 204 +tmp/overnight/interface/delayed_drop_thunk.lam: 221 bits ok=667 skip=1 fail=0 tmp/overnight/interface/delayed_drop_thunk.lam + letopt --max-cuts 2: smallest 214 +tmp/overnight/interface/thunk_input_output.lam: 236 bits ok=667 skip=1 fail=0 tmp/overnight/interface/thunk_input_output.lam + letopt --max-cuts 2: smallest 230 +tmp/overnight/interface/delayed_drop_function_env.lam: 199 bits ok=667 skip=1 fail=0 tmp/overnight/interface/delayed_drop_function_env.lam + letopt --max-cuts 2: smallest 197 +tmp/overnight/interface/root_next_thunk.lam: 242 bits ok=667 skip=1 fail=0 tmp/overnight/interface/root_next_thunk.lam + letopt --max-cuts 2: smallest 242 diff --git a/data/self-interpreter/reasoning_floor/interface/root_next_thunk.best.blc b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.best.blc new file mode 100644 index 00000000..bd31aa64 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.best.blc @@ -0,0 +1 @@ +010000000110000001100111111000000101111111011001101001000110100001000100000001111000010111001111000000111100000010111011100110111100001011111100001111110000101111101001110100110100000010110000001011101000010111111011001110110011110110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/root_next_thunk.best.lam b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.best.lam new file mode 100644 index 00000000..a0a74d11 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.best.lam @@ -0,0 +1 @@ +((\v0. (\v1. (\v2. (v2 (\v3. (\v4. (v4 (v0 (\v5. (\v6. ((v1 v5) (v6 v6)))))))))))) ((\v0. (v0 v0)) (\v0. ((\v1. ((\v2. (\v3. (\v4. (v2 (\v5. ((v4 (v3 (\v6. (\v7. (v5 (\v8. (\v9. ((v8 v7) (v9 v6))))))))) (\v6. ((v2 (\v7. (v3 (\v8. ((v5 v8) (v7 v8)))))) (v6 v6))))))))) (\v2. (\v3. ((v3 (\v4. (\v5. ((v4 v5) (\v6. ((v2 v5) (v5 v5))))))) (v1 v2)))))) (v0 v0))))) diff --git a/data/self-interpreter/reasoning_floor/interface/root_next_thunk.blc b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.blc new file mode 100644 index 00000000..bd31aa64 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.blc @@ -0,0 +1 @@ +010000000110000001100111111000000101111111011001101001000110100001000100000001111000010111001111000000111100000010111011100110111100001011111100001111110000101111101001110100110100000010110000001011101000010111111011001110110011110110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/root_next_thunk.lam b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.lam new file mode 100644 index 00000000..3e2f0146 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.lam @@ -0,0 +1 @@ +(\n0. \c\s. s (\zero\q. q (n0 (\v\t. c v (t t))))) ((\x. x x) (\x. (\n. (\p. \c\d. p (\f. d (c (\e\a. f (\b\r. b a (r e)))) (\t. p (\g. c (\e. f e (g e))) (t t)))) (\k\s. s (\b\r. b r (\u. k r (r r))) (n k))) (x x))) diff --git a/data/self-interpreter/reasoning_floor/interface/root_next_thunk.letopt.log b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.letopt.log new file mode 100644 index 00000000..b585759c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.letopt.log @@ -0,0 +1,5 @@ +input 240 bits; core 460 bits (166 nodes); 1953 candidate cuts (53 shared) +k=1: 1953 valid, 0 invalid, 0.0s; smallest sizes 443:1 448:1 449:2 452:1 454:1 456:2 +k=2: 1752092 valid, 154036 invalid, 2.4s; smallest sizes 440:1 442:1 444:2 445:4 446:5 447:4 +smallest rendering over 0..=2 cuts: 240 bits +best 240 010000000110000001100111111000000101111111011001101001000110100001000100000001111000010111001111000000111100000010111011100110111100001011111100001111110000101111101001110100110100000010110000001011101000010111111011001110110011110110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/root_next_thunk.polish.log b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.polish.log new file mode 100644 index 00000000..7af9ebee --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.polish.log @@ -0,0 +1,3 @@ +/Users/a9lim/Work/blam/tmp/overnight/interface/root_next_thunk.lam: 240 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/interface/root_next_thunk.lam + letopt --max-cuts 2: smallest 240 +elapsed_seconds=4.318 diff --git a/data/self-interpreter/reasoning_floor/interface/root_next_thunk.render.log b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.render.log new file mode 100644 index 00000000..b585759c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/root_next_thunk.render.log @@ -0,0 +1,5 @@ +input 240 bits; core 460 bits (166 nodes); 1953 candidate cuts (53 shared) +k=1: 1953 valid, 0 invalid, 0.0s; smallest sizes 443:1 448:1 449:2 452:1 454:1 456:2 +k=2: 1752092 valid, 154036 invalid, 2.4s; smallest sizes 440:1 442:1 444:2 445:4 446:5 447:4 +smallest rendering over 0..=2 cuts: 240 bits +best 240 010000000110000001100111111000000101111111011001101001000110100001000100000001111000010111001111000000111100000010111011100110111100001011111100001111110000101111101001110100110100000010110000001011101000010111111011001110110011110110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/run_checks.py b/data/self-interpreter/reasoning_floor/interface/run_checks.py new file mode 100644 index 00000000..f3b1f9af --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/run_checks.py @@ -0,0 +1,51 @@ +"""Run the requested unmodified polish.py; archive exact sizes and checks.""" +from pathlib import Path +import os, subprocess, sys, time, json, re +ROOT=Path(__file__).resolve().parents[3] +LANE=Path(__file__).resolve().parent +sys.path.insert(0,str(ROOT/'tools/self-interpreter')) +import battery, lc + +def named(t, names=()): + if t[0]=='V': return names[t[1]] + if t[0]=='L': + v='v'+str(len(names)) + return '(\\'+v+'. '+named(t[1],(v,)+names)+')' + return '('+named(t[1],names)+' '+named(t[2],names)+')' + +names=['delayed_drop','third_operand_thunk','delayed_drop_thunk', + 'thunk_input_output','delayed_drop_function_env','root_next_thunk'] +records=[] +for name in names: + env=dict(os.environ, INTERFACE_CAPTURE=name, PYTHONDONTWRITEBYTECODE='1', + PYTHONPATH=str(LANE), TMPDIR=str(LANE), RAYON_NUM_THREADS='2') + start=time.monotonic() + run=subprocess.run([sys.executable,str(ROOT/'tools/self-interpreter/polish.py'), + str(LANE/(name+'.lam'))],env=env,cwd=ROOT, + capture_output=True,text=True,timeout=110) + elapsed=time.monotonic()-start + log=run.stdout+run.stderr + (LANE/(name+'.polish.log')).write_text(log+f'elapsed_seconds={elapsed:.3f}\n') + print(log, end='',flush=True) + assert run.returncode==0 and 'fail=0' in log + minimum=int(re.search(r'smallest (\d+)',log)[1]) + rendering=subprocess.run([str(ROOT/'target/release/blam'),'golf','letopt', + '--bits',(LANE/(name+'.blc')).read_text().strip(), + '--max-cuts','2','--report-le',str(minimum),'--threads','2'], + cwd=ROOT,capture_output=True,text=True,timeout=30) + (LANE/(name+'.render.log')).write_text(rendering.stdout+rendering.stderr) + match=re.search(r'best (\d+) ([01]+)',rendering.stdout) + assert match and int(match[1])==minimum + bits=match[2] + best=LANE/(name+'.best.blc') + best.write_text(bits+'\n') + term,end=lc.decode(bits) + assert end==len(bits) + (LANE/(name+'.best.lam')).write_text(named(term)+'\n') + ok,skip,bad=battery.check(term,threads=2) + line=f'{len(bits)} bits ok={ok} skip={skip} fail={len(bad)} {name}.best.lam' + print(line,flush=True) + assert not bad + records.append(dict(name=name,source_bits=len((LANE/(name+'.blc')).read_text().strip()), + best_bits=len(bits),best_battery=line,seconds=elapsed)) +(LANE/'checks.json').write_text(json.dumps(records,indent=2)+'\n') diff --git a/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.best.blc b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.best.blc new file mode 100644 index 00000000..4785ad4a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.best.blc @@ -0,0 +1 @@ +0001010001101000010000000101100000010111010000101111110110011101100001111100001011100111110000001111000000101110111001101111000010111111100001111111000010111110100111010011010011010000001011110110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.best.lam b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.best.lam new file mode 100644 index 00000000..105f0ec5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.best.lam @@ -0,0 +1 @@ +(\v0. (((\v1. (v1 v1)) (\v1. ((\v2. (\v3. (\v4. ((v4 (\v5. (\v6. ((v5 v6) (\v7. ((v3 v6) (v6 v6))))))) (\v5. (v2 (\v6. ((v5 (v3 (\v7. (\v8. (v6 (\v9. (\v10. ((v9 v8) (v10 v7))))))))) (\v7. ((v2 (\v8. (v3 (\v9. ((v6 v9) (v8 v9)))))) (v7 v7))))))))))) (v1 v1)))) (\v1. (\v2. ((v0 v1) (v2 v2)))))) diff --git a/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.blc b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.blc new file mode 100644 index 00000000..b3ce0d2d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.blc @@ -0,0 +1 @@ +01000001110000001011110110011010010001101000010000000101100000010111010000101111110110011101100001111100001011100111110000001111000000101110111001101111000010111111100001111111000010111110100111010011010011010 diff --git a/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.lam b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.lam new file mode 100644 index 00000000..a864a6af --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.lam @@ -0,0 +1 @@ +(\p0. \c. p0 (\v\t. c v (t t))) ((\x. x x) (\x. (\p. \c\s. s (\b\r. b r (\u. c r (r r))) (\d. p (\f. d (c (\e\a. f (\b\r. b a (r e)))) (\t. p (\g. c (\e. f e (g e))) (t t))))) (x x))) diff --git a/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.letopt.log b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.letopt.log new file mode 100644 index 00000000..a2380649 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.letopt.log @@ -0,0 +1,5 @@ +input 209 bits; core 208 bits (80 nodes); 501 candidate cuts (9 shared) +k=1: 501 valid, 0 invalid, 0.0s; smallest sizes 202:1 204:1 205:2 206:1 210:1 211:3 +k=2: 110126 valid, 15124 invalid, 0.1s; smallest sizes 205:1 206:2 207:3 208:11 209:27 210:28 +smallest rendering over 0..=2 cuts: 202 bits +best 208 0001010001101000000001011000000101110100001011111101100111011000010111110111100001011100111110000001111000000101110111001101111000010101111111011111100001111111000010111110100111010011010000001011110110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.polish.log b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.polish.log new file mode 100644 index 00000000..2d6f3c43 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.polish.log @@ -0,0 +1,3 @@ +/Users/a9lim/Work/blam/tmp/overnight/interface/third_operand_thunk.lam: 209 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/interface/third_operand_thunk.lam + letopt --max-cuts 2: smallest 202 +elapsed_seconds=1.985 diff --git a/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.render.log b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.render.log new file mode 100644 index 00000000..609eefe3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/third_operand_thunk.render.log @@ -0,0 +1,8 @@ +input 209 bits; core 208 bits (80 nodes); 501 candidate cuts (9 shared) +k=1: 501 valid, 0 invalid, 0.0s; smallest sizes 202:1 204:1 205:2 206:1 210:1 211:3 + 202 [[22, 42]->66] + \a. (\b. b b) (\b. (\c d e. e (\f g. f g (\h. d g (g g))) (\f. c (\g. f (d (\h i. g (\j k. j i (k h)))) (\h. c (\i. d (\j. g j (i j))) (h h))))) (b b)) (\b c. a b (c c)) + 0001010001101000010000000101100000010111010000101111110110011101100001111100001011100111110000001111000000101110111001101111000010111111100001111111000010111110100111010011010011010000001011110110011010 +k=2: 110126 valid, 15124 invalid, 0.1s; smallest sizes 205:1 206:2 207:3 208:11 209:27 210:28 +smallest rendering over 0..=2 cuts: 202 bits +best 202 0001010001101000010000000101100000010111010000101111110110011101100001111100001011100111110000001111000000101110111001101111000010111111100001111111000010111110100111010011010011010000001011110110011010 diff --git a/data/self-interpreter/reasoning_floor/interface/thunk_input_output.best.blc b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.best.blc new file mode 100644 index 00000000..27329fad --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.best.blc @@ -0,0 +1 @@ +0000010101000110100001000001000001010110100001011000000111011111011110010110100110100000010111110000101111001111100000011110000001011101110011011110011111100001111110000101111010011101000110011010000001011111011001101000110 diff --git a/data/self-interpreter/reasoning_floor/interface/thunk_input_output.best.lam b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.best.lam new file mode 100644 index 00000000..e6bc99d6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.best.lam @@ -0,0 +1 @@ +(\v0. (\v1. ((((\v2. (v2 v2)) (\v2. ((\v3. (\v4. ((\v5. (\v6. (((v6 v6) (\v7. ((v7 (\v8. (\v9. (v8 v5)))) v4))) ((v6 v6) (v6 v6))))) (\v5. (\v6. ((v3 (\v7. ((v5 (v4 (\v8. (\v9. (v7 (\v10. (\v11. ((v10 v9) (v11 v8))))))))) (v3 (\v8. (v4 (\v9. ((v7 v9) (v8 v9))))))))) (\v7. v6))))))) (v2 v2)))) (\v2. (\v3. ((v0 v2) (v3 v3))))) (\v2. v1)))) diff --git a/data/self-interpreter/reasoning_floor/interface/thunk_input_output.blc b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.blc new file mode 100644 index 00000000..fa8e58b6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.blc @@ -0,0 +1 @@ +010000000101111000000101111101100110100011001000110100001000000010100000101100001011000000111011111011111001101000000101111110000101111001111110000001111000000101110111001101111001111111000011111110000101111010011101000110011010011010 diff --git a/data/self-interpreter/reasoning_floor/interface/thunk_input_output.lam b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.lam new file mode 100644 index 00000000..435b53b0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.lam @@ -0,0 +1 @@ +(\p0. \c\s. p0 (\v\t. c v (t t)) (\u. s)) ((\x. x x) (\x. (\p. \c\t. ((\j. \s. s (\b. b (\r\u. r j) c) (s s)) (\d\r. p (\f. d (c (\e\a. f (\b\r. b a (r e)))) (p (\g. c (\e. f e (g e))))) (\u. r))) (t t)) (x x))) diff --git a/data/self-interpreter/reasoning_floor/interface/thunk_input_output.letopt.log b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.letopt.log new file mode 100644 index 00000000..ccb4882f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.letopt.log @@ -0,0 +1,5 @@ +input 234 bits; core 241 bits (87 nodes); 859 candidate cuts (57 shared) +k=1: 859 valid, 0 invalid, 0.0s; smallest sizes 228:2 230:3 231:7 232:2 233:2 235:3 +k=2: 304542 valid, 63969 invalid, 0.3s; smallest sizes 223:1 225:1 226:4 227:2 228:5 229:6 +smallest rendering over 0..=2 cuts: 223 bits +best 234 010000000101111000000101111101100110100011001000110100001000000010100000101100001011000000111011111011111001101000000101111110000101111001111110000001111000000101110111001101111001111111000011111110000101111010011101000110011010011010 diff --git a/data/self-interpreter/reasoning_floor/interface/thunk_input_output.polish.log b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.polish.log new file mode 100644 index 00000000..699c10a1 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.polish.log @@ -0,0 +1,3 @@ +/Users/a9lim/Work/blam/tmp/overnight/interface/thunk_input_output.lam: 234 bits ok=667 skip=1 fail=0 /Users/a9lim/Work/blam/tmp/overnight/interface/thunk_input_output.lam + letopt --max-cuts 2: smallest 223 +elapsed_seconds=2.187 diff --git a/data/self-interpreter/reasoning_floor/interface/thunk_input_output.render.log b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.render.log new file mode 100644 index 00000000..06e6806a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/interface/thunk_input_output.render.log @@ -0,0 +1,8 @@ +input 234 bits; core 241 bits (87 nodes); 859 candidate cuts (57 shared) +k=1: 859 valid, 0 invalid, 0.0s; smallest sizes 228:2 230:3 231:7 232:2 233:2 235:3 +k=2: 304542 valid, 63969 invalid, 0.3s; smallest sizes 223:1 225:1 226:4 227:2 228:5 229:6 + 223 [[51]->68 [11, 31]->69] + \a b. (\c. c c) (\c. (\d e. (\f g. g g (\h. h (\i j. i f) e) (g g (g g))) (\f g. d (\h. f (e (\i j. h (\k l. k j (l i)))) (d (\i. e (\j. h j (i j))))) (\h. g))) (c c)) (\c d. a c (d d)) (\c. b) + 0000010101000110100001000001000001010110100001011000000111011111011110010110100110100000010111110000101111001111100000011110000001011101110011011110011111100001111110000101111010011101000110011010000001011111011001101000110 +smallest rendering over 0..=2 cuts: 223 bits +best 223 0000010101000110100001000001000001010110100001011000000111011111011110010110100110100000010111110000101111001111100000011110000001011101110011011110011111100001111110000101111010011101000110011010000001011111011001101000110 diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/PROMPT.md b/data/self-interpreter/reasoning_floor/next-proof-codex/PROMPT.md new file mode 100644 index 00000000..3a30b4db --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/PROMPT.md @@ -0,0 +1,44 @@ +Lane "next-proof-codex": is the 165's NEXT region optimal? Read +/Users/a9lim/Work/blam/tmp/overnight/BRIEF.md (contract, the 165), then +docs/classical/self-interpreter/interpreter.md §2, §4 (module grammar), §5, +and these reports: + tmp/overnight/reader-proof/REPORT.md — a handwritten proof, by residual + tracing, that with the 165's knot and NEXT fixed every reader body costs + ≥ 43 (two reviews found it essentially right; gaps repaired). Its METHOD + is the model for this lane: a structure theorem from the laws, a + head-path decomposition, a role inventory priced at cheapest + realizations, and a minimization over a few shapes. + tmp/overnight/env/REPORT.md §3, §5 — cell ≥ 24 / lift ≥ 19 under weak laws. + tmp/overnight/nextfuse/REPORT.md — a catalogue of NEXT variants and a + decomposition heuristic for 92 (NOT a theorem: an independent review in + tmp/overnight/verify/vdispatch_codex.md §5–§6 refuted its shared-argument + lemma with a pair-packing construction and explained what a real proof + must specify). + +THE QUESTION. Fix the 165's knot and reader: + + E_N = (\x. x x) (\x. (\intL. \cont. (\next. \list. + list (\bit0. bit0 (\u \r. r next) cont) (list list list)) N) (x x)) + +where N is any term over the frame [cont, intL, x] (de Bruijn depths as in the +165). The 165 is N = \bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. +zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args))))), 92 bits. +Prove: if E_N is a self-interpreter (the exact contract) then |N| ≥ 92 — or +find a cheaper N (that IS a sub-165: build it, run +`python3 tools/self-interpreter/polish.py FILE.lam` from the repo root, and +report immediately in your final message). + +Note what is fixed and what is not: the reader hands N the second tag bit and +the stream after it (`r next = next b2 r2`), the variable value is the raw +unary code r with cont receiving (r, N); NEXT is free to choose how λ-values, +environments and APP values work, but the raw-code variable values force the +environment to answer `r env` as lookup, and the root forces λz.M values. +First derive the laws N must satisfy from the contract (on actual streams, +with actual intL = E_N behaviour, which N may exploit — do not assume intL +rigid unless you prove it can be). Then price. A complete theorem is the goal; +a precisely delimited conditional theorem plus an exact list of residual +cases is the fallback. Rigour first; mark handwritten vs checked. Small fixed +checks only (seconds), no enumeration of N, ≤ 2 threads. Write files only in +your lane directory (given in the prompt that sent you); REPORT.md there. + +Your lane directory: /Users/a9lim/Work/blam/tmp/overnight/next-proof-codex/ diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/REPORT.md b/data/self-interpreter/reasoning_floor/next-proof-codex/REPORT.md new file mode 100644 index 00000000..6bbdf321 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/REPORT.md @@ -0,0 +1,591 @@ +# NEXT proof lane: a conditional 92-bit theorem, with the actual-contract gap exposed + +**No sub-165 interpreter found. The requested unrestricted 92-bit theorem is not proved.** + +There is a complete handwritten 92-bit theorem for a precisely specified +normal-source control fragment, without opaque ABS/APP module boundaries. +It allows arbitrarily many repeated tag tests and explicit tail binding. +Its proof reduces every member to one of nine forms; their costs are +92, 93, 99, 103, 104, 107, 108, 115, and 116. A separate handwritten lemma +closes the two normal-source, single-shared-argument cases with one bare +branch head, at 96 and 97 bits. Neither result assumes that the old +shared-argument catalogue was exhaustive. + +For the unrestricted question, the main new results are: + +* exact necessary-and-sufficient **actual-parser root laws**; +* a four-way head-normal-form classification after substituting the actual + knot values, rather than declaring `intL` rigid; +* a passing 184-bit witness showing that the rigid-parser branch laws do + **not** follow from the actual contract, even with the fixed knot and + reader and unchanged semantic values; +* an embedding of any closed self-interpreter Q into this NEXT problem + with `|N_Q| = |Q| + 44`. Thus the unrestricted 92-bit theorem would also + establish an unconditional **48-bit interpreter floor**. + +All proofs below are handwritten. The fixed equalities, inequalities, +sizes, and four finite batteries are checked. No new Lean theorem is claimed. + +## 1. Notation and the laws actually forced + +Write `c,p,x` for the ambient frame `[cont,intL,x]`, nearest first. +Let `G_N` be the right-hand knot operand in the question, and put + +``` +P = G_N G_N, +J_c = N[c/cont, P/intL, G_N/x], +H(j,c) = lambda b. b (lambda u r. r j) c, +R(j,c,s) = s H(j,c) (s s s). +``` + +The displayed `E_N` reduces to `P`. The fixed lets and reader give the +following finite reductions, independently of the contents of N: + +``` +P c s ->* R(J_c,c,s), +G_N q c s ->* R(N[c/cont, q q/intL, q/x],c,s). +``` + +The second equation matters: using `x` at another argument invokes a copy +of N with **both** its recursive parameters changed. It is not an opaque +extra constant. + +Let `U_n(T)` be the Scott stream `1^n 0 ++ T`, for n >= 0. Directly from +the reader: + +``` +P c U_n(T) ->* c U_(n-1)(T) T (n >= 1), +P c (cons K (cons b t)) ->* J_c b t. (1) +``` + +In the second equation b and t can be arbitrary terms. In the first, +`U_n(T) U_n(T) ->* K T`; the remaining application in the skip returns T. +The first-bit F selects c and the stream supplies `U_(n-1)(T)` itself. +For the second equation the whole-stream skip returns `cons b t`; the +zero arm discards the duplicate and applies that cell to `J_c`. + +Write `code(M,T)` for the quotation of a possibly open source M with +suffix T, and `kappa(M) = lambda z.M` with z fresh. Then the requested +closed-source contract is equivalent to exactly these two families: + +``` +J_c K code(B,T) + =beta c (kappa(lambda B)) T whenever lambda B is closed; + +J_c F code(L,code(R,T)) + =beta c (kappa(L R)) T whenever L and R are closed. (2) +``` + +Here `J_c` contains the **actual** P and G_N. Necessity follows from (1) +at the two constructors. Sufficiency follows because a closed source has +an abstraction or an application at its root; it cannot have a variable +root. This also covers divergent source terms: only finite beta +conversions and the syntax of the root were used. + +The initially rigid c,T can subsequently be replaced by arbitrary terms +by capture-avoiding substitution. In particular the contract legitimately +gives + +``` +P k code(A,T) =beta k (kappa(A)) T +``` + +for every **closed** A and arbitrary k,T. It does not give this statement +for open A. In the ABS law in (2), B may be open with its one outer +variable bound by the displayed abstraction; that is the exact quantifier. + +### What the raw variable return does, and does not, force + +If a continuation uses the returned raw value as `U_(n-1)(T) e`, then +Scott application forces the lookup equation + +``` +(cons b r) e -> e b r. +``` + +This fact is unconditional. Existence of a uniform family of environment +cells for **every** candidate N is not. N can bypass the fixed parser for +its recursive work entirely; section 3 gives a finite explicit construction +that does this. Likewise, (2) does not assert a context-independent parsed +value for every open compound source. Such a value interface has to be +proved or assumed before the cell/lift bounds can be summed. + +At least one source occurrence of `cont` in N **is** forced. If N omitted +it, J_c would contain no free c: P and G_N are closed. After the constructor +handoff (1), reduction could not create the free c required by, for example, +the contract on I. + +The two tag cases must also genuinely differ. Use the same stream +`t = code(I,code(I,T))` in both cases of (2). The ABS instance must return +suffix `code(I,T)`, whereas the APP instance must return T. These cannot +be beta-equal for fresh rigid T. + +### An actual-neighbour head structure theorem + +For fresh rigid c, a correct `J_c` has one of these head normal forms: + +``` +lambda b. b A1 ... Ak k >= 2; +lambda b s. c A B; +lambda b s. b A1 ... Ak k >= 2; +lambda b s. s A1 ... Ak k >= 1. (3) +``` + +The arguments may contain arbitrary reductions and recursive helpers. +This is a statement about the actual instantiated head normal form, not +about disjoint pieces of the finite source N. + +Proof. A normal contract instance, such as I, makes `J_c K t` +head-normalizable. Head normalization reflects to the function, so J_c +has a head normal form. Its only possible free variable is c. More than +two leading lambdas would leave an outer lambda after the two arguments, +which cannot join a c-headed result. With no leading lambda its head must +be c; rigid arity forces `J_c = c`, which returns the tag and unparsed +stream. With one leading lambda, a c head makes the unparsed stream the +last output argument, also impossible. Its head is therefore the bound +tag. With zero internal arguments an abstraction remains; with one, the +F case returns the raw stream. Thus it has at least two. With two leading +lambdas, a c head has exactly two arguments by rigid arity, a tag head +needs at least two to consume the Boolean, and a stream head needs at +least one to eliminate the Scott cell. These exhaust the free and bound +heads. QED. + +For the actual 165, substituting its P,G and exposing only the head gives +the **fourth** shape, with two leading lambdas and stream-head arity two. +The fixed Python head trace checks this. It is therefore especially +important not to confuse the source's rigid-p presentation with its actual +head decomposition. + +## 2. The real parser is a usable combinator + +For every N, the fixed reader gives + +``` +P c K =beta H(J_c,c), +P c F =beta F, +P c I =beta lambda r.r J_c, +P c (lambda u v.X) ->* X. (4) +``` + +The first three are the previously recorded off-stream identities, now +noted to be independent of NEXT. For the last, let `s=lambda u v.X`, with +u,v fresh for X. Then `s s s ->* X`, while `s H X ->* X`. The handler, +continuation, and NEXT are erased without being evaluated. This is the +recorded constant-stream identity `R(K(K X)) = X` in the useful two-lambda +form; it is not a new reader identity. + +Put + +``` +A(f) = lambda e a.f (lambda u r.u a (r e)), +V(f,g) = lambda e.f e (g e), +B(f) = lambda g.c V(f,g). +``` + +Consider this replacement, in the exact original frame: + +``` +N_ret = lambda b.p (lambda f. + b (p f (lambda u v.c A(f))) + (p B(f))). (5) +``` + +It costs **111 bits**, so its complete interpreter costs **184**. By (4), +the ABS return `P f (lambda u v.c A(f))` reduces to `c A(f)` for the +actual changed parser P itself. The APP branch is unchanged. Consequently +the parser has the same three syntax-recursion equations as the 165: +raw variable return, A for abstraction, and V for application. Induction +on source syntax gives the same parsed closures and suffixes; the usual +environment induction gives the exact closed-source contract, including +divergent programs. This is a handwritten correctness transfer, not an +assumption that two fixed points are beta-equal. + +But with p rigid, + +``` +N_ret K t + =beta p (lambda f.p f (lambda u v.c A(f))) t +``` + +is a different normal form from `p (lambda f.c A(f)) t`. Both the actual +constant-stream identity and the rigid-p inequality are checked. Thus +the rigid branch law used in section 4 is a **real additional hypothesis**, +not a consequence of (2). The witness is beta-normal as an open N and +uses the tag only once with exactly two arms; this isolates the rigidity +gap from the other restrictions in that theorem. + +## 3. An arbitrary interpreter embeds into NEXT + +For any closed self-interpreter Q satisfying the exact contract, define + +``` +N_Q = lambda b t. + Q c (lambda h.h K (lambda j.j b t)). (6) +``` + +This uses neither p nor x. For every closed source, the fixed reader +consumes its initial zero and second tag; (6) rebuilds precisely those +two cells and calls Q on the original stream. Equation (1) therefore +proves E_(N_Q) correct directly from Q's contract. No assumption about +Q's behaviour on open programs or environments is necessary. + +The source cost is exactly + +``` +|N_Q| = |Q| + 44, +44 = 4 outer lambda b,t + + 4 the two applications to Q + + 4 c at depth two + + 32 the two-cell stream, including literal K. +``` + +The inner cell costs `2+4+2+5+4=17`; the outer one costs +`2+4+2+7+17=32`. Q is closed, so placing it under the new binders does not +change its cost. The fixed surrounding interpreter costs another 73 bits. + +It follows, without any unproved lower bound, that + +``` +[ every correct N in the question has at least 92 bits ] + implies +[ every closed self-interpreter Q has at least 48 bits ]. (7) +``` + +This implication is a useful measure of the unrestricted question's +scope. A proof that assumes every N uses p for the two child parses has +silently excluded even (6). The concrete Q=165 instance is **282 bits** +overall, with a 209-bit NEXT, and passes the battery. + +## 4. A complete conditional 92-bit theorem + +This theorem prices a whole NEXT region, including dispatch placement; +it does not assume an opaque-module grammar. Its semantic and syntactic +restrictions are explicit. + +Keep c,p,x **independent rigid** in frame `[c,p,x]`, and use the literal +normal A,V above. Define the following normal terms, at their displayed +scopes: + +``` +K0 = lambda f.c A(f), +K1 = lambda f.p B(f), +T0 = p K0, +T1 = p K1, +eta(T) = lambda r.T r. r fresh for T +``` + +Assume: + +**R. Rigid canonical branch laws.** For a fresh rigid t, + +``` +N K t =beta T0 t, +N F t =beta T1 t. (8) +``` + +**B. Source normality.** N is beta-normal as an open term in `[c,p,x]`. + +**D. Two-arm selector use.** Every occurrence of the binder receiving the +first argument is the head of a maximal application spine with **exactly +two arguments inside N**. In other words, every tag use is `b U V`; it +is not a bare data occurrence, a partial application, or `b U V W ...`. +The number of occurrences of b is unrestricted. The rest of the source +syntax is unrestricted subject to B and D. + +R is sufficient for the fixed reader to implement the usual syntax +recursion after substituting its actual P,G; structural induction then +gives the interpreter contract. Section 2 shows that R is not necessary. + +**Theorem.** Under R, B, D, `|N| >= 92`. Equality holds only for + +``` +lambda b.p (lambda f.b (c A(f)) (p B(f))) (9) +``` + +up to alpha conversion. + +### 4.1 Normalization is pruning in this fragment + +First N has a leading lambda. If a beta-normal N had none, it would be +headed by one of c,p,x. The two supplied arguments cannot change that +rigid head; the only arity-compatible possibility would be N=p, which +has the wrong first argument K on the first test. Write `N=lambda b.T`. + +Replacing b by K or F now only selects the first or second child of each +two-arm tag use. It creates no other internal beta redex. To see this, +the result of `b U V` could create a redex with a surrounding application +only if that surrounding application gave the tag a third argument, +which D forbids. All pre-existing source redexes are forbidden by B. +Thus the two pruned terms `T_K,T_F` are beta-normal. + +For a normal term W and fresh rigid t, the equation `W t =beta Ti t` +forces exactly one of + +``` +W = Ti, W = eta(Ti). (10) +``` + +Indeed, if W has no leading lambda, rigid spine comparison forces W=Ti. +If it has a leading lambda, substituting the fresh variable t into its +normal body is only renaming, so the body is literally `Ti t`. More than +one leading lambda would leave an outer lambda after applying t. This is +a beta argument: it does not identify Ti with eta(Ti). + +There are consequently four pairs `(T_K,T_F)`, according to the two +independent choices in (10). + +### 4.2 Repeated tests cannot produce an additional minimum shape + +Inside a selected K arm, specialize every remaining tag test to K; inside +a selected F arm specialize every remaining one to F. This is valid for +both complete executions, since the arm is reached only in its matching +case. Every such specialization deletes the dispatch leaf, its two +applications, and one branch. It introduces no node, changes no enclosing +binder of the surviving branch, and strictly decreases the BLC size. + +Likewise, a subtree with identical pruned results on K and F can be +replaced by either of its fully specialized versions. That preserves both +results and cannot increase cost. This operation also removes x and any +other material present only in unreachable subtrees. + +To classify the remaining tree, use normal head spines rather than raw +binary-application nodes. A non-tag head and its arity cannot change +under pruning. The heads of `c A(f)` and `p B(f)` differ. Therefore the +tag choice must occur before that differing head; it cannot be split +between a separately selected head and a separately selected payload, +since `(b c p) W` violates D. The common head path of T0,T1 is exactly +`p`, its single argument, and the lambda f at the start of that argument. +For the two eta expansions it is the extra lambda r, then p with its two +arguments, of which the last is the same rigid r and the first is K0/K1. +This proves the following exhaustive list after strictly decreasing +pruning. It does not postulate disjoint ABS/APP modules. + +### 4.3 The nine forms and their original-source prices + +All variables in each row are hygienically scoped as displayed; A and B +are expanded literally before measuring. The left two digits say whether +the K and F branches in (10) have the final eta expansion. + +| choices | form | L | A | X | bits | +|---|---|---:|---:|---:|---:| +| 00 | `lambda b.b T0 T1` | 9 | 14 | 23 | 99 | +| 00 | `lambda b.p (b K0 K1)` | 9 | 13 | 21 | 93 | +| 00 | `lambda b.p (lambda f.b (c A) (p B))` | 8 | 13 | 22 | **92** | +| 01 | `lambda b.b T0 (eta(T1))` | 10 | 15 | 26 | 108 | +| 10 | `lambda b.b (eta(T0)) T1` | 10 | 15 | 25 | 107 | +| 11 | `lambda b.b (eta(T0)) (eta(T1))` | 11 | 16 | 28 | 116 | +| 11 | `lambda b r.b (T0 r) (T1 r)` | 10 | 16 | 29 | 115 | +| 11 | `lambda b r.p (b K0 K1) r` | 10 | 14 | 26 | 104 | +| 11 | `lambda b r.p (lambda f.b (c A) (p B)) r` | 9 | 14 | 27 | 103 | + +Each price is `2L+4A+2+X` in the original frame `[c,p,x]`. All nine exact +terms and both laws per term are checked. Pruning was strictly decreasing +whenever it changed the source, and only one row has cost 92. This proves +the bound and uniqueness. QED. + +Repeated tests satisfying D are covered by this proof. In particular, +“there might be more than one dispatch” is not a remaining case within +this fragment. Using the tag as data or applying an argument after its +two arms is a remaining case. + +## 5. A repaired bare-head shared-argument lemma + +The earlier nextfuse proof inferred too much from the distinctness of A +and B. The following narrower statement has a residual/head argument. +It handles two families that D excludes. + +Work after the first parse, with f,c,p,x independent rigid. Suppose the +single shared argument and the two adapters are beta-normal and do not +contain the tag. Require + +``` +K X Y Z =beta c A(f), +F X Y Z =beta p B(f). (11) +``` + +Then: + +* If X=c, necessarily `Z=A(f)` and `Y=lambda z.p B(f)`, with z unused. +* If Y=p, necessarily `Z=B(f)` and `X=lambda z.c A(f)`, with z unused. + +Proof of the first case. Rigid c and normality force Z literally A(f). +If normal Y has no leading lambda, it cannot consume A and have the +required p-headed spine: the only arity-compatible possibility Y=p +would give p A, not p B. Write `Y=lambda z.D`, with D normal. + +Consider the first occurrence of z demanded in normal-order normalization +of `D[A/z]`. Before that demand there is no computation: D was normal. +Its enclosing path consists of surviving lambdas and rigid-headed +argument positions. Thus the result of A at that position must match a +subterm of the prescribed normal output `p B(f)`. + +For arbitrary arguments U,V,W_i, the possible head structures of A are: + +``` +A = lambda e a.f (Cell(a,e)); +A U -> lambda a.f (Cell(a,U)); +A U V W1 ... Wk -> f (Cell(V,U)) W1 ... Wk, +Cell(v,u) = lambda d r.d v (r u). +``` + +None can occupy any position of `p B(f)`: that target has no two-leading- +lambda subterm; its one-lambda f-headed subterm is the lift, whose f has +two arguments rather than one; and each f-headed application has the +bound environment variable, not a two-lambda cell, as its first argument. +Other subterms have different heads. These observations do not depend on +the chosen U,V,W_i. Therefore no such first demand exists. Normal D +cannot contain z, and literal normal-form equality forces `D=p B(f)`. + +For the second case, normality and rigid p force Z=B(f). Use the same +first-demand argument for a normal adapter applied to B. With no supplied +argument B has one leading lambda and a free c beneath it, which occurs +nowhere in A. With one argument U it gives + +``` +c (lambda e.f e (U e)). +``` + +The only possible matching free-c-headed position in `c A(f)` is its +root, but the displayed payload has one leading lambda followed by +rigid head f, whereas A has two leading lambdas. With more arguments its +c-spine arity is too large. Thus B also cannot be demanded at a surviving +normal-form position. The adapter is exactly `lambda z.c A(f)`. QED. + +Reinsert the first parse and tag binder. The two forced sources are + +``` +lambda b.p (lambda f.b c (lambda z.p B(f)) A(f)) 97 bits; +lambda b.p (lambda f.b (lambda z.c A(f)) p B(f)) 96 bits. +``` + +Their full interpreter sizes are 170 and 169, agreeing with the old +measurements; both branch laws and prices were independently rechecked +here. A bare branch head cannot take two or more common arguments, since +the rigid c or p would then have too many arguments. This lemma does not +cover non-normal adapters, tag-dependent shared payloads, or the case in +which neither branch head is bare. + +### The pair-packing case is real + +The review's construction is legal: + +``` +Z = lambda h.h A(f) B(f), +X = lambda z.c (z K), +Y = lambda z.p (z F), +N_pair = lambda b.p (lambda f.b X Y Z). +``` + +Both adapters use their shared argument and neither repeats the tag. +Its rigid branch equations are direct beta reductions. Expanded in the +actual frame, N_pair costs **132 bits** and its complete interpreter +costs **205**. The battery passes. This prices that explicit construction +only; it is not a bound on arbitrary packing or common-payload schemes. + +## 6. Complete interpreter ledger and verification + +Every complete interpreter built in this lane is listed here. The +reference is a freshly parsed copy of the existing term; exact AST equality +was checked before testing. + +| file | NEXT | full bits | exact battery line | purpose | +|---|---:|---:|---|---| +| `reference165.lam` | 92 | 165 | `165 bits ok=667 skip=1 fail=0 reference165.lam` | unchanged attaining reference | +| `pair_packet.lam` | 132 | 205 | `205 bits ok=667 skip=1 fail=0 pair_packet.lam` | complete version of the review's shared-packet counterexample | +| `actual_parser_return.lam` | 111 | 184 | `184 bits ok=667 skip=1 fail=0 actual_parser_return.lam` | actual parser implements the ABS return; rigid-p law fails | +| `embedded_reference.lam` | 209 | 282 | `282 bits ok=667 skip=1 fail=0 embedded_reference.lam` | instantiate the arbitrary-Q embedding with the 165 | + +All have matching `.blc` files. Their general correctness arguments are +in sections 2, 3, and 5; the batteries alone establish only those finite +instances. No candidate below 165 was produced, so no sub-165 polish run +was triggered. These are the exact written-source sizes, not claims of +minimal representation for the larger witnesses. + +`checks.py` parses unoptimized source directly and writes only here. +The complete run used exactly two battery workers, took 7.615 seconds, +and is recorded in `checks.json`. The subsequent focused run, recorded in +`fixed_checks.json`, took 16.153 seconds and checks: + +* 47 fixed beta equality/inequality comparisons with both Python and Rust + normalization, including all nine forms, the two bare-head cases, and + exact rigid-suffix recovery on Omega and lambda-Omega for all four + complete interpreters; +* the actual reference NEXT's two-lambda, stream-headed head form; +* the original-source prices and the +44 embedding overhead; +* a concrete size-increasing affine beta contraction. + +The last example is + +``` +lambda f g h.(lambda q.lambda a b c d.q a b c d) (f g h) + -> lambda f g h a b c d.f g h a b c d. +``` + +Its sizes are **59 -> 61**. Moving the three free leaves of the argument +under four lambdas adds twelve index bits; removing the q leaf, its binder, +and the redex application removes ten. Hence even an affine contraction +can increase source cost. Source normality in section 4 cannot simply be +assumed without a compression argument. + +Reproduce the fixed checks without rerunning batteries: + +``` +PYTHONDONTWRITEBYTECODE=1 RAYON_NUM_THREADS=2 \ + python3 tmp/overnight/next-proof-codex/checks.py --fixed-only +``` + +Omit `--fixed-only` for the four two-worker batteries as well. No N +enumeration, letopt sweep, external consult, or Lean run was used. + +## 7. Exact residual cases and the next proof step + +Here is an exhaustive partition of candidates not covered by the 92-bit +theorem, using the first failed condition in order. It is a partition by +explicit hypotheses, not a claim that the mechanisms listed within each +part have themselves been classified. + +**R fails.** The actual correct candidate does not satisfy the independent +canonical branch laws (8). This includes actual-P/G computations such as +(5), nonstandard or body-dependent open values/environments, bypassing the +fixed parser as in (6), and parsing/control protocols whose canonical +intermediate closures cannot be exposed independently. The env report's +cell theorem assumes uniform lookup laws across bodies; its actual-value +lift theorem assumes the unchanged environment protocol. Neither supplies +the missing implication from (2) to R. The 184-bit witness proves that R +itself cannot be an unconditional conclusion without first finding a +size-nonincreasing replacement for such actual-helper uses. + +**R holds but B fails.** Source beta redexes compress the region, possibly +sharing code or moving captures. Their normal form may be one of the +priced shapes while the source is smaller. The 59 -> 61 example shows why +normal-form pricing alone is insufficient. A valid extension must charge +the original source origins or prove appropriate wire-cost inequalities +for these compression cases. + +**R and B hold but D fails.** The tag is used as data, partly applied, or +receives shared post-selection arguments. Section 5 closes the specified +single-shared-argument families with one bare head and tag-independent +normal payloads/adapters. Still open are both non-bare adapters (including +general pair packing), tag-dependent common payloads, more common arguments, +and Boolean data borrowing across semantic construction and control. +Repeated tests whose every use is fully saturated at exactly two arms are +already covered by section 4; repetition alone is not a separate residual. + +The actual head forms (3) supply a sound starting decomposition but no +92-bit pricing: their code may originate in the unchanged reader, in a +specialized copy of N inside G_N, or in shared source arguments. A genuine +full proof needs an ancestry-sensitive bound on those origins, together +with an interface theorem strong enough to replace R. Counting the 24-bit +cell, 19-bit lift, and old header independently does not provide either. + +The most concrete next lemma would bound **useful off-stream calls of P +and specialized calls of G_N below the 92-bit budget**, while preserving +their real reader equations (4). Even a result that replaces such calls +by a no-larger canonical control term would remove a substantial part of +the first residual class. It cannot be justified by declaring P rigid. + +My read: the ordinary normal control arrangement really is at its floor, +and the two bare-head factoring cases have no hidden saving under their +stated hypotheses. I have no rigorous reason to exclude all of the +actual-helper, alternate-protocol, or source-compression cases. The +unrestricted optimality question remains open after this lane. diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/actual_parser_return.blc b/data/self-interpreter/reasoning_floor/next-proof-codex/actual_parser_return.blc new file mode 100644 index 00000000..f90fa03b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/actual_parser_return.blc @@ -0,0 +1 @@ +0100011010000100000100000101100001011000000110111110111100101101010000111100001011100101111101000000111111000000111111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/actual_parser_return.lam b/data/self-interpreter/reasoning_floor/next-proof-codex/actual_parser_return.lam new file mode 100644 index 00000000..83fe3217 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/actual_parser_return.lam @@ -0,0 +1,3 @@ +(\x.x x) (\x.(\p.\c. + (\j.\s.s (\b0.b0 (\u r.r j) c) (s s s)) + (\b.p (\f.b (p f (\u v.c (\e a.f (\u r.u a (r e))))) (p (\g.c (\e.f e (g e))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/checks.json b/data/self-interpreter/reasoning_floor/next-proof-codex/checks.json new file mode 100644 index 00000000..a2aea80c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/checks.json @@ -0,0 +1,262 @@ +{ + "normal_fragment_forms": { + "00_root": { + "bits": 99, + "LAX": [ + 9, + 14, + 23 + ] + }, + "00_continuation": { + "bits": 93, + "LAX": [ + 9, + 13, + 21 + ] + }, + "00_after_first_parse": { + "bits": 92, + "LAX": [ + 8, + 13, + 22 + ] + }, + "01_root": { + "bits": 108, + "LAX": [ + 10, + 15, + 26 + ] + }, + "10_root": { + "bits": 107, + "LAX": [ + 10, + 15, + 25 + ] + }, + "11_root": { + "bits": 116, + "LAX": [ + 11, + 16, + 28 + ] + }, + "11_after_tail_binder": { + "bits": 115, + "LAX": [ + 10, + 16, + 29 + ] + }, + "11_continuation": { + "bits": 104, + "LAX": [ + 10, + 14, + 26 + ] + }, + "11_after_first_parse": { + "bits": 103, + "LAX": [ + 9, + 14, + 27 + ] + } + }, + "batteries": { + "reference165": { + "line": "165 bits ok=667 skip=1 fail=0 reference165.lam", + "seconds": 1.8359707500057993, + "NEXT_bits": 92, + "LAX": [ + 17, + 25, + 29 + ] + }, + "pair_packet": { + "line": "205 bits ok=667 skip=1 fail=0 pair_packet.lam", + "seconds": 1.8600658329960424, + "NEXT_bits": 132, + "LAX": [ + 24, + 30, + 35 + ] + }, + "actual_parser_return": { + "line": "184 bits ok=667 skip=1 fail=0 actual_parser_return.lam", + "seconds": 1.8668627079969156, + "NEXT_bits": 111, + "LAX": [ + 19, + 27, + 36 + ] + }, + "embedded_reference": { + "line": "282 bits ok=667 skip=1 fail=0 embedded_reference.lam", + "seconds": 1.875438708004367, + "NEXT_bits": 209, + "LAX": [ + 32, + 43, + 44 + ] + } + }, + "equations": [ + { + "label": "00_root K", + "equal": true + }, + { + "label": "00_root F", + "equal": true + }, + { + "label": "00_continuation K", + "equal": true + }, + { + "label": "00_continuation F", + "equal": true + }, + { + "label": "00_after_first_parse K", + "equal": true + }, + { + "label": "00_after_first_parse F", + "equal": true + }, + { + "label": "01_root K", + "equal": true + }, + { + "label": "01_root F", + "equal": true + }, + { + "label": "10_root K", + "equal": true + }, + { + "label": "10_root F", + "equal": true + }, + { + "label": "11_root K", + "equal": true + }, + { + "label": "11_root F", + "equal": true + }, + { + "label": "11_after_tail_binder K", + "equal": true + }, + { + "label": "11_after_tail_binder F", + "equal": true + }, + { + "label": "11_continuation K", + "equal": true + }, + { + "label": "11_continuation F", + "equal": true + }, + { + "label": "11_after_first_parse K", + "equal": true + }, + { + "label": "11_after_first_parse F", + "equal": true + }, + { + "label": "raw variable n=1", + "equal": true + }, + { + "label": "raw variable n=2", + "equal": true + }, + { + "label": "raw variable n=4", + "equal": true + }, + { + "label": "constructor handoff (\\u v.u)", + "equal": true + }, + { + "label": "constructor handoff (\\u v.v)", + "equal": true + }, + { + "label": "constructor handoff b", + "equal": true + }, + { + "label": "constant-stream return, arbitrary NEXT", + "equal": true + }, + { + "label": "reader on K", + "equal": true + }, + { + "label": "reader on F", + "equal": true + }, + { + "label": "reader on I", + "equal": true + }, + { + "label": "packet K", + "equal": true + }, + { + "label": "packet F", + "equal": true + }, + { + "label": "actual return fails rigid-p K law", + "equal": false + }, + { + "label": "actual modified parser returns constants", + "equal": true + }, + { + "label": "embedded interpreter forwarding K", + "equal": true + }, + { + "label": "embedded interpreter forwarding F", + "equal": true + }, + { + "label": "size-growing affine contraction", + "equal": true + } + ], + "seconds": 7.614520541996171, + "status": "Finite identities and measurements only; no general lower bound machine-checked." +} diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/checks.py b/data/self-interpreter/reasoning_floor/next-proof-codex/checks.py new file mode 100644 index 00000000..d9670195 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/checks.py @@ -0,0 +1,297 @@ +#!/usr/bin/env python3 +"""Fixed NEXT identities, nine proved normal forms, and explicit witnesses. + +No candidate enumeration. All generated files stay beside this script. +Batteries explicitly use two workers; fixed equations use one process. +""" +from pathlib import Path +import json +import re +import subprocess +import sys +import time + +sys.dont_write_bytecode = True +LANE = Path(__file__).resolve().parent +ROOT = LANE.parents[2] +sys.path[:0] = [str(ROOT / "tools"), str(ROOT / "tools/self-interpreter")] +import blcc +import battery +import lc + + +def parse(src, frame=()): + src = re.sub(r"\\([A-Za-z_]\w*(?:\s+[A-Za-z_]\w*)+)\.", + lambda m: "\\" + "\\".join(m[1].split()) + ".", src) + parser = blcc.P(blcc.strip_comments(src)) + named = blcc.p_lc(parser) + parser.ws() + assert parser.i == len(parser.t), (parser.i, parser.t[parser.i:]) + return blcc.to_db(named, frame) + + +def app(f, *xs): + for x in xs: + f = ("A", f, x) + return f + + +def counts(t): + if t[0] == "V": + return (0, 0, t[1]) + if t[0] == "L": + l, a, x = counts(t[1]) + return l + 1, a, x + left, right = counts(t[1]), counts(t[2]) + return (left[0] + right[0], left[1] + right[1] + 1, left[2] + right[2]) + + +def fixed_nf(t): + return lc.nf(t, [30000]) + + +def head_nf(t): + def step(u): + if u[0] == "V": + return None + if u[0] == "L": + v = step(u[1]) + return None if v is None else ("L", v) + if u[1][0] == "L": + return lc.beta(u[1], u[2]) + v = step(u[1]) + return None if v is None else ("A", v, u[2]) + for _ in range(1000): + u = step(t) + if u is None: + return t + t = u + raise AssertionError("head normalization cap") + + +def rust_nf(t): + result = subprocess.run( + [battery.BLAM, "normalize", lc.enc(t), "--beta", "30000"], + text=True, capture_output=True, timeout=5, + ) + fields = result.stdout.split() + assert result.returncode == 0 and fields and set(fields[0]) <= {"0", "1"}, result.stderr + return fields[0] + + +CHECKS = [] + + +def equation(label, lhs, rhs, equal=True): + left, right = parse(lhs), parse(rhs) + equation_terms(label, left, right, equal) + + +def equation_terms(label, left, right, equal=True): + left_nf, right_nf = fixed_nf(left), fixed_nf(right) + assert (left_nf == right_nf) == equal, label + assert rust_nf(left) == lc.enc(left_nf), label + " Rust lhs" + assert rust_nf(right) == lc.enc(right_nf), label + " Rust rhs" + CHECKS.append({"label": label, "equal": equal}) + + +K = r"(\u v.u)" +F = r"(\u v.v)" +I = r"(\u.u)" +A = r"(\e a.f (\u r.u a (r e)))" +B = r"(\g.c (\e.f e (g e)))" +KA = rf"(\f.c {A})" +KB = rf"(\f.p {B})" +T0 = rf"(p {KA})" +T1 = rf"(p {KB})" +NEXT = rf"\b.p (\f.b (c {A}) (p {B}))" +FRAME = ("c", "p", "x") + + +def machine(nxt): + return rf"""(\x.x x) (\x.(\p.\c. + (\j.\s.s (\b0.b0 (\u r.r j) c) (s s s)) + ({nxt})) (x x))""" + + +def reader(j, c, s): + return rf"({s}) (\b0.b0 (\u r.r ({j})) ({c})) (({s}) ({s}) ({s}))" + + +def cons(b, s): + return rf"(\h.h ({b}) ({s}))" + + +def unary(n, tail="t"): + s = cons(K, tail) + for _ in range(n): + s = cons(F, s) + return s + + +def main(): + started = time.monotonic() + ref = parse(machine(NEXT)) + canonical = parse((ROOT / "data/self-interpreter/machines/int165.lam").read_text()) + assert ref == canonical and lc.size(ref) == 165 + assert counts(parse(NEXT, FRAME)) == (8, 13, 22) + # Substitute the actual knot values, then expose only the head form. + # The reference NEXT is tail-headed, not rigid-p-headed, after this. + generator = ref[2] + parser = app(generator, generator) + actual_j = app(parse(rf"\x p c.{NEXT}"), generator, parser, ("V", 0)) + h = head_nf(actual_j) + lambdas = 0 + while h[0] == "L": + lambdas += 1 + h = h[1] + hargs = [] + while h[0] == "A": + hargs.append(h[2]) + h = h[1] + assert (lambdas, h, len(hargs)) == (2, ("V", 0), 2) + + # Exactly the nine forms in the conditional theorem; no search. + forms = { + "00_root": rf"\b.b {T0} {T1}", + "00_continuation": rf"\b.p (b {KA} {KB})", + "00_after_first_parse": NEXT, + "01_root": rf"\b.b {T0} (\r.{T1} r)", + "10_root": rf"\b.b (\r.{T0} r) {T1}", + "11_root": rf"\b.b (\r.{T0} r) (\r.{T1} r)", + "11_after_tail_binder": rf"\b r.b ({T0} r) ({T1} r)", + "11_continuation": rf"\b r.p (b {KA} {KB}) r", + "11_after_first_parse": rf"\b r.p (\f.b (c {A}) (p {B})) r", + } + sizes = {} + for label, source in forms.items(): + t = parse(source, FRAME) + assert fixed_nf(t) == t, label + sizes[label] = {"bits": lc.size(t), "LAX": counts(t)} + for bit, target in [(K, T0), (F, T1)]: + equation(label + (" K" if bit == K else " F"), + rf"\x p c t.({source}) {bit} t", + rf"\x p c t.{target} t") + assert min(v["bits"] for v in sizes.values()) == 92 + + # Fixed reader laws are independent of NEXT, not an opaque-parser axiom. + for n in [1, 2, 4]: + equation(f"raw variable n={n}", + rf"\j c t.{reader('j', 'c', unary(n))}", + rf"\j c t.c ({unary(n - 1)}) t") + for b in [K, F, "b"]: + equation("constructor handoff " + b, + rf"\j c b t.{reader('j', 'c', cons(K, cons(b, 't')))}", + rf"\j c b t.j ({b}) t") + equation("constant-stream return, arbitrary NEXT", + rf"\j c v.{reader('j', 'c', r'(\u w.v)')}", + r"\j c v.v") + equation("reader on K", rf"\j c.{reader('j', 'c', K)}", + r"\j c.\b.b (\u r.r j) c") + equation("reader on F", rf"\j c.{reader('j', 'c', F)}", rf"\j c.{F}") + equation("reader on I", rf"\j c.{reader('j', 'c', I)}", r"\j c.\r.r j") + + # A legal shared packet: the review's counterexample, now priced as NEXT. + X = rf"(\z.c (z {K}))" + Y = rf"(\z.p (z {F}))" + Z = rf"(\h.h {A} {B})" + packed = rf"\b.p (\f.b {X} {Y} {Z})" + for bit, target in [(K, T0), (F, T1)]: + equation("packet " + ("K" if bit == K else "F"), + rf"\x p c t.({packed}) {bit} t", + rf"\x p c t.{target} t") + + # The two single-shared-argument shapes with a bare branch head. + # The report proves that these exact erasing adapters are forced + # under its normal-source / tag-independent-payload hypotheses. + bare_c = rf"\b.p (\f.b c (\z.p {B}) {A})" + bare_p = rf"\b.p (\f.b (\z.c {A}) p {B})" + bare_sizes = {"bare_c": lc.size(parse(bare_c, FRAME)), + "bare_p": lc.size(parse(bare_p, FRAME))} + assert bare_sizes == {"bare_c": 97, "bare_p": 96}, bare_sizes + for label, source in [("bare_c", bare_c), ("bare_p", bare_p)]: + for bit, target in [(K, T0), (F, T1)]: + equation(label + (" K" if bit == K else " F"), + rf"\x p c t.({source}) {bit} t", + rf"\x p c t.{target} t") + + # The concrete parser implements a constant-stream return. This is + # intentionally NOT equal to the rigid-p branch law. + actual_return = rf"\b.p (\f.b (p f (\u v.c {A})) (p {B}))" + equation("actual return fails rigid-p K law", + rf"\x p c t.({actual_return}) {K} t", + rf"\x p c t.{T0} t", equal=False) + actual_machine = machine(actual_return) + equation("actual modified parser returns constants", + rf"\c v.({actual_machine}) c (\u w.v)", + r"\c v.v") + + # An arbitrary closed self-interpreter Q embeds in NEXT with 44 extra bits. + reference_src = machine(NEXT) + embedded = rf"\b t.({reference_src}) c {cons(K, cons('b', 't'))}" + embedded_n = parse(embedded, FRAME) + assert lc.size(embedded_n) == lc.size(ref) + 44 + # Symbolic proof of the adapter, for either actual tag, all tails and Q. + adapter = rf"(\b t.q c {cons(K, cons('b', 't'))})" + for bit in [K, F]: + equation("embedded interpreter forwarding " + ("K" if bit == K else "F"), + rf"\q c t.{adapter} {bit} t", + rf"\q c t.q c {cons(K, cons(bit, 't'))}") + + witnesses = { + "reference165": NEXT, + "pair_packet": packed, + "actual_parser_return": actual_return, + "embedded_reference": embedded, + } + batteries = {} + for label, nsrc in witnesses.items(): + src = machine(nsrc) + term = parse(src) + (LANE / (label + ".lam")).write_text(src + "\n") + (LANE / (label + ".blc")).write_text(lc.enc(term) + "\n") + if "--fixed-only" in sys.argv: + continue + then = time.monotonic() + ok, skip, bad = battery.check(term, threads=2) + line = f"{lc.size(term)} bits ok={ok} skip={skip} fail={len(bad)} {label}.lam" + print(line, flush=True) + assert not bad, (label, bad) + batteries[label] = { + "line": line, "seconds": time.monotonic() - then, + "NEXT_bits": lc.size(parse(nsrc, FRAME)), "LAX": counts(term), + } + + # The ordinary battery skips Omega's full output. Check exact suffix + # extraction on Omega and lambda-Omega separately, with a rigid tail. + omega = parse(r"(\u.u u) (\u.u u)") + for label, nsrc in witnesses.items(): + term = parse(machine(nsrc)) + for program_name, program in [("Omega", omega), ("lambda Omega", ("L", omega))]: + stream = lc.bitlist(lc.enc(program), ("V", 0)) + probe = ("L", app(term, parse(F), stream)) + equation_terms(label + " suffix " + program_name, probe, parse(I)) + + # A fixed affine contraction increases BLC size by two bits. + grow_before = r"\f g h.(\q.\a b c d.q a b c d) (f g h)" + grow_after = r"\f g h a b c d.f g h a b c d" + equation("size-growing affine contraction", + grow_before, grow_after) + growth_sizes = [lc.size(parse(grow_before)), lc.size(parse(grow_after))] + assert growth_sizes[1] - growth_sizes[0] == 2, growth_sizes + result = { + "normal_fragment_forms": sizes, "batteries": batteries, + "bare_head_shared_argument_sizes": bare_sizes, + "equations": CHECKS, "seconds": time.monotonic() - started, + "actual_NEXT_head": {"lambdas": lambdas, "head_index": h[1], "arguments": len(hargs)}, + "affine_growth_sizes": growth_sizes, + "status": "Finite identities and measurements only; no general lower bound machine-checked.", + } + output = "fixed_checks.json" if "--fixed-only" in sys.argv else "checks.json" + (LANE / output).write_text(json.dumps(result, indent=2) + "\n") + print(json.dumps(sizes, indent=2)) + print(f"PASS {len(CHECKS)} dual-normalizer comparisons; {result['seconds']:.3f}s", flush=True) + + +if __name__ == "__main__": + main() diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/embedded_reference.blc b/data/self-interpreter/reasoning_floor/next-proof-codex/embedded_reference.blc new file mode 100644 index 00000000..f4adb686 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/embedded_reference.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100000011011111011110010110101000000101010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010111000010110000011000010110111101110011010 diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/embedded_reference.lam b/data/self-interpreter/reasoning_floor/next-proof-codex/embedded_reference.lam new file mode 100644 index 00000000..3cf053e2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/embedded_reference.lam @@ -0,0 +1,5 @@ +(\x.x x) (\x.(\p.\c. + (\j.\s.s (\b0.b0 (\u r.r j) c) (s s s)) + (\b t.((\x.x x) (\x.(\p.\c. + (\j.\s.s (\b0.b0 (\u r.r j) c) (s s s)) + (\b.p (\f.b (c (\e a.f (\u r.u a (r e)))) (p (\g.c (\e.f e (g e))))))) (x x))) c (\h.h ((\u v.u)) ((\h.h (b) (t)))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/fixed_checks.json b/data/self-interpreter/reasoning_floor/next-proof-codex/fixed_checks.json new file mode 100644 index 00000000..04846ec2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/fixed_checks.json @@ -0,0 +1,282 @@ +{ + "normal_fragment_forms": { + "00_root": { + "bits": 99, + "LAX": [ + 9, + 14, + 23 + ] + }, + "00_continuation": { + "bits": 93, + "LAX": [ + 9, + 13, + 21 + ] + }, + "00_after_first_parse": { + "bits": 92, + "LAX": [ + 8, + 13, + 22 + ] + }, + "01_root": { + "bits": 108, + "LAX": [ + 10, + 15, + 26 + ] + }, + "10_root": { + "bits": 107, + "LAX": [ + 10, + 15, + 25 + ] + }, + "11_root": { + "bits": 116, + "LAX": [ + 11, + 16, + 28 + ] + }, + "11_after_tail_binder": { + "bits": 115, + "LAX": [ + 10, + 16, + 29 + ] + }, + "11_continuation": { + "bits": 104, + "LAX": [ + 10, + 14, + 26 + ] + }, + "11_after_first_parse": { + "bits": 103, + "LAX": [ + 9, + 14, + 27 + ] + } + }, + "batteries": {}, + "bare_head_shared_argument_sizes": { + "bare_c": 97, + "bare_p": 96 + }, + "equations": [ + { + "label": "00_root K", + "equal": true + }, + { + "label": "00_root F", + "equal": true + }, + { + "label": "00_continuation K", + "equal": true + }, + { + "label": "00_continuation F", + "equal": true + }, + { + "label": "00_after_first_parse K", + "equal": true + }, + { + "label": "00_after_first_parse F", + "equal": true + }, + { + "label": "01_root K", + "equal": true + }, + { + "label": "01_root F", + "equal": true + }, + { + "label": "10_root K", + "equal": true + }, + { + "label": "10_root F", + "equal": true + }, + { + "label": "11_root K", + "equal": true + }, + { + "label": "11_root F", + "equal": true + }, + { + "label": "11_after_tail_binder K", + "equal": true + }, + { + "label": "11_after_tail_binder F", + "equal": true + }, + { + "label": "11_continuation K", + "equal": true + }, + { + "label": "11_continuation F", + "equal": true + }, + { + "label": "11_after_first_parse K", + "equal": true + }, + { + "label": "11_after_first_parse F", + "equal": true + }, + { + "label": "raw variable n=1", + "equal": true + }, + { + "label": "raw variable n=2", + "equal": true + }, + { + "label": "raw variable n=4", + "equal": true + }, + { + "label": "constructor handoff (\\u v.u)", + "equal": true + }, + { + "label": "constructor handoff (\\u v.v)", + "equal": true + }, + { + "label": "constructor handoff b", + "equal": true + }, + { + "label": "constant-stream return, arbitrary NEXT", + "equal": true + }, + { + "label": "reader on K", + "equal": true + }, + { + "label": "reader on F", + "equal": true + }, + { + "label": "reader on I", + "equal": true + }, + { + "label": "packet K", + "equal": true + }, + { + "label": "packet F", + "equal": true + }, + { + "label": "bare_c K", + "equal": true + }, + { + "label": "bare_c F", + "equal": true + }, + { + "label": "bare_p K", + "equal": true + }, + { + "label": "bare_p F", + "equal": true + }, + { + "label": "actual return fails rigid-p K law", + "equal": false + }, + { + "label": "actual modified parser returns constants", + "equal": true + }, + { + "label": "embedded interpreter forwarding K", + "equal": true + }, + { + "label": "embedded interpreter forwarding F", + "equal": true + }, + { + "label": "reference165 suffix Omega", + "equal": true + }, + { + "label": "reference165 suffix lambda Omega", + "equal": true + }, + { + "label": "pair_packet suffix Omega", + "equal": true + }, + { + "label": "pair_packet suffix lambda Omega", + "equal": true + }, + { + "label": "actual_parser_return suffix Omega", + "equal": true + }, + { + "label": "actual_parser_return suffix lambda Omega", + "equal": true + }, + { + "label": "embedded_reference suffix Omega", + "equal": true + }, + { + "label": "embedded_reference suffix lambda Omega", + "equal": true + }, + { + "label": "size-growing affine contraction", + "equal": true + } + ], + "seconds": 16.15280391700071, + "actual_NEXT_head": { + "lambdas": 2, + "head_index": 0, + "arguments": 2 + }, + "affine_growth_sizes": [ + 59, + 61 + ], + "status": "Finite identities and measurements only; no general lower bound machine-checked." +} diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/pair_packet.blc b/data/self-interpreter/reasoning_floor/next-proof-codex/pair_packet.blc new file mode 100644 index 00000000..92f1f275 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/pair_packet.blc @@ -0,0 +1 @@ +0100011010000100000100000101100001011000000110111110111100101101010000111100001010111000011111001100000110000111111001100000100001011000000111110000001011101110011011110000111111000010111110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/pair_packet.lam b/data/self-interpreter/reasoning_floor/next-proof-codex/pair_packet.lam new file mode 100644 index 00000000..e8d38b4f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/pair_packet.lam @@ -0,0 +1,3 @@ +(\x.x x) (\x.(\p.\c. + (\j.\s.s (\b0.b0 (\u r.r j) c) (s s s)) + (\b.p (\f.b (\z.c (z (\u v.u))) (\z.p (z (\u v.v))) (\h.h (\e a.f (\u r.u a (r e))) (\g.c (\e.f e (g e))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/reference165.blc b/data/self-interpreter/reasoning_floor/next-proof-codex/reference165.blc new file mode 100644 index 00000000..5c37eb3e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/reference165.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/next-proof-codex/reference165.lam b/data/self-interpreter/reasoning_floor/next-proof-codex/reference165.lam new file mode 100644 index 00000000..297d609c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof-codex/reference165.lam @@ -0,0 +1,3 @@ +(\x.x x) (\x.(\p.\c. + (\j.\s.s (\b0.b0 (\u r.r j) c) (s s s)) + (\b.p (\f.b (c (\e a.f (\u r.u a (r e)))) (p (\g.c (\e.f e (g e))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/b44.lam b/data/self-interpreter/reasoning_floor/origin162/b44.lam new file mode 100644 index 00000000..7cbabdab --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/b44.lam @@ -0,0 +1,7 @@ +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\a. a) (\u. list (\q. cont) (list list u)) next) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/int162.blc b/data/self-interpreter/reasoning_floor/origin162/int162.blc new file mode 100644 index 00000000..ce926778 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/int162.blc @@ -0,0 +1 @@ +010001101000010000000101011000100001011100011110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/origin162/int162.lam b/data/self-interpreter/reasoning_floor/origin162/int162.lam new file mode 100644 index 00000000..db877833 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/int162.lam @@ -0,0 +1,13 @@ +-- 162-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- The 165's knot, NEXT, ABS and APP around a new reader. `list I` turns the +-- first cell into its own selection `bit0 list1`, so on a 0-tag the zero arm +-- is the tail list1 itself, applied to NEXT, which is the reader's last +-- operand; on a variable the selection picks the middle operand, which +-- reopens the stream to hand list1 to cont and erases NEXT as the skip's +-- junk operand. +(\x. x x) (\x. (\intL. \cont. \list. + list (\a. a) (\u. list (\q. cont) (list list u)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/suffix_check.py b/data/self-interpreter/reasoning_floor/origin162/suffix_check.py new file mode 100644 index 00000000..1c51e41e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/suffix_check.py @@ -0,0 +1,14 @@ +import sys +sys.path.insert(0,'tools/self-interpreter'); sys.path.insert(0,'tools') +import battery, lc, db as dbparse +from battery import enc, shift, bitlist, normalize +E,_=lc.decode(open(sys.argv[1]).read().strip()) +F=("L",("L",("V",0))) +def parse(s): return dbparse.parse(s) +progs={"Omega":"(\\1 1)(\\1 1)","lam Omega":"\\(\\1 1)(\\1 1)","Omega I":"(\\1 1)(\\1 1)(\\1)","I Omega":"(\\1)((\\1 1)(\\1 1))","K Omega":"\\\\(\\1 1)(\\1 1)","Omega3":"(\\1 1 1)(\\1 1 1)"} +for name,src in progs.items(): + M=parse(src) + # \n. E F ( ++ n) should normalize to \n. n + t=("L",("A",("A",shift(E,1),shift(F,1)),bitlist(enc(M),("V",0)))) + out=normalize(enc(t),1<<20) + print(name, "suffix ->", out, "(want", enc(("L",("V",0))),")") diff --git a/data/self-interpreter/reasoning_floor/reader-proof/REPORT.md b/data/self-interpreter/reasoning_floor/reader-proof/REPORT.md index 53207c82..ee652873 100644 --- a/data/self-interpreter/reasoning_floor/reader-proof/REPORT.md +++ b/data/self-interpreter/reasoning_floor/reader-proof/REPORT.md @@ -1,4 +1,64 @@ -# Lane reader-proof: the 165's reader is optimal for every reader shape +# Lane reader-proof: the 165's reader is optimal — for stream-linear readers + +## Status after review 2 [after review 2] + +Two independent adversarial reviews (Gemini: "gap", Codex: "error in the +proof") found no reader body below 43 bits and no second 43-bit reader +body, and both confirmed the shape (α) arithmetic. Codex refuted several +steps of the *general* argument: the residual-distinctness lemma for +copied nodes (Lemma 2.7(ii)) is false under higher-order sharing; a +non-dispatch stream cell can supply the output node `cont P_{n-1}` (a +52-bit reader missing from §2.4); rebuilt tails can borrow stream nodes +(`λh. r h`); a shape (α) sub-bound of 64 is wrong (59-bit witness); the +leaf-let and forced-depth claims do not follow from T10; and the walker +inference from a fixed threshold `n > 3|B|` is invalid (finite +composition). Each is addressed below: repaired where the step can be +repaired, conceded where it cannot be rescued tonight. + +**What I can defend.** Call a reader body `B` **stream-linear** (Class S) +when (1) `B` is β-normal, and (2) every binder of `B` that occurs more than +once in its scope is contracted, in the two law reductions, only on stream +material created by a cell step (a bit `β` or a tail `τ`). Equivalently: +no node of `B` is ever duplicated in either reduction. The 165's reader is +in Class S (all its binders are affine), and so are all the natural +readers with a nonlinear tail (`r r r`-style skips), including every +witness the reviewers built except the let/sharing/walker ones. + +> **Theorem S.** Every stream-linear reader body has `|B| ≥ 43`, and +> `|B| = 43` only for `s (λb. b (λu r. r next) cont) (s s s)`. + +Its proof is Parts 1–2 with the corrections marked `[after review 2]`: +in Class S nothing of `B` is copied, so the inventory's distinct-origin +charging is sound without Lemma 2.7; depths are syntactic; there are no +lets; no lambda of `B` is contracted twice, so the N-source is a +cell–cell chain (Lemma 2.3(a)) and no walker case is needed; the new +shape (α′) covers the non-dispatch cell; the corrected Lemma 2.5(iv) and +the corrected shape (α) sub-bound are used. It remains handwritten, now +reviewed twice, with every hole either reviewer found closed inside the +class. + +**What remains a conjecture.** For reader bodies outside Class S — lets +and hoists (non-shrinking redexes exist, e.g. Δ = +17), higher-order +sharing of one source node across roles, finite compositions, self-passing +walkers — the inventory is heuristic evidence only: the cheapest such +readers known are 55 (let), 76 (walker), 98 (shared application), and no +reader below 43 was found by three independent efforts. The unconditional +43-bit bound and its uniqueness clause are **not proved** tonight. + +### Repairs and concessions, by finding + +| finding (Codex §) | status | what changed | +|---|---|---| +| 1. Lemma 2.7(ii): one source node `a b` can realize several output roles with different signatures (98-bit valid reader, Δ = +17) | **conceded** for general `B`; **unnecessary** in Class S | Lemma 2.7 replaced by the no-duplication lemma for Class S; general claim withdrawn | +| 2. Output node `cont P_{n-1}` from a non-dispatch cell (52-bit `s (λb. b (λr. r next) (λr. s (λq. cont) (r r r)))`) | **repaired** | new shape (α′) in §2.4, bound ≥ 51 (51 attained, checked), ≥ 57 when the cell is in an operand | +| 3. Rebuilt tails borrow stream nodes (`λh. r h`, 9 bits; 53-bit reader) | **repaired** | Lemma 2.5(iv) now: a rebuilt tail is an η-expansion `λh. r h` of a bound tail (≥ 8 + index) or a literal cell `λh. h F' P'` (≥ 12); T7's last sentence qualified; no shape used the old figure in a way that changes a bound | +| 4. Shape (α) sub-bound 64 vs 59-bit witness; "depth-0 operands have no binders" | **repaired** | sub-case re-counted with the operand's own dispatch: ≥ 58; depth-0 operand paragraph rewritten (`s F`, `s s s` are 10-bit dual operands; a dual *arm-valued* operand costs ≥ 33) | +| 5. Leaf lets and forced depths are not consequences of T10 (Δ = +2 examples) | **conceded** for general `B`; **moot** in Class S | Lemma 2.7(i) and the forced-depth remark withdrawn; β-normality makes depths syntactic; lets excluded by hypothesis | +| 6. Walker inference: three contractions do not force a cycle; `n > 3|B|` too small; shared-dispatch flag claim unproved; 37 ≠ 43 | **conceded** as a general argument; **unnecessary** in Class S | in Class S no lambda of `B` is contracted twice, so the chain case (a) is the only case; the walker analysis is kept as a remark on the conjecture, with "for `n` large enough (the copy graph of a fixed `B` is finite)" in place of the threshold; the 37-sum was already removed | +| 7. T8 omits `I`; §2.1 cell steps can occur at created nodes (`S S`); T9 parity wording; `|K| = 7` | **repaired** | all four corrected in place | +| Gemini 1–3 (walker 22-bit core, (γ1) `s s` operand, `d` definition) | repaired in review 1 | unchanged; the walker material is now a remark | + +--- Lane directory: `tmp/overnight/reader-proof/`. Everything here is new to this lane except where a document in `docs/classical/self-interpreter/` or a @@ -13,33 +73,32 @@ interpreters), each a few seconds, two threads. ## Summary -**Theorem (handwritten, with checked finite identities).** With the -165's knot and NEXT region fixed, every reader body `B` in the frame -`[s, next, cont, intL, x]` satisfying the two reader laws +**Theorem S (handwritten, with checked finite identities) [after review 2].** +With the 165's knot and NEXT region fixed, every *stream-linear* reader body +`B` in the frame `[s, next, cont, intL, x]` — β-normal, with every +nonlinear binder contracted only on a bit or a tail — satisfying the two +reader laws B[cons K R / s] →* R next B[1ⁿ0 ++ N / s] →* cont (1ⁿ⁻¹0 ++ N) N (n ≥ 1) -with `next, cont, intL, x, R, N` independent and rigid has `|B| ≥ 43`, -and `|B| = 43` only for the 165's `s (λb. b (λu r. r next) cont) (s s s)`. -No restriction on `B` is assumed: any arity, any operands (bare `next`, -bare `cont`, operands with lambdas), bodies with head redexes or any -internal redexes, bodies whose head is reached only after reduction, and -both dispatch heads (bit selection and tail dispatch) are covered. +with `next, cont, intL, x, R, N` independent and rigid has `|B| ≥ 43`, and +`|B| = 43` only for the 165's `s (λb. b (λu r. r next) cont) (s s s)`. +Within the class no restriction on arity, operands, dispatch head or +nesting is made. The unconditional statement (any `B`) is a conjecture; +see the status section above. The proof is uniform in the sense the lane asked for: it is driven by what the two laws force every reduction to *do* (a structure theorem, Part 1), by a decomposition of any body along the head reduction of the symbolic stream `λh. h β τ` into dispatch, zero arm, variable arm and operands (§2.1), and by an inventory of roles each priced at its cheapest -realization (§2.2–2.3); the case analysis that remains is over four +realization (§2.2–2.3); the case analysis that remains is over the *shapes* of how stream-created nodes can stand in for nodes of `B` (§2.4), not over reader syntax. Shape (α) — the variable output's first -application is the stream's own node — is where the 165 lives and is -priced exactly (`41 + 2d`, so 43 at depth 1); the other shapes are ≥ 46. -Part 3 lists the steps whose rigour is weakest; the least formal is the -self-passing-walker bound (Lemma 2.3(c)), now a two-case split giving -≥ 47 for any reader with a lambda walk (cheapest construction 85). +application is the dispatch cell's own node — is where the 165 lives and +is priced exactly (`41 + 2d`, so 43 at depth 1); the other shapes are +≥ 46 (the new (α′) ≥ 51). ### 1. Complete interpreters built @@ -74,8 +133,8 @@ and each is at or above the bound its shape receives in §2.4. streams); `s K` is the uniform bit. * Cell–cell chains alternate roles, `P_i P_j → P_{j-1} P_{i-1}`; they end in `K N` iff `i = j`, and otherwise in `I` (suffix erased) or in an - `N`-headed neutral, according to the parity of `|i − j|` (T9, checked - for `i, j ≤ 6`). Application-only trees over copies of one `P_n` and + `N`-headed neutral, according to which side reaches index 0 first (T9, + checked for `i, j ≤ 6`; corrected after review 2). Application-only trees over copies of one `P_n` and rigid leaves normalize only to `P_n`, `K N`, or rigid-headed neutrals (checked exhaustively for ≤ 5 leaves). * The exact wire-cost change of a β-step, `Δ = (m−1)|Q| + (fl(Q)−1)·D − @@ -211,16 +270,19 @@ output of `(V_n)` and follow it backwards. The `n+1` cell lambdas `P_n, …, P_0` of its copy of the stream enclose it initially; an enclosing lambda disappears only when that lambda is contracted. So every reduction realizing `(V_n)` contracts (a descendant of) every one of these `n+1` -cells. The same holds for the copy whose `P_{n-1}` survives intact: its -`P_n` is contracted. +cells. If the output's `P_{n-1}` is a stream residual (it need not be, see +Lemma 2.5(iv) [after review 2]), the same holds for its copy: its `P_n` is +contracted. **T8 (the last cell).** The final cell `P_0 = λh. h K N` on the surviving path is contracted on some argument `Y`: `P_0 Y → Y K N`. Checked table: -`P_0 P_0 → Q`; `P_0 F → N`; `P_0 K → K` (erases `N`); `P_0 P_j → I` -for `j ≥ 1` (erases `N`); `P_0 (rigid neutral)` traps `N` as an argument -of that neutral forever. Hence **`Y` is `P_0`, `F`, or a descendant of a -lambda of `B`**. Since the output has `N` as an argument of `cont`, a -reduct `N X` (head `N`) is also fatal. +`P_0 P_0 → Q`; `P_0 F → N`; `P_0 I → Q` [after review 2: `I` was +omitted; `I` is a lambda of `B` or arises as `F X` from stream material]; +`P_0 K → K` (erases `N`); `P_0 P_j → I` for `j ≥ 1` (erases `N`); +`P_0 (rigid neutral)` traps `N` as an argument of that neutral forever. +Hence **`Y` is `P_0`, `F`, `I`, or a descendant of a lambda of `B`**. +Since the output has `N` as an argument of `cont`, a reduct `N X` (head +`N`) is also fatal. **T9 (cell–cell chains).** If two cells meet, `P_i P_j`, the chain is forced and the two sides alternate roles: @@ -228,7 +290,8 @@ forced and the two sides alternate roles: bottom `P_0 P_0 → Q`, `P_0 P_j → I` (`j ≥ 1`, `N` erased), `P_j P_0 → N P_{j-1}` (`j ≥ 1`, `N` trapped as a rigid head, which no reduction can turn into an argument). So a meeting with unequal indices is -fatal (which of the two deaths occurs depends on the parity of `|i−j|`), +fatal (which of the two deaths occurs depends on which side reaches index +0 first — `P_2 P_1 →* I` but `P_1 P_0 →* N P_0` [after review 2] —), a cell–cell meeting on the surviving path has **equal indices**, and the chain then ends in `Q = K N`, which yields `N` only when applied to one more argument. (Checked for all `i, j ≤ 6`, `tools/algebra.py`.) @@ -265,7 +328,11 @@ when its residual is in the output. The stream's own lambdas (`λh`, `K`, Fix a minimum reader body `B` (T10), free variables in `{s, next, cont}` (T1), and fix reductions `ρ_z : B[Z_R] →* R next` and `ρ_v : B[P_n] →* cont P_{n-1} N` for one `n` larger than three times the -number of nodes of `B`. "A node of `B`" always means a node of the +number of nodes of `B` (in Class S this exceeds the number of cell +openings that lambdas of `B` can cause, see Lemma 2.3; outside Class S +"large enough" must depend on the finite copy graph of `B` [after review +2]). **From here on `B` is assumed stream-linear (Class S)** unless a +remark says otherwise. "A node of `B`" always means a node of the original syntax of `B`; the stream copies substituted for the `s`-leaves are *stream material*, not nodes of `B`. @@ -276,8 +343,11 @@ Head-reduce `B[S]` (T3). The head steps are of two kinds: * a **cell step** `S Y A⃗ → Y β τ A⃗`: the head is a copy of `S`, i.e. the residual of a leaf of `B` that is `s` or is a bound variable whose binder was contracted on a copy of `S`; the redex node is an application node - of `B`. The step creates two new application nodes, `(Y β)` and - `((Y β) τ)`, and two new leaves `β, τ` — **stream material**; + of `B` *or* a created node (`S S → S β τ → β β τ τ` contracts the second + cell at the created node `(h β)` [after review 2]); the *first* cell + step's node is the head node of `B`. The step creates two new + application nodes, `(Y β)` and `((Y β) τ)`, and two new leaves `β, τ` — + **stream material**; * a **λ-step** `(λy.M) Q A⃗ → M[Q/y] A⃗`: the abstraction is (a copy of) a lambda of `B`; `Q` is `β`, `τ`, a copy of `S`, or a subterm of `B` (an *operand* bound by a handler lambda, or the argument of a *let*). @@ -426,77 +496,37 @@ distinct from `n_N`. Total ≥ 6 + 4 = 10. *(b) `F`.* `P_0 F → N` needs an `F` *value* at the right moment. `F` arises only as a syntactic `λa b.b` of `B` (6 bits, a lambda of `B`) or -from `P_j K → F`, where `K` is syntactic (6) or the first component of +from `P_j K → F`, where `K` is syntactic (7) or the first component of some `P_0`, delivered to a lambda of `B`. In either case the `n+1` cell steps of the surviving copy that are not cell–cell meetings are each caused by a contraction of a lambda of `B` (an `F`, a `K`, or a receiver of the cell), and we are in case (c). -*(c) Lambda walk* **[repaired after review 1]**. If no cell–cell meeting -occurs on the surviving path, each of its `n+1` cell contractions is caused -by a lambda of `B` (directly, or through an `F` it produced), and `F`-values -are at most `2L + c` in number, so for `n > 3|B|` some lambda of `B` is -contracted at least three times in `ρ_v`, hence copied at least twice; the -copies come from a nonlinear binder of `B`, and following the copying -relation among the finitely many lambdas of `B` gives a lambda whose copies -receive cells of different indices — a *walker*. - -Two facts hold at every level `i ≥ 1` of such a walk. First, the tail -`P_{i-1}` must itself be opened (T7), so it is the *function* of some -redex; its node cannot be a created node (a created node's function is -`(Y' β')` or `Y'`, and `Y' →* P_{i-1}` or `Y' β' →* P_{i-1}` would make -that node a cell applied to a bit or to a tail, i.e. a cell–cell step, -excluded here), so **the tail is bound by a lambda `λr` of `B` and applied -at a node of `B` whose function is a leaf `r` of that lambda** (`λr` 2, -`r` 2, node 2). Second, the bit must be tested: at `P_0` the walker -receives `K` and must return the bare `N`, at `P_i` it receives `F` and must -continue; a term that does not select on the bit either returns the tail -unapplied (no recursion) or applies `N` (a rigid head, fatal). The -selection is `b Z C` with `b` a leaf of a `λb` of `B` and **two** nodes of -`B`: the second cannot be a created node, because then the zero arm would -receive the tail as its argument and have to *be* `N` (it is syntax of `B` -with no access to `N` unless a `λr` bound it, which is the other case). -Third, the walker refers to itself: at least two leaves of a nonlinear -binder (one applied or passed, one passed on) and a node (`λf` 2, `f f` 6). -The cases are distinguished by where `λr` sits: - -* **(A) the walker takes `(β, τ)`**, `Y = λb r. b Z C`, and `C` applies - `r` to the next copy: `C = r f f`-like. Zero arm `Z = r` (the leaf, 2) - is the cheapest term returning `N` at the bottom. Pieces: `λb λr λf` (6), - `b`, `r`, `r`, `f`, `f` (10), four nodes — two selection nodes, `(r f)`, - `((r f) f)` — (8): **24**, and the forced binder order `b, r, f` (the - cell supplies `β` then `τ`, the copy comes third) puts `b` at index 2 and - both `r` at index 1: **≥ 28 with indices**. `Y = λb r f. b r (r f f)` - attains 28 and walks (checked: `(λf. P_n f f) Y →* N`, `n ≤ 5`). -* **(B) the walker takes the cell**, `W W = λr. r H`, and the cell's own - second created node applies the selection result to the tail, so - `H = λb. b Z (w w)`; at the bottom `K Z (W W) N → Z N` forces `Z N →* N` - with `Z` syntax of `B` not binding `N`: `Z = I` (4) is the cheapest. - Pieces: `λw λr λb` (6), `r`, `b`, `w`, `w` (8), nodes `(r H)`, two - selection nodes, `(w w)` (8), `I` (4): **26**, and `w` under `λr λb` - carries index 2 twice: **≥ 30 with indices**. `W = λw r. r (λb. b I (w w))` - attains 30 and walks (checked: `W W P_n →* N`, `n ≤ 5`). The 22-bit - `λw b. b I (w w)` is not a walker: `P_i (W W) →* (W W) P_{i-1}` hands the - tail to `W W` as an argument, and `W W P_{i-1} →* W W` loses it - (checked). - -So **every walker costs ≥ 28 bits of original syntax**, consumed or erased -in `ρ_v`, none of it a frame leaf. A walker must also be *started*: its -first copy is referenced from outside itself, so `B` contains a second -syntactic copy (≥ 28) or a nonlinear let `(λg. … g … g …) W` (`λg`, its -node, two leaves: ≥ 8) — in case (B) the let's `g g` is the only way to -form `W W` once. The dispatch cell's `s`-leaf (2; in case (B) its node may -be the walker's `(r H)` node, in case (A) the node `(s g)` is separate), the -`cont` leaf (4), the `next` leaf (3) and the output node `n_N` (2; the only -created node with argument `N` is `P_0`'s, whose function would have to be -`cont P_{n-1}`, i.e. the walker would carry `P_{n-1}` and `cont` down the -walk, ≥ 8 more) are disjoint from all of this. Hence a reader containing a -lambda walk has - - |B| ≥ 28 + 8 + 2 + 4 + 3 + 2 = 47, - -and the N-source in this case is ≥ 36, never 10. (The cheapest walker reader -I can write is 85 bits.) ∎ +*(c) Lambda walk — closed in Class S [after review 2].* In Class S no node +of `B` is ever duplicated (Lemma 2.7), so every lambda of `B` is +contracted at most once in `ρ_v`, every syntactic `F`, `K`, `I` is used at +most once, and the `K`'s produced by terminal cells number at most `c`. +Hence at most `|B| + c` cell openings on the surviving path are caused by +anything other than a cell–cell meeting, and for our `n` a meeting exists: +case (a) applies, and the N-source costs ≥ 10 with equality only for +`s s X`-shaped realizations. ∎ + +*Remark (outside Class S; not used in Theorem S).* For a general `B`, if +no cell–cell meeting occurs on the surviving path then, for `n` large +enough — the copy graph of a fixed `B` is finite, so without a cycle the +number of lambda contractions is bounded independently of `n` (a fixed +threshold such as `n > 3|B|` is *not* enough: finite compositions +`D^k G` with `D = λf t. f (f t)` give `2^k` openings) — some lambda of `B` +is applied to a copy of a lambda of its own copying cycle: a *walker*. +The review-1 case split (A)/(B) prices a walker's original syntax at +≥ 28 bits (`λb r f. b r (r f f)`, 28; `λw r. r (λb. b I (w w))`, 30; both +checked to walk; the 22-bit `λw b. b I (w w)` loses the tail), and a +reader using one appears to cost ≥ 47; but that accounting assumes the +walker's pieces are distinct from the other charged roles, which the +refutation of Lemma 2.7(ii) shows is not automatic (a copy of the walker's +selection node `(b r)` with `b := cont` *is* an output node). The cheapest +walker readers known are 76 bits (Codex) and 85 bits. This case is +conjectural. **Lemma 2.4 (zero-R-source).** Realizations of **z-R** and their costs: (i) a bound leaf (2) whose binder is a head-path `λr` contracted on `τ` @@ -520,21 +550,30 @@ dispatch cell's `τ` through its own second node (`n_P` = stream node), cost 0, requiring `V[envⁱ] →* cont`; (ii) a bound leaf `r` (2) bound to `τ` on the head path (counted in `d`) or inside `V` (2); (iii) `s F` or `s (λu r. r)` (≥ 10) or any other compound contracting a fresh copy of -the cell with a tail-returning `Y`; (iv) a rebuilt cell `λh. h F' P'` -with `F' →* F` and `P' →* P_{n-2}`: at least 2 + 4 + 2 + 2 + 2 = 12 bits -plus a second cell contraction to obtain `P_{n-2}` (≥ 4) — never -competitive. *Proof.* The output's `P_{n-1}` has a root lambda that is a -residual of a stream cell (then, the cell body being closed, the whole -`P_{n-1}` is that cell's residual, i.e. the tail of a contracted `P_n` -copy), or of a lambda of `B`, which is case (iv). ∎ +the cell with a tail-returning `Y`; (iv) [after review 2] a rebuilt cell: +a lambda `λh` of `B` whose body reduces to `h F P_{n-2}`, either an +η-expansion `λh. r h` of a bound tail (`λh`, node, `r`, `h`: ≥ 8 plus the +index of `r`, and it still needs the bound tail of (ii); the output cell's +body nodes are then *stream* nodes — `λh. r h →* P_{n-1}`, 53- and 60-bit +readers checked) or a literal `λh. h F' P'` with `F' →* F`, `P' →* P_{n-2}` +(≥ 12 plus a second cell opening). Both cost at least 6 more than the +bound leaf they replace, so no bound below changes. *Proof.* The output's +`P_{n-1}` has a root lambda that is a residual of a stream cell (then, the +cell body being closed, the whole `P_{n-1}` is that cell's residual, i.e. +the tail of a contracted `P_n` copy), or of a lambda of `B`, whose body +must become `h F P_{n-2}` — by applying a tail to `h` or by spelling the +cell out. ∎ **Lemma 2.6 (stream-node shortcuts).** A created node has argument a bit (`(Y β)`) or a tail (`((Y β) τ)`). The only roles a created node can take are: -(α) `n_P` = the second node of a cell step with `(Y β)ⁱ →* cont` — when -it is the dispatch cell, `V[envⁱ] →* cont`; then `n_N` is a node of `B` +(α) `n_P` = the second node of a cell step with `(Y β)ⁱ →* cont`. When it +is the dispatch cell, `V[envⁱ] →* cont` and `n_N` is a node of `B` applying `cont τ` to the N-source, necessarily the spine node of an -N-valued operand (it cannot lie inside `V`, which is the leaf `cont`); +N-valued operand (it cannot lie inside `V`, which is the leaf `cont`). +When it is **another** cell — a fresh `s`-leaf inside `V` or inside an +operand, applied to a `Y` with `Y β' →* cont` — this is shape (α′) of +§2.4 [after review 2]; (β) the first selection node, `((Y β') τ')` with `Y β' →* β`: `Y`'s hnf is `λb'. b'` or `λb'. b` (an outer bit); then `Z = τ'`, the zero arm cannot contain `next` (so `ν_z` is an operand and `n_R` its spine node), and `V` @@ -552,38 +591,39 @@ only the last node of `P_0`, Lemma 2.3(c)); as a meeting or consumer node it is priced in Lemma 2.3(a). *Proof.* By inspection of the two created node shapes and of what their function parts can reduce to (`cont`, `β`, `β Z`, a cell, `Q`); `(Y β)` with `Y →* β` or `Y →* S` gives (δ). ∎ -**Lemma 2.7 (copies do not help the inventory).** In the minimum `B`, -(i) a let on a single leaf, `(λy.M) Q` with `Q ∈ {s, next, cont}` at -depth `e`, has `Δ = (m−1)(|Q|) − 2m − 4 − f(M)` with `|Q| = 2+e, 3+e, -4+e`; it is negative for `Q = s` always, and otherwise only non-negative -when the leaf is used many times (`m ≥ 7` for `next`, `m ≥ 4` for `cont` -at depth 0). In those cases the let costs `4 + |Q| + 2m` while the -inventory below charges at most `|Q| + e' + 2(m−1)` for the roles its -uses can fill (one output leaf and consumer leaves), so the inventory -remains a lower bound; in all other cases leaves are never copied and -each charged leaf role is an original leaf. -(ii) the residuals of one copied application node all have β-equal -functions and β-equal arguments, since copies of a let argument are -substituted under the same binders. All roles charged within one -reduction have pairwise different (function, argument) signatures -(`n_P`: `(cont, P_{n-1})`; `n_N`: `(cont P_{n-1}, N)`; meeting node: -`(P_i, P_i)`; consumer: `(K N, X)`; the two selection nodes: -`(β, Z)`, `(β Z, V)`; the dispatch cell step: `(S, Y)`), so no two of them -are residuals of one node. Roles in different reductions may share syntax -only through the head path, operands and lets, which the shapes below -treat explicitly. The one mechanism that copies lambdas with *different* -arguments — a self-passing walker — is priced in Lemma 2.3(c). ∎ - -**Remark (forced depths).** Inside an arm the free leaves sit under all -the arm's own leading lambdas: an arm applied to `m` arguments it consumes -with lambdas has head normal form `λu₁ … u_m. body`, and by T10 the -arm's syntax cannot hide a free leaf above those lambdas through a let -(a let on a leaf shrinks; a let `(λy. λu⃗. … y …) Q` with `Q ∋ next` needs -`fl(Q) ≥ 4`, i.e. `|Q| ≥ 14`, far above the savings). Consuming an -argument by a data value instead of a lambda (`K`, `F`, `b`, `s s`, a cell -step) costs ≥ 4 instead of 2 and spares at most one bit of depth on each -free leaf of the arm — never cheaper than the lambda for the arms below, -whose free leaves number at most two. +**Lemma 2.7 (Class S: nothing of `B` is copied) [after review 2].** In a +stream-linear `B`, no application node, lambda or leaf of `B` has two +residuals at any point of `ρ_z` or `ρ_v`; hence every role charged in +§2.2 is realized by a distinct original node or leaf of `B`, and the +decomposition of §2.1 is an equality up to erased material. *Proof.* A +node of `B` is duplicated only when a binder with ≥ 2 occurrences is +contracted on an argument containing it. Stream lambdas are affine. +β-normality removes syntactic redexes, so a lambda of `B` is contracted +either at a created node (its argument is `β` or `τ`, stream material) or +at a node of `B` whose function is a bound variable holding a copy of a +lambda; in Class S the nonlinear binders are only ever contracted on `β` +or `τ`, so nonlinear contractions copy only stream material, and affine +contractions copy nothing. The leaves of a nonlinear tail binder `r` are +distinct original leaves. ∎ + +*Withdrawn [after review 2].* The former Lemma 2.7 claimed (i) that lets +on single leaves always shrink — false: a let on `s` at depth `e` has +`Δ = (m−1)e − 6 − f(M)`, positive for `m = 5, e = 2` — and (ii) that +copies of one application node have β-equal signatures — false under +higher-order sharing: in `(λf. f (f next cont) s) (λa b. a b)` both output +nodes descend from the one node `a b`, and a 98-bit valid reader realizes +`n_P`, `n_N` and consumed skip nodes from one source node with its only +redex at `Δ = +17` (Codex). Neither claim is needed in Class S. + +**Remark (depths and consumers).** In a β-normal `B` the free leaves of an +arm sit syntactically under the arm's leading lambdas, so their depth +charges are exact; outside Class S a hoist `(λy. λu⃗. … y …) Q` with +`fl(Q) ≥ 2` can have `Δ > 0` (`(λy. λa…h. y) (next cont)`, Δ = +2), and the +general case is open. Consuming an argument by a data value instead of a +lambda (`K`, `F`, `b`, `s s`, a cell step) costs ≥ 4 instead of 2 and +spares at most one bit of depth on each free leaf of the arm; the data +variant `Z = b (λu. u next)` is a valid 44-bit reader, one bit above the +minimum, as this predicts (checked). ## 2.4 The minimization @@ -613,13 +653,17 @@ argument, so `rest = (τ, T, …)` and `n_N` is the spine node of the operand operand**: a third element of `rest` would be a third argument of `cont`. The zero arm receives exactly `R` and `T⁰`. `n_R` cannot be `T`'s spine -node (`T⁰` would have to be `next`, but `T` is N-valued and `next`-valued -only if it contains a selection with its own bit source: ≥ 10 + 8 more -than a leaf). If `n_R` lay inside `T`, then `T⁰ →* R next` and `Z = λu t.t` -(6): `T` at depth 0 has no bound variables, so it pays a compound -`R`-source (≥ 10), `next` and `n_R` (5), the N-source (10) and a selection -with a bit source (`s K` or a cell with a lambda, ≥ 14): `|B| ≥ 12 + 2 + -39 + 6 + 5 ≥ 64`. Otherwise `Z` contains `n_R`, `ν_z`, and an `R`-source. `Z` +node (`T⁰` would have to be `next` while `Tⁱ` is `N`: `T` would contain a +selection on a bit it opens itself, ≥ 12, plus the N-source, so `|T| ≥ 25` +and `|B| ≥ 12 + 27 + |Z| + 5 ≥ 55`). If `n_R` lies inside `T` [after +review 2: corrected], then `T⁰ →* R next` and `Z = λu t. t` (6); `T` is +then a *dual arm-valued operand*: it opens its own cell (`s`-leaf and node, +4), tests the bit (`λb`, `b`, two nodes: 8), binds the tail for the +`R`-source (`λr`, `r`: 4), contains `n_R` (2) and `next` (≥ 5), and an +N-source (≥ 10): `|T| ≥ 33`, so `|B| ≥ 12 + 2 + 33 + 6 + 5 = 58` +(Codex's `T = s (λb r. b (r next) (r r r))`, 34 bits, gives a valid 59-bit +reader; the former claim of ≥ 64 assumed, wrongly, that a depth-0 operand +has no binders). Otherwise `Z` contains `n_R`, `ν_z`, and an `R`-source. `Z` consumes both arguments: two lambdas (4) above `ν_z`, or data consumers (≥ 4 each, Remark). So `ν_z` costs `3 + d + 2`, the `R`-source is a bound leaf (2; a compound would cost ≥ 10 by Lemma 2.4 (iv)), and @@ -635,6 +679,30 @@ Altogether with equality iff `d = 1`, `T = s s s`, `Z = λu r. r next`, `V = cont`: **the 165's reader, uniquely**. +### Shape (α′): `n_P` is the second node of a non-dispatch cell [after review 2] + +The cell is a fresh `s`-leaf `ℓ'` applied at a node of `B` to a term `Y'` +with `Y' β' →* cont`; the output's `P_{n-1}` is this cell's tail, and +`n_N` is a node of `B` applying `cont τ'` to an N-valued term `U` (≥ 10, +Lemma 2.3). The cheapest `Y'` is `λq. cont` (its `cont` is `κ_v`). + +* *The cell lies inside `V`.* `V` consumes the dispatch's `τ` (a lambda, + 2, or `d = 2`), contains `ℓ'` at depth ≥ 2 (4), its node (2), `λq` (2), + `κ_v` at depth ≥ 3 (7), `n_N` (2) and `U` (10): + `d = 1`: `|V| ≥ 2 + 4 + 2 + 2 + 7 + 2 + 10 = 29`, `|Z| ≥ 11`, + `|B| ≥ 12 + 11 + 29 = 52` (attained: Codex's + `s (λb. b (λr. r next) (λr. s (λq. cont) (r r r)))`, 52, checked); + `d = 2`: dispatch 15, `|Z| ≥ 9`, `|V| ≥ 4 + 2 + 2 + 7 + 2 + 10 = 27`, + `|B| ≥ 51` (attained: `s (λb r. b (r next) (s (λq. cont) (r r r)))`, 51, + checked). +* *The cell lies inside an operand `T`* (depth 0): `|T| ≥ 2 + 2 + 2 + 5 + + 2 + 10 = 23`; the selection result must return `Tⁱ` on the variable + stream (`V = λr t. t`, 6, or `V = t` with `d ≥ 2`), and `Z` consumes + `τ` and `T⁰` (≥ 13): `|B| ≥ 12 + 2 + 23 + 13 + 4 ≥ 54` (56 attained by + `s (λb r t. b (r next) t) (s (λq. cont) (s s s))`, checked). + +So (α′) gives `|B| ≥ 51`. + ### Shape (β): the first selection node is created, `Z` is a cell's tail The dispatch cell's `Y` has head normal form `λb'. b'` or `λb'. b`. @@ -686,9 +754,10 @@ different argument lists on the two streams (`A₅⁰ …` against `F P_{n-2} A₄ⁱ …`) and must distinguish them, which needs a lambda of `B` whose bound leaf heads a selection (≥ 8) — with the zero-side selector supplied by an operand (`K`, ≥ 6) or by a tail test — and must consume -`F` and `P_{n-2}` (≥ 4); the two cell steps cost 8. With `κ_v`, `ν_z`, -`n_R`, `n_P`, `n_N` (≥ 15) and the N-source (10): -`|B| ≥ 8 + 8 + 6 + 4 + 10 + 10 + 10 + 15 ≥ 71`. +`F` and `P_{n-2}` (≥ 4); the two cell steps cost 6 (`s s`: two leaves and +one node of `B`, the second cell opening at a created node [after review +2]). With `κ_v`, `ν_z`, `n_R`, `n_P`, `n_N` (≥ 15) and the N-source (10): +`|B| ≥ 6 + 8 + 6 + 4 + 10 + 10 + 10 + 15 ≥ 69`. ### Shape (γ): `n_P` and `n_N` are nodes of `B` @@ -771,28 +840,32 @@ itself, and `V` binds `t` or `d ≥ 3`) or has its own N-source and wastes `T`: `|V| ≥ (4 + d + e_V) + 2 + 2 + 2 + 2` with `e_V ≥ 1` or `d ≥ 2`; with `|Z| ≥ 12` and the operand's 12 and dispatch ≥ 12 this is ≥ 52. -### Depth-0 operands as role carriers +### Depth-0 operands as role carriers [after review 2: corrected] -An operand at depth 0 sees no bound variable, so any `R`, `P_{n-1}`, `N` -or bit it supplies is a compound (≥ 10 each, Lemmas 2.3–2.5 and `s K`), -and an operand serving a zero role and a variable role with different -values (a *dual* operand) contains a selection with its own bit source -(≥ 8 + 10). Moving a role out of an arm into such an operand therefore +An operand at depth 0 is a term over `s, next, cont` with its own binders. +Its useful values are priced by Lemmas 2.3–2.5: an `R`-, tail- or +`N`-valued compound costs ≥ 10, and `s F` (`R`, `P_{n-1}`) and `s s s` +(`R`, `N`) are 10-bit *dual* operands — the skip is the one the 165 uses. +An operand that is dual **arm-valued** (`R next` on the zero stream and a +`cont`-headed term, or `N`, on the variable stream) must open a cell and +test its bit itself: ≥ 12 for that, plus its payloads (≥ 33 in the shape +(α) sub-case above). Moving a role out of an arm into an operand therefore never lowers the bounds above, which already charge the cheapest -realization of every role. +realization of every role; the former sentence claiming every dual operand +needs fresh selection machinery was wrong. ### Extras -Each additional head-path cell step costs ≥ 4 and its `β', τ'` must be -bound or consumed (≥ 2); each head-path let costs `≥ 4 + |Q| ≥ 10` -(T10: a let needs `fl(Q) ≥ 2` or `|Q| ≥ 8`); a data dispatch (`s K …`) -costs 14 and forfeits the tail; none lowers the minimum realization cost of +Each additional head-path cell step costs ≥ 2 for its leaf (its node may be +created, as in `s s` [after review 2]) and its `β', τ'` must be bound or +consumed (≥ 2); lets do not occur in Class S; a data dispatch (`s K …`) +costs 15 and forfeits the tail; none lowers the minimum realization cost of any role, because every role is priced in leaves and nodes (≥ 2 each) and -in forced depths. So each extra only adds to the bounds above. +in syntactic depths. So each extra only adds to the bounds above. -**Conclusion of 2.4.** In the β-case `|B| ≥ 43`, with equality exactly for -the 165's reader (shape (α), `d = 1`, `T = s s s`, `Z = λu r. r next`, -`V = cont`). +**Conclusion of 2.4.** In the β-case, for stream-linear `B`, `|B| ≥ 43`, +with equality exactly for the 165's reader (shape (α), `d = 1`, +`T = s s s`, `Z = λu r. r next`, `V = cont`). ## 2.5 The τ-case @@ -817,41 +890,41 @@ and an N-source (≥ 10). Hence ## 2.6 Statement -**Theorem.** Every reader body — every term `B` over the frame -`[s, next, cont, intL, x]` with `B[Z_R/s] →* R next` and -`B[P_n/s] →* cont P_{n-1} N` for all `n ≥ 1`, with `R, N, next, cont, -intL, x` rigid — has `|B| ≥ 43`, and `|B| = 43` only for -`s (λb. b (λu r. r next) cont) (s s s)`. +**Theorem S [after review 2].** Every stream-linear reader body — every +β-normal term `B` over the frame `[s, next, cont, intL, x]` whose +nonlinear binders are contracted only on bits and tails, with +`B[Z_R/s] →* R next` and `B[P_n/s] →* cont P_{n-1} N` for all `n ≥ 1`, +with `R, N, next, cont, intL, x` rigid — has `|B| ≥ 43`, and `|B| = 43` +only for `s (λb. b (λu r. r next) cont) (s s s)`. For arbitrary reader +bodies the same bound is conjectured. The proof is the structure theorem (Part 1), the head-path decomposition -and role inventory (§2.1–2.3, Lemma 2.7), and the minimization -(§2.4–2.5). It is handwritten; the finite identities it uses are checked -by the scripts in `tools/`; the exact wire-cost formula it uses is the -Lean theorem `Blc.SelfintWireCost.wire_beta_delta`. Part 3 lists the steps -whose rigour is weakest. +and role inventory (§2.1–2.3, with Lemma 2.7 in its Class-S form), and the +minimization (§2.4–2.5), under the Class-S hypothesis stated in the status +section. It is handwritten; the finite identities it uses are checked by +the scripts in `tools/`; the exact wire-cost formula it uses is the Lean +theorem `Blc.SelfintWireCost.wire_beta_delta`. Part 3 lists the steps +whose rigour is weakest and what is only conjectured. # Part 3. What is proved, how, and where the argument is thin -## 3.1 Status by component +## 3.1 Status by component [after review 2] | component | status | |---|---| -| T1–T4 (free variables, open hnf `s A⃗`, symbolic hnf dichotomy, forced leaves) | handwritten, standard tools (solvability, Church–Rosser); the 165's symbolic hnf checked | -| T5 (no lambda-free body) | handwritten; the application table and the `P_n`-only closure checked for indices ≤ 6 and trees ≤ 5 leaves | -| T6–T9 (duplication, every cell opened, last cell, equal-index chains) | handwritten residual arguments; all finite identities checked | -| T10 (minimum has no shrinking redex; Δ formula) | the formula is Lean (`wire_beta_delta`), re-checked on 3000 random redexes; the minimality argument is one line | -| §2.1 decomposition, Lemma 2.1 (selection leaf) | handwritten residual tracing | -| Lemma 2.3 (N-source ≥ 10), cases (a), (b) | handwritten, tight | -| Lemma 2.3 (c) (self-passing walker: ≥ 28 per walker, reader ≥ 47) | handwritten two-case split, repaired after review 1 (see 3.2); the two attaining walkers checked — still the least formal step | -| Lemmas 2.4–2.6 (R-source, tail, stream-node shortcuts) | handwritten exhaustive lists of realizations | -| Lemma 2.7 (copies) | handwritten; relies on T10 and on the distinct signatures of the roles | -| §2.4 shapes (α), (β), (β′), (δ), (γ) and extras | handwritten arithmetic; the (γ1) operand cases written out per operand after review 1; every valid construction measured (`tools/menu.py` and inline checks) is ≥ its shape's bound | +| T1–T4 (free variables, open hnf `s A⃗`, symbolic hnf dichotomy, forced leaves) | handwritten, standard tools; unconditional | +| T5 (no lambda-free body) | handwritten; tables checked for indices ≤ 6, trees ≤ 5 leaves; unconditional | +| T6–T9 (duplication, every cell opened, last cell incl. `I`, equal-index chains) | handwritten residual arguments; finite identities checked; unconditional (T7's intact-copy sentence qualified) | +| T10 (minimum has no shrinking redex; Δ formula) | Lean formula; unconditional; its *consequences* claimed in the old Lemma 2.7(i)/Remark are withdrawn | +| Class S (Lemma 2.7: nothing copied) | handwritten, short; the hypothesis of Theorem S | +| §2.1 decomposition, Lemma 2.1 | handwritten residual tracing; cell steps may occur at created nodes (corrected) | +| Lemma 2.3 (a) N-source ≥ 10 | handwritten, tight; in Class S the only case | +| Lemma 2.3 (c) walkers | **remark only**, conjectural outside Class S | +| Lemmas 2.4–2.6 (R-source, tail incl. η-rebox, stream-node shortcuts incl. (α′)) | handwritten realization lists; Codex's three structural witnesses now covered | +| §2.4 shapes (α), (α′), (β), (β′), (δ), (γ) and extras | handwritten arithmetic; every valid construction measured by me and by both reviewers is ≥ its shape's bound | | §2.5 τ-case ≥ 52 | handwritten, coarse | +| Unconditional 43-bit bound | **conjecture**; evidence: three independent efforts found no reader below 43, cheapest non-Class-S readers 55/76/85/98 | -No Lean was written in this lane: the statements pinned down enough to -formalize (the application tables, T5) are finite-instance checks of -small value, and the load-bearing steps (residual tracing over all -reductions, the inventory) would need a formalization of residuals that -does not exist in `lean/Blc`. +No Lean was written in this lane. ## 3.2 Where a reviewer should push @@ -902,23 +975,22 @@ does not exist in `lean/Blc`. The precision note on `d` (a head-path let whose argument contains the selection does not enclose it) is closed in §2.1 by T10 pricing. -## 3.3 Residual cases +## 3.3 Residual cases [after review 2] -With the caveats of 3.2, I do not have a residual *class* of reader bodies -outside the theorem: the decomposition covers every term (compressed or -not, any arity, any operand, both dispatch heads), because it is driven by -the head reduction of `B[S]` and by residual tracing rather than by the -syntax of `B`. The residual risk is in the rigour of the listed steps, not -in an identified family of terms. The honest summary: +Inside Class S I do not have a residual *class* of reader bodies outside +Theorem S; the residual risk is the rigour of the realization lists +(3.2 item 1) and of the shape arithmetic. Outside Class S, everything is +residual: readers with a β-redex (lets, hoists), readers whose nonlinear +binders receive operands or let arguments (higher-order sharing, finite +composition), and self-passing walkers. For these the inventory gives +heuristic bounds only (Lemma 2.3's remark, the withdrawn Lemma 2.7), and +the known constructions are 55, 76, 85 and 98 bits. -* **Fully covered with tight arithmetic:** shape (α) — every reader whose - variable output node `cont P_{n-1}` is the stream's own node (this is - the 165's mechanism; the 165 is the unique minimum there). -* **Covered with margin ≥ 3:** shapes (β), (γ) including its operand - cases, the τ-case, chains, lets, data dispatch. -* **Covered with large margin but coarser reasoning:** self-passing - walkers (Lemma 2.3 (c), ≥ 47 by a two-case piece count), rebuilt cells - (Lemma 2.5 (iv)). +* **Fully covered with tight arithmetic (Class S):** shape (α) — the 165's + mechanism; the 165 is the unique minimum there. +* **Covered with margin ≥ 3 (Class S):** shapes (α′), (β), (β′), (δ), + (γ) with its operand cases, the τ-case, chains, data dispatch. +* **Conjectural:** every reader body outside Class S. ## 3.4 Relation to the earlier bounds @@ -931,26 +1003,37 @@ inside `V` (`t X` for `s s`); the neutral-operand domination is the lambdas, arities `k ≠ 2`, head redexes, and the tail-headed dispatch — the open list in the lane prompt — are the rows of (β), (γ) and §2.5. -## 3.5 Honest read - -The reader is optimal because its three mechanisms are each at their -floor and share everything that can be shared: the stream's own second -node is the variable output's first application (shape (α) is the only -way to get an output node for free), the skip `s s s` is the cheapest -N-source (Lemma 2.3) and its zero value happens to be the tail, so one -operand serves both arms, and the zero arm then pays exactly for the two -lambdas that consume what the variable arm uses. Every alternative in the -inventory pays at least 3 more bits. - -Where a sub-165 could still hide is therefore **not in the reader with -the 165's knot and NEXT fixed**: it would have to change the laws — a -different `next` protocol (the zero arm's `r next` is the only place -`next` is used, and the reader never exploits what `next` does), a reader -that hands NEXT something other than the raw remaining stream, or a fusion -of the reader's self-application `s s` with the knot (the reader already -contains the only self-application the knot needs). The next proof step -that would make this record-grade is to formalize residual tracing for -the two reader laws in Lean (origins and fates of nodes, as -`SelfintOrigins.lean` does for quotation-origin binders) and to discharge -Lemma 2.3 and Lemma 2.7 from it; the arithmetic of §2.4 would then be a -finite check over realization patterns. +## 3.5 Honest read [after review 2] + +Within stream-linear readers the picture is exactly as before: the reader +is optimal because its three mechanisms are each at their floor and share +everything that can be shared — the dispatch cell's own second node is the +variable output's first application (shape (α) is the only way to get an +output node for free from the dispatch cell; a second cell costs ≥ 8 more, +shape (α′)), the skip `s s s` is the cheapest N-source and its zero value +is the tail, so one operand serves both arms, and the zero arm pays exactly +for the two lambdas that consume what the variable arm uses. Every +alternative in the inventory pays at least 3 more bits. + +The full theorem could not be rescued tonight. Codex's refutations are +of the *proof*, not of the bound: lets with positive Δ, shared +higher-order combinators and walkers all exist as valid readers, all far +above 43, and nobody found anything below. What a proof for them needs is +a quantitative sharing argument — that a let or a passed lambda, which +costs its scaffolding (`λ`, node, leaves) and gains copies of a value or +a function, cannot reduce the total of the role inventory below 43 — +rather than the signature argument I gave. The right tool is probably +not residual tracing on source nodes at all but a cost measure on the +*hnf of `B[S]`* that is monotone along the head reduction and already +≥ 43 on every hnf satisfying the two laws; I did not find such a measure. + +Where a sub-165 could still hide is therefore unchanged in substance: +**not in a stream-linear reader with the 165's knot and NEXT fixed**, and +— on the evidence, though not by proof — not in a reader with sharing or +walkers either. It would have to change the laws: a different `next` +protocol, a reader that hands NEXT something other than the raw remaining +stream, or a fusion of the reader's self-application `s s` with the knot. +The next proof step is the sharing argument above, or a Lean +formalization of residual tracing for the two reader laws from which the +Class-S lemmas follow mechanically and the remaining cases become +explicit. diff --git a/data/self-interpreter/reasoning_floor/reader-proof/REPORT.review1.md b/data/self-interpreter/reasoning_floor/reader-proof/REPORT.review1.md new file mode 100644 index 00000000..53207c82 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/reader-proof/REPORT.review1.md @@ -0,0 +1,956 @@ +# Lane reader-proof: the 165's reader is optimal for every reader shape + +Lane directory: `tmp/overnight/reader-proof/`. Everything here is new to +this lane except where a document in `docs/classical/self-interpreter/` or a +Lean module is cited. No tracked repository file was modified by this lane (the modified and +untracked files `git status` shows under `docs/`, `lean/` and `data/` belong +to other lanes); nothing was committed; no reader bodies were enumerated. Mechanical checks: +`tools/rt.py` (toolkit), `tools/algebra.py` (data-algebra tables), +`tools/symbolic.py` (symbolic-stream head normal forms), `tools/menu.py` +and inline runs (valid alternative readers and their sizes), +`splice/*.lam` with `tools/self-interpreter/battery.py` (complete +interpreters), each a few seconds, two threads. + +## Summary + +**Theorem (handwritten, with checked finite identities).** With the +165's knot and NEXT region fixed, every reader body `B` in the frame +`[s, next, cont, intL, x]` satisfying the two reader laws + + B[cons K R / s] →* R next + B[1ⁿ0 ++ N / s] →* cont (1ⁿ⁻¹0 ++ N) N (n ≥ 1) + +with `next, cont, intL, x, R, N` independent and rigid has `|B| ≥ 43`, +and `|B| = 43` only for the 165's `s (λb. b (λu r. r next) cont) (s s s)`. +No restriction on `B` is assumed: any arity, any operands (bare `next`, +bare `cont`, operands with lambdas), bodies with head redexes or any +internal redexes, bodies whose head is reached only after reduction, and +both dispatch heads (bit selection and tail dispatch) are covered. + +The proof is uniform in the sense the lane asked for: it is driven by what +the two laws force every reduction to *do* (a structure theorem, Part 1), +by a decomposition of any body along the head reduction of the symbolic +stream `λh. h β τ` into dispatch, zero arm, variable arm and operands +(§2.1), and by an inventory of roles each priced at its cheapest +realization (§2.2–2.3); the case analysis that remains is over four +*shapes* of how stream-created nodes can stand in for nodes of `B` +(§2.4), not over reader syntax. Shape (α) — the variable output's first +application is the stream's own node — is where the 165 lives and is +priced exactly (`41 + 2d`, so 43 at depth 1); the other shapes are ≥ 46. +Part 3 lists the steps whose rigour is weakest; the least formal is the +self-passing-walker bound (Lemma 2.3(c)), now a two-case split giving +≥ 47 for any reader with a lambda walk (cheapest construction 85). + +### 1. Complete interpreters built + +No sub-165 claim. To confirm that the two reader laws are exactly what the +interpreter contract needs in the 165's frame, five readers were spliced +into the 165 (`splice/*.lam`) and run through the exact battery +(`python3 tools/self-interpreter/battery.py FILE`, 2 threads): + +| file | reader | idea | battery | +|---|---:|---|---| +| `r165_control.lam` | 43 | the 165 | `165 bits ok=667 skip=1 fail=0` | +| `r46_k1.lam` | 46 | arity 1, nonlinear tail: `s (λb r. b (r next) (cont r (r r r)))` | `168 bits ok=667 skip=1 fail=0` | +| `r58_tau.lam` | 58 | tail-headed dispatch: `s (λb r. r (b next (λb' t. cont r (r r t))))` | `180 bits ok=667 skip=1 fail=0` | +| `r50_tnext.lam` | 50 | bare `next` operand: `s (λb r. b r (λt. cont r (r r t))) next` | `172 bits ok=667 skip=1 fail=0` | +| `r49_betashortcut.lam` | 49 | created selection node, zero arm is a tail: `s I (λt. cont (s F) (s s t)) next` | `171 bits ok=667 skip=1 fail=0` | + +Each measures `165 + (reader − 43)`, as the frame is otherwise unchanged. +About thirty further valid reader bodies (every pattern of the inventory, +including a `(λy. y y)`-compressed head, a self-passing walker at 85 bits, +chains, lets, data dispatch) were checked against the reader laws on +actual streams `n = 1..5` (`tools/menu.py` and inline runs); all are ≥ 43 +and each is at or above the bound its shape receives in §2.4. + +### 2. New exact identities + +* Symbolic stream `S = λh. h β τ` (`β, τ` rigid): `s K →* β`, + `s F →* τ`, `s s →* β β τ τ`, `s s s →* β β τ τ S`, + `s (s s) →* β β τ τ β τ`; the 165's body has symbolic head normal form + `β (λu r. r next) cont τ (S S S)` (checked). Every reader body's + `B[S]` has head normal form `β A₁ … A_k` (`k ≥ 2`) or `τ A₁` (T3). +* `s F` is the uniform tail (`R` on the zero stream, `P_{n-1}` on variable + streams); `s K` is the uniform bit. +* Cell–cell chains alternate roles, `P_i P_j → P_{j-1} P_{i-1}`; they end + in `K N` iff `i = j`, and otherwise in `I` (suffix erased) or in an + `N`-headed neutral, according to the parity of `|i − j|` (T9, checked + for `i, j ≤ 6`). Application-only trees over copies of one `P_n` and + rigid leaves normalize only to `P_n`, `K N`, or rigid-headed neutrals + (checked exhaustively for ≤ 5 leaves). +* The exact wire-cost change of a β-step, `Δ = (m−1)|Q| + (fl(Q)−1)·D − + 2m − 4 − f(M)` (Lean, `wire_beta_delta`), re-derived and re-checked; its + consequence for a minimum reader body (no shrinking redex) is T10. + +### 3. Lower bounds proved + +The theorem above (Part 1 + Part 2), with the status table in §3.1: all +handwritten; finite identities checked; one Lean theorem used. The earlier +27/31/35-bit handler bounds appear as rows of the inventory (§3.4). + +### 4. Honest read + +§3.5: the reader is optimal because its three mechanisms are each at their +floor and share exactly what can be shared; a sub-165 cannot be found by +changing the reader under the 165's laws. The next proof step is a Lean +formalization of residual tracing for the two reader laws, from which +Lemma 2.3 (N-source) and Lemma 2.7 (copies) would follow and the +arithmetic of §2.4 would become a finite check. + +--- +# Part 1. Setting and the uniform structure theorem + +## 1.1 Setting + +Frame `Γ = [s, next, cont, intL, x]`, innermost first; a leaf `s` costs 2 +bits at depth 0, `next` 3, `cont` 4, `intL` 5, `x` 6, and every enclosing +lambda adds one bit to a free leaf. For any term `|M| = 2L + 4A + 2 + X` +(`L` lambdas, `A` applications, `X` the sum of 0-based indices). + +Data. `K = λa b.a`, `F = λa b.b`, `I = λa.a`, `cons b r = λh. h b r`. +`Z_R = cons K R` (the zero stream, rigid tail `R`), +`P_0 = cons K N`, `P_{i+1} = cons F P_i` (so `P_n = 1ⁿ0 ++ N`), `Q = K N`. +`R, N` are fresh rigid variables, as are `next, cont, intL, x`. + +A **reader body** is a term `B` with free variables in `Γ` such that + + (Z) B[Z_R / s] →* R next + (V_n) B[P_n / s] →* cont P_{n-1} N for every n ≥ 1. + +(The brief writes `=β`; the right-hand sides are β-normal, so by +Church–Rosser `=β` is the same as `→*`.) The 165's body is +`s H (s s s)`, `H = λb. b (λu r. r next) cont`, 43 bits (L 3, A 7, X 7). + +**Claim to prove: every reader body has `|B| ≥ 43`.** + +Throughout, "handwritten" means a proof written here; "checked" means a +specific finite identity was run through the normalizer +(`tools/rt.py`, `tools/algebra.py`, `tools/symbolic.py`, `tools/menu.py` in +this lane directory). Nothing in this lane enumerates reader bodies. + +## 1.2 The structure theorem (every reader body) + +**T1 (free variables).** If `B` is a reader body, so is `B[next/intL, +next/x]`, and it is strictly smaller when `intL` or `x` occurs. *Proof.* +Rigid variables absent from both required outputs can be renamed to any +other rigid variable: substitute `next` for `intL` throughout a reduction +`B[Z_R] →* R next`; every step stays a β-step and the target is unchanged. +A leaf `intL` or `x` costs at least two bits more than `next` at the same +depth. ∎ Hence a minimum reader body has free variables among +`s, next, cont`, and we assume this from now on. + +**T2 (open head normal form).** `B` is solvable and its head normal form +is `s A₁ … A_k` with `k ≥ 1` and no leading lambda. *Proof.* `B[Z_R]` +has a normal form, so it is solvable, so `B` is (an instance of an +unsolvable term is unsolvable). Write the hnf `λy⃗. h A⃗`. A leading lambda +would make `B[Z_R]` reduce to an abstraction, which cannot reduce to +`R next`. So `h ∈ Γ`. If `h ≠ s`, both instances keep the rigid head `h`, +but the zero output has head `R`. So `h = s`; and `k = 0` gives +`B[Z_R] = Z_R`, an abstraction. ∎ + +**T3 (symbolic first cell).** Let `S = λh. h β τ` with fresh rigid +`β, τ`, and for a term `U` over `β, τ, next, cont` write +`U⁰ = U[K/β, R/τ]` and `Uⁱ = U[F/β, P_{n-1}/τ]`. Then `B[S/s]` has a +head normal form of exactly one of the two shapes + + (β-case) β A₁ A₂ … A_k, k ≥ 2, with + A₁⁰ A₃⁰ … A_k⁰ →* R next, A₂ⁱ A₃ⁱ … A_kⁱ →* cont P_{n-1} N; + (τ-case) τ A₁, with + A₁⁰ →* next, A₁ⁱ F P_{n-2} →* cont P_{n-1} N (n ≥ 2), + A₁ⁱ K N →* cont P_0 N (n = 1). + +The `A_j` may contain copies of `S`. *Proof.* `B[Z_R] = (B[S])⁰` and +`B[P_n] = (B[S])ⁱ`, so `B[S]` is solvable with a lambda-free hnf `h A⃗`, +`h ∈ {β, τ, next, cont}`. A rigid `next`/`cont` head survives both +instantiations and is wrong for the zero law. If `h = τ`: the zero +instance is `R A₁⁰ … A_k⁰`, forcing `k = 1` and `A₁⁰ →* next` (`next` is +normal); the variable instance is `P_{n-1} A₁ⁱ → A₁ⁱ F P_{n-2}` (or +`A₁ⁱ K N` when `n = 1`). If `h = β`: the zero instance `K A₁⁰ A₂⁰ …` +needs `k ≥ 2` (else it is an abstraction) and reduces to +`A₁⁰ A₃⁰ … A_k⁰`; the variable instance reduces to `A₂ⁱ A₃ⁱ … A_kⁱ`. ∎ + +Checked: the 165's body has symbolic hnf `β Z cont τ (S S S)` with +`Z = λu r. r next`, and the two instantiations reduce to the required +outputs (`tools/symbolic.py`). Also `s K →* β`, `s F →* τ`, +`s s →* β β τ τ`, `s (s s) →* β β τ τ β τ`: the bit, the tail, and the +skip are all data operations on the symbolic cell. + +**T4 (forced leaves).** `B` contains at least one leaf each of `s`, +`next`, `cont`; hence `X ≥ 3` and `A ≥ 2`. *Proof.* Reduction never creates +a free variable; `next` and `cont` occur in the outputs; `s` heads the hnf +of T2. ∎ + +**T5 (no lambda-free body).** `L ≥ 1`. *Proof.* A lambda-free `B` is an +application tree with head `s` (T2) and leaves in `{s, next, cont}`. +Substitute `P_n` for every `s` and normalize innermost-first using the +application table (checked for indices ≤ 6 in `tools/algebra.py`): + + P_n P_n →* Q, P_n Q → N P_{n-1}, Q V → N, + P_n (z A⃗) → z A⃗ F P_{n-1}, (z A⃗) V = z A⃗ V (z rigid). + +Every subtree normalizes to `P_n`, to `Q`, or to a rigid-headed neutral: +the only functional values generated from copies of a single `P_n` are +`P_n` and `Q`, because `F`, `I`, `K`, and lower cells arise only from +`F`-, `K`-, or `I`-arguments or from cells of unequal index, none of which +is available (checked exhaustively for trees with ≤ 5 leaves, n = 3). A +`cont`-headed neutral receives its first argument either from an explicit +subtree, whose value is `P_n`, `Q`, or a neutral, never `P_{n-1}`, or from +`P_n (cont …) → cont … F P_{n-1}`, where `F` precedes `P_{n-1}`. So no +normal form `cont P_{n-1} N` is reachable, contradicting `(V_n)`. ∎ + +**T6 (the suffix is duplicated).** In `B[P_n]` the rigid `N` occurs once +per `s`-leaf of `B`; in the output it occurs twice (inside `P_{n-1}` and +bare). Every lambda of the stream (`λh`, `K`, `F`) binds its variable at +most once, so the only sources of duplication are: `s` occurring at least +twice in `B`, or a lambda of `B` whose binder occurs at least twice and +which is contracted on an argument containing `N`. In particular **either +`s` occurs ≥ 2 times in `B`, or `B` has a nonlinear binder**. + +**T7 (every cell is opened).** Fix the copy of `N` that ends bare in the +output of `(V_n)` and follow it backwards. The `n+1` cell lambdas +`P_n, …, P_0` of its copy of the stream enclose it initially; an enclosing +lambda disappears only when that lambda is contracted. So every reduction +realizing `(V_n)` contracts (a descendant of) every one of these `n+1` +cells. The same holds for the copy whose `P_{n-1}` survives intact: its +`P_n` is contracted. + +**T8 (the last cell).** The final cell `P_0 = λh. h K N` on the surviving +path is contracted on some argument `Y`: `P_0 Y → Y K N`. Checked table: +`P_0 P_0 → Q`; `P_0 F → N`; `P_0 K → K` (erases `N`); `P_0 P_j → I` +for `j ≥ 1` (erases `N`); `P_0 (rigid neutral)` traps `N` as an argument +of that neutral forever. Hence **`Y` is `P_0`, `F`, or a descendant of a +lambda of `B`**. Since the output has `N` as an argument of `cont`, a +reduct `N X` (head `N`) is also fatal. + +**T9 (cell–cell chains).** If two cells meet, `P_i P_j`, the chain is +forced and the two sides alternate roles: +`P_i P_j → P_j F P_{i-1} → P_{j-1} P_{i-1}` (both indices `≥ 1`); at the +bottom `P_0 P_0 → Q`, `P_0 P_j → I` (`j ≥ 1`, `N` erased), +`P_j P_0 → N P_{j-1}` (`j ≥ 1`, `N` trapped as a rigid head, which no +reduction can turn into an argument). So a meeting with unequal indices is +fatal (which of the two deaths occurs depends on the parity of `|i−j|`), +a cell–cell meeting on the surviving path has **equal indices**, and the +chain then ends in `Q = K N`, which yields `N` only when applied to one +more argument. (Checked for all `i, j ≤ 6`, `tools/algebra.py`.) + +**T10 (minimal counterexample is non-shrinking).** Suppose a reader body +below 43 bits exists and take one of minimum size. Contracting any redex +gives a β-equal term, hence another reader body, so every redex +`(λv.M) Q` of the minimum has `Δ ≥ 0`, where (Lean: +`Blc.SelfintWireCost.wire_beta_delta`; re-checked here on 3000 random +redexes) + + Δ = (m−1)|Q| + (fl(Q)−1)·D − 2m − 4 − f(M), + +`m` the number of occurrences of `v` in `M`, `D` the sum over them of +the number of lambdas of `M` above the occurrence, `fl(Q)` the number of +free-variable leaves of `Q`, `f(M)` the number of leaves of `M` free in +`λv.M` (frame variables included). Consequences: no erasing redex +(`m = 0` gives `Δ < 0`); a linear redex needs `fl(Q) ≥ 2` and +`(fl(Q)−1)·D ≥ 6 + f(M)`; a redex with `m = 2` needs +`|Q| + (fl(Q)−1)·D ≥ 8 + f(M)`, with `m = 3` needs +`2|Q| + (fl(Q)−1)·D ≥ 10 + f(M)`. +# Part 2. The head-path decomposition and the role inventory + +The structure theorem says what every reader body computes; this part +says what syntax it must therefore contain. The method is residual +tracing: in any β-reduction every lambda, application and leaf of a reduct +descends from a unique node of the initial term, copies of one node share +that origin, and a node is *consumed* when its residual is the redex (for +an application) or the contracted abstraction (for a lambda), *erased* +when it lies inside the argument of a vacuous contraction, and *surviving* +when its residual is in the output. The stream's own lambdas (`λh`, `K`, +`F`) are affine, so **only lambdas of `B` ever copy anything**. + +Fix a minimum reader body `B` (T10), free variables in `{s, next, cont}` +(T1), and fix reductions `ρ_z : B[Z_R] →* R next` and +`ρ_v : B[P_n] →* cont P_{n-1} N` for one `n` larger than three times the +number of nodes of `B`. "A node of `B`" always means a node of the +original syntax of `B`; the stream copies substituted for the `s`-leaves +are *stream material*, not nodes of `B`. + +## 2.1 The head path and the selection + +Head-reduce `B[S]` (T3). The head steps are of two kinds: + +* a **cell step** `S Y A⃗ → Y β τ A⃗`: the head is a copy of `S`, i.e. the + residual of a leaf of `B` that is `s` or is a bound variable whose binder + was contracted on a copy of `S`; the redex node is an application node + of `B`. The step creates two new application nodes, `(Y β)` and + `((Y β) τ)`, and two new leaves `β, τ` — **stream material**; +* a **λ-step** `(λy.M) Q A⃗ → M[Q/y] A⃗`: the abstraction is (a copy of) a + lambda of `B`; `Q` is `β`, `τ`, a copy of `S`, or a subterm of `B` + (an *operand* bound by a handler lambda, or the argument of a *let*). + +The head reduction stops at `β A₁ … A_k` (β-case) or `τ A₁` (τ-case). + +**Lemma 2.1 (the selection leaf).** In the β-case the head `β` was +created by a cell step as the argument of the stream node `(Y β)`, and it +reaches head position in one of two ways: **(i)** `Y`'s head normal form +is `λb. b …` — a lambda of `B` binds it and the body's head is that +binder's leaf `b` (a node of `B`; `K = λa b.a` is an instance with leaf +`a`) — or **(ii)** `Y` reduces to a copy of `S`, so the cell is applied to +the bit: `S β → β β' τ'`, the binder is the cell's own `λh`, and the two +hnf arguments `A₁, A₂` are the created `β', τ'` (shape (δ) of Lemma 2.6). +In case (i) the two selection nodes `(β A₁)`, `((β A₁) A₂)` are nodes of +`B`, except that one of them may be a created node `((Y' β'') τ'')` with +`Y' β'' →* β` or `→* β A₁` (shapes (β), (β′) of Lemma 2.6). *Proof.* A +created `β` is the argument of its node `(Y β)`; it becomes the head only +if `Y β →* β …`, i.e. `Y`'s hnf is `λb. b …` or `Y →* S` (then +`S β → β β' τ'`); a term over `β', τ', next, cont` and `S`-copies with +hnf head the *argument* `β` must be an abstraction binding it, and the only +abstractions available are lambdas of `B` and the cell's `λh`. A node +whose function residual is `β` or `β A₁` is a node of `B` unless it is a +created node whose function `(Y' β'')` reduces to it. ∎ + +So in case (i) every reader body contains, on its head path, a cell step +(an `s`-leaf or `S`-valued leaf, 2 bits, plus its application node, 2), +a dispatch lambda `λb` (2), its leaf `b` (2), and the two selection nodes +(4; 2 when one is created). Call this the **dispatch**, cost ≥ 12 (≥ 10 +in the created-node shapes). Case (ii) is priced separately in §2.4. + +**Depth [repaired after review 1].** Let `d` be the number of lambdas of +`B` that enclose the selection node and are contracted on the head path; +`λb` is one of them, so `d ≥ 1`, and every free leaf `s, next, cont` inside +the arms pays `d` extra bits. A head-path λ-step `(λy.M) Q` whose +abstraction does *not* enclose the selection is a let with the selection +inside `Q`: the head then continues through `y` at the head of `M`'s hnf +(`M = λz₁ … z_D. y A⃗`, the `λz` binding `D` operands first), and T10 forces +`fl(Q) ≥ 2` and `(fl(Q)−1)·D ≥ 6 + f(M)` when `y` occurs once (so `D ≥ 1`, +and the scaffolding `λy`, its node, the `λz`'s and the leaf `y` costs +`6 + 3D ≥ 9`, with `D ≥ 3` whenever `fl(Q) ≤ 3`, i.e. ≥ 15), or +`|Q| + (fl(Q)−1)·D ≥ 8 + f(M)` when `y` occurs twice (scaffolding ≥ 8). Such +a let contributes nothing to the arms' depth and is additive to every +cost below (its `Q` is the handler, whose dispatch and arms are charged +as usual, and its `A⃗` are operands); it therefore only raises the bounds. +Below, "operand" means a head-path argument subterm not containing the +selection, and `Z, V` lie in the bodies of all `d` enclosing lambdas. + +**Definition (arms, operands, environment).** `Z` (zero arm) and `V` +(variable arm) are the subterms of `B` at the two argument positions of +the selection node. The **operands** are the subterms of `B` at argument +positions along the head path that are not `Z`, `V` (handler operands and +let arguments). The **environment** at the selection is the set of bound +variables in scope with their values on the two streams: `b ↦ (K, F)`; +`r ↦ (R, P_{n-1})` if a lambda bound the dispatch cell's `τ`; an operand +or let variable `t ↦ (O⁰, Oⁱ)`; a second cell's `b', r'`; and the free +`s ↦ (Z_R, P_n)`. The **rest** is the list of arguments applied to the +selection result: the dispatch cell's `τ` if unbound, then the unbound +operands. The laws read + + Z[env⁰] rest⁰ →* R next, V[envⁱ] restⁱ →* cont P_{n-1} N. + +In `ρ_z` the whole of `V` is erased (`K Z V → Z`), in `ρ_v` the whole of +`Z` is erased. Hence **a node or leaf inside `Z` plays a role only in +`ρ_z`, one inside `V` only in `ρ_v`; only head-path syntax, operands and +let arguments can serve both reductions.** + +**Decomposition.** Since `Z`, `V`, the operands, the head-path leaves and +lambdas, and the selection nodes are pairwise disjoint pieces of the +syntax of `B`, + + |B| ≥ dispatch + Σ_operands (2 + |O|) + Σ_{other head λ} 2 + |Z| + |V|, + +with equality when `B` has no further head-path material (copies made by +nonlinear binders cost nothing extra, which is why this is an inequality +in general). + +## 2.2 The roles + +The two outputs force the following **roles**, each realized by specific +syntax of `B`; two roles whose realizations must be distinct nodes or +leaves of `B` (because they are simultaneously present with different +fates in one reduction, or because one lies in `Z` and the other in `V`) +are charged separately. + +In `ρ_z` (zero): + +* **z-out**: the output node `R next` is a node `n_R` of `B` (a stream + node has argument `K`, `R`, `F`, or a cell, never `next`). It survives. + Either it lies inside `Z`, or it is the spine node of an operand `O` with + `O⁰ →* next` and `Z[env⁰] rest'⁰ →* R`. +* **z-next**: the output leaf `next` is a leaf `ν_z` of `B` (3 bits plus + its depth), surviving in `ρ_z`. +* **z-R**: the function of `n_R` reduces to `R`. `R` enters only as the + tail of a contracted zero cell `Z_R Y → Y K R`. It reaches the function + position of `n_R` either as the value of a bound leaf (`r` from a + head-path `λr`, or `u` from a lambda inside `Z` that receives the + unbound `τ` or an `R`-valued operand), or as the value of a compound + subterm (`s s X`, `s F`, …) placed at that position or bound to a leaf. + +In `ρ_v` (variable): + +* **v-cont**: the output leaf `cont` is a leaf `κ_v` of `B` (4 bits plus + depth), surviving. +* **v-N**: the bare `N` is produced by an **N-source** (Lemma 2.3), whose + syntax is consumed or erased in `ρ_v`. +* **v-P**: the output node `cont P_{n-1}` is `n_P`: either a node of `B` + inside `V` (or a spine node), or the second node `((Y β) τ)` of the + dispatch cell, which requires the selection result on the variable + stream to reduce to `cont` before `τ` is applied and `τ` to be unbound. +* **v-N-node**: the output node `(cont P_{n-1}) N` is `n_N`, a node of + `B` (inside `V`, or the spine node of an N-valued operand); the only + stream node with argument `N` is the last node of `P_0`, and Lemma 2.3 + shows that using it costs more than any realization below. +* **v-tail**: the intact `P_{n-1}` is the tail of the dispatch cell + delivered through `n_P` when `n_P` is the stream node, or the value of a + bound leaf `r`, or a compound (`s F`, a rebuilt cell). + +Shared: **dispatch** (2.1), and **consumption**: every element of `rest` +is applied to the selection result in *both* reductions; an arm that does +not use it must still consume it, by a lambda of its own (2 bits, which +also deepens the arm's free leaves) or by a data selector. + +## 2.3 Resource lemmas + +**Lemma 2.3 (N-source ≥ 10).** The syntax of `B` producing the bare `N` +of `ρ_v` costs at least 10 bits and consists of at least three leaves and +two application nodes, none of which survives in the output; the bound is +attained only by `s s X`-shaped realizations: two leaves whose values are +cells of equal index, their meeting node, a consumer node and its argument +leaf `X` (any leaf). *Proof.* By T7–T9 the surviving copy's last cell is +contracted on `P_0`, `F`, or a descendant `Λ` of a lambda of `B`. + +*(a) Cell–cell.* There is a first meeting redex `P_i P_i` (equal indices +by T9). Its node is a node of `B` whose two argument subtrees contain two +distinct leaves (two `s`-leaves, or bound leaves whose values are cells) +— a single leaf cannot be the origin of both sides of one redex — or it is +a created node `((Y F) P_{i-1})` with `Y F →* P_i`, `Y` a descendant of a +lambda `λb.W` of `B` (2 bits) with `W` cell-valued (≥ 2), applied by a +further cell step (≥ 4): at least 8 instead of 6. The chain then yields +`Q = K N`, consumed by a redex `Q X → N` whose node is a node of `B` with +an argument subtree (≥ 2) or a created node `((Y F) P_{j-1})` with +`Y F →* Q`, `Y = λb.W'` with the chain inside `W'`, applied by a cell step +(≥ 6 instead of 4). The consumer node is a redex, hence consumed, hence +distinct from `n_N`. Total ≥ 6 + 4 = 10. + +*(b) `F`.* `P_0 F → N` needs an `F` *value* at the right moment. `F` +arises only as a syntactic `λa b.b` of `B` (6 bits, a lambda of `B`) or +from `P_j K → F`, where `K` is syntactic (6) or the first component of +some `P_0`, delivered to a lambda of `B`. In either case the `n+1` cell +steps of the surviving copy that are not cell–cell meetings are each +caused by a contraction of a lambda of `B` (an `F`, a `K`, or a receiver +of the cell), and we are in case (c). + +*(c) Lambda walk* **[repaired after review 1]**. If no cell–cell meeting +occurs on the surviving path, each of its `n+1` cell contractions is caused +by a lambda of `B` (directly, or through an `F` it produced), and `F`-values +are at most `2L + c` in number, so for `n > 3|B|` some lambda of `B` is +contracted at least three times in `ρ_v`, hence copied at least twice; the +copies come from a nonlinear binder of `B`, and following the copying +relation among the finitely many lambdas of `B` gives a lambda whose copies +receive cells of different indices — a *walker*. + +Two facts hold at every level `i ≥ 1` of such a walk. First, the tail +`P_{i-1}` must itself be opened (T7), so it is the *function* of some +redex; its node cannot be a created node (a created node's function is +`(Y' β')` or `Y'`, and `Y' →* P_{i-1}` or `Y' β' →* P_{i-1}` would make +that node a cell applied to a bit or to a tail, i.e. a cell–cell step, +excluded here), so **the tail is bound by a lambda `λr` of `B` and applied +at a node of `B` whose function is a leaf `r` of that lambda** (`λr` 2, +`r` 2, node 2). Second, the bit must be tested: at `P_0` the walker +receives `K` and must return the bare `N`, at `P_i` it receives `F` and must +continue; a term that does not select on the bit either returns the tail +unapplied (no recursion) or applies `N` (a rigid head, fatal). The +selection is `b Z C` with `b` a leaf of a `λb` of `B` and **two** nodes of +`B`: the second cannot be a created node, because then the zero arm would +receive the tail as its argument and have to *be* `N` (it is syntax of `B` +with no access to `N` unless a `λr` bound it, which is the other case). +Third, the walker refers to itself: at least two leaves of a nonlinear +binder (one applied or passed, one passed on) and a node (`λf` 2, `f f` 6). +The cases are distinguished by where `λr` sits: + +* **(A) the walker takes `(β, τ)`**, `Y = λb r. b Z C`, and `C` applies + `r` to the next copy: `C = r f f`-like. Zero arm `Z = r` (the leaf, 2) + is the cheapest term returning `N` at the bottom. Pieces: `λb λr λf` (6), + `b`, `r`, `r`, `f`, `f` (10), four nodes — two selection nodes, `(r f)`, + `((r f) f)` — (8): **24**, and the forced binder order `b, r, f` (the + cell supplies `β` then `τ`, the copy comes third) puts `b` at index 2 and + both `r` at index 1: **≥ 28 with indices**. `Y = λb r f. b r (r f f)` + attains 28 and walks (checked: `(λf. P_n f f) Y →* N`, `n ≤ 5`). +* **(B) the walker takes the cell**, `W W = λr. r H`, and the cell's own + second created node applies the selection result to the tail, so + `H = λb. b Z (w w)`; at the bottom `K Z (W W) N → Z N` forces `Z N →* N` + with `Z` syntax of `B` not binding `N`: `Z = I` (4) is the cheapest. + Pieces: `λw λr λb` (6), `r`, `b`, `w`, `w` (8), nodes `(r H)`, two + selection nodes, `(w w)` (8), `I` (4): **26**, and `w` under `λr λb` + carries index 2 twice: **≥ 30 with indices**. `W = λw r. r (λb. b I (w w))` + attains 30 and walks (checked: `W W P_n →* N`, `n ≤ 5`). The 22-bit + `λw b. b I (w w)` is not a walker: `P_i (W W) →* (W W) P_{i-1}` hands the + tail to `W W` as an argument, and `W W P_{i-1} →* W W` loses it + (checked). + +So **every walker costs ≥ 28 bits of original syntax**, consumed or erased +in `ρ_v`, none of it a frame leaf. A walker must also be *started*: its +first copy is referenced from outside itself, so `B` contains a second +syntactic copy (≥ 28) or a nonlinear let `(λg. … g … g …) W` (`λg`, its +node, two leaves: ≥ 8) — in case (B) the let's `g g` is the only way to +form `W W` once. The dispatch cell's `s`-leaf (2; in case (B) its node may +be the walker's `(r H)` node, in case (A) the node `(s g)` is separate), the +`cont` leaf (4), the `next` leaf (3) and the output node `n_N` (2; the only +created node with argument `N` is `P_0`'s, whose function would have to be +`cont P_{n-1}`, i.e. the walker would carry `P_{n-1}` and `cont` down the +walk, ≥ 8 more) are disjoint from all of this. Hence a reader containing a +lambda walk has + + |B| ≥ 28 + 8 + 2 + 4 + 3 + 2 = 47, + +and the N-source in this case is ≥ 36, never 10. (The cheapest walker reader +I can write is 85 bits.) ∎ + +**Lemma 2.4 (zero-R-source).** Realizations of **z-R** and their costs: +(i) a bound leaf (2) whose binder is a head-path `λr` contracted on `τ` +(the lambda is counted in `d`); (ii) a bound leaf (2) whose binder is a +lambda inside `Z` (2) contracted on the unbound `τ` or on an `R`-valued +element of `rest`; (iii) the tail of a cell delivered by a created +selection node (Lemma 2.6(β)), cost 0 for the leaf but with the +dispatch's own costs; (iv) a compound inside `Z` or bound to a leaf, whose +zero value is `R`: it must contract a zero cell with a `Y` returning the +tail (`F`, `λu r.r`: 6 bits, or a second cell `s s` then an argument): +at least 10 bits of syntax that is consumed in `ρ_z`, shareable with the +N-source only when it is the same subterm (an operand or let whose zero +value is `R` and whose variable value is `N`, i.e. a skip `s s X`). +*Proof.* `R` has no other provenance (T3, T7 applied to the zero stream: +`R` occurs once per copy, as the tail). A leaf receives `R` only through a +binder contracted on `R` itself or on a term reducing to `R`; the latter +needs a contracted zero cell and the tail-returning `Y`, as listed. ∎ + +**Lemma 2.5 (variable tail).** Realizations of **v-tail**: (i) the +dispatch cell's `τ` through its own second node (`n_P` = stream node), +cost 0, requiring `V[envⁱ] →* cont`; (ii) a bound leaf `r` (2) bound to +`τ` on the head path (counted in `d`) or inside `V` (2); (iii) `s F` or +`s (λu r. r)` (≥ 10) or any other compound contracting a fresh copy of +the cell with a tail-returning `Y`; (iv) a rebuilt cell `λh. h F' P'` +with `F' →* F` and `P' →* P_{n-2}`: at least 2 + 4 + 2 + 2 + 2 = 12 bits +plus a second cell contraction to obtain `P_{n-2}` (≥ 4) — never +competitive. *Proof.* The output's `P_{n-1}` has a root lambda that is a +residual of a stream cell (then, the cell body being closed, the whole +`P_{n-1}` is that cell's residual, i.e. the tail of a contracted `P_n` +copy), or of a lambda of `B`, which is case (iv). ∎ + +**Lemma 2.6 (stream-node shortcuts).** A created node has argument a bit +(`(Y β)`) or a tail (`((Y β) τ)`). The only roles a created node can take +are: +(α) `n_P` = the second node of a cell step with `(Y β)ⁱ →* cont` — when +it is the dispatch cell, `V[envⁱ] →* cont`; then `n_N` is a node of `B` +applying `cont τ` to the N-source, necessarily the spine node of an +N-valued operand (it cannot lie inside `V`, which is the leaf `cont`); +(β) the first selection node, `((Y β') τ')` with `Y β' →* β`: `Y`'s hnf is +`λb'. b'` or `λb'. b` (an outer bit); then `Z = τ'`, the zero arm cannot +contain `next` (so `ν_z` is an operand and `n_R` its spine node), and `V` +receives no tail from this cell; +(β′) the second selection node, `((Y β') τ')` with `Y β' →* β Z`: then +`V = τ'` is a tail, and on the variable stream `P_{n-1}` is applied to the +following argument `X`, which must satisfy `Xⁱ F P_{n-2} … →* cont P_{n-1} +N` (and handle `n = 1`, where it receives `K N`); +(δ) both arms at once, when the bit is bound by the cell's `λh` +(Lemma 2.1 (ii)): hnf `β β' τ' A₃ …`, so on the zero stream +`K K R A₃⁰ … → A₃⁰ A₅⁰ …` (the tail `R` is erased) and on the variable +stream `F F P_{n-1} A₃ⁱ … → A₃ⁱ F P_{n-2} A₄ⁱ …` (the tail is consumed). +A created node is never `n_R` (argument `next`) nor `n_N` (argument `N`: +only the last node of `P_0`, Lemma 2.3(c)); as a meeting or consumer node +it is priced in Lemma 2.3(a). *Proof.* By inspection of the two created +node shapes and of what their function parts can reduce to (`cont`, `β`, +`β Z`, a cell, `Q`); `(Y β)` with `Y →* β` or `Y →* S` gives (δ). ∎ +**Lemma 2.7 (copies do not help the inventory).** In the minimum `B`, +(i) a let on a single leaf, `(λy.M) Q` with `Q ∈ {s, next, cont}` at +depth `e`, has `Δ = (m−1)(|Q|) − 2m − 4 − f(M)` with `|Q| = 2+e, 3+e, +4+e`; it is negative for `Q = s` always, and otherwise only non-negative +when the leaf is used many times (`m ≥ 7` for `next`, `m ≥ 4` for `cont` +at depth 0). In those cases the let costs `4 + |Q| + 2m` while the +inventory below charges at most `|Q| + e' + 2(m−1)` for the roles its +uses can fill (one output leaf and consumer leaves), so the inventory +remains a lower bound; in all other cases leaves are never copied and +each charged leaf role is an original leaf. +(ii) the residuals of one copied application node all have β-equal +functions and β-equal arguments, since copies of a let argument are +substituted under the same binders. All roles charged within one +reduction have pairwise different (function, argument) signatures +(`n_P`: `(cont, P_{n-1})`; `n_N`: `(cont P_{n-1}, N)`; meeting node: +`(P_i, P_i)`; consumer: `(K N, X)`; the two selection nodes: +`(β, Z)`, `(β Z, V)`; the dispatch cell step: `(S, Y)`), so no two of them +are residuals of one node. Roles in different reductions may share syntax +only through the head path, operands and lets, which the shapes below +treat explicitly. The one mechanism that copies lambdas with *different* +arguments — a self-passing walker — is priced in Lemma 2.3(c). ∎ + +**Remark (forced depths).** Inside an arm the free leaves sit under all +the arm's own leading lambdas: an arm applied to `m` arguments it consumes +with lambdas has head normal form `λu₁ … u_m. body`, and by T10 the +arm's syntax cannot hide a free leaf above those lambdas through a let +(a let on a leaf shrinks; a let `(λy. λu⃗. … y …) Q` with `Q ∋ next` needs +`fl(Q) ≥ 4`, i.e. `|Q| ≥ 14`, far above the savings). Consuming an +argument by a data value instead of a lambda (`K`, `F`, `b`, `s s`, a cell +step) costs ≥ 4 instead of 2 and spares at most one bit of depth on each +free leaf of the arm — never cheaper than the lambda for the arms below, +whose free leaves number at most two. + +## 2.4 The minimization + +Costs: a free `next` at depth `e` costs `3 + e`, `cont` `4 + e`, `s` +`2 + e`; a bound leaf costs `2 +` (lambdas between it and its binder). +`d ≥ 1` is the depth of the selection node; `rest` the arguments applied +to the selection result (§2.1). An arm either uses an element of `rest` +as an output argument, or consumes it (≥ 2 per element, Remark). + +**v-cont and z-next placements.** `κ_v` is a leaf inside `V` (`4 + depth`) +or a leaf elsewhere reaching `V` through a bound variable, which costs the +leaf (≥ 4), a lambda (2), the variable (2) and a node (2) ≥ 10 — never +competitive, so `κ_v ∈ V` below. Likewise `ν_z ∈ Z` (`3 + depth`) or +`ν_z` is an operand `next` (3) applied through its spine node, which is +then `n_R` (2); other indirections cost ≥ 9. + +By Lemma 2.6 exactly one shape applies. + +### Shape (α): `n_P` is the dispatch cell's second node + +Then `V[envⁱ] →* cont` with `κ_v ∈ V`; the only `V` of minimum size is +the leaf `cont`, `4 + d` (any other `V` has a second leaf or a lambda: +≥ `6 + d`). The dispatch's `τ` is unbound and becomes `cont`'s first +argument, so `rest = (τ, T, …)` and `n_N` is the spine node of the operand +`T`, with `Tⁱ →* N`; by Lemma 2.3, `|T| ≥ 10`, with equality only for +`T = s s X`, `X` an index-0 leaf, i.e. `X = s`. **There is no further +operand**: a third element of `rest` would be a third argument of `cont`. + +The zero arm receives exactly `R` and `T⁰`. `n_R` cannot be `T`'s spine +node (`T⁰` would have to be `next`, but `T` is N-valued and `next`-valued +only if it contains a selection with its own bit source: ≥ 10 + 8 more +than a leaf). If `n_R` lay inside `T`, then `T⁰ →* R next` and `Z = λu t.t` +(6): `T` at depth 0 has no bound variables, so it pays a compound +`R`-source (≥ 10), `next` and `n_R` (5), the N-source (10) and a selection +with a bit source (`s K` or a cell with a lambda, ≥ 14): `|B| ≥ 12 + 2 + +39 + 6 + 5 ≥ 64`. Otherwise `Z` contains `n_R`, `ν_z`, and an `R`-source. `Z` +consumes both arguments: two lambdas (4) above `ν_z`, or data consumers +(≥ 4 each, Remark). So `ν_z` costs `3 + d + 2`, the `R`-source is a bound +leaf (2; a compound would cost ≥ 10 by Lemma 2.4 (iv)), and + + |Z| ≥ 4 + 2 + (5 + d) + 2 = 13 + d, + +with equality only for `Z = λu r. r next` with `T⁰ = R` (`T` a skip) — +`λu r. u next` costs one more because `u` sits under the second lambda. +Altogether + + |B| ≥ 12 + (2 + 10) + (13 + d) + (4 + d) = 41 + 2d ≥ 43, + +with equality iff `d = 1`, `T = s s s`, `Z = λu r. r next`, `V = cont`: +**the 165's reader, uniquely**. + +### Shape (β): the first selection node is created, `Z` is a cell's tail + +The dispatch cell's `Y` has head normal form `λb'. b'` or `λb'. b`. + +*`Y →* λb'. b'`.* The cheapest such `Y` is `I` (4): dispatch +`4 + 4 + 0 + 2 = 10` (one selection node is created). `Z = τ'` costs 0, +so `ν_z` is an operand `next` (3) whose spine node is `n_R` (2), and +`rest = (next)` exactly (a second operand would trail `R next`). The +variable arm `V` sits at depth 0, receives `next` and **no tail** +(`F τ' V → V`). It must consume or use `next` — a lambda (2), since `V`'s +value must be a function; using `next` as the N-source's consumer leaf `X` +is allowed and already inside the N-source's 10 — and must realize +**v-tail** without any bound tail: Lemma 2.5 (ii) with a fresh cell step +applying a lambda of `V` that binds the tail (`4 + 4 + 2 = 10`) or +(iii) `s F`/`s (λu r.r)` (10), or (iv) (≥ 16); the N-source (10, disjoint +syntax: its own two cell leaves, meeting node, consumer node and `X`); +`κ_v` (≥ 4 + 1); `n_P`, `n_N` (4). So + + |V| ≥ 2 + 10 + 10 + 5 + 4 = 31, |B| ≥ 10 + 5 + 31 = 46. + +(The cheapest construction found, `s I (λt. cont (s F) (s s t)) next`, +is 49 bits, checked.) + +*`Y →* λb'. b`.* `b` is bound by an outer handler lambda on an outer cell +step: at least `4 + 2` more on the head path than the previous case, while +`V` may now use that outer cell's tail through a bound `r` (saving at most +`10 − 4` on **v-tail**): `|B| ≥ 46 + 6 − 6 = 46`. + +### Shape (β′): the second selection node is created, `V` is a tail + +Here `V = τ'` and the variable stream continues `P_{n-1} X … → X F +P_{n-2} …`, so the continuation `X` must bind or consume two extra +arguments (≥ 4), test the bit it receives (for `n = 1` it receives `K N` +and must not walk `N`: a leaf and two nodes, ≥ 6), contain `κ_v` +(≥ 4 + 2), an N-source (≥ 10), `n_P`, `n_N` (4), and a tail: the outer +cell's `τ` passed to it (a binding, ≥ 4) or a compound (≥ 10). The head +path has two cell steps (8), `λb` and `λb'` (4), the leaf `b` (≥ 2), the +node `(b Z)` (2) and the spine node of `X` (2). The zero arm `Z` is as in +shape (α) (`≥ 13 + d` with `d ≥ 2`). So `|B| ≥ 18 + 15 + 34 ≥ 67`. (A +71-bit construction exists; I did not check it, as it is irrelevant to +the bound.) + +### Shape (δ): the bit is bound by the cell's own `λh` + +Then (Lemma 2.6) `R` is erased before any arm can see it and `P_{n-1}` is +consumed, so **z-R** is a compound (≥ 10, Lemma 2.4 (iv)) and **v-tail** a +compound (≥ 10, Lemma 2.5 (iii)/(iv)); the continuation `A₃` receives +different argument lists on the two streams (`A₅⁰ …` against +`F P_{n-2} A₄ⁱ …`) and must distinguish them, which needs a lambda of `B` +whose bound leaf heads a selection (≥ 8) — with the zero-side selector +supplied by an operand (`K`, ≥ 6) or by a tail test — and must consume +`F` and `P_{n-2}` (≥ 4); the two cell steps cost 8. With `κ_v`, `ν_z`, +`n_R`, `n_P`, `n_N` (≥ 15) and the N-source (10): +`|B| ≥ 8 + 8 + 6 + 4 + 10 + 10 + 10 + 15 ≥ 71`. + +### Shape (γ): `n_P` and `n_N` are nodes of `B` + +`V` contains `κ_v` (`4 + d + e_V`, `e_V` the number of `V`'s own lambdas +above it) and `n_P` (2); it contains `n_N` (2) unless `n_N` is the spine +node of an N-valued operand (case γ2). + +**(γ1) No N-valued operand.** The N-source (≥ 10) lies inside `V`. The +tail is a bound leaf `r` (2) — bound on the head path (then `d ≥ 2`) or by +a lambda of `V` receiving the unbound `τ` (then `e_V ≥ 1`) — or a compound +(≥ 10, worse). The zero arm: `ν_z ∈ Z` gives +`|Z| ≥ 2 + (3 + d + e_Z) + 2 + 2·(consumed)`; `ν_z` an operand `next` +gives `|Z| ≥ 2` (a bound `R`-leaf, `d ≥ 2`) or `|Z| ≥ 4` (`λu. u`). + +| `d` | operands | dispatch | `Z` ≥ | `V` ≥ | total ≥ | attained | +|---|---|---:|---:|---:|---:|---:| +| 1 | none | 12 | 11 (`λu. u next`) | 2+6+2+10+4 = 24 | 47 | 47 | +| 2 | none | 15 | 9 (`r next`) | 6+2+10+4 = 22 | 46 | 46 | +| 1 | `next` (5) | 12 | 4 (`λu. u`) | 4+7+2+10+4 = 27 | 48 | 51 | +| 2 | `next` (5) | 15 | 2 (`r`) | 2+7+2+10+4 = 25 | 47 | 50 | + +(Row 1: `V` binds `τ`, so `e_V = 1`, `κ_v` costs 6, plus `λr` 2, `r` 2, +N-source 10, `n_P n_N` 4. Row 3: `V` binds `τ` and `next`, `e_V = 2`. +Row 4: `V` binds `next`.) A head-path depth `d ≥ 3` adds 2 per extra +lambda and one bit on `b` and on each free leaf of the arms (≥ 4 per +lambda). + +**Other operands [repaired after review 1].** An operand `O` that is +neither `N`-valued nor `next` must be bound by a lambda — on the head path +(`d` grows by 1: `+1` on `b`, on `κ_v`, and on `ν_z` or its substitute) or +inside the arm that uses it (`+2` for the lambda, `+1` on that arm's free +leaves), and the other arm must consume `O` too (`≥ 2`) unless it also uses +it. Against this, `O` can replace syntax inside the arms. Case by case, +over the four rows above (base ≥ 46): + +* `O = s s` (spine `2 + 6 = 8`; values `K R`, `K N`). Inside `V` the + N-source becomes `q X` (node, `q`, `X`: 6 instead of 10, saving 4); in + `Z` the value `K R` can at best replace the `R`-leaf by `q u` (`q`, `u` + and a node, 6 instead of 2: a loss), so `Z` just consumes it (`+2`) or + pays a depth bit. Net `≥ 8 + 2 + 2 − 4 = +8`: `|B| ≥ 54`. Cheapest + construction: `s (λb r q. b (r next) (cont r (q r))) (s s)`, 58 bits + (checked). +* `O = s` (spine 4; values `Z_R`, `P_n`). It supplies one more cell-valued + leaf `t` at 2 bits, but the rows already price every cell-valued leaf of + the N-source at 2 (`r r X` with `r` at index 0), so nothing is saved; + net `≥ 4 + 2 + 2 = +8`: `|B| ≥ 54` + (`s (λb r t. b (r next) (cont r (t t t))) s`, 57 bits, checked). +* `O = s F` (spine 12; values `R`, `P_{n-1}`). It can replace the tail + leaf `r` in `V` and the `R`-leaf in `Z` (each 2, each already at its + minimum), so it saves ≤ 4 at the price of 12 + 2: net `≥ +10`: + `|B| ≥ 56` (`s (λb r t. b (t next) (cont t (r r r))) (s F)`, 66 bits, + checked). +* `O = s K` (spine 12; values `K`, `F`): a second bit, which no role + needs; net `≥ +14`. +* `O = cont` (spine 6): `V` may use the bound `t` (2 + index) instead of + `κ_v` (`4 + d + e_V`), saving at most `2 + d + e_V`, which is ≤ 6 in + every configuration below 50 bits (`d + e_V ≤ 4`); the price is + `6 + 2 + 2`: net `≥ +4`: `|B| ≥ 50` + (`s (λb r t. b (r next) (t r (r r t))) cont`, 56 bits, checked). +* a second `next` (spine 5): can only serve as a consumer leaf `X` + (already charged 2): net `≥ +5`. +* any `O` with a lambda, or any compound not listed, costs `≥ 2 + |O| + 2 + ≥ 10` and supplies at most one `R`-, tail-, or `N`-valued leaf (its + value is one term), replacing at most 2 bits in each arm — the dual + (zero/variable) operands of Lemma 2.4/2.5 (iv) cost ≥ 10 themselves: + net `≥ +6`. + +Hence (γ1) gives `|B| ≥ 46`, operands included. + +**(γ2) An N-valued operand `T`** (`2 + |T| ≥ 12`). If `n_N` is `T`'s +spine node, `V[envⁱ]` applied to `τ` (if unbound) reduces to +`cont P_{n-1}`, so `V` contains `κ_v`, `n_P`, and a tail leaf: +`V = cont r` (`d = 2`, 10) or `V = λr. cont r` (`d = 1`, 12). The zero arm +receives `τ` (if unbound) and `T⁰` and contains `n_R`, `ν_z`, an +`R`-leaf: `d = 2`: `|Z| ≥ 2 + 2 + 6 + 2 = 12` (consumes `T⁰`); +`d = 1`: `|Z| ≥ 4 + 2 + 6 + 2 = 14`. Totals: `15 + 12 + 10 + 12 = 49` +and `12 + 12 + 12 + 14 = 50`. If `n_N` is inside `V`, then `V` applies +`cont P_{n-1}` to a leaf `t` bound to `T` (the N-source is then `T` +itself, and `V` binds `t` or `d ≥ 3`) or has its own N-source and wastes +`T`: `|V| ≥ (4 + d + e_V) + 2 + 2 + 2 + 2` with `e_V ≥ 1` or `d ≥ 2`; +with `|Z| ≥ 12` and the operand's 12 and dispatch ≥ 12 this is ≥ 52. + +### Depth-0 operands as role carriers + +An operand at depth 0 sees no bound variable, so any `R`, `P_{n-1}`, `N` +or bit it supplies is a compound (≥ 10 each, Lemmas 2.3–2.5 and `s K`), +and an operand serving a zero role and a variable role with different +values (a *dual* operand) contains a selection with its own bit source +(≥ 8 + 10). Moving a role out of an arm into such an operand therefore +never lowers the bounds above, which already charge the cheapest +realization of every role. + +### Extras + +Each additional head-path cell step costs ≥ 4 and its `β', τ'` must be +bound or consumed (≥ 2); each head-path let costs `≥ 4 + |Q| ≥ 10` +(T10: a let needs `fl(Q) ≥ 2` or `|Q| ≥ 8`); a data dispatch (`s K …`) +costs 14 and forfeits the tail; none lowers the minimum realization cost of +any role, because every role is priced in leaves and nodes (≥ 2 each) and +in forced depths. So each extra only adds to the bounds above. + +**Conclusion of 2.4.** In the β-case `|B| ≥ 43`, with equality exactly for +the 165's reader (shape (α), `d = 1`, `T = s s s`, `Z = λu r. r next`, +`V = cont`). + +## 2.5 The τ-case + +The head `τ` is the residual of a bound leaf `r` (2) whose binder `λr` (2) +is on the head path and was contracted on the dispatch cell's tail after a +`λb` (2) took the bit (data variants `s F`: 6 for the `F`, same count); +the node `(τ A₁)` is a node of `B` (2): a created node `((Y β') τ')` would +need `Y β' →* τ`, giving `τ τ'`, whose zero instance `R R` is not +`R next`. Apply T3's argument to `A₁` (a term with `A₁⁰ →* next` normal +and `A₁ⁱ` a function): its head normal form is `β A₁' A₂' O⃗` with +`A₁'⁰ O⃗⁰ →* next` and `A₂'ⁱ O⃗ⁱ F P_{n-2} →* cont P_{n-1} N`, so `A₁` +contains a selection: a leaf `b` (2 + 1, under `λr`) and two nodes (4). +Its zero arm contains or receives `next` (≥ 5 at depth ≥ 2). Its variable +arm receives `F` and `P_{n-2}` and must consume or use them (≥ 4), +contains `κ_v` (≥ 4 + 2 + 2), the tail leaf `r` (≥ 2), `n_P`, `n_N` (4), +and an N-source (≥ 10). Hence + + |B| ≥ (4 + 2 + 2 + 2 + 2) + (3 + 4) + 5 + (4 + 8 + 2 + 4 + 10) = 52. + +(Cheapest construction found: `s (λb r. r (b next (λb' t. cont r (r r t))))`, +58 bits, checked.) The τ-case never competes. + +## 2.6 Statement + +**Theorem.** Every reader body — every term `B` over the frame +`[s, next, cont, intL, x]` with `B[Z_R/s] →* R next` and +`B[P_n/s] →* cont P_{n-1} N` for all `n ≥ 1`, with `R, N, next, cont, +intL, x` rigid — has `|B| ≥ 43`, and `|B| = 43` only for +`s (λb. b (λu r. r next) cont) (s s s)`. + +The proof is the structure theorem (Part 1), the head-path decomposition +and role inventory (§2.1–2.3, Lemma 2.7), and the minimization +(§2.4–2.5). It is handwritten; the finite identities it uses are checked +by the scripts in `tools/`; the exact wire-cost formula it uses is the +Lean theorem `Blc.SelfintWireCost.wire_beta_delta`. Part 3 lists the steps +whose rigour is weakest. +# Part 3. What is proved, how, and where the argument is thin + +## 3.1 Status by component + +| component | status | +|---|---| +| T1–T4 (free variables, open hnf `s A⃗`, symbolic hnf dichotomy, forced leaves) | handwritten, standard tools (solvability, Church–Rosser); the 165's symbolic hnf checked | +| T5 (no lambda-free body) | handwritten; the application table and the `P_n`-only closure checked for indices ≤ 6 and trees ≤ 5 leaves | +| T6–T9 (duplication, every cell opened, last cell, equal-index chains) | handwritten residual arguments; all finite identities checked | +| T10 (minimum has no shrinking redex; Δ formula) | the formula is Lean (`wire_beta_delta`), re-checked on 3000 random redexes; the minimality argument is one line | +| §2.1 decomposition, Lemma 2.1 (selection leaf) | handwritten residual tracing | +| Lemma 2.3 (N-source ≥ 10), cases (a), (b) | handwritten, tight | +| Lemma 2.3 (c) (self-passing walker: ≥ 28 per walker, reader ≥ 47) | handwritten two-case split, repaired after review 1 (see 3.2); the two attaining walkers checked — still the least formal step | +| Lemmas 2.4–2.6 (R-source, tail, stream-node shortcuts) | handwritten exhaustive lists of realizations | +| Lemma 2.7 (copies) | handwritten; relies on T10 and on the distinct signatures of the roles | +| §2.4 shapes (α), (β), (β′), (δ), (γ) and extras | handwritten arithmetic; the (γ1) operand cases written out per operand after review 1; every valid construction measured (`tools/menu.py` and inline checks) is ≥ its shape's bound | +| §2.5 τ-case ≥ 52 | handwritten, coarse | + +No Lean was written in this lane: the statements pinned down enough to +formalize (the application tables, T5) are finite-instance checks of +small value, and the load-bearing steps (residual tracing over all +reductions, the inventory) would need a formalization of residuals that +does not exist in `lean/Blc`. + +## 3.2 Where a reviewer should push + +1. **Exhaustiveness of realization lists.** Lemmas 2.4–2.6 enumerate how + `R`, the tail, and the output nodes can be produced. The lists rest on + T3/T7–T9 (what stream material can do) and on the observation that a + created node has argument `β` or `τ`. A missed realization would have + to produce `R`, `P_{n-1}` or `N` from stream material in a way the + tables do not cover; the `P_n`-only closure check and the table are the + evidence that there is none, but the general claim is handwritten. +2. **The walker bound (Lemma 2.3 (c)) [repaired after review 1].** The + first review found that the original piece count (24) was not tight + for the pieces it named: `λw b. b I (w w)` has 22 bits and the right + first step, but it is not a walker (it loses the tail at the next + level). The repaired lemma proves two facts for every level of a lambda + walk — the tail is bound by a lambda of `B` and applied at a node of + `B`, and the bit is tested with two nodes of `B` — and splits on where + the tail binder sits: (A) `λb r. b r (r f f)`-shaped, ≥ 24 pieces and + ≥ 28 with the forced indices; (B) `λw r. r (λb. b I (w w))`-shaped, + ≥ 26 pieces and ≥ 30 with indices. Both attaining walkers were checked + to walk. With the starter (≥ 8), the `s`-leaf, `cont`, `next` and + `n_N`, any walker reader is ≥ 47. This is still a count of necessary + pieces rather than a case analysis of all syntax; a reviewer should + check that no walker can test the bit with the created node *and* still + recover `N` at the bottom (the lemma argues it cannot, since the zero + arm would then have to be `N` without a binder for it). +3. **Lemma 2.7 (ii)** uses that copies of a let argument have β-equal + values. This is true for copies produced by substitution of one + argument; for copies produced inside a walker (different arguments at + each level) it is not, which is why walkers are priced separately. A + reader mixing a walker with cheap arms would have to be re-examined + against both arguments at once; the repaired 28-bit walker cost and + the 47-bit reader bound of Lemma 2.3(c) close it with margin, but I + have not written that mixed case out separately. +4. **Depth taxes.** The arms' free leaves are charged `+1` per lambda + above them. The Remark in §2.4 shows that a let cannot lift a leaf + above an arm's consumption lambdas in the minimum. Data consumers + (`K`, `b`, `s s`) were priced at ≥ 4 against the lambda's 2 and shown + to save at most one depth bit per free leaf; the arms in the tables + have at most two free leaves, so this is safe, but shape (γ) rows with + several consumptions deserve a re-count. +5. **Shape (γ1) "other operands" [repaired after review 1].** The first + review found that `O = s s` is half of an N-source (the bound `q = K N` + completes it as `q X`, saving 4 inside `V`), so the one-line dominance + was wrong as written. §2.4 now prices `s s`, `s`, `s F`, `s K`, `cont`, + a second `next`, and arbitrary other operands individually (all + ≥ +4 over the rows, `s s` giving ≥ 54 with a 58-bit construction). + The precision note on `d` (a head-path let whose argument contains + the selection does not enclose it) is closed in §2.1 by T10 pricing. + +## 3.3 Residual cases + +With the caveats of 3.2, I do not have a residual *class* of reader bodies +outside the theorem: the decomposition covers every term (compressed or +not, any arity, any operand, both dispatch heads), because it is driven by +the head reduction of `B[S]` and by residual tracing rather than by the +syntax of `B`. The residual risk is in the rigour of the listed steps, not +in an identified family of terms. The honest summary: + +* **Fully covered with tight arithmetic:** shape (α) — every reader whose + variable output node `cont P_{n-1}` is the stream's own node (this is + the 165's mechanism; the 165 is the unique minimum there). +* **Covered with margin ≥ 3:** shapes (β), (γ) including its operand + cases, the τ-case, chains, lets, data dispatch. +* **Covered with large margin but coarser reasoning:** self-passing + walkers (Lemma 2.3 (c), ≥ 47 by a two-case piece count), rebuilt cells + (Lemma 2.5 (iv)). + +## 3.4 Relation to the earlier bounds + +The earlier results are recovered as instances: the 27-bit handler bound +(`s H (s s s)`) is shape (α)/(γ) with `T = s s s`; the 35- and 31-bit +handler bounds for `T = s` and `T = s s` are the rows where the operand is +not N-valued at depth 0 (`s`, `s s`) and the N-source must be completed +inside `V` (`t X` for `s s`); the neutral-operand domination is the +"other operand" line. The bare operands `next` and `cont`, operands with +lambdas, arities `k ≠ 2`, head redexes, and the tail-headed dispatch — the +open list in the lane prompt — are the rows of (β), (γ) and §2.5. + +## 3.5 Honest read + +The reader is optimal because its three mechanisms are each at their +floor and share everything that can be shared: the stream's own second +node is the variable output's first application (shape (α) is the only +way to get an output node for free), the skip `s s s` is the cheapest +N-source (Lemma 2.3) and its zero value happens to be the tail, so one +operand serves both arms, and the zero arm then pays exactly for the two +lambdas that consume what the variable arm uses. Every alternative in the +inventory pays at least 3 more bits. + +Where a sub-165 could still hide is therefore **not in the reader with +the 165's knot and NEXT fixed**: it would have to change the laws — a +different `next` protocol (the zero arm's `r next` is the only place +`next` is used, and the reader never exploits what `next` does), a reader +that hands NEXT something other than the raw remaining stream, or a fusion +of the reader's self-application `s s` with the knot (the reader already +contains the only self-application the knot needs). The next proof step +that would make this record-grade is to formalize residual tracing for +the two reader laws in Lean (origins and fates of nodes, as +`SelfintOrigins.lean` does for quotation-origin binders) and to discharge +Lemma 2.3 and Lemma 2.7 from it; the arithmetic of §2.4 would then be a +finite check over realization patterns. diff --git a/data/self-interpreter/reasoning_floor/verify/v162.md b/data/self-interpreter/reasoning_floor/verify/v162.md new file mode 100644 index 00000000..2a2eca2b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/v162.md @@ -0,0 +1,37 @@ +Adversarial verification request — high stakes. You are a fresh, independent +reviewer. Repository: /Users/a9lim/Work/blam. Your job: try hard to show that +the following term is NOT a BLC self-interpreter, or is not 162 bits. + +Candidate: /Users/a9lim/Work/blam/tmp/overnight/self/int162.lam (wire bits in +int162.blc beside it): + + (\x. x x) (\x. (\intL. \cont. \list. + list (\a. a) (\u. list (\q. cont) (list list u)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) + +Contract (exact): E C (⌜M⌝ ++ N) =β C (λz. M) N for EVERY closed M (including +M without a normal form), C and N rigid; ⌜λM⌝ = 00⌜M⌝, ⌜M N⌝ = 01⌜M⌝⌜N⌝, +⌜var n⌝ = 1ⁿ0 (n ≥ 1, de Bruijn, 1 innermost); streams cons b r = λf. f b r, +bit 0 = K = λx y. x, bit 1 = F = λx y. y. Size: |M| = 2L + 4A + 2 + X. +Reference: the 165 in data/self-interpreter/machines/int165.lam, Lean-proved +correct in lean/Blc/Selfint165.lean; docs/classical/self-interpreter/ +interpreter.md §1–§2 explain its parser law. + +Do all of: (1) recompute the size from the term by hand (L, A, X) and from +the wire bits; (2) derive the parser law of the candidate on genuine streams +— zero tag 0 b2 r2 and variable 1ⁿ0 ++ N for every n ≥ 1 — and compare with +the 165's (`r next = next b2 r2`, `cont r N`); (3) give a complete structural +induction proof of the contract for every closed M, including divergent M +(the 165's argument: values are environment functions, variable values are +raw unary codes, the cell performs lookup) — or find where it fails; +(4) run `python3 tools/self-interpreter/battery.py tmp/overnight/self/int162.lam` +and `--max-bits 21`, and test divergent sources (Ω, λ.Ω, Ω I) for exact +suffix return with a suffix-projecting continuation; (5) check it against the +record's exclusions (interpreter.md §5) — explain why none applies, or which +one it contradicts (that would indicate an error somewhere). Answer with a +verdict (correct / not a self-interpreter / size wrong), the proof or the +counterexample, and what you checked. Write the review to +/Users/a9lim/Work/blam/tmp/overnight/verify/v162_codex.md. diff --git a/data/self-interpreter/reasoning_floor/verify/v162_codex.md b/data/self-interpreter/reasoning_floor/verify/v162_codex.md new file mode 100644 index 00000000..70c6371b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/v162_codex.md @@ -0,0 +1,453 @@ +( •̀_•́ ) **Verdict: correct, and exactly 162 bits.** + +The candidate satisfies the stated contract for every finite closed source +term, including sources without a normal form. In fact the proof below gives +finite full beta reduction, not merely beta equivalence: + +```text +E C (quote(M) ++ N) ->* C (lambda z. M) N. +``` + +No eta conversion or normalization of the source program is used. I found no +counterexample and no conflict with the scoped exclusions in the record. +This is a handwritten universal proof with independent encoding checks and +executed finite tests; I did not construct or kernel-check a Lean proof of +the 162. No minimality claim follows. + +## 1. Exact object and size + +Reviewed on 2026-10-21 in `/Users/a9lim/Work/blam`, at repository HEAD +`f13d3f3323b1e30508ca100311b9eaf148f7b599`, with an already-dirty working tree. +The candidate and its wire are the requested files: + +```text +tmp/overnight/self/int162.lam +tmp/overnight/self/int162.blc +``` + +Their SHA-256 digests, respectively, are: + +```text +7b3ef102b1e30dfc846397d7cf47db8b572e7eaeb6f975bf2163e355a8005e93 +1d522650caf6fe48a0d1cb94ed68d39e7661fad3c3144a32cbfd0a4a25149b18 +``` + +### Hand count + +Here `X` sums zero-based indices, so each variable occurrence has wire cost +`2 + index`. The following is a disjoint partition of the literal source. +"NEXT header" excludes its ABS and APP arguments; those are the last two +rows. "Reader spine" includes the three applications to `list`, but excludes +their three operands. The knot row includes the outer application, both knot +lambdas, both `x x` applications, and the `intL` let's lambda/application. + +| Region | L | A | Variable indices, zero based | X | Direct wire cost | +|---|---:|---:|---|---:|---:| +| Knot and `intL` let | 3 | 4 | 0, 0, 0, 0 | 0 | 22 | +| `cont`, `list` binders | 2 | 0 | none | 0 | 4 | +| Reader spine `list I D NEXT` | 0 | 3 | 0 | 0 | 8 | +| `I = lambda a. a` | 1 | 0 | 0 | 0 | 4 | +| `D = lambda u. list (lambda q. cont) (list list u)` | 2 | 4 | 1, 3, 1, 1, 0 | 6 | 28 | +| NEXT header | 2 | 3 | 3, 1 | 4 | 18 | +| ABS arm | 4 | 5 | 3, 2, 1, 2, 0, 3 | 11 | 41 | +| APP arm | 2 | 5 | 4, 4, 2, 0, 1, 0 | 11 | 37 | +| **Total** | **16** | **24** | **25 occurrences** | **32** | **162** | + +The per-region direct costs are `2L + 2A + 2V + X`. Globally `V = A + 1`, so +the requested identity gives + +```text +2L + 4A + 2 + X = 2*16 + 4*24 + 2 + 32 = 162. +``` + +In particular, moving NEXT under `list` increases its captured-variable +indices. The count includes that increase; it does not reuse the 165's +NEXT/ABS/APP prices. + +### Independent wire check + +The wire, with only the file's final newline removed, is: + +```text +010001101000010000000101011000100001011100011110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 +``` + +It contains exactly 162 bits. I wrote a small independent named-source +parser, encoder, and wire decoder in `v162_codex_checks.py`. They check that: + +- the literal source encodes to exactly this wire without optimization; +- decoding consumes the entire wire, with no trailing bits; +- every variable is bound; +- the decoded AST equals the independently parsed source AST; +- the AST counts are `(L,A,V,X) = (16,24,25,32)`; +- the repository compiler's **unoptimized** AST is the same AST. + +Thus neither an implicit optimizer nor a wire/source mismatch supplies the +claimed size. + +## 2. Reader law, including every unary index + +All terms below use capture-avoiding substitution and fresh binders. Write +`->*` for a finite sequence of ordinary beta reductions. Define + +```text +K = lambda x y. x -- bit 0 +F = lambda x y. y -- bit 1 +I = lambda x. x +cons b r = lambda f. f b r +U_0(T) = cons K T +U_(m+1)(T) = cons F (U_m(T)). +``` + +Thus `U_m(T)` is the stream `1^m 0 ++ T`; a source variable `n >= 1` has +whole code `U_n(T)`, and its returned value must be `U_(n-1)(T)`. + +Let `P = W W`, where `W` is the candidate's right-hand knot argument. The +literal candidate `E = (lambda x. x x) W` reduces to `P`. Unfolding `P` on +continuation `C` and stream `s` gives + +```text +P C s ->* s I D_(C,s) J_(P,C) +D_(C,s) = lambda u. s (lambda q. C) (s s u). +``` + +Here `J` is the candidate's displayed `lambda bit1. ...` term. The reader +calculation actually holds with **any** term `J` in its place. + +**Zero tag.** For `s = cons K r`, + +```text +s I D J ->* K r D J ->* r J. +``` + +For `r = cons b2 r2`, this is `J b2 r2`. Neither `D` nor the skip is used. +This is precisely the 165's zero-branch law `r next = next b2 r2`. + +**Skip lemma.** For every `m >= 0` and every suffix `T`, + +```text +U_m(T) U_m(T) ->* K T. +``` + +To see this, a cell `s = cons b r` satisfies + +```text +s s ->* b b r r. +``` + +At `b = K`, the result is `K r`. At `b = F`, it is `r r`. The zero case +therefore gives `K T`; the successor case reduces to the induction +hypothesis. Consequently `U_m(T) U_m(T) J ->* T` for every `J`, without +evaluating `J` or `T`. + +**Variable tag.** For `n >= 1`, put `s = U_n(T) = cons F r`, where +`r = U_(n-1)(T)`. Then + +```text +s I D J + ->* F r D J + ->* D J + ->* s (lambda q. C) (s s J) + ->* C r (s s J) + ->* C r T. +``` + +The penultimate step uses +`s (lambda q. C) ->* (lambda q. C) F r ->* C r`. +The final step is the skip lemma for the **whole** stream `U_n(T)`. + +This is exactly the 165's variable law `cont r N`, including `n = 1`. +The reader first discards `r` through `F r`, but its variable arm retains +the original `s` and recovers `r` from that stream. NEXT is supplied as the +skip's junk argument and erased. It is not called on a variable. These two +facts are essential to the correctness of the apparent shortcut. + +## 3. Complete structural proof + +### Parser induction on arbitrary source syntax + +Define the environment cell and the two value constructors: + +```text +cell a e = lambda b t. b a (t e) +Abs(f) = lambda e a. f (cell a e) +App(f,g) = lambda e. f e (g e). +``` + +The second-bit continuation in the candidate is exactly + +```text +J_(P,C) = lambda b. P (lambda f. + b (C (Abs(f))) (P (lambda g. C (App(f,g))))). +``` + +Therefore the zero-reader law, followed by selection of its second bit, +gives + +```text +P C (00 ++ Q) ->* P (lambda f. C (Abs(f))) Q +P C (01 ++ Q) ->* P (lambda f. P (lambda g. C (App(f,g)))) Q. +``` + +These are full beta reductions: selecting `K` or `F` inside the pending +continuation's lambda is permitted. The other branch is erased without +evaluating it. + +For any source term `M`, open or closed, and any suffix `T`, define a +syntactic closure `V(M,T)` recursively: + +```text +V(var n,T) = U_(n-1)(T) +V(lambda B,T) = Abs(V(B,T)) +V(M1 M2,T) = App(V(M1, quote(M2) ++ T), V(M2,T)). +``` + +Every `V(M,T)` is literally a lambda abstraction. Notice that the left +child's closure in the application case retains `quote(M2) ++ T` as its +raw quotation suffix. Replacing that suffix by `T` without justification +would give an incorrect account of the parser's actual returned value. + +**Parser theorem.** For every finite source `M`, every `T`, and every `C`, + +```text +P C (quote(M) ++ T) ->* C (V(M,T)) T. +``` + +Proof by structural induction on `M`, uniformly in `C,T`: + +1. **Variable `n`.** This is the all-index variable reader law above. +2. **Abstraction `lambda B`.** The zero law with second bit `K` gives + `P (lambda f. C (Abs(f))) (quote(B) ++ T)`. By the induction hypothesis + this reduces to + `(lambda f. C (Abs(f))) V(B,T) T`, then to + `C (Abs(V(B,T))) T = C V(lambda B,T) T`. +3. **Application `M1 M2`.** Put `S2 = quote(M2) ++ T`. The zero law with + second bit `F` gives + `P (lambda f. P (lambda g. C (App(f,g)))) (quote(M1) ++ S2)`. + The induction hypothesis for `M1` reduces this to + `P (lambda g. C (App(V(M1,S2),g))) S2`. + The induction hypothesis for `M2` reduces that to + `C (App(V(M1,S2),V(M2,T))) T`, as required. + +All these reductions parse finite syntax. No beta step of the source +program is needed, and the induction makes no normalization assumption. + +### Lookup and closure-body induction + +The cell satisfies the exact two lookup equations + +```text +cell a e K t ->* a +cell a e F t ->* t e. +``` + +For arbitrary entries `a1,...,ak` and arbitrary base `zeta`, define + +```text +Env([],zeta) = zeta +Env([a1,...,ak],zeta) = cell a1 (Env([a2,...,ak],zeta)). +``` + +By induction on `j`, whenever `0 <= j < k`, + +```text +U_j(T) Env([a1,...,ak],zeta) ->* a_(j+1). +``` + +For `j = 0`, the first cell receives `K,T` and returns `a1`. For `j > 0`, +it receives `F,U_(j-1)(T)` and returns +`U_(j-1)(T) Env([a2,...,ak],zeta)`, to which the induction hypothesis +applies. At the terminating zero, the quotation suffix is discarded. No +entry, base, or suffix is evaluated to establish this result. + +It is important to prove a **body** statement, rather than infer an +unjustified beta equality from extensional equality. Write the literal +closure, up to fresh alpha renaming, as + +```text +V(M,T) = lambda e. B(M,T,e). +``` + +Its bodies are explicitly + +```text +B(var 1,T,e) = e K T +B(var n,T,e) = e F U_(n-2)(T) (n >= 2) +B(lambda B0,T,e) = lambda a. V(B0,T) (cell a e) +B(M1 M2,T,e) = V(M1,quote(M2) ++ T) e (V(M2,T) e). +``` + +**Body theorem.** If every free source index of `M` is at most `k`, then + +```text +B(M,T,Env([a1,...,ak],zeta)) ->* M[a1,...,ak], +``` + +where the right side is capture-avoiding simultaneous substitution for the +free indices, with `1` mapped to `a1`. All suffixes, entries and bases are +arbitrary. Proof is a structural induction on `M`, strengthened over `k` +and all these parameters: + +- **Variable.** For `n = 1`, the body is the first cell applied to `K,T`, + and reduces to `a1`. For `n >= 2`, its first cell applied to + `F,U_(n-2)(T)` reduces to the tail lookup, which returns `an` by the + preceding lemma. The assumption `n <= k` guarantees enough cells. +- **Abstraction.** Its body is + `lambda a. V(B0,T) (cell a Env([a1,...,ak],zeta))`. + Take `a` fresh for all entries, the suffix, and the base. Under this + lambda, contract the literal outer lambda of `V(B0,T)`, then apply the + induction hypothesis for `B0` with environment entries + `[a,a1,...,ak]`. The result is + `lambda a. B0[a,a1,...,ak]`, exactly the substituted source abstraction. + In de Bruijn notation the old entries and base are weakened under `a`; + the fresh named notation here performs the same capture avoidance. +- **Application.** Its body is the application of + `V(M1,quote(M2) ++ T) Env` to `V(M2,T) Env`. + Contract each closure's literal outer lambda. Apply the induction + hypotheses, with their respective suffixes, to its two bodies. Context + closure of beta reduction gives the literal application + `M1[a1,...,ak] M2[a1,...,ak]`. Do not contract that resulting source + application. In particular, it may be a redex belonging to a divergent + source; this proof stops at the required syntax. + +Now let `M` be closed. Set `k = 0` and use a fresh rigid `z` as the empty +environment's base. The body theorem gives + +```text +B(M,T,z) ->* M. +``` + +Reducing under the already-present outer lambda gives + +```text +V(M,T) =alpha lambda z. B(M,T,z) ->* lambda z. M. +``` + +This step uses beta reduction under a lambda, **not eta conversion**. +Combining it with `E ->* P` and the parser theorem proves + +```text +E C (quote(M) ++ N) + ->* C V(M,N) N + ->* C (lambda z. M) N. +``` + +This finishes the proof for every finite closed `M`, divergent sources +included. The proof actually permits arbitrary terms `C,N`, since its chosen +reductions never require them to reduce. The requested rigid contract is a +special case. + +## 4. Executed checks + +Both requested commands were run against the existing release binary: + +```text +python3 tools/self-interpreter/battery.py tmp/overnight/self/int162.lam + 162 bits ok=667 skip=1 fail=0 + real 2.01 s + +python3 tools/self-interpreter/battery.py tmp/overnight/self/int162.lam --max-bits 21 + 162 bits ok=3341 skip=2 fail=0 + real 9.96 s +``` + +The harness was inspected: it compares beta-normal forms with rigid +continuation and suffix, using a 2^16 beta budget for the expected result +and 2^20 for the interpreter result. A skipped expected result is not a +passed contract test. The two commands ran concurrently, so these wall +times are operational observations, not isolated performance measurements. + +For the requested divergent-source tests I used the suffix projection +`F = lambda v r. r` and a rigid suffix bound at the outside: + +```text +lambda n. E F (quote(M) ++ n). +``` + +Every result was exactly `lambda n. n`, wire `0010`: + +| Source | Source wire | Source bits | Beta contractions to suffix | +|---|---|---:|---:| +| Omega = `(lambda x. x x) (lambda x. x x)` | `010001101000011010` | 18 | 215 | +| `lambda a. Omega` | `00010001101000011010` | 20 | 228 | +| `Omega I` | `010100011010000110100010` | 24 | 263 | + +These checks used a fresh frozen copy of the release KN binary, capped at +262,144 beta contractions and 15 seconds per subprocess. Its SHA-256 was + +```text +5266a7fc450c2bc6050a2baf7f7a23f06589fdf99a8a6470d73b83dcb324c112 +``` + +I also checked the isolated reader with rigid continuation, rigid NEXT, +and rigid suffix: one zero case with even the second bit left rigid, and +all variable lengths `1..32,63,64,127,128,255,256`. The expected outputs +retain the raw unary variable value, so these probes test both the value +and the suffix. All 39 reader checks and all three divergent-source +checks passed: **42/42** in about 0.32 seconds in total. + +Reproducible check code and machine-readable results are beside this review: + +```text +tmp/overnight/verify/v162_codex_checks.py +tmp/overnight/verify/v162_codex_checks.json +``` + +## 5. Audit against interpreter.md section 5 + +No listed exclusion rules out this candidate. The consequential distinction +is the reader interface, not a weakened interpreter contract. + +**The 43-bit reader bounds do not apply to this shape.** They price +`s H T` with two operands and specified laws for `T` (`s`, `s s`, or +`s s s`). This reader is `s I D J`, with three operands. In particular +`I` is not a four-bit counterexample to the handler theorem: it does not +satisfy that theorem's `H K R R = R next` law. On genuine streams, the same +behavior can instead be expressed as a two-operand reader by taking + +```text +H_s = lambda b r. b r D_(C,s) +``` + +gives `s H_s J`; its last operand is the bare NEXT parameter, one of the +families expressly left outside the bound. + +There is also an exact pricing sanity check. Put this reader back into the +165's fixed frame `[s,next,cont,intL,x]` with an explicit `next` let. Its +reader costs **44**, and the whole interpreter costs **166**, independently +compiled by the check script. Inlining the single `next` occurrence then +gives the actual 162: remove the next let's lambda/application (4), remove +the `next` reference (3), lower the variable arm's captured `cont` index +(1), and increase NEXT's four captured-reference indices (4), for a net +change of `-4-3-1+4 = -4`. Thus neither the 43-bit reader floor nor a sum +holding the other 122 bits fixed is contradicted. + +The remaining bounds and exclusions have the following status: + +| Recorded result | Why the candidate does not contradict it | +|---|---| +| Unconditional head shape | Its head normal form is `lambda c s. s I D J`, the permitted stream-headed case with three operands. | +| Nonlinearity and incomparable branches | The two knot `x` binders are nonlinear and lie in the two incomparable children of the outer application. The candidate is well above the recorded numerical global floors. | +| Capture/width constraints | The subterm `exp (lambda zx zy. zx arg (zy args))` has the three distinct free variables `exp,arg,args`; the requisite capture is present. | +| Opaque knot floor | The ordinary knot is retained. Its recursive references are now at zero-based depths 3 and 4, giving overhead 33 rather than the 165's 31; no saving below the knot bound is claimed. | +| Zero arm at least 14 under `Z R R = R next` | This reader never supplies two copies of `R` to such a zero arm. Its zero branch selects the tail itself, then applies that tail to NEXT. | +| APP lift at least 19; cell at least 24 | Both subterms are unchanged. ABS and APP are slightly more expensive here because of the binder frame. | +| One uniform handler for both tag bits | `I` handles the first selection; the distinct `J` handles the second tag. No repeated-handler protocol is used. | +| `E E = E`, or a continuation acting as its own knot driver | Neither identity is asserted or used. Recursion uses the usual separate knot generator. NEXT in the variable arm is merely erased junk. | +| Shared head carrying all tag dependence | NEXT retains the original distinct ABS and APP continuation constructions; it is not the forbidden single tag-independent payload. | +| Mode-free ABS/APP builder | The second tag explicitly chooses ABS versus APP; the two constructors remain distinct. | +| Cell/APP alias | APP is `lambda e. f e (g e)`, not the excluded `lambda e. e f g`. | +| Destructured rest reaching the root | The parser theorem returns the intact arbitrary suffix `T`; it never needs to destructure it. | +| Trees made only of the 165's readers/handlers | This is a new reader with extra lambdas and a bare NEXT operand, plus the ordinary external knot; it is not such a tree. | +| Full parser as zero-arm carrier; `next next` obstruction | The zero carrier is the actual stream tail. There is no replacement of it by a full parser, nor a `next next` diagonal. | +| Bare-cont handler requires outer arity one; application-only reader impossible | The first operand is `I`, not `lambda b. b Z C`; `D` contains lambdas and reopens the stream. Those hypotheses are absent. | +| No continuation adapter for thunked streams | No thunked-stream interface or continuation-only adapter is introduced. | +| NEXT projections losing code information | NEXT receives the complete second cell's bit and tail. The variable arm separately recovers its raw tail from the captured original stream. The forbidden lossy fields are not substituted for them. | +| Eta-collapsed representation cannot be repaired | The returned values are the same raw-unary/ABS/APP representation as the 165. The body proof produces literal `lambda z. M` using beta alone. | + +The 168's opaque-module sum and the neighborhood searches elsewhere in the +record also impose no global 165-bit lower bound. This candidate changes +the reader architecture and its capture layout. Statements such as +"nothing below 165 is known" describe the previous record and should be +updated once this result is incorporated; they are not exclusions refuted +by a flaw in the proof above. diff --git a/data/self-interpreter/reasoning_floor/verify/v162_codex_checks.json b/data/self-interpreter/reasoning_floor/verify/v162_codex_checks.json new file mode 100644 index 00000000..1d6b97cf --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/v162_codex_checks.json @@ -0,0 +1,410 @@ +{ + "candidate_sha256": "7b3ef102b1e30dfc846397d7cf47db8b572e7eaeb6f975bf2163e355a8005e93", + "wire_sha256": "1d522650caf6fe48a0d1cb94ed68d39e7661fad3c3144a32cbfd0a4a25149b18", + "binary_sha256": "5266a7fc450c2bc6050a2baf7f7a23f06589fdf99a8a6470d73b83dcb324c112", + "wire": "010001101000010000000101011000100001011100011110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010", + "bits": 162, + "L": 16, + "A": 24, + "V": 25, + "X": 32, + "source_equals_wire": true, + "source_equals_repo_unoptimized_ast": true, + "fixed_frame_version_bits": 166, + "sources": { + "Omega": { + "bits": "010001101000011010", + "size": 18 + }, + "lambda_Omega": { + "bits": "00010001101000011010", + "size": 20 + }, + "Omega_I": { + "bits": "010100011010000110100010", + "size": 24 + } + }, + "tests": [ + { + "name": "reader_zero_rigid_bit_and_tail", + "ok": true, + "returncode": 0, + "stdout": "000000000101111011010\n|nf| = 21 bits, 8 beta", + "stderr": "", + "expected_wire": "000000000101111011010", + "seconds": 0.21785558300325647 + }, + { + "name": "reader_variable_1", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000011011010\n|nf| = 34 bits, 20 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000011011010", + "seconds": 0.21632037500239676 + }, + { + "name": "reader_variable_2", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000110111010\n|nf| = 49 bits, 24 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000110111010", + "seconds": 0.21352833400305826 + }, + { + "name": "reader_variable_3", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001101111010\n|nf| = 64 bits, 28 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001101111010", + "seconds": 0.21358533299644478 + }, + { + "name": "reader_variable_4", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000011011111010\n|nf| = 79 bits, 32 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000011011111010", + "seconds": 0.009025291001307778 + }, + { + "name": "reader_variable_5", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000110111111010\n|nf| = 94 bits, 36 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000110111111010", + "seconds": 0.005946625002252404 + }, + { + "name": "reader_variable_6", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111010\n|nf| = 109 bits, 40 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111010", + "seconds": 0.0061591670018970035 + }, + { + "name": "reader_variable_7", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111010\n|nf| = 124 bits, 44 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111010", + "seconds": 0.0032169580008485354 + }, + { + "name": "reader_variable_8", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111010\n|nf| = 139 bits, 48 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111010", + "seconds": 0.0030665000012959354 + }, + { + "name": "reader_variable_9", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111010\n|nf| = 154 bits, 52 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111010", + "seconds": 0.0041849580011330545 + }, + { + "name": "reader_variable_10", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111010\n|nf| = 169 bits, 56 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111010", + "seconds": 0.007487708004191518 + }, + { + "name": "reader_variable_11", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111010\n|nf| = 184 bits, 60 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111010", + "seconds": 0.0035483750034472905 + }, + { + "name": "reader_variable_12", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111010\n|nf| = 199 bits, 64 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111010", + "seconds": 0.00320241699955659 + }, + { + "name": "reader_variable_13", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111010\n|nf| = 214 bits, 68 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111010", + "seconds": 0.004385375003039371 + }, + { + "name": "reader_variable_14", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111010\n|nf| = 229 bits, 72 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111010", + "seconds": 0.005879500000446569 + }, + { + "name": "reader_variable_15", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111010\n|nf| = 244 bits, 76 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111010", + "seconds": 0.004894416997558437 + }, + { + "name": "reader_variable_16", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111010\n|nf| = 259 bits, 80 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111010", + "seconds": 0.0054332080035237595 + }, + { + "name": "reader_variable_17", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111010\n|nf| = 274 bits, 84 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111010", + "seconds": 0.006412665999960154 + }, + { + "name": "reader_variable_18", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111010\n|nf| = 289 bits, 88 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111010", + "seconds": 0.006625208996410947 + }, + { + "name": "reader_variable_19", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111010\n|nf| = 304 bits, 92 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111010", + "seconds": 0.005404957999417093 + }, + { + "name": "reader_variable_20", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111111010\n|nf| = 319 bits, 96 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111111010", + "seconds": 0.003945457996451296 + }, + { + "name": "reader_variable_21", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111111010\n|nf| = 334 bits, 100 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111111010", + "seconds": 0.004023499997856561 + }, + { + "name": "reader_variable_22", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111010\n|nf| = 349 bits, 104 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111010", + "seconds": 0.005040625001129229 + }, + { + "name": "reader_variable_23", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111111111010\n|nf| = 364 bits, 108 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111111111010", + "seconds": 0.005165624999790452 + }, + { + "name": "reader_variable_24", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111111111010\n|nf| = 379 bits, 112 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111111111010", + "seconds": 0.006715957999404054 + }, + { + "name": "reader_variable_25", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111111010\n|nf| = 394 bits, 116 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111111010", + "seconds": 0.005071999999927357 + }, + { + "name": "reader_variable_26", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111111111111010\n|nf| = 409 bits, 120 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111111111111010", + "seconds": 0.004258958993887063 + }, + { + "name": "reader_variable_27", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111111111111010\n|nf| = 424 bits, 124 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111111111111010", + "seconds": 0.006420290999813005 + }, + { + "name": "reader_variable_28", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111111111010\n|nf| = 439 bits, 128 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111111111010", + "seconds": 0.0036235419975128025 + }, + { + "name": "reader_variable_29", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111111111111111010\n|nf| = 454 bits, 132 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111111111111111010", + "seconds": 0.006029459000274073 + }, + { + "name": "reader_variable_30", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111111111111111010\n|nf| = 469 bits, 136 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111111111111111010", + "seconds": 0.004915500001516193 + }, + { + "name": "reader_variable_31", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111111111111010\n|nf| = 484 bits, 140 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111111111111010", + "seconds": 0.005207624999457039 + }, + { + "name": "reader_variable_32", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111111111111111111010\n|nf| = 499 bits, 144 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111111111111111111010", + "seconds": 0.002864959002181422 + }, + { + "name": "reader_variable_63", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111111111111111111111111111111111111111111111111010\n|nf| = 964 bits, 268 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111111111111111111111111111111111111111111111111010", + "seconds": 0.0069532500056084245 + }, + { + "name": "reader_variable_64", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111111111111111111111111111111111111111111111010\n|nf| = 979 bits, 272 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111111111111111111111111111111111111111111111010", + "seconds": 0.003937333000067156 + }, + { + "name": "reader_variable_127", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111010\n|nf| = 1924 bits, 524 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111010", + "seconds": 0.005014834001485724 + }, + { + "name": "reader_variable_128", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111010\n|nf| = 1939 bits, 528 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000110111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111010", + "seconds": 0.008788250001089182 + }, + { + "name": "reader_variable_255", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111010\n|nf| = 3844 bits, 1036 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001101111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111010", + "seconds": 0.0056214170035673305 + }, + { + "name": "reader_variable_256", + "ok": true, + "returncode": 0, + "stdout": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111010\n|nf| = 3859 bits, 1040 beta", + "stderr": "", + "expected_wire": "0000000101111000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000010000101100000100001011000001000010110000011011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111010", + "seconds": 0.004705667000962421 + }, + { + "name": "suffix_Omega", + "ok": true, + "returncode": 0, + "stdout": "0010\n|nf| = 4 bits, 215 beta", + "stderr": "", + "expected_wire": "0010", + "seconds": 0.005604500001936685 + }, + { + "name": "suffix_lambda_Omega", + "ok": true, + "returncode": 0, + "stdout": "0010\n|nf| = 4 bits, 228 beta", + "stderr": "", + "expected_wire": "0010", + "seconds": 0.0029348340030992404 + }, + { + "name": "suffix_Omega_I", + "ok": true, + "returncode": 0, + "stdout": "0010\n|nf| = 4 bits, 263 beta", + "stderr": "", + "expected_wire": "0010", + "seconds": 0.00269829200260574 + } + ], + "seconds": 0.3217443329995149, + "all_ok": true +} diff --git a/data/self-interpreter/reasoning_floor/verify/v162_codex_checks.py b/data/self-interpreter/reasoning_floor/verify/v162_codex_checks.py new file mode 100644 index 00000000..179fb586 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/v162_codex_checks.py @@ -0,0 +1,229 @@ +#!/usr/bin/env python3 +"""Independent source/wire accounting and bounded rigid-term checks for int162. + +No optimizer or repository parser is used by parse(), encode(), or decode(). +Repository compilation is a cross-check only. Reductions use a frozen copy of +the existing release KN engine; this script does not rebuild it. +""" +import concurrent.futures +import hashlib +import json +from pathlib import Path +import re +import shutil +import subprocess +import sys +import tempfile +import time + +ROOT = Path(__file__).resolve().parents[3] +sys.path.insert(0, str(ROOT / "tools")) +import blcc + + +def parse(src): + src = re.sub(r"--[^\n]*", "", src) + toks = re.findall(r"[A-Za-z][A-Za-z0-9_]*|[\\().]", src) + assert "".join(toks) == re.sub(r"\s", "", src) + pos = 0 + + def expr(env): + nonlocal pos + if toks[pos] == "\\": + pos += 1 + name = toks[pos] + pos += 1 + if toks[pos] == ".": + pos += 1 + return ("L", expr((name,) + env)) + terms = [] + while pos < len(toks) and toks[pos] != ")": + if toks[pos] == "(": + pos += 1 + t = expr(env) + assert toks[pos] == ")" + pos += 1 + else: + assert re.fullmatch(r"[A-Za-z][A-Za-z0-9_]*", toks[pos]) + t = ("V", env.index(toks[pos])) + pos += 1 + terms.append(t) + assert terms + t = terms[0] + for arg in terms[1:]: + t = ("A", t, arg) + return t + + t = expr(()) + assert pos == len(toks) + return t + + +def encode(t): + if t[0] == "V": + return "1" * (t[1] + 1) + "0" + if t[0] == "L": + return "00" + encode(t[1]) + return "01" + encode(t[1]) + encode(t[2]) + + +def decode(bits): + pos = 0 + + def term(depth): + nonlocal pos + if bits[pos] == "1": + n = 0 + while bits[pos] == "1": + pos += 1 + n += 1 + assert bits[pos] == "0" and 1 <= n <= depth + pos += 1 + return ("V", n - 1) + tag = bits[pos:pos + 2] + pos += 2 + if tag == "00": + return ("L", term(depth + 1)) + assert tag == "01" + return ("A", term(depth), term(depth)) + + t = term(0) + assert pos == len(bits) + return t + + +def counts(t): + if t[0] == "V": + return (0, 0, 1, t[1]) + if t[0] == "L": + l, a, v, x = counts(t[1]) + return (l + 1, a, v, x) + l, a, v, x = (p + q for p, q in zip(counts(t[1]), counts(t[2]))) + return (l, a + 1, v, x) + + +def shift(t, d, cutoff=0): + if t[0] == "V": + return ("V", t[1] + d) if t[1] >= cutoff else t + if t[0] == "L": + return ("L", shift(t[1], d, cutoff + 1)) + return ("A", shift(t[1], d, cutoff), shift(t[2], d, cutoff)) + + +def app(*ts): + t = ts[0] + for u in ts[1:]: + t = ("A", t, u) + return t + + +K = parse(r"\x. \y. x") +F = parse(r"\x. \y. y") +I = parse(r"\x. x") + + +def stream(bits, tail): + for b in reversed(bits): + tail = ("L", app(("V", 0), shift(K if b == "0" else F, 1), shift(tail, 1))) + return tail + + +def close(t, n): + for _ in range(n): + t = ("L", t) + return t + + +def digest(path): + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def main(): + started = time.monotonic() + src = ROOT / "tmp/overnight/self/int162.lam" + wire = src.with_suffix(".blc") + binary = ROOT / "target/release/blam" + E = parse(src.read_text()) + bits = wire.read_text().strip() + assert set(bits) <= {"0", "1"} + assert encode(E) == bits and decode(bits) == E + _, repo_db, _ = blcc.compile_lam(src) + assert repo_db == E + l, a, v, x = counts(E) + assert (l, a, v, x) == (16, 24, 25, 32) + assert len(bits) == 2 * l + 4 * a + 2 + x == 162 + reader = parse(r"\c. \j. \s. s (\a. a) (\u. s (\q. c) (s s u)) j") + # This is exactly the candidate reader with its final NEXT operand opaque. + tests = [] + # All free parameters are closed by binders and stay rigid during reduction. + # Inside lambda c j b r: c=3, j=2, b=1, r=0. + arbitrary_second = ("L", app(("V", 0), ("V", 2), ("V", 1))) + zero_stream = stream("0", arbitrary_second) + tests.append(("reader_zero_rigid_bit_and_tail", + close(app(reader, ("V", 3), ("V", 2), zero_stream), 4), + close(app(("V", 2), ("V", 1), ("V", 0)), 4))) + for n in list(range(1, 33)) + [63, 64, 127, 128, 255, 256]: + # Inside lambda c j n: c=2, j=1, n=0. + tail = ("V", 0) + s = stream("1" * n + "0", tail) + r = stream("1" * (n - 1) + "0", tail) + tests.append((f"reader_variable_{n}", + close(app(reader, ("V", 2), ("V", 1), s), 3), + close(app(("V", 2), r, tail), 3))) + omega = parse(r"(\x. x x) (\x. x x)") + sources = {"Omega": omega, "lambda_Omega": ("L", omega), "Omega_I": app(omega, I)} + for name, m in sources.items(): + quoted = stream(encode(m), ("V", 0)) + # lambda n. E (lambda v r. r) ( ++ n) must be exactly lambda n. n. + tests.append(("suffix_" + name, close(app(E, F, quoted), 1), I)) + # Check that the fixed-frame version is 166, with a 44-bit reader region. + fixed_frame = parse(r""" + (\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\a. a) (\u. list (\q. cont) (list list u)) next) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) + """) + assert len(encode(fixed_frame)) == 166 + report = { + "candidate_sha256": digest(src), "wire_sha256": digest(wire), + "binary_sha256": digest(binary), "wire": bits, "bits": len(bits), + "L": l, "A": a, "V": v, "X": x, + "source_equals_wire": True, "source_equals_repo_unoptimized_ast": True, + "fixed_frame_version_bits": len(encode(fixed_frame)), + "sources": {k: {"bits": encode(m), "size": len(encode(m))} for k, m in sources.items()}, + } + with tempfile.TemporaryDirectory(prefix="v162-codex-") as temp: + frozen = Path(temp) / "blam" + shutil.copy2(binary, frozen) + + def check(test): + name, got, want = test + t0 = time.monotonic() + run = subprocess.run([str(frozen), "normalize", encode(got), "--beta", "262144"], + capture_output=True, text=True, timeout=15) + words = run.stdout.split() + ok = run.returncode == 0 and bool(words) and words[0] == encode(want) + return {"name": name, "ok": ok, "returncode": run.returncode, + "stdout": run.stdout.strip(), "stderr": run.stderr.strip(), + "expected_wire": encode(want), "seconds": time.monotonic() - t0} + + with concurrent.futures.ThreadPoolExecutor(max_workers=4) as pool: + report["tests"] = list(pool.map(check, tests)) + assert digest(binary) == report["binary_sha256"] + report["seconds"] = time.monotonic() - started + report["all_ok"] = all(t["ok"] for t in report["tests"]) + dest = Path(__file__).with_suffix(".json") + dest.write_text(json.dumps(report, indent=2) + "\n") + print(json.dumps({k: report[k] for k in ("bits", "L", "A", "V", "X", "all_ok", "seconds")}, indent=2)) + for test in report["tests"]: + if test["name"].startswith("suffix_") or not test["ok"]: + print(test["name"], test["ok"], test["stdout"]) + print(f"Passed {sum(t['ok'] for t in report['tests'])}/{len(tests)} checks; evidence: {dest}") + assert report["all_ok"] + + +if __name__ == "__main__": + main() diff --git a/data/self-interpreter/reasoning_floor/verify/vnext.md b/data/self-interpreter/reasoning_floor/verify/vnext.md new file mode 100644 index 00000000..cdd7030a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vnext.md @@ -0,0 +1,33 @@ +Adversarial verification request. You are a fresh, independent reviewer; your +job is to find an error if there is one. Repository: /Users/a9lim/Work/blam. + +Under review: /Users/a9lim/Work/blam/tmp/overnight/next-proof-codex/REPORT.md, +about the NEXT region of the 165-bit BLC self-interpreter (contract +E C (⌜M⌝ ++ N) =β C (λz. M) N for every closed M; ⌜λM⌝ = 00⌜M⌝, +⌜M N⌝ = 01⌜M⌝⌜N⌝, var n = 1ⁿ0; K = λab.a (0), F = λab.b (1), +cons b r = λh. h b r; |M| = 2L + 4A + 2 + X; the 165 is +data/self-interpreter/machines/int165.lam). Check, in order of importance: + +1. §3, the embedding: for any closed self-interpreter Q, + N_Q = λb t. Q c (λh. h K (λj. j b t)) makes E_(N_Q) a self-interpreter and + |N_Q| = |Q| + 44; hence "every correct N has ≥ 92 bits" implies "every + interpreter has ≥ 48 bits". Verify correctness (including the reader's + handoff equation (1) on every closed source and divergent ones) and the + exact bit count. +2. §4, the conditional theorem: under R (rigid canonical branch laws (8)), + B (N β-normal), D (every tag use is a two-argument spine `b U V`), + |N| ≥ 92 with equality only for the 165's NEXT. Check the pruning + argument (4.1, 4.2: does specializing repeated tests really never increase + size, never create redexes, and cover every D-respecting tree?), the + claim (10) about normal W with W t =β T t, the completeness of the nine + forms in 4.3 (could a tag test sit somewhere the list misses, e.g. inside + A(f) or B(f), or splitting a payload between arms while respecting D?), + and every price in the table. +3. §5, the bare-head shared-argument lemma (first-demand argument) and its + two forced sources (96, 97 bits). +4. §1's root laws (2) and head-structure theorem (3), and §2's 184-bit + witness showing R is not necessary. +Small fixed checks (seconds) are fine; no enumeration. Answer: verdict per +item (correct / gap / error), each problem with location and a +counterexample or failing step, what you checked fully. Write the review to +/Users/a9lim/Work/blam/tmp/overnight/verify/vnext_codex.md. diff --git a/data/self-interpreter/reasoning_floor/verify/vnext_codex.md b/data/self-interpreter/reasoning_floor/verify/vnext_codex.md new file mode 100644 index 00000000..5f932aa3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vnext_codex.md @@ -0,0 +1,258 @@ +# Independent adversarial review of the NEXT report + +Reviewed `tmp/overnight/next-proof-codex/REPORT.md`, SHA-256 +`04edba6a9b70a9fd57d7b2ebd88d2458858dcea89ca12d64546aacdb1362d120`. +Line references below refer to that version. I found no counterexample or +substantive proof gap in the four requested items. The conditional theorem +remains conditional on all three of R, B, and D. + +| Requested item | Verdict | Scope of conclusion | +|---|---|---| +| 1. §3 embedding and +44 bits | **Correct** | Uniform in every closed interpreter Q, including its divergent-source contract; the 48-bit implication follows. | +| 2. §4 conditional theorem | **Correct** | Pruning, (10), completeness of the nine reduced forms, their prices, and uniqueness at 92 hold under R/B/D. | +| 3. §5 bare-head lemma | **Correct** | Under the stated normality and tag-independence assumptions, the erasing adapters are forced; prices are 97 and 96. | +| 4. §1 root/head laws; §2 witness | **Correct** | The root laws are equivalent to the actual contract, the HNF exclusions hold, and the 184-bit witness really separates actual correctness from R. | + +The universal arguments below were checked mathematically. Separately, +`vnext_codex_checks.py` independently constructs the terms and passes **59 +fixed equality/inequality checks**, each compared using a separate Python +beta normalizer and the existing Rust normalizer. It also checks all nine +L/A/X counts, source normality and D for the nine forms, selected repeated-test +examples, the 97/96 prices, the 165/184/282 full sizes, the embedding overhead, +and the actual reference NEXT's head form. The run took 0.272 seconds with +two workers; results are in `vnext_codex_checks.json`. There was no candidate +enumeration, full battery rerun, Lean run, or further consult. The checker +imports the repository's source parser/encoder, but does not import the +report's checker or normalizer. + +**1. Embedding — §3, lines 219–257.** + +The necessary reader identity is valid with arbitrary, possibly nonnormal +arguments. Put `s = cons K r`. Direct contraction gives `s s ->* K r` +and therefore `s s s ->* r`. Consequently + +``` +s H(J_c,c) (s s s) + ->* H(J_c,c) K r r + ->* r J_c. +``` + +Taking `r = cons b t` gives exactly `J_c b t`. Neither b nor t is evaluated +to obtain this equation. The fixed knot/let unfolding gives this reader +expression for every N, including one that ignores p and x. + +Every closed source has an abstraction or application root, so its code is +`cons K (cons b t)` for the appropriate tag b. For the proposed replacement, + +``` +E_(N_Q) c (cons K (cons b t)) + ->* N_Q b t + ->* Q c (cons K (cons b t)) + =beta c (lambda z.M) T. +``` + +In the middle expression, `N_Q` denotes its instantiation with this c. +The last equality is precisely Q's closed-source contract on the original +stream. The argument never asks Q to interpret the open abstraction body +separately. It never normalizes M: divergent M has finite syntax, and the +last step uses the assumed beta-conversion contract, not a normal-form test. +Arbitrary continuation and suffix terms follow by capture-avoiding +substitution from the rigid-variable equation. + +The cost is exact in the frame `[c,p,x]`. The inner cell +`lambda j.j b t`, occurring under b,t,h, costs +`2 + 4 + 2 + 5 + 4 = 17`: the three variable costs are those of j,b,t. +The outer cell costs `2 + 4 + 2 + 7 + 17 = 32`; literal K costs 7. +The two outer lambdas cost 4, the applications to Q cost 4, and c has +one-based index 3 and costs 4. Closed Q has no free indices to move under +the added binders. Hence `|N_Q| = |Q| + 44`. + +The unchanged surrounding source costs 73, as checked against the exact +165-bit AST. Q=165 gives NEXT=209 and full=282. Applying the hypothetical +unrestricted NEXT floor to this construction gives `|Q|+44 >= 92`, hence +`|Q| >= 48`. This is an implication, not a new proof of either floor. + +**2. Conditional theorem — §4, lines 265–389.** + +The pruning argument is sound, including its source-size claim. In a normal +term satisfying D, every maximal tag-headed spine is exactly `b U V`. +It can occur at the root, under a lambda, or as an argument of another +spine. It cannot occur as the function of an additional application: +that would make its maximal spine have at least three arguments. +Selecting U or V therefore cannot expose a new beta redex at the boundary +with its context. Induction handles nested tests. All other nodes were +already normal by B. + +When simplifying the source, retain the outer tag binder and replace a +whole `b U V` node by its chosen child. The child has exactly the same +enclosing binders before and after the replacement. Thus no surviving +variable index increases; the tag leaf, two application nodes, and the +discarded child are removed. This is strictly cheaper in BLC. It is not +the generally false claim that arbitrary beta reduction decreases BLC size. + +Equation (10), lines 321–332, is also exact. If normal W has no leading +lambda, `W t` is already normal, and equality of its normal form with +`T_i t` gives W=T_i. If W starts with one lambda, applying the fresh +variable t merely renames its bound variable; it creates no beta redex +inside the body. Equality forces that body to be `T_i r`. Two or more +leading lambdas would leave a lambda where the target has rigid head p. +There are no additional beta-normal possibilities and no use of eta +conversion in this reasoning. + +Here is a precise completeness argument for §4.2. Regard a normal term +as either a lambda or a variable-headed maximal spine. Its two prunings +determine the following cases: + +- At a tag-headed node, conditionally specialize the entire K child to K + and the entire F child to F. This preserves both results and removes + every further tag occurrence below this node. +- At a non-tag node, its lambda constructor, or its head and full arity, + survives both prunings. Both target trees must have that same structure + there; recurse into its children with their required pairs of outputs. +- Whenever a required output pair is identical, specialize that subtree + completely. Its two outputs are normal, so beta equality here is literal + equality up to alpha conversion. This removes all unnecessary tests. + +For `(T0,T1)`, there is exactly one path to a structural difference: +the common p head, its only argument, and the argument's lambda f. +At the next node the rigid heads are c versus p. Thus a remaining test +can occur at precisely three positions: before p, before lambda f, +or after lambda f. These are the three 00 rows. + +For a mixed pair `(T0,eta(T1))` or `(eta(T0),T1)`, the root constructors +already differ, so the test must be at the root. These are the two mixed +rows. For the pair of eta expansions, the common path starts with lambda r, +then the p spine of arity two, then its first argument and lambda f. The +second argument is the identical r and is completely specialized. The +four possible positions give exactly the four 11 rows. Total: nine. + +This also addresses the suggested missing cases. A test inside A or B +cannot change the enclosing c-versus-p head. A preceding tag test must +already have selected that arm, after which all tests within its payload +can be specialized to that same tag and deleted. A separately selected +head with a shared or separately selected payload has the shape +`(b c p) W`, which violates D. Tests in a common identical payload, such +as the eta tail argument, are removed by the identical-output case. +There can be many tests in an original source; the list is exhaustive +**after** these strictly decreasing simplifications, not a list of all +literal sources satisfying the assumptions. + +Every table count was recomputed directly from the unoptimized AST: + +| Row | L | A | X | Bits | +|---|---:|---:|---:|---:| +| 00, root | 9 | 14 | 23 | 99 | +| 00, before lambda f | 9 | 13 | 21 | 93 | +| 00, after lambda f | 8 | 13 | 22 | 92 | +| 01 | 10 | 15 | 26 | 108 | +| 10 | 10 | 15 | 25 | 107 | +| 11, root | 11 | 16 | 28 | 116 | +| 11, after lambda r | 10 | 16 | 29 | 115 | +| 11, before lambda f | 10 | 14 | 26 | 104 | +| 11, after lambda f | 9 | 14 | 27 | 103 | + +The sole reduced source of cost 92 is (9). Any source changed by the +simplification has strictly greater cost than its reduced source. Thus +both the lower bound and equality uniqueness follow; neither is merely +inferred from the nine examples passing their branch checks. + +**3. Bare-head lemma — §5, lines 397–466.** + +I find the first-demand argument valid. For precision, a demanded occurrence +must include a bare occurrence of z, treated as a spine of arity zero. +This is a clarification of the argument's terminology, not an additional +semantic assumption. + +If X=c, the K equation and normality force Z=A literally. A normal Y +without an initial lambda has a fixed variable head. The only arity-compatible +choice for `Y A =beta p B` is Y=p, which fails since A and B have different +normal forms. Hence Y=`lambda z.D`, with normal D. + +If D contains z, choose an outermost z-headed maximal spine: one with no +z-headed spine above it. Its context consists only of lambdas and rigid +heads, including locally bound variables that cannot be applied from +outside this context. That context survives substitution and reduction. +The inserted A, with whatever arguments this spine supplied, must +therefore normalize to the corresponding target subterm. This is a +structural formulation of the report's first-demand step; it prevents a +later computation from erasing the allegedly surviving occurrence. + +With zero arguments, A retains two leading lambdas, absent from p B. +With one argument, it has one leading lambda and rigid f with one +argument, unlike the target's one-lambda f-headed lift, whose f has two. +With two or more, its first f argument is always the two-lambda Cell. +Every f-headed target spine instead has the environment variable as +its first argument. Reductions inside U, V, or later arguments cannot +remove that Cell's lambdas or its bound head. Thus no such z occurrence +is possible. Normal-form equality now forces D=`p B`. + +For Y=p the symmetric initial step gives Z=B. A demanded B with no +arguments has a lambda with free c beneath it; no such subterm occurs +inside A. With one argument it has rigid head c and the payload +`lambda e.f e (U e)`. Its only possible c-headed location in `c A` is the +root, but that payload has one leading lambda before f, while A has two. +With more arguments its c-spine has excessive arity. Again the mismatch +persists regardless of reductions in the supplied arguments. The adapter +must therefore be exactly `lambda z.c A`. + +The reconstructed sources have `(L,A,X)=(9,13,25)` and `(9,13,24)`, hence +97 and 96 bits. Their four rigid branch equations pass the independent +checks. This conclusion does not cover arbitrary shared packets or two +non-bare adapters; the report correctly leaves those outside the lemma. + +**4. Actual root/head laws and the witness — §§1–2.** + +For the unary stream, `U_n(T) U_n(T)` reduces to +`U_(n-1)(T) U_(n-1)(T)` when n>0, and `U_0(T) U_0(T) ->* K T`. +The skip is therefore T; selecting the F reader arm returns +`c U_(n-1)(T) T`. This is a finite induction on the unary prefix and +requires no property of T. The constructor handoff was checked above. + +Consequently the root equations (2), lines 71–83, are necessary. They +are sufficient because every closed term is either a closed abstraction +or an application with both children closed. They explicitly include +the possibly open body of a closed abstraction. This equivalence applies +to divergent sources without any normalizability premise. + +The HNF argument at lines 138–151 has the needed exclusions. A normal +closed-source probe gives `J_c` a head normal form, whose only free head +candidate is c. Three or more initial lambdas survive two applications +and cannot join a c-headed answer. With zero lambdas, rigid arity forces +J_c=c, which returns the wrong arguments. With one lambda, a c head +leaves the unparsed stream as the final output argument; a tag head with +zero arguments leaves a lambda, and with one argument the F case returns +the raw stream. With two lambdas, the possible heads are c, the tag, and +the stream. Their admissible arities are respectively two, at least two, +and at least one. All smaller cases leave a lambda or a raw stream. +This gives exactly (3) as a necessary classification. The independently +traced reference J has two lambdas and stream-head arity two, as reported. + +For §2, the four reader identities follow directly from substitution into +`s H (s s s)`. In particular `s=lambda u v.X` returns X while erasing H; +it works for the changed parser itself and for an arbitrary continuation, +including f. Thus the extra ABS computation in N_ret reduces to `c A(f)` +without a recursive assumption about N_ret's correctness. The three syntax +recursion equations are those of the reference with the changed parser +in each recursive call. + +The correctness transfer is justified by finite induction on source syntax, +followed by the same finite environment-lookup induction. A raw variable +value applied to `Cell(a,e)` selects a when its unary prefix ends, or +continues into e when its leading bit is F. A and V then implement the +abstraction and application constructors. For a closed source, the +environment argument is unused after these finite conversions and the +value is beta-convertible to `lambda z.M`. Every returned value already +has a leading lambda, so this conclusion requires no eta conversion. +This reconstructs syntax; it does not evaluate M, so divergence causes +no additional obligation. + +The replacement is beta-normal, respects D, and costs 111 bits; the full +source costs 184. With p rigid its K branch retains the additional +`p f (lambda u v.c A(f))` subterm. Both sides of the purported rigid ABS +law are normal and distinct, so R fails by uniqueness of beta normal +forms. That makes it a valid witness that actual correctness does not +imply R, not merely a candidate that passes a finite battery. + +No change to the four requested mathematical conclusions is indicated. +The distinction between the conditional 92-bit theorem and the open +unrestricted NEXT bound must remain explicit. diff --git a/data/self-interpreter/reasoning_floor/verify/vnext_codex_checks.py b/data/self-interpreter/reasoning_floor/verify/vnext_codex_checks.py new file mode 100644 index 00000000..522c03c7 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vnext_codex_checks.py @@ -0,0 +1,317 @@ +#!/usr/bin/env python3 +"""Independent fixed checks for REPORT.md; no enumeration and no lane imports. + +Uses only blcc's source parser/encoder. Beta substitution, normalization, +size statistics, and the tag-spine checker below are separate implementations. +All outputs stay in this review directory. +""" +from concurrent.futures import ThreadPoolExecutor +import hashlib +import json +from pathlib import Path +import re +import subprocess +import sys +import time + +sys.dont_write_bytecode = True +ROOT = Path(__file__).resolve().parents[3] +sys.path.insert(0, str(ROOT / "tools")) +import blcc + +FRAME = ("c", "p", "x") + + +def parse(s, frame=()): + s = re.sub(r"\\([A-Za-z_]\w*(?:\s+[A-Za-z_]\w*)+)\.", + lambda m: "\\" + "\\".join(m[1].split()) + ".", s) + p = blcc.P(blcc.strip_comments(s)) + t = blcc.p_lc(p) + p.ws() + assert p.i == len(p.t) + return blcc.to_db(t, frame) + + +def app(t, *args): + for a in args: + t = ("A", t, a) + return t + + +def shift(t, n, depth=0): + if t[0] == "V": + return ("V", t[1] + n) if t[1] >= depth else t + if t[0] == "L": + return ("L", shift(t[1], n, depth + 1)) + return ("A", shift(t[1], n, depth), shift(t[2], n, depth)) + + +def replace_bound(t, value, depth=0): + if t[0] == "V": + if t[1] == depth: + return shift(value, depth) + return ("V", t[1] - 1) if t[1] > depth else t + if t[0] == "L": + return ("L", replace_bound(t[1], value, depth + 1)) + return ("A", replace_bound(t[1], value, depth), + replace_bound(t[2], value, depth)) + + +def nf(t, fuel=None): + fuel = [30000] if fuel is None else fuel + + def whnf(u): + while u[0] == "A": + f = whnf(u[1]) + if f[0] != "L": + return ("A", f, u[2]) + fuel[0] -= 1 + assert fuel[0] >= 0, "fixed-check fuel exhausted" + u = replace_bound(f[1], u[2]) + return u + + t = whnf(t) + if t[0] == "L": + return ("L", nf(t[1], fuel)) + if t[0] == "A": + return ("A", nf(t[1], fuel), nf(t[2], fuel)) + return t + + +def hnf(t): + def step(u): + if u[0] == "V": + return None + if u[0] == "L": + body = step(u[1]) + return None if body is None else ("L", body) + if u[1][0] == "L": + return replace_bound(u[1][1], u[2]) + head = step(u[1]) + return None if head is None else ("A", head, u[2]) + for _ in range(1000): + after = step(t) + if after is None: + return t + t = after + raise AssertionError("fixed head-normalization cap") + + +def stats(t): + if t[0] == "V": + return (0, 0, t[1]) + if t[0] == "L": + l, a, x = stats(t[1]) + return l + 1, a, x + a, b = stats(t[1]), stats(t[2]) + return a[0] + b[0], a[1] + b[1] + 1, a[2] + b[2] + + +def measure(s, frame=FRAME): + t = parse(s, frame) + l, a, x = stats(t) + bits = len(blcc.encode(t)) + assert bits == 2 * l + 4 * a + 2 + x + return {"L": l, "A": a, "X": x, "bits": bits} + + +def respects_D(n): + assert n[0] == "L" + + def walk(t, tag): + if t[0] == "L": + return walk(t[1], tag + 1) + args = [] + h = t + while h[0] == "A": + args.append(h[2]) + h = h[1] + if h == ("V", tag): + return len(args) == 2 and all(walk(a, tag) for a in args) + return (h[0] == "V" or walk(h, tag)) and all(walk(a, tag) for a in args) + + return walk(n[1], 0) + + +K = r"(\a b.a)" +F = r"(\a b.b)" +I = r"(\a.a)" +A = r"(\e a.f (\u r.u a (r e)))" +B = r"(\g.c (\e.f e (g e)))" +K0 = rf"(\f.c {A})" +K1 = rf"(\f.p {B})" +T0 = rf"(p {K0})" +T1 = rf"(p {K1})" +NEXT = rf"\b.p (\f.b (c {A}) (p {B}))" + + +def machine(n): + return rf"(\x.x x) (\x.(\p c.(\j s.s (\v.v (\u r.r j) c) (s s s)) ({n})) (x x))" + + +def cons(b, t): + return rf"(\h.h ({b}) ({t}))" + + +def reader(j, c, s): + return rf"({s}) (\v.v (\u r.r ({j})) ({c})) (({s}) ({s}) ({s}))" + + +def stream(bits, tail): + for b in reversed(bits): + bit = parse(K if b == "0" else F) + tail = ("L", app(("V", 0), shift(bit, 1), shift(tail, 1))) + return tail + + +EQUATIONS = [] + + +def eq(label, a, b, equal=True): + EQUATIONS.append((label, parse(a), parse(b), equal)) + + +def branches(label, src): + for bit, rhs in [(K, T0), (F, T1)]: + eq(label + (" K" if bit == K else " F"), + rf"\x p c t.({src}) {bit} t", rf"\x p c t.{rhs} t") + + +def run_check(item): + label, a, b, equal = item + aa, bb = nf(a), nf(b) + assert (aa == bb) == equal, label + # Independently replay every fixed input using the existing Rust engine. + for side, term, normal in [("lhs", a, aa), ("rhs", b, bb)]: + proc = subprocess.run( + [str(ROOT / "target/release/blam"), "normalize", blcc.encode(term), + "--beta", "30000"], text=True, capture_output=True, timeout=5) + assert proc.returncode == 0, (label, side, proc.stderr) + assert proc.stdout.split()[0] == blcc.encode(normal), (label, side) + return {"label": label, "equal": equal} + + +def main(): + start = time.monotonic() + forms = [ + rf"\b.b {T0} {T1}", + rf"\b.p (b {K0} {K1})", + NEXT, + rf"\b.b {T0} (\r.{T1} r)", + rf"\b.b (\r.{T0} r) {T1}", + rf"\b.b (\r.{T0} r) (\r.{T1} r)", + rf"\b r.b ({T0} r) ({T1} r)", + rf"\b r.p (b {K0} {K1}) r", + rf"\b r.p (\f.b (c {A}) (p {B})) r", + ] + expected = [(9,14,23,99), (9,13,21,93), (8,13,22,92), + (10,15,26,108), (10,15,25,107), (11,16,28,116), + (10,16,29,115), (10,14,26,104), (9,14,27,103)] + prices = [] + for i, (s, want) in enumerate(zip(forms, expected), 1): + m = measure(s) + assert tuple(m.values()) == want + assert respects_D(parse(s, FRAME)) and nf(parse(s, FRAME)) == parse(s, FRAME) + prices.append(m) + branches(f"table row {i}", s) + + repeated = [ + (rf"\b.b {T0} (b x {T1})", forms[0]), + (rf"\b.p (\f.b (c (\e a.f (\u r.u a (r (b e x)))) )" + rf" (p (\g.c (\e.f e (g (b x e))))))", NEXT), + (rf"\b r.p (\f.b (c {A}) (p {B})) (b r r)", forms[8]), + ] + for i, (s, target) in enumerate(repeated, 1): + assert respects_D(parse(s, FRAME)) + assert nf(parse(s, FRAME)) == parse(s, FRAME) + assert measure(s)["bits"] > measure(target)["bits"] + branches(f"repeated test example {i}", s) + split = rf"\b.p (\f.(b c p) (b {A} {B}))" + assert not respects_D(parse(split, FRAME)) + branches("selected head plus payload is excluded by D", split) + + eq("generic constructor handoff", rf"\j c b t.{reader('j','c',cons(K,cons('b','t')))}", + r"\j c b t.j b t") + for n in (1, 2, 4): + u, prev = cons(K, "t"), cons(K, "t") + for _ in range(n): + prev, u = u, cons(F, u) + eq(f"raw variable {n}", rf"\j c t.{reader('j','c',u)}", rf"\j c t.c ({prev}) t") + for name, s, out in [("K", K, r"\v.v (\u r.r j) c"), + ("F", F, F), ("I", I, r"\r.r j"), + ("constant", r"\u v.w", "w")]: + eq("off-stream " + name, rf"\j c w.{reader('j','c',s)}", rf"\j c w.({out})") + + bare_c = rf"\b.p (\f.b c (\z.p {B}) {A})" + bare_p = rf"\b.p (\f.b (\z.c {A}) p {B})" + assert measure(bare_c)["bits"] == 97 + assert measure(bare_p)["bits"] == 96 + branches("bare c", bare_c) + branches("bare p", bare_p) + + ret = rf"\b.p (\f.b (p f (\u v.c {A})) (p {B}))" + assert measure(ret)["bits"] == 111 + assert respects_D(parse(ret, FRAME)) and nf(parse(ret, FRAME)) == parse(ret, FRAME) + eq("ret violates rigid ABS law", rf"\x p c t.({ret}) {K} t", rf"\x p c t.{T0} t", False) + eq("actual changed parser returns constants", rf"\c v.({machine(ret)}) c (\u w.v)", r"\c v.v") + + original = parse((ROOT / "data/self-interpreter/machines/int165.lam").read_text()) + assert parse(machine(NEXT)) == original + generator = original[2] + parser = app(generator, generator) + j = app(parse(rf"\x p c.{NEXT}"), generator, parser, ("V", 0)) + head = hnf(j) + lambdas, arguments = 0, 0 + while head[0] == "L": + lambdas += 1 + head = head[1] + while head[0] == "A": + arguments += 1 + head = head[1] + assert (lambdas, head, arguments) == (2, ("V", 0), 2) + embed = rf"\b t.({machine(NEXT)}) c {cons(K,cons('b','t'))}" + assert measure(embed)["bits"] == 209 + assert measure(machine(embed), ())["bits"] == 282 + for q in (I, K, machine(NEXT)): + adapter = rf"\b t.({q}) c {cons(K,cons('b','t'))}" + assert measure(adapter)["bits"] - measure(q, ())["bits"] == 44 + adapter = rf"\b t.q c {cons(K,cons('b','t'))}" + eq("generic embedding forwarding", rf"\q c v s.{reader(adapter,'c',cons(K,cons('v','s')))}", + rf"\q c v s.q c {cons(K,cons('v','s'))}") + + witnesses = {"reference": machine(NEXT), "ret": machine(ret), "embedded": machine(embed)} + witness_prices = {name: measure(src, ()) for name, src in witnesses.items()} + programs = {"I": I, "I I": rf"{I} {I}", "self apply": r"\a.a a", + "open body app": r"\a b.a b"} + for name, src in witnesses.items(): + for pname, psrc in programs.items(): + m = parse(psrc) + inp = stream(blcc.encode(m), ("V", 0)) + lhs = ("L", ("L", app(parse(src), ("V", 1), inp))) + rhs = ("L", ("L", app(("V", 1), ("L", m), ("V", 0)))) + EQUATIONS.append((name + " contract " + pname, lhs, rhs, True)) + omega = parse(r"(\a.a a) (\a.a a)") + for pname, m in [("Omega", omega), ("lambda Omega", ("L", omega))]: + inp = stream(blcc.encode(m), ("V", 0)) + lhs = ("L", app(parse(src), parse(F), inp)) + EQUATIONS.append((name + " divergent suffix " + pname, lhs, parse(I), True)) + + with ThreadPoolExecutor(max_workers=2) as pool: + checks = list(pool.map(run_check, EQUATIONS)) + report = ROOT / "tmp/overnight/next-proof-codex/REPORT.md" + result = {"report_sha256": hashlib.sha256(report.read_bytes()).hexdigest(), + "nine_prices": prices, "bare_c": measure(bare_c), "bare_p": measure(bare_p), + "witnesses": witness_prices, "checks": checks, + "reference_actual_J_head": {"lambdas": lambdas, "head_index": head[1], + "arguments": arguments}, + "seconds": time.monotonic() - start, + "scope": "Fixed checks only. General claims reviewed by structural arguments."} + out = Path(__file__).with_suffix(".json") + out.write_text(json.dumps(result, indent=2) + "\n") + print(json.dumps({"passed": len(checks), "seconds": result["seconds"], + "witness_bits": {k:v["bits"] for k,v in witness_prices.items()}, + "output": str(out)}, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/data/self-interpreter/reasoning_floor/verify/vreaderS.md b/data/self-interpreter/reasoning_floor/verify/vreaderS.md new file mode 100644 index 00000000..c5567511 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreaderS.md @@ -0,0 +1,32 @@ +Adversarial verification request. You are a fresh, independent reviewer; your +job is to find an error if there is one. Repository: /Users/a9lim/Work/blam. + +Claim under review: "Theorem S" in +/Users/a9lim/Work/blam/tmp/overnight/reader-proof/REPORT.md (the version with +steps marked "[after review 2]"). A reader body B over the frame +[s, next, cont, intL, x] satisfies B[cons K R/s] →* R next and +B[1ⁿ0 ++ N/s] →* cont (1ⁿ⁻¹0 ++ N) N for all n ≥ 1 (next, cont, intL, x, R, N +rigid; K = λab.a bit 0, F = λab.b bit 1, cons b r = λh. h b r). B is +*stream-linear* when it is β-normal and every binder of B occurring more than +once is contracted, in the two law reductions, only on stream material +created by a cell step (a bit or a tail). Theorem S: every stream-linear +reader body has |B| ≥ 43 (|M| = 2L + 4A + 2 + X), with equality only for +s (λb. b (λu r. r next) cont) (s s s). + +History you should know: an earlier, unconditional version was refuted by a +review (tmp/overnight/verify/vreader_codex.md — read it; its counterexamples +used lets, shared higher-order nodes, a non-dispatch output cell, rebuilt +tails, a depth-0 dual operand). The author restricted the class and repaired +the cases. Your task: check whether the restricted theorem is now correct. +In particular: is Class S precisely defined and does it really exclude every +copying of B's nodes in the reductions; is "no node of B is duplicated" a +proof of distinct-origin charging; are the new shape (α′), the corrected +Lemma 2.5(iv), the re-counted shape (α) (≥ 58), and the remaining shapes +complete and correctly priced *within* the class; does any stream-linear +reader below 43 or a second 43 exist (try to build one by hand; check it with +a small normalizer or by splicing into data/self-interpreter/machines/int165.lam +and running `python3 tools/self-interpreter/battery.py FILE.lam`). No +enumeration of reader bodies; small fixed checks only. Answer: verdict +(correct / gap / error), each problem with location and counterexample or +failing step, and what you checked fully. Write the review to +/Users/a9lim/Work/blam/tmp/overnight/verify/vreaderS_codex.md. diff --git a/data/self-interpreter/reasoning_floor/verify/vreaderS_codex.md b/data/self-interpreter/reasoning_floor/verify/vreaderS_codex.md new file mode 100644 index 00000000..a29a8c65 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreaderS_codex.md @@ -0,0 +1,385 @@ +# ( •̀_•́ ) Independent adversarial review of Theorem S + +**Verdict: error in the proof.** The restriction to stream-linear readers does +not repair the claimed proof. There are beta-normal readers within Class S +that violate several of the revised case bounds. Three of the counterexamples +have **only affine binders**, so they satisfy even the strongest natural +interpretation of the restriction. The fourth duplicates only a directly +received stream bit and tail. + +**I found no reader below 43 bits and no second 43-bit reader.** The examples +refute the proof's numerical sub-bounds and exhaustiveness claims, rather than +the numerical conclusion of Theorem S. + +Locations below refer to `tmp/overnight/reader-proof/REPORT.md`, SHA-256 +`7d71031ae5508665e9aca15d044e85d51452b1c28c0701bd2da8ee8eb0595a27`, the version +marked `[after review 2]`. I read the requested earlier Codex review, but did +not consult another model or read the other current reviewers' reports. No +reader bodies were enumerated; all terms below were constructed by hand. + +| Witness | Bits | Class-S justification | Refuted assertion | +|---|---:|---|---| +| `B44` | 44 | every binder affine | shape (beta) >= 46; shape (alpha-prime) >= 51; shapes exclusive | +| `B46` | 46 | every binder affine | corrected shape (alpha) dual-operand subcase >= 58 | +| `B57` | 57 | every binder affine | shape (beta-prime) >= 67 | +| `B65` | 65 | nonlinear binders receive only the first bit and tail | shape (delta) >= 69 | + +Throughout, `I = λa.a`, `F = λa b.b`, `K = λa b.a`, `P_n = 1^n0 ++ N`, +and the identities `P_m P_m X →* N` for every `m >= 0` and +`Z_R Z_R X →* R` are used. Costs are those of the specified frame +`[s, next, cont, intL, x]` without optimizing the source. + +## 1. A 44-bit affine reader combines shapes (beta) and (alpha-prime) + +**Locations:** lines 567–593, 643, 682–704, 706–724; consequently 866–868, +989–992, and 1016. + +```text +B44 = s I (λu. s (λq. cont) (s s u)) next. +``` + +It has `(L,A,X) = (3,7,8)`, hence size `6 + 28 + 2 + 8 = 44`. It is +beta-normal; its three binders have multiplicities 1, 1, and 0. Thus there +is no source copying under any reduction order. + +Write `V = λu. s (λq. cont) (s s u)`. The two laws follow uniformly: + +```text +Z_R I →* K R, +B44[Z_R/s] →* K R V[Z_R/s] next →* R next. + +P_n I →* F P_{n-1}, +B44[P_n/s] + →* V[P_n/s] next + → P_n (λq. cont) (P_n P_n next) + →* cont P_{n-1} N. +``` + +For the symbolic stream `S = λh. h β τ`, the outer head reduction is + +```text +S I V[S/s] next →* β τ V[S/s] next. +``` + +The **first selection node is a stream node**, exactly shape (beta). +In the variable output, `cont P_{n-1}` is the **second node of the input +copy inside `V`**, exactly the non-dispatch shortcut added as (alpha-prime). +An origin-tagged reduction confirms both the output provenance and absence +of source copying. + +These mechanisms coexist. Line 643's “exactly one shape applies” is false. +Prioritizing either case does not rescue the count: the body is below both +claimed floors. In particular, `|V| = 29`, whereas line 724 asserts +`|V| >= 31`. The beta-case calculation charges a separately supplied tail +and a source `n_P`; here one inner cell supplies both the tail and `n_P`. +Conversely, the alpha-prime calculation assumes the arms are under an +ordinary source dispatch binder. Here `V` is at depth zero and its `s` at +depth one, contradicting the placement assumptions at 689–692. + +The general case split must allow combinations of selection-node and +output-node provenance. Adding (alpha-prime) as a mutually exclusive row +does not do that. + +## 2. The corrected >=58 subcase of (alpha) has a 46-bit affine inhabitant + +**Locations:** lines 655–665, 843–855; the distinct-origin implication at +594–607 is also implicated. + +Define + +```text +T21 = s I (s s) next, +B46 = s (λb. b (λu t. t) cont) T21. +``` + +Direct counting gives + +```text +T21: (L,A,X) = (1,4,1), |T21| = 21. +B46: (L,A,X) = (4,8,4), |B46| = 46. +``` + +Both are beta-normal and all binders are affine. The operand has exactly +the two values required by the disputed subcase: + +```text +T21[Z_R/s] + →* (K R) (Z_R Z_R) next + →* R next, + +T21[P_n/s] + →* (F P_{n-1}) (P_n P_n) next + →* (P_n P_n) next + →* N. +``` + +Consequently the outer reader reduces to `T21[Z_R/s]` in the zero case and +to `cont P_{n-1} T21[P_n/s]` in the variable case. Its `n_P` is the outer +dispatch cell's own second node. Its zero output application lies inside +`T21`. It is therefore precisely the subcase at 658–665, now claimed to +require `|T| >= 33` and `|B| >= 58`. + +The arithmetic for this actual inhabitant is + +```text +12 + (2 + 21) + 6 + 5 = 46. +``` + +There are several concrete failures in the claimed inventory for `T`: + +* Its selection uses a created first node, costing 10 rather than the + asserted mandatory 12. +* It never binds the zero tail. The created selection argument already + supplies `R`. +* Its `next` is at depth zero, costing 3 rather than at least 5. +* Most significantly, its final application node is `R next` in the zero + reduction **and the consumed `Q next → N` node in the variable reduction**. + The same source `next` leaf survives in one reduction and is the erased + consumer argument in the other. + +The tagged normalizer identifies both application roles with source path +`B.a`, and the shared leaf with `B.a.a`. No source node is copied in either +run. + +Thus “no node is duplicated” does not imply the report's blanket +distinct-origin charging conclusion. It ensures injectivity of residual +origins for distinct nodes within one run. It does not establish disjointness +of roles across two runs, or prove that two named roles are different events +in the first place. This example realizes the overcharge in the very +subcase that was re-counted after review 2. + +## 3. Shape (beta-prime) admits 57 bits and does not need a second bit test + +**Locations:** lines 581–584 and 734–746. + +```text +Z = λu r. r next, +X = λq t. s (λw. cont), +B57 = s (λb. b Z) X (s s s). +``` + +Here `(L,A,X) = (6,8,11)`, so `|B57| = 57`. Every binder is affine. +The symbolic head form is + +```text +β Z τ X (S S S). +``` + +The second selection node is the dispatch cell's own second node, so this +is shape (beta-prime). There is only **one** cell opening on this symbolic +head path before selection, not the two charged at 742–744. + +For zero, + +```text +B57[Z_R/s] →* Z X[Z_R/s] (Z_R Z_R Z_R) →* R next. +``` + +For a variable stream, put `r = P_{n-1}`. It is always a cell, including +when `n=1`: + +```text +B57[P_n/s] + →* r X[P_n/s] (P_n P_n P_n) + →* P_n (λw. cont) (P_n P_n P_n) + →* cont r N. +``` + +`X` ignores both the bit and tail it receives. It handles the `n=1` input +`K N` by erasing both, so it does not need the second bit test claimed at +738–739. The output `n_P` uses another cell, combining (beta-prime) with +(alpha-prime). The shared external skip provides the zero arm's `R` and +the variable output's `N`. + +This is a numerical counterexample to `|B| >= 67`, not just an objection +to its explanation. + +## 4. Shape (delta) can retain another copy of the erased tail: 65 < 69 + +**Locations:** lines 585–588, 748–760, and the “extras” assertion at 859–864. + +```text +B65 = s (λb r. s b (b (r next) (λq t. cont r))) (s s s). +``` + +It has `(L,A,X) = (4,10,15)`, hence 65 bits, and is beta-normal. Only `b` +and `r` are nonlinear. They receive the first cell's bit and tail directly; +every other source binder is affine. This meets the literal Class-S +restriction and never duplicates source nodes. + +After the outer cell opens, let + +```text +C = b (r next) (λq t. cont r). +``` + +The remaining body is `s b C (s s s)`. Symbolically, `S β →* β β τ`, so +the head form is `β β τ C (S S S)`: exactly shape (delta). + +On zero, `b=K`, `r=R`, and `Z_R K →* K`. Therefore + +```text +B65[Z_R/s] →* K C (Z_R Z_R Z_R) → C →* R next. +``` + +On a variable stream, `b=F`, `r=P_{n-1}`, and `P_n F →* r`. Then + +```text +B65[P_n/s] + →* r (λq t. cont r) (P_n P_n P_n) + →* cont r N. +``` + +The tail erased or consumed by the **second** cell-bound dispatch is not +the separately retained `r` from the **first** opening. Thus both `z-R` +and `v-tail` use a bound leaf, contrary to the mandatory compounds at +750–752. The extra head-path opening lowers the cost of other roles, +contrary to 862–864. The complete reader is below the asserted 69-bit floor. + +## 5. Class S needs one definition and explicit reduction quantifiers + +**Locations:** lines 18–25, 78–79, 328–337, 594–607, and 893–896. + +The literal restriction and the proposed “equivalently, no node of B is +ever duplicated” are not equivalent as written. For example, the report's +own 57-bit construction at line 807 is + +```text +Bwhole = s (λb r t. b (r next) (cont r (t t t))) s. +``` + +It is beta-normal and satisfies both laws. Its nonlinear `t` receives the +whole initial stream from the final `s` operand. No source node is duplicated, +since substituting for that `s` has replaced it entirely by input material. +But this whole stream was not produced as a bit or tail by a cell step. +If the intended class includes whole streams, the literal definition must +say so; if it excludes them, the stated equivalence is false. + +There is also a reduction-order ambiguity. Consider the valid beta-normal +64-bit reader + +```text +Bord = s (λb r t. b (r next) (cont t (t t t))) (s F). +``` + +Normal-order reduction contracts `λt` on the unevaluated source expression +`s F` and copies its source application and source `F`. Alternatively, +normalize that operand first. It becomes the pure stream tail `R` or +`P_{n-1}`, and the remaining reductions copy no source node. Both behaviors +were checked with origin labels. The definition must specify whether it +requires existence of suitable reductions for zero and every `n`, a fixed +strategy, or the condition for every reduction. Those are different classes. + +Under a precise, literal reading in which each permitted nonlinear +contraction receives an actual pure input bit/tail, the **no-source-copying +implication itself is defensible**. Use a first-copy argument: a source +binder cannot acquire additional occurrences without an earlier source-copy +event; input binders are affine; and a permitted nonlinear source +contraction has no source node in its argument. Merely having a +stream-origin root would not be a sufficient purity condition. + +That implication does not prove the subsequent disjoint-role inventory, +as `B46` demonstrates. Moreover, no choice among these reasonable Class-S +definitions excludes `B44`, `B46`, or `B57`: all their binders are affine. + +## 6. Other revised realization claims still need arguments + +These are additional gaps, not further counterexamples to the 43-bit bound. + +**Lemma 2.5(iv), 548–565.** The repaired `λh. r h` example and its 9-bit +cost for an immediately outer `r` are correct. The claimed source-syntax +alternative between that expression and a literal `λh. h F' P'` remains +incomplete. For example, + +```text +λh. s (λq t. t h) +``` + +reduces to `P_{n-1}` on `s=P_n`. It is neither stated literal form: a fresh +tail binding occurs inside its body. It occurs in the valid, stream-linear, +beta-normal 65-bit reader + +```text +s (λb r. b (r next) + (cont (λh. s (λq t. t h)) (r r r))). +``` + +Its root is a source lambda and its eventual cell-body applications are +stream nodes. I found no violation of the proposed coarse `+6` surcharge, +but proving that surcharge for arbitrary source syntax needs more than +asserting this two-form classification. Replacing the term by a +beta-equivalent eta-expansion does not establish its source-node inventory. + +**Functional operands, 822–826.** “Its value is one term” does not imply +that an operand replaces at most a 2-bit leaf in each arm. The beta-normal +stream-linear reader + +```text +s (λb r f. b (r next) (f r)) (λr. cont r (r r r)) +``` + +has 61 bits. Its operand supplies the entire variable-arm computation, +including `cont`, both output applications, and the N-source. The procedure +is passed affinely, and its nonlinear `r` receives a pure tail. It does not +violate the numerical gamma floor, but disproves the stated justification +for dismissing arbitrary functional operands. A quantitative bound on such +placements is still needed. + +**N-source reduction, 481–512.** The proof's list at 482 still omits the +stream-derived `I` that T8 now explicitly allows. In addition, `c` in the +terminal-`K` count at 508–510 is undefined, and no bound on it in terms of +source size is supplied. No repeated contraction of a source lambda alone +does not bound the number of copied input lambdas. Under a precise +pure-bit/pure-tail discipline a separate input-copy accounting invariant +may repair this, but that invariant is not proved here. I found no +counterexample to the 10-bit N-source floor itself. + +## What was checked fully + +I read the complete revised report, the earlier Codex review and its fixed +check code, the actual `int165.lam`, the named-term toolkit, and the +repository beta-normalizer/battery interfaces. I found no new error in the +elementary T1–T7 arguments for the required free variables, symbolic-head +dichotomy, no lambda-free reader, suffix duplication, and ancestry of the +bare surviving `N`, with the report's qualified rebuilt-tail caveat. The +equal-index chain identity used above is valid by induction. + +The four principal counterexamples have the all-length reductions given +above. Their normality, bit costs, and finite normal forms were also checked +mechanically. The script + +```text +python3 tmp/overnight/verify/vreaderS_codex_checks.py +``` + +contains only fixed hand-selected readers. It compares both laws for zero +and `n = 1..16, 31, 64`, with every ambient name and suffix rigid. A tagged +de Bruijn reducer retains original source/stream origins, checks for source +copying, and agrees with the repository normalizer. Traces for zero and +`n=1,3,16` are recorded. This is executable evidence, not a Lean +formalization or a lower-bound certificate. + +The literal 43-bit reader remains `(L,A,X)=(3,7,7)` and passes. The +displayed `41+2d` arithmetic for its specific arrangement is correct. +The report's 51-bit alpha-prime construction and the earlier 59-bit +dual-operand construction also pass, but they do not attain the minima +claimed for their unrestricted shapes. + +Three new readers were spliced into the actual 165 source and checked +against the complete default interpreter battery, using a fresh frozen +copy of the release executable and two workers: + +| Reader | Complete interpreter | Result | +|---|---:|---| +| `B44` | 166 bits | 667 ok, 1 skip, 0 failures | +| `B46` | 168 bits | 667 ok, 1 skip, 0 failures | +| `B57` | 179 bits | 667 ok, 1 skip, 0 failures | + +Each battery took about two seconds. Artifacts beside this review are +`vreaderS_codex_checks.py`, `vreaderS_codex_checks.json`, and +`vreaderS_codex_splice/{hybrid44,alpha46,beta_prime57}.lam`. + +The strict 43-bit bound and its uniqueness clause remain unproved by this +report. Any repair must account jointly for selection provenance, output +provenance, retained tails from other openings, and cross-reduction reuse +of source nodes. Restricting copying does not remove these examples. diff --git a/data/self-interpreter/reasoning_floor/verify/vreader_codex.md b/data/self-interpreter/reasoning_floor/verify/vreader_codex.md new file mode 100644 index 00000000..2e06eba7 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreader_codex.md @@ -0,0 +1,352 @@ +# ( •̀_•́ ) Independent adversarial review of the unrestricted reader bound + +**Verdict: error in the proof.** The report does not establish the unrestricted +43-bit lower bound or its uniqueness clause. There are false residual and cost +claims, including a concrete 59-bit reader in a subcase claimed to cost at least +64 bits. **I found no reader below 43 bits and no different 43-bit reader.** The +counterexamples below refute proof steps, not the numerical 43-bit conjecture. + +Locations refer to `tmp/overnight/reader-proof/REPORT.md`. I did not consult +another model or read the other reviewers' reports. No reader bodies were +enumerated. All constructed terms were chosen by hand. + +## 1. Lemma 2.7(ii) is false: different signatures do not imply different origins + +**Locations:** lines 513–523; consequently the distinct-node charging rule at +347–351 and the original-syntax decomposition at 335–343 are unsupported. + +Copies agree immediately after substitution, up to the necessary shifts. They +need not agree after their enclosing abstractions receive different arguments. +This occurs in ordinary finite higher-order application, without a self-passing +walker. The following 39-bit term is a small counterexample to the proposed +residual invariant: + +```text +J = λa b. a b +C = (λf. f (f next cont) s) J + →* next cont s. +``` + +Both application nodes in the final result descend from the **one** application +`a b` in `J`. Their signatures are `(next, cont)` and `(next cont, s)`, which +are not beta-equal. The only syntactic redex in `C` has wire delta **0**. Thus +T10's necessary local condition does not make the asserted invariant true. + +There is also a counterexample using the exact reader roles, rather than an +unrelated output: + +```text +Bcopy = + (λf. + s (λb. b (λu r. f r next) (λr. f (f cont r))) + (f (f s s) s)) + (λa b. a b). +``` + +This is a **98-bit valid reader**. Replacing each `J U V` by `U V` proves both +laws for all unary lengths. In the variable result, `n_P`, `n_N`, and consumed +application nodes in the skip calculation all have the same original source +node, `a b`. An origin-tagged normalizer confirms this. This reader's only +source redex has delta **+17**, so it has no shrinking source redex either. +Its suffix calculation uses the ordinary equal-index cell chain; there is no +recursive lambda walker to which the exception at line 523 can assign this +sharing. + +These examples do not claim to be globally minimum readers. They show that the +residual assertion used to justify the inventory is false, including under +the nonshrinking condition actually obtained from T10. A separate, quantitative +argument must show that sharing these roles cannot fit the improving budget. +Distinct function/argument signatures do not supply that argument. + +## 2. A valid reader has an output node from a non-dispatch stream cell + +**Locations:** lines 374–377, 482–485, 551–559, and 641–645. + +Consider the beta-normal, **52-bit** reader + +```text +Bsecond = s (λb. b (λr. r next) + (λr. s (λq. cont) (r r r))). +``` + +For zero it reduces to `R next`. For a variable stream it reduces as follows: + +```text +Bsecond[P_n/s] + →* P_n (λq. cont) (P_{n-1} P_{n-1} P_{n-1}) + →* cont P_{n-1} N. +``` + +The final `cont P_{n-1}` application is the second application node of the +**inner** occurrence of the stream, inside the variable arm. It is neither a +node of `B` nor a node of the outer dispatch cell. The symbolic first-cell head +reduction stops at the outer `β`, before that inner stream application runs. + +Thus this is not shape (α) as specified in §2.4, which requires the *dispatch* +cell's node, and it is not (γ), which requires a source node. Neither selection +node is created, so (β), (β′), and (δ) do not cover it. Lemma 2.6 initially +mentions an arbitrary cell step, but the minimization subsequently drops the +non-dispatch case. “Extras” at 697–702 does not account for a cell step inside +an arm by charging an additional step on the pre-selection head path. + +This reader is beta-normal, so deleting a shrinking source redex cannot dispose +of the example. It may well be possible to prove this additional case costs +more than 43; that proof is absent. + +## 3. Rebuilt tails can borrow their body nodes from the stream + +**Location:** Lemma 2.5(iv), lines 471–477. + +When `r=P_m`, including `m=0`, + +```text +λh. r h →* λh. h bit_m tail_m = P_m. +``` + +The source fragment `λh. r h`, with `r` immediately outside `h`, costs **9** +bits: two for its lambda, two for its application, three for `r`, and two for +`h`. Its surviving root lambda is a lambda of `B`, but both application nodes +in its final cell body come from the stream. It does not contain the literal +source construction `λh. h F' P'` charged in the proof, and it does not need the +claimed separate source code for `F'`, `P'`, and their application nodes. + +For a complete beta-normal witness, the **53-bit** reader + +```text +Brebox = s (λb r. b (r next) + (cont (λh. r h) (r r r))) +``` + +satisfies both laws. The tagged normalizer confirms that its output tail has a +source-origin root lambda and stream-origin body applications. + +Replacing this reboxing by `r` would be cheaper on the specified streams, so +this is not itself a route below 43. It does refute the claimed exhaustive +source-syntax description and its ≥16 price. A normal form's visible cell +syntax cannot simply be charged to the original source. + +For the same reason, T7's last sentence (213–214) cannot assume that every +reader has an intact surviving `P_{n-1}` copy. In this example its root is +rebuilt. T7's ancestry argument for the copy of `N` that ends bare still holds. + +## 4. Shape (α) contains an explicit numerical overcharge + +**Locations:** lines 566–570, also the role-carrier assertions at 685–693. + +Define + +```text +T = s (λb r. b (r next) (r r r)) +Bdual = s (λb. b (λu t. t) cont) T. +``` + +Direct wire accounting gives **|T|=34** and **|Bdual|=59**. Both terms are +beta-normal. For every `n≥1`, + +```text +T[cons K R/s] →* R next, +T[P_n/s] →* N. +``` + +Consequently `Bdual` satisfies both reader laws. It is exactly the subcase in +lines 566–570: `n_R` lies inside `T`, the outer zero arm is `λu t.t`, the +variable arm is `cont`, and `n_P` is the outer dispatch cell's node. The report +claims **|T|≥39** and **|B|≥64** for this subcase; the witness has 34 and 59. + +The failed step is “`T` at depth 0 has no bound variables” followed by separate +charges for a compound R-source and a bit-source/selection. An operand at +depth zero can have **its own** binders. In `T`, the same cell opening supplies +both the bit and the bound tail `r`; these mechanisms cannot be priced as +disjoint compound sources. + +The later assertion that every dual-valued operand requires fresh selection +machinery is also false literally: `s F` costs 10 and gives `(R,P_{n-1})`, while +`s s s` costs 10 and gives `(R,N)`. Both identities are already present in the +report. Any intended exceptions need a proved classification, not a general +dominance sentence. + +The displayed sum + +```text +12 + (2+10) + (13+d) + (4+d) = 41+2d +``` + +is arithmetically correct. For the literal unshared arrangement with the given +two consumers it yields 43 and the displayed reader. It does **not** repair +the earlier exclusions, origin-sharing assumptions, or placement assumptions +needed to apply that arrangement to every minimum. The 59-bit example does +not contradict the 43-bit lower bound; it contradicts a claimed numerical +sub-bound in its proof. + +## 5. The leaf-let and depth assertions are not consequences of T10 + +**Locations:** Lemma 2.7(i), lines 504–512; forced-depth remark, 525–534. + +For a let on `s` at ambient depth `e`, the report's own exact formula gives + +```text +Δ = (m−1)e − 6 − f(M), +``` + +not an always-negative quantity. In particular, + +```text +λa b. (λy. y y y y y) s -- 30 bits + → λa b. s s s s s -- 32 bits +``` + +has `e=2`, `m=5`, `f(M)=0`, and **Δ=+2**. This refutes “negative for `Q=s` +always.” The only source redex is the displayed one. + +The assertion that a linear hoist containing `next` needs `fl(Q)≥4` also needs +an independently proved depth bound. For example, + +```text +(λy. λa b c d e f g h. y) (next cont) -- 39 bits + → λa b c d e f g h. next cont -- 41 bits +``` + +has `fl(Q)=2`, `D=8`, `f(M)=0`, and **Δ=+2**. These are not readers, but they +are counterexamples to the local claims invoked to exclude sharing and +hoisting. The improving-reader budget might exclude their relevant uses; +that requires a budget argument before the forced depths can be assumed. + +The (γ1) domination lines at 663–670 inherit this problem and the earlier +role-sharing problem. I did not obtain a reader violating the claimed γ1 +numerical floor. I also did not find a proof that its finite table exhausts +let/copy realizations once these assumptions are removed. + +## 6. Lemma 2.3(c) does not establish the necessary walker structure + +**Locations:** lines 422–447; the supporting explanation at 776–792. + +Three contractions of one source lambda do not imply a recursive walker. Even +the proposed linear choice of a long stream does not force a cycle in copying. +Let + +```text +D = λf t. f (f t), +G = λr. r F, +T_k = (D (D (... (D G) ...))) s, -- k written copies of D +``` + +so `D^k G` applies `G` exactly `2^k` times. This is finite function composition, +with no recursive call or self-passing walker. For `k=10`, `T_k` has **196 +bits, 88 syntax nodes, and 23 lambdas**. On `P_1023` it returns `N` by 1,024 +successive tail projections. Thus the unary length exceeds **both** three +times the node count and three times the bit length. Its syntactic beta +redexes all have positive deltas (2, 20, ..., 164). The tagged normalizer +checked the result in 6,142 beta steps. + +This is not a reader for all unary lengths. Its relevance is exact: it refutes +the finite-copying inference used in the proof for the selected long input. +The universal reader laws might force recursion by a different argument, but +one must use them to exclude arbitrarily large finite expansions, then prove +the required receiver/passing structure and charge its original nodes without +the false Lemma 2.7(ii). A threshold `n>3|B|` and three uses of a lambda do not +do that. The claim that every shared top/bottom dispatch needs an extra flag +and an extra test per arm also receives no argument covering general +continuation-passing or higher-order realizations. + +I tried an explicit compact self-passing walker: + +```text +W = λb r w. b r (r w w), |W|=28, +Twalk = (λw. s w w) W, |Twalk|=43, +Bwalk = s (λb. b (λu r. r next) cont) Twalk, |Bwalk|=76. +``` + +Induction on the stream proves `s W W` skips through its first zero. This +improves the report's 85-bit walker example, but remains well above 43. It +neither proves nor refutes the proposed 24-bit necessary walker charge. + +There are two additional equality issues here. The unshared-dispatch estimate +at 442–443 gives only **≥43**, so it does not itself exclude a second 43-bit +reader. And the supporting shared-dispatch sum in Part 3, lines 782–783, + +```text +12 + (24−8) + 4 + 3 + 2, +``` + +is **37**, not 43. The different sum in Part 2 equals 47, but depends on the +unproved extra-flag assertion. The uniqueness conclusion needs its own strict +exclusion of these cases. + +## 7. Further local corrections + +These are not needed for the verdict above, but matter to the purported +exhaustive inventories. + +* **T8, lines 216–222:** the last-cell argument list omits `I`. + `P_0 I →* K N`, then one further argument yields `N`. Moreover `I` can be + the residual inner lambda of a stream bit `F`, since `(P_1 K) s →* F s → I`. + Thus `P_0 ((P_1 K) s) s →* N`, with last-cell handler `I` originating in + stream material, not in a source lambda. This is a local data counterexample, + not a uniform reader. +* **§2.1, lines 275–282:** a cell contraction's application need not be a + source application. Already `S S → S β τ → β β τ τ` contracts the second + cell at a stream-origin application. `s s` costs 6, not two independent + 4-bit cell steps. Any claim restricted to successful readers needs a reason + this overlap is impossible in the relevant place; it is not a general + residual fact. +* **T9, lines 229–230:** the description of unequal-index outcome by parity + of `|i−j|` is wrong. `P_2 P_1 →* I`, whereas `P_1 P_0 →* N P_0`, although + both differences are 1. The equal-index recurrence and the conclusion + that unequal meetings cannot carry the designated bare surviving `N` are + not refuted by this correction. +* **Lemma 2.3(b), line 416:** literal `K=λa b.a` costs 7 bits, not 6. + This undercharge is conservative for the claimed lower bound. + +## What was checked + +I read Parts 1–3 of the report, the handler-bound background, the requested +cheap-tail-bound introduction, the reader toolkit, the actual 165 source, +and the wire-cost Lean module. I reviewed T1–T6's elementary arguments, T7's +ancestry argument for the bare `N`, and the equal-index chain identity; I found +no error in those deductions. I +checked the local minimality implication in T10 and the exact wire formula. +The command + +```text +cd lean && lake env lean Blc/SelfintWireCost.lean +``` + +succeeded. This checks that module using its existing imported dependencies; +it does not formalize the proposed reader theorem or its inventories. + +`vreader_codex_checks.py` performs direct beta-normal-form comparisons against +both reader laws, with all ambient variables and suffixes rigid, for zero and +`n=1..64`. It also supplies an independent origin-tagged de Bruijn normalizer +and compares its untagged answers against the repository normalizer. The +universal correctness of the displayed reader witnesses additionally follows +from the short equations above and `P_m P_m X →* N` for every `m≥0`. + +The following splices were checked against the repository's complete default +battery on a frozen copy of `target/release/blam`, two workers: + +| reader | reader bits | interpreter bits | battery | +|---|---:|---:|---| +| second cell | 52 | 174 | 667 ok, 1 skip, 0 failures | +| rebuilt tail | 53 | 175 | 667 ok, 1 skip, 0 failures | +| dual operand in shape (α) | 59 | 181 | 667 ok, 1 skip, 0 failures | +| shared self-passing walker | 76 | 198 | 667 ok, 1 skip, 0 failures | +| finite copied application | 98 | 220 | 667 ok, 1 skip, 0 failures | + +Each battery took about two seconds. These are finite semantic checks, not +lower-bound certificates. The ordinary reader was independently counted at +43 bits with `(L,A,X)=(3,7,7)` and passed the direct-law checks. + +Reproducible artifacts, all beside this review: + +* `vreader_codex_checks.py`, `.json`, and `.log`: hand-selected terms, costs, + source-redex deltas, direct laws, and source/stream origin checks. +* `vreader_codex_acyclic.py` and `.json`: the nonrecursive long-prefix check. +* `vreader_codex_battery.py` and `.json`: the frozen-binary battery runner and + its results. Optional arguments select splice stems. +* `vreader_codex_splice/*.lam`: the five complete interpreters. + +The report's conclusion that no improvement can occur under these reader laws +should be withdrawn pending a proof of the missing cases and a valid +origin-sharing/depth accounting argument. The established narrower bounds are +not challenged by this review. Formalizing the current inventory without +changing its assertions would encounter the concrete counterexamples above. diff --git a/data/self-interpreter/reasoning_floor/verify/vreader_codex_acyclic.py b/data/self-interpreter/reasoning_floor/verify/vreader_codex_acyclic.py new file mode 100644 index 00000000..5b83a8ff --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreader_codex_acyclic.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +"""A finite, nonrecursive expansion exceeds the proposed linear threshold.""" +import json +import sys +import time +from pathlib import Path + +sys.dont_write_bytecode = True +from vreader_codex_checks import (A, L, V, F, P, s, size, counts, db, FRAME, + RIGID, syntactic_redex_deltas, tagged_stream_subst, tagged_nf, strip) + +D = L('f', 't', A(V('f'), A(V('f'), V('t')))) +G = L('r', A(V('r'), F)) +term = G +k = 10 +for _ in range(k): + term = A(D, term) +term = A(term, s) +n = 2**k - 1 +l, a, x = counts(db(term, FRAME)) +assert n > 3 * size(term) +start = time.perf_counter() +res, events = tagged_nf(tagged_stream_subst(term, P(n)), fuel=20000) +assert strip(res) == db(V('N'), FRAME + RIGID) +row = {'k': k, 'n': n, 'source_bits': size(term), 'source_nodes': l+2*a+1, + 'source_lambdas': l, 'source_redex_deltas': syntactic_redex_deltas(term), + 'result': 'N', 'beta_steps': len(events), + 'seconds': round(time.perf_counter()-start, 3)} +Path(__file__).with_suffix('.json').write_text(json.dumps(row, indent=2)+'\n') +print(json.dumps(row, indent=2)) diff --git a/data/self-interpreter/reasoning_floor/verify/vreader_codex_battery.py b/data/self-interpreter/reasoning_floor/verify/vreader_codex_battery.py new file mode 100644 index 00000000..fbbe26d2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreader_codex_battery.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +"""Run the repository battery on hand-selected splices, two workers.""" +import json +import shutil +import sys +import tempfile +import time +from pathlib import Path + +sys.dont_write_bytecode = True +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[2] +sys.path.insert(0, str(ROOT / 'tools/self-interpreter')) +import battery + +ledger = HERE / 'vreader_codex_battery.json' +rows = {r['file']: r for r in json.loads(ledger.read_text())} if ledger.exists() else {} +requested = set(sys.argv[1:]) +with tempfile.TemporaryDirectory(prefix='vreader-codex-') as tmp: + frozen = Path(tmp) / 'blam' + shutil.copy2(ROOT / 'target/release/blam', frozen) + battery.BLAM = str(frozen) + for p in sorted((HERE / 'vreader_codex_splice').glob('*.lam')): + if requested and p.stem not in requested: + continue + start = time.perf_counter() + E = battery.compile_lam(p.read_text()) + ok, skip, bad = battery.check(E, threads=2) + row = {'file': p.name, 'bits': len(battery.enc(E)), 'ok': ok, 'skip': skip, + 'failures': bad, 'seconds': round(time.perf_counter()-start, 3)} + rows[p.name] = row + print(json.dumps(row), flush=True) + assert not bad +ledger.write_text(json.dumps([rows[k] for k in sorted(rows)], indent=2)+'\n') diff --git a/data/self-interpreter/reasoning_floor/verify/vreader_codex_checks.json b/data/self-interpreter/reasoning_floor/verify/vreader_codex_checks.json new file mode 100644 index 00000000..f6311686 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreader_codex_checks.json @@ -0,0 +1,180 @@ +{ + "standard": { + "bits": 43, + "LAX": [ + 3, + 7, + 7 + ], + "laws": "zero and n=1..64 pass", + "source_redex_deltas": [], + "n_P_origin": "stream@B.f.f.b", + "n_N_origin": "B", + "output_origin_also_consumed": false + }, + "second_cell": { + "bits": 52, + "LAX": [ + 4, + 8, + 10 + ], + "laws": "zero and n=1..64 pass", + "source_redex_deltas": [], + "n_P_origin": "stream@B.a.b.a.b.f.f.b", + "n_N_origin": "B.a.b.a.b", + "output_origin_also_consumed": false + }, + "copied_app_reader": { + "bits": 90, + "LAX": [ + 7, + 13, + 22 + ], + "laws": "zero and n=1..64 pass", + "source_redex_deltas": [ + [ + "B", + -1 + ] + ], + "n_P_origin": "B.a.b.b", + "n_N_origin": "B.a.b.b", + "output_origin_also_consumed": false + }, + "copied_app_nonshrinking": { + "bits": 98, + "LAX": [ + 7, + 15, + 22 + ], + "laws": "zero and n=1..64 pass", + "source_redex_deltas": [ + [ + "B", + 17 + ] + ], + "n_P_origin": "B.a.b.b", + "n_N_origin": "B.a.b.b", + "output_origin_also_consumed": true + }, + "rebuilt_tail": { + "bits": 53, + "LAX": [ + 3, + 9, + 9 + ], + "laws": "zero and n=1..64 pass", + "source_redex_deltas": [], + "n_P_origin": "B.a.b.b.a.f", + "n_N_origin": "B.a.b.b.a", + "output_origin_also_consumed": false, + "tail_root_origin": "B.a.b.b.a.f.a", + "tail_body_application_origins": [ + "stream@B.f.b.a.b", + "stream@B.f.b.a.b.f" + ] + }, + "alpha_dual_operand": { + "bits": 59, + "LAX": [ + 5, + 10, + 7 + ], + "laws": "zero and n=1..64 pass", + "source_redex_deltas": [], + "n_P_origin": "stream@B.f.f.b", + "n_N_origin": "B", + "output_origin_also_consumed": false + }, + "walker_reader": { + "bits": 95, + "LAX": [ + 9, + 15, + 15 + ], + "laws": "zero and n=1..64 pass", + "source_redex_deltas": [], + "n_P_origin": "stream@B.f.f.b", + "n_N_origin": "B", + "output_origin_also_consumed": false + }, + "walker_reader_shared": { + "bits": 76, + "LAX": [ + 7, + 12, + 12 + ], + "laws": "zero and n=1..64 pass", + "source_redex_deltas": [ + [ + "B.a", + 19 + ] + ], + "n_P_origin": "stream@B.f.f.b", + "n_N_origin": "B", + "output_origin_also_consumed": false + }, + "copied_app_small": { + "bits": 39, + "nf_bits": 13, + "source_redex_deltas": [ + [ + "B", + 0 + ] + ], + "normal_form": "next cont s", + "two_output_applications_origin": "B.a.b.b" + }, + "deep_leaf_let": { + "bits": 30, + "nf_bits": 32, + "source_redex_deltas": [ + [ + "B.b.b", + 2 + ] + ], + "normal_form": "\\p\\q.s s s s s" + }, + "two_free_hoist": { + "bits": 39, + "nf_bits": 41, + "source_redex_deltas": [ + [ + "B", + 2 + ] + ], + "normal_form": "\\p\\q\\r\\s\\t\\u\\v\\w.next cont" + }, + "last_cell_I": { + "P0_I_is_K_N": true, + "P0_((P1_K)_s)_s_is_N": true + }, + "created_cell_step": { + "normal_form": "beta beta tau tau", + "redex_origins": [ + [ + "stream@B.f.b.f", + "stream@B.a" + ] + ], + "source_bits": 6 + }, + "dual_operand": { + "s_F_bits": 10, + "sss_bits": 10, + "s_F_zero_R_var_tail": true + }, + "seconds": 9.835 +} diff --git a/data/self-interpreter/reasoning_floor/verify/vreader_codex_checks.py b/data/self-interpreter/reasoning_floor/verify/vreader_codex_checks.py new file mode 100644 index 00000000..89230a2e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreader_codex_checks.py @@ -0,0 +1,256 @@ +#!/usr/bin/env python3 +"""Hand-selected reader-proof counterchecks; no reader enumeration. + +The lane's named-term helpers and untagged normalizer are used for comparison. +An independent, origin-tagged de Bruijn normalizer checks the residual claims. +""" +from pathlib import Path +import json +import sys +import time + +sys.dont_write_bytecode = True +ROOT = Path(__file__).resolve().parents[3] +sys.path.insert(0, str(ROOT / 'tmp/overnight/reader-proof/tools')) +from rt import A, L, V, K, F, I, P, zero, cons, db, size, counts, laws, eq, nf, subst_s, lc, FRAME, RIGID, delta + + +def tag(t, origin='B'): + if t[0] == 'V': + return ('V', t[1], origin) + if t[0] == 'L': + return ('L', tag(t[1], origin + '.b'), origin) + return ('A', tag(t[1], origin + '.f'), tag(t[2], origin + '.a'), origin) + + +def strip(t): + if t[0] == 'V': + return t[:2] + if t[0] == 'L': + return ('L', strip(t[1])) + return ('A', strip(t[1]), strip(t[2])) + + +def shift(t, amount, cutoff=0): + if t[0] == 'V': + return ('V', t[1] + amount if t[1] >= cutoff else t[1], t[-1]) + if t[0] == 'L': + return ('L', shift(t[1], amount, cutoff + 1), t[-1]) + return ('A', shift(t[1], amount, cutoff), shift(t[2], amount, cutoff), t[-1]) + + +def contract(body, arg, depth=0): + if body[0] == 'V': + if body[1] == depth: + return shift(arg, depth) + return ('V', body[1] - (body[1] > depth), body[-1]) + if body[0] == 'L': + return ('L', contract(body[1], arg, depth + 1), body[-1]) + return ('A', contract(body[1], arg, depth), contract(body[2], arg, depth), body[-1]) + + +def tagged_nf(term, fuel=100000): + events = [] + def whnf(t): + nonlocal fuel + if t[0] != 'A': + return t + f = whnf(t[1]) + while f[0] == 'L': + fuel -= 1 + if fuel < 0: + raise RuntimeError('tagged normalizer fuel exhausted') + events.append((t[-1], f[-1])) + t = contract(f[1], t[2]) + if t[0] != 'A': + return t + f = whnf(t[1]) + return ('A', f, t[2], t[-1]) + def go(t): + t = whnf(t) + if t[0] == 'V': + return t + if t[0] == 'L': + return ('L', go(t[1]), t[-1]) + return ('A', go(t[1]), go(t[2]), t[-1]) + return go(term), events + + +def tagged_stream_subst(body, stream): + original = tag(db(body, FRAME + RIGID)) + def go(t, depth=0): + if t[0] == 'V': + if t[1] == depth: # the ambient free s + return shift(tag(db(stream, FRAME + RIGID), 'stream@' + t[-1]), depth) + return t + if t[0] == 'L': + return ('L', go(t[1], depth + 1), t[-1]) + return ('A', go(t[1], depth), go(t[2], depth), t[-1]) + return go(original) + + +def syntactic_redex_deltas(t): + found = [] + def visit(u, path='B'): + if u[0] == 'L': + visit(u[1], path + '.b') + elif u[0] == 'A': + if u[1][0] == 'L': + found.append((path, delta(u[1][1], u[2]))) + visit(u[1], path + '.f') + visit(u[2], path + '.a') + visit(db(t, FRAME + RIGID)) + return found + + +def show(t): + return lc.show(strip(t), names=FRAME + RIGID) + + +s, nxt, c, b, r, f = map(V, ['s', 'next', 'cont', 'b', 'r', 'f']) +Z = L('u', 'r', A(r, nxt)) +standard = A(s, L('b', A(b, Z, c)), A(s, s, s)) + +# n_P is made by the SECOND stream cell, inside the variable arm. +second_cell = A(s, L('b', A(b, L('r', A(r, nxt)), + L('r', A(s, L('q', c), A(r, r, r)))))) + +# One source application a b supplies both output application nodes. +app = L('a', 'b', A(V('a'), V('b'))) +copied_app_reader = A(L('f', A(s, L('b', A(b, + L('u', 'r', A(f, r, nxt)), + L('r', A(f, A(f, c, r))))), A(s, s, s))), app) + +# The only source redex now EXPANDS, so T10's necessary condition does +# not exclude ordinary finite higher-order sharing either. +copied_app_nonshrinking = A(L('f', A(s, L('b', A(b, + L('u', 'r', A(f, r, nxt)), + L('r', A(f, A(f, c, r))))), A(f, A(f, s, s), s))), app) + +# The output tail's root lambda comes from B, but its two body application +# nodes come from the stream. The claimed literal-rebuilding cost is wrong. +rebuilt_tail = A(s, L('b', 'r', A(b, A(r, nxt), + A(c, L('h', A(r, V('h'))), A(r, r, r))))) + +# Shape alpha's claimed >=64 subcase has a 59-bit beta-normal inhabitant. +dual_output_operand = A(s, L('b', 'r', A(b, A(r, nxt), A(r, r, r)))) +alpha_dual_operand = A(s, L('b', A(b, F, c)), dual_output_operand) + +# A single non-shrinking redex below 43 bits, with two unequal residuals +# of the one original a b node and no recursive walker. +copied_app_small = A(L('f', A(f, A(f, nxt, c), s)), app) + +# The claim that a let on the free s leaf always shrinks fails at depth 2. +deep_leaf_let = L('a', 'b', A(L('y', A(V('y'), V('y'), V('y'), V('y'), V('y'))), s)) + +# A linear hoist with only TWO free leaves and a positive beta delta. +two_free_hoist = A(L('y', L('a', 'b', 'c1', 'd', 'e', 'f1', 'g', 'h', V('y'))), A(nxt, c)) + +# A concrete self-passing suffix walker, taken as a hand-designed term, +# not an enumeration. W consumes the bit and tail and receives itself. +W = L('b', 'r', 'w', A(b, r, A(r, V('w'), V('w')))) +walk_skip = A(s, W, W) +walker_reader = A(s, L('b', A(b, Z, c)), walk_skip) +walk_skip_shared = A(L('w', A(s, V('w'), V('w'))), W) +walker_reader_shared = A(s, L('b', A(b, Z, c)), walk_skip_shared) + + +def main(): + start = time.perf_counter() + info = {} + readers = {'standard': standard, 'second_cell': second_cell, + 'copied_app_reader': copied_app_reader, + 'copied_app_nonshrinking': copied_app_nonshrinking, + 'rebuilt_tail': rebuilt_tail, + 'alpha_dual_operand': alpha_dual_operand, + 'walker_reader': walker_reader, + 'walker_reader_shared': walker_reader_shared} + for name, term in readers.items(): + assert laws(term, ns=range(1, 65), fuel=100000) + info[name] = {'bits': size(term), 'LAX': counts(db(term, FRAME)), + 'laws': 'zero and n=1..64 pass', + 'source_redex_deltas': syntactic_redex_deltas(term)} + got, events = tagged_nf(tagged_stream_subst(term, P(3))) + assert strip(got) == nf(subst_s(term, P(3))) + info[name]['n_P_origin'] = got[1][-1] + info[name]['n_N_origin'] = got[-1] + info[name]['output_origin_also_consumed'] = any( + app_origin == got[-1] for app_origin, _ in events) + if name == 'rebuilt_tail': + tail = got[1][2] + info[name]['tail_root_origin'] = tail[-1] + info[name]['tail_body_application_origins'] = [tail[1][-1], tail[1][1][-1]] + assert info['standard']['bits'] == 43 + assert info['second_cell']['bits'] == 52 + assert not info['second_cell']['source_redex_deltas'] + assert info['second_cell']['n_P_origin'].startswith('stream@B.a.') + assert info['copied_app_reader']['n_P_origin'] == info['copied_app_reader']['n_N_origin'] + assert info['copied_app_nonshrinking']['source_redex_deltas'] == [('B', 17)] + assert info['copied_app_nonshrinking']['n_P_origin'] == info['copied_app_nonshrinking']['n_N_origin'] + assert info['copied_app_nonshrinking']['output_origin_also_consumed'] + assert size(dual_output_operand) == 34 + assert info['alpha_dual_operand']['bits'] == 59 + assert not info['alpha_dual_operand']['source_redex_deltas'] + for name, term in [('copied_app_small', copied_app_small), + ('deep_leaf_let', deep_leaf_let), + ('two_free_hoist', two_free_hoist)]: + d = db(term, FRAME + RIGID) + got, events = tagged_nf(tag(d)) + assert strip(got) == lc.nf(d, [100000]) + info[name] = {'bits': size(term), 'nf_bits': lc.size(strip(got)), + 'source_redex_deltas': syntactic_redex_deltas(term), + 'normal_form': show(got)} + if name == 'copied_app_small': + assert got[-1] == got[1][-1] + info[name]['two_output_applications_origin'] = got[-1] + assert info['copied_app_small']['source_redex_deltas'] == [('B', 0)] + assert info['deep_leaf_let']['source_redex_deltas'] == [('B.b.b', 2)] + assert info['two_free_hoist']['source_redex_deltas'] == [('B', 2)] + + # Omitted last-cell head: I from the INNER lambda of a DATA F. + # P_0 ((P_1 K) s) s -> P_0 I s -> (K N) s -> N. + last_i = A(P(0), A(P(1), K, s), s) + assert eq(last_i, V('N')) + assert eq(A(P(0), I), A(K, V('N'))) + info['last_cell_I'] = {'P0_I_is_K_N': True, 'P0_((P1_K)_s)_s_is_N': True} + + # A created stream application can itself contract another cell. + # S S -> S beta tau -> beta beta tau tau. + symbolic = cons(V('beta'), V('tau')) + got, events = tagged_nf(tagged_stream_subst(A(s, s), symbolic)) + created_steps = [(app_origin, lam_origin) for app_origin, lam_origin in events + if app_origin.startswith('stream@') and lam_origin.startswith('stream@')] + assert created_steps + info['created_cell_step'] = {'normal_form': show(got), 'redex_origins': created_steps, + 'source_bits': size(A(s, s))} + + # A dual-valued operand needs no fresh selection machinery. + assert eq(subst_s(A(s, F), zero()), V('R')) + for n in range(1, 65): + assert eq(subst_s(A(s, F), P(n)), P(n - 1)) + assert eq(subst_s(walk_skip, P(n)), V('N')) + info['dual_operand'] = {'s_F_bits': size(A(s, F)), 'sss_bits': size(A(s, s, s)), + 's_F_zero_R_var_tail': True} + + # Splice only the hand-selected examples into the actual interpreter. + def lam_text(t): + if t[0] == 'V': + return 'list' if t[1] == 's' else t[1] + if t[0] == 'L': + return '(\\' + t[1] + '. ' + lam_text(t[2]) + ')' + return '(' + lam_text(t[1]) + ' ' + lam_text(t[2]) + ')' + original = (ROOT / 'data/self-interpreter/machines/int165.lam').read_text() + needle = 'list (\\bit0. bit0 (\\unused \\r. r next) cont) (list list list)' + assert original.count(needle) == 1 + splice_dir = Path(__file__).parent / 'vreader_codex_splice' + splice_dir.mkdir(exist_ok=True) + for name in ['second_cell', 'rebuilt_tail', 'copied_app_nonshrinking', 'walker_reader_shared', 'alpha_dual_operand']: + (splice_dir / (name + '.lam')).write_text(original.replace(needle, lam_text(readers[name]))) + info['seconds'] = round(time.perf_counter() - start, 3) + dest = Path(__file__).with_suffix('.json') + dest.write_text(json.dumps(info, indent=2) + '\n') + print(json.dumps(info, indent=2)) + + +if __name__ == '__main__': + main() diff --git a/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/alpha_dual_operand.lam b/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/alpha_dual_operand.lam new file mode 100644 index 00000000..2514bd59 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/alpha_dual_operand.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + ((list (\b. ((b (\fa. (\fb. fb))) cont))) (list (\b. (\r. ((b (r next)) ((r r) r))))))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/copied_app_nonshrinking.lam b/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/copied_app_nonshrinking.lam new file mode 100644 index 00000000..e6c5eb98 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/copied_app_nonshrinking.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + ((\f. ((list (\b. ((b (\u. (\r. ((f r) next)))) (\r. (f ((f cont) r)))))) ((f ((f list) list)) list))) (\a. (\b. (a b))))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/rebuilt_tail.lam b/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/rebuilt_tail.lam new file mode 100644 index 00000000..d200bc82 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/rebuilt_tail.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + (list (\b. (\r. ((b (r next)) ((cont (\h. (r h))) ((r r) r))))))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/second_cell.lam b/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/second_cell.lam new file mode 100644 index 00000000..94334539 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/second_cell.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + (list (\b. ((b (\r. (r next))) (\r. ((list (\q. cont)) ((r r) r))))))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/walker_reader_shared.lam b/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/walker_reader_shared.lam new file mode 100644 index 00000000..5ff40b18 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/verify/vreader_codex_splice/walker_reader_shared.lam @@ -0,0 +1,13 @@ +-- 165-bit BLC self-interpreter: E C ( ++ N) = C (\z. M) N for closed M. +-- Palmer's 168 with one reader change. `list list list` is the rest after +-- the first 0 of the whole stream: list1 after a 0-tag, the remainder N after +-- a variable 1^n 0, so one skip computed before the dispatch serves both +-- arms; and `list H S = H bit0 list1 S` hands list1 to the variable arm, +-- which is then `cont` itself. +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + ((list (\b. ((b (\u. (\r. (r next)))) cont))) ((\w. ((list w) w)) (\b. (\r. (\w. ((b r) ((r w) w)))))))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/docs/STATUS.md b/docs/STATUS.md index f18aebba..b8ffe4a9 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -144,14 +144,37 @@ with all features (three opt-in tests ignored) and 328 with default features. ### Self-interpreter and universal machine -- **The 165** (`classical/self-interpreter/interpreter.md`, +- **The 162** (`classical/self-interpreter/interpreter.md`, + `data/self-interpreter/machines/int162.lam`): the 165's knot and NEXT + around a new reader `list I V NEXT` (L 16, A 24, X 32). `list I` makes the + first cell its own selection, so on a 0-tag the zero arm is the tail itself + applied to NEXT, the reader's last operand; on a variable + `V = λu. list (λq. cont) (list list u)` reopens the stream, hands the tail + to `cont`, and erases NEXT as the skip's junk operand. The `next` let goes + and the reader drops from 43 bits to 40, against +4 for NEXT one binder + deeper. The 44-bit reader is Codex's, built while refuting a + reader-optimality proof; NEXT as a reader operand is Grok's idea; `blam golf + letopt` inlined NEXT into the operand slot of the resulting 166. Lean + proves it correct for every closed program (`selfint_contract162`, + `isSelfInterpreter_intL162`, `not_selfintSizeBound_163`); its variable + residual names the continuation, so the parser statement is per + continuation (`not_parses_intL162`). An independent adversarial review + re-derived the contract and the size. Battery 667/1/0, and 3,341/2/0 + through 21 bits; exact suffixes on divergent sources. Its let structure is + the unique minimum to three cuts, and its βη component to slack 24 + (12,024,847 terms) and contextual component to slack 18 hold nothing + smaller (`data/self-interpreter/letopt_162.log`, `component_162_*.log`). + The 165's reader-shape searches and conditional bounds below do not reach + the 162's reader: as a two-operand reader its last operand is the bare + `next`, a family they left open. +- **The 165**, the previous record (`classical/self-interpreter/interpreter.md`, `data/self-interpreter/machines/int165.lam`), Codex's design: Palmer's 168 with a reader that computes the skip `list list list` once on the whole stream, where it is right for both dispatch arms, and lets the Scott list hand `list1` to the variable arm, which becomes `cont` itself (L 17, A 25, X 29). Lean proves it, and the 168, correct for every closed program as a - β-reduction (`selfint_contract165`, `selfint_contract`). No verified - sub-165 has been found in the tested neighbourhoods: let structure to + β-reduction (`selfint_contract165`, `selfint_contract`). Nothing smaller + appears in its tested neighbourhoods: let structure to three cuts (unique minimum), βη component to +20 (2,183,051 terms) and contextual to +16, every reader slot singly and handler × skip jointly through 164-bit interpreters (32,366,372 @@ -205,10 +228,9 @@ with all features (three opt-in tests ignored) and 328 with default features. values, with raw quotation data borrowable (not yet independently reviewed). The reasoning consults in `data/self-interpreter/reasoning_floor/` built about forty further - correct interpreters of 166–220 bits, the smallest new shape a 168 that - passes NEXT as the reader's third operand; none goes below 165 at its - optimal let structure, and letopt only shrinks recorded variants (the - spine3 repair 178→174, tag replay 189→186 and 199→194). + correct interpreters of 166–220 bits besides the 162 and the 166 it was + polished from; letopt also shrinks recorded variants (the spine3 repair + 178→174, tag replay 189→186 and 199→194). - **Unconditional structure** (`classical/self-interpreter/structural-bounds.md`): Lean proves that every interpreter has at least two syntactically nonlinear binders, and that an explicit `λc s.B` needs two inside `B`. @@ -421,8 +443,11 @@ with all features (three opt-in tests ignored) and 328 with default features. maps outweigh the sharing. Except for the unconditional non-idempotence and its generator corollary, these are protocol-specific handwritten proofs. - **The universal machine** (`classical/self-interpreter/universal.md`): - Tromp's wirings around the 165's body give 175 (non-strict) and 187 - (strict), against 178 and 190 around the 168's. Wirings around the new body + Tromp's wirings around the 162's body give 172 (non-strict) and 184 + (strict; all seven strictness probes), around the 165's 175 and 187, and + around the 168's 178 and 190 (`machines/uni172.lam`, `uni184.lam`); letopt + finds no smaller rendering of 172 or 184, and no wiring search has run + around the 162's body yet. Wirings around the 165's body give no non-strict machine below 175 (14,856,126 contexts, 68,017 capped, 16,144 of those certified divergent); around the old body no non-strict machine below 178 and no strict one below 185, conditional on 3,961 and @@ -512,19 +537,21 @@ GHC 9.10.3; `uni.rs` with rustc), all three harnesses in 11 minutes: 8. **Discrete Solomonoff induction:** measure Church bit-list decode coverage and build prefix-tree conditional predictions under `m` and `S`. Infinite streams belong to the separate monotone-machine `ref/AIT` lane. -9. **The self-interpreter below 165** (`classical/self-interpreter/interpreter.md` - §7). Constructive: a protocol change at an interface NEXT shares with - the rest (the `r next` handoff, the value and continuation protocols), - the knot × NEXT coupling through the reader's diagonal, and the capped - fills of the reader searches; NEXT-internal fusions and second-bit - dispatch placements are catalogued and lose. Look for another shared - computation of the kind the reader is, by reasoning first. Proof: the - floor is 37 handwritten and 27 kernel-checked; the next steps are an - application-sensitive charge for residual control (`remainder.md`), - which no structural count supplies, and a formalization of residual - tracing that would mechanize the conditional reader and NEXT bounds. - Upstreaming the 165, 175 and 187 to tromp/AIT is a9's call - (`contrib/PR_KIT.md`). +9. **The self-interpreter below 162** (`classical/self-interpreter/interpreter.md` + §7). Constructive: the 162's own architecture is new and its + neighbourhood beyond letopt and the βη components is unexplored; readers with the bare `next` operand + and other heads, the knot × NEXT coupling through the reader's diagonal, + and wiring searches for U around the 162's body. NEXT-internal fusions and + second-bit dispatch placements are catalogued and lose; NEXT optimality + alone is as hard as a 48-bit global floor (any interpreter embeds into + the NEXT slot at +44 bits). Look for another shared computation of the + kind the readers are, by reasoning first. Proof: the floor is 37 + handwritten and 27 kernel-checked; the next steps are an + application-sensitive charge for residual control (`remainder.md`), which + no structural count supplies, and a formalization of residual tracing. + Carrying the 162's reader into int4, ko2kp, nf and pairup_Kp on the + fork's golf branch, and upstreaming the 162, 172 and 184 to tromp/AIT, + are a9's call (`contrib/PR_KIT.md` still describes the 165). 10. **`blam uni` throughput:** within 4× of `uni.c` on byte streams. The next lever is allocation: a slab with index-based reference counts (or the open global-allocator decision) would remove most of malloc/free and the diff --git a/docs/classical/self-interpreter/capture-width.md b/docs/classical/self-interpreter/capture-width.md index 5fe7814d..4036bfde 100644 --- a/docs/classical/self-interpreter/capture-width.md +++ b/docs/classical/self-interpreter/capture-width.md @@ -12,7 +12,7 @@ obstruction is kernel-checked; the numerical counting and exclusion arguments and the sharpness constructions are handwritten. Together they give 34 bits globally and 46 for literal or beta-normal interpreters; `global-floor.md` extends the global count to 37. None of this establishes -165-bit optimality. +162-bit optimality. ## The source measure @@ -663,4 +663,4 @@ This attains all three minima simultaneously within the beta-normal fragment and rules out any necessary occurrence of index three or higher, even within that fragment. It is an existential structural construction, not a new measured compact interpreter or a proof of -165-bit optimality. +162-bit optimality. diff --git a/docs/classical/self-interpreter/global-floor.md b/docs/classical/self-interpreter/global-floor.md index 520c0bfc..965835a2 100644 --- a/docs/classical/self-interpreter/global-floor.md +++ b/docs/classical/self-interpreter/global-floor.md @@ -22,7 +22,7 @@ The counting argument of `capture-width.md` gives 33 and excludes it. This proof excludes 34, 35 and 36 using semantic consequences of the exact contract (head arity, internal width, internal nonlinearity, and exact identity-source outputs). It is not an additive parser-module argument and -does not approach a proof of 165-bit optimality. +does not approach a proof of 162-bit optimality. ## 1. Dependencies and conventions diff --git a/docs/classical/self-interpreter/head-decomposition.md b/docs/classical/self-interpreter/head-decomposition.md index 77a75b6b..d730e406 100644 --- a/docs/classical/self-interpreter/head-decomposition.md +++ b/docs/classical/self-interpreter/head-decomposition.md @@ -350,4 +350,4 @@ theorems use only `propext` and `Quot.sound`. The head decomposition and continuation-independence arguments above remain handwritten. Charging index movement and shared-code copying across an entire decoding trace still has not yielded a useful global numerical lower bound; none of -these results establishes 165-bit optimality. +these results establishes 162-bit optimality. diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index bf117652..6127dbfb 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -1,8 +1,8 @@ -# The 165-bit self-interpreter +# The 162-bit self-interpreter This is the record of what is known about the size of BLC's self-interpreter: its anatomy, its formal proofs, every search run against it -and its predecessor, and the exact boundary of what those searches prove. The +and its predecessors, and the exact boundary of what those searches prove. The universal machine, whose contract differs, has its own record in `universal.md`; the parametric slot searches are specified in `slots.md`. Logs are in `data/self-interpreter/`, the interpreters themselves in @@ -17,77 +17,130 @@ E C (⌜M⌝ ++ N) = C (λz. M) N ``` for closed `M`, a rigid continuation `C`, and a rigid remainder `N`. The -current minimum is 165 bits (`machines/int165.lam`), Codex's design: +current minimum is 162 bits (`machines/int162.lam`): ```text -(\x. x x) (\x. (\intL. \cont. - (\next. \list. - list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) - (\bit1. intL (\exp. bit1 - (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) - (intL (\exp2. cont (\args. exp args (exp2 args))))))) +(\x. x x) (\x. (\intL. \cont. \list. + list (\a. a) (\u. list (\q. cont) (list list u)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) (x x)) ``` -It is Sean Palmer's 168-bit `int.lam` (tromp/AIT `2cfa384`) with a new -reader; everything from `next` inward is the 168's. The 168 is itself one -β-expansion of Tromp's 170: the zero-branch continuation `\bit1. …` is -let-floated out from under `\list \bit0 \list1` to sit just inside `\cont`. -In the size identity `|M| = 2L + 4A + 2 + X` the three read `(17, 25, 29)`, -`(16, 26, 30)` and `(15, 25, 38)`. - -**Both are proved correct.** `lean/Blc/Selfint165.lean` and -`lean/Blc/SelfintProof.lean` prove in Lean, for the 165 and the 168 pinned to -their wire bits, that `E C (⌜M⌝ ++ N)` β-*reduces* to `C (λz. M) N` for every -closed `M` and any terms `C`, `N` (`selfint_contract165`, `selfint_contract`), -divergent programs included, together with the head-reduction parser -statements of `Blc/Selfint.lean` for every term, open or closed. The axioms are -`propext` and `Quot.sound`. One induction on the source term carries -everything: the parsed closure denotes the term under any cons' environment -(`Den`), implements it under head reduction (`Implements`), and leaves a -residual that spine-reduces to the tail; the variable engine is an induction on -the unary index, and the control is a set of kernel-replayed machine runs on -placeholder terms, lifted because head steps are stable under substitution. - -**Nothing below 165 is known.** §3 lists everything searched around it, §5 the -lower bounds. None is an unconditional optimality proof; §7 says what remains. +It is the 165 (`machines/int165.lam`, §2) with a new reader; everything from +`\bit1` inward is the 165's, which is Sean Palmer's 168 (tromp/AIT +`2cfa384`) with Codex's reader, and the 168 is one β-expansion of Tromp's +170. The 162's reader is a 44-bit reader that Codex built while refuting a +step of a reader-optimality proof (`data/self-interpreter/reasoning_floor/`), +placed in the 165 with NEXT as the reader's last operand, Grok's idea; that +interpreter measures 166 with a `next` let, and `blam golf letopt` renders it +at 162 by inlining NEXT into the operand slot. In the size identity +`|M| = 2L + 4A + 2 + X` the four interpreters read `(16, 24, 32)`, +`(17, 25, 29)`, `(16, 26, 30)` and `(15, 25, 38)`. + +**All four are proved correct.** `lean/Blc/Selfint162.lean`, +`Selfint165.lean` and `SelfintProof.lean` prove in Lean, for the 162, the 165 +and the 168 pinned to their wire bits, that `E C (⌜M⌝ ++ N)` β-*reduces* to +`C (λz. M) N` for every closed `M` and any terms `C`, `N` +(`selfint_contract162`, `selfint_contract165`, `selfint_contract`), divergent +programs included, together with head-reduction parser statements for every +term, open or closed, and `¬ SelfintSizeBound 163`. The axioms are `propext` +and `Quot.sound`. One induction on the source term carries everything: the +parsed closure denotes the term under any cons' environment (`Den`), +implements it under head reduction (`Implements`), and leaves a residual that +spine-reduces to the tail; the variable engine is an induction on the unary +index, and the control is a set of kernel-replayed machine runs on placeholder +terms, lifted because head steps are stable under substitution. The 162's +variable residual `s s NEXT` names the continuation, through NEXT, so its +parser statement quantifies the residual inside the continuation: +`not_parses_intL162` proves that the 165's continuation-uniform statement +fails for it. An independent adversarial review re-derived the contract by +hand and recounted the size (`reasoning_floor/verify/v162_codex.md`). + +**Nothing below 162 is known.** §3 lists everything searched around it and its +predecessors, §5 the lower bounds. None is an unconditional optimality proof; +§7 says what remains. `tools/self-interpreter/battery.py` is the exact contract check used for every measured size: rigid continuation and tail, every closed program through 18 bits plus deep-index extras. Of its 668 programs, the one whose expected result has no normal form is skipped and 667 must pass. It compares β-normal forms, so an interpreter correct only up to η fails it (one with arguments -before environments measures 237 and passes a separate βη audit). The 165 -also passes 3,341 programs through 21 bits, and its suffix extraction +before environments measures 237 and passes a separate βη audit). The 162 and +the 165 also pass 3,341 programs through 21 bits, and their suffix extraction `E (λv r. r) (⌜M⌝ ++ n)` normalizes to `n` on divergent `M`. -`tools/self-interpreter/merges.py` re-measures the 165, its nearest variants, -and the 168's protocol variants of §6. +`tools/self-interpreter/merges.py` re-measures the 162, the 165, their nearest +variants, and the 168's protocol variants of §6. ## 2. Anatomy | part | bits | |---|---:| | knot and `intL = x x` let | 22 | -| `\cont`, the `next` let, `\list` | 8 | -| reader `list H S`: two applications and `list` | 6 | -| handler `\bit0. bit0 Z cont` around its zero arm | 13 | -| zero arm `Z = \unused \r. r next` | 14 | -| skip `S = list list list` | 10 | -| NEXT header `\bit1. intL (\exp. bit1 · ·)` | 17 | -| ABS (the `cons'` cell alone is 24) | 40 | -| APP | 35 | - -The 25 applications: knot 3 and the `intL` let 1; the `next` let 1; the reader -2, its skip 2, the handler's dispatch 2, the zero arm's read of the second bit -1; the first parse 1 and the dispatch on `bit1` 2; ABS 5 (return, enter the -body, build the cell 3); APP 5 (second parse, return, `exp args (exp2 args)` -3). The 17 λs: the knot's two, the two lets, `cont` and `list`, `bit0`, the -zero arm's two, `bit1` and `exp`, the λ-value's `args` and `arg`, the cell's -`zx` and `zy`, and APP's `exp2` and `args`. +| `\cont`, `\list` | 4 | +| reader `list I V NEXT`: three applications and `list` | 8 | +| `I = \a. a` | 4 | +| variable arm `V = \u. list (\q. cont) (list list u)` | 28 | +| NEXT header `\bit1. intL (\exp. bit1 · ·)` | 18 | +| ABS (the `cons'` cell alone is 24) | 41 | +| APP | 37 | + +The 24 applications: knot 3 and the `intL` let 1; the reader 3; the variable +arm 4 (`list` applied twice, the skip's two); the first parse 1 and the +dispatch on `bit1` 2; ABS 5 (return, enter the body, build the cell 3); APP 5 +(second parse, return, `exp args (exp2 args)` 3). The 16 λs: the knot's two, +`intL`, `cont` and `list`, `I`'s, the variable arm's `u` and `q`, `bit1` and +`exp`, the λ-value's `args` and `arg`, the cell's `zx` and `zy`, and APP's +`exp2` and `args`. ### The reader -With `s = cons b r` the whole input stream, +With `s = cons b r` the whole input stream and `NEXT` the reader's last +operand, + +```text +s I V NEXT = b r V NEXT. +``` + +`s I` turns the first cell into its own selection. + +- **0-tag:** `K r V NEXT = r NEXT = NEXT b2 r2` for `r = cons b2 r2`, the + 165's zero branch `r next`. The zero arm is the tail itself: there is no + handler, no zero-arm λs, and no duplicate stream copy to drop. +- **Variable** `1ⁿ0 ++ N`: `F r V NEXT = V NEXT`, and `V` reopens the whole + stream: `s (\q. cont) = cont r` hands the tail to `cont`, and + `s s NEXT = r r NEXT = N` is the skip, with NEXT as its erased third + operand (`U_m U_m = K N` for every unary code). So `V NEXT = cont r N`, + the 165's variable law. + +Against the 165 the `next` let goes (4 bits) and the reader shrinks from 43 +bits to 40; NEXT, now under `\list`, pays one more index bit on each of its +four references to `cont` and `intL` (header 18, ABS 41, APP 37: +4). On genuine +streams the parser equations are exactly the 165's, which is why its proof +transfers; off them they differ, and the variable residual carries NEXT. +The reader lies outside every reader class of §5: it has three operands, and +written as a two-operand reader `s H NEXT` (`H = λb r. b r V`) its last +operand is the bare `next`, a family the record had left open. + +### The 165's reader + +The 165 is + +```text +(\x. x x) (\x. (\intL. \cont. + (\next. \list. + list (\bit0. bit0 (\unused \r. r next) cont) (list list list)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) +``` + +with anatomy knot 22; `\cont`, the `next` let, `\list` 8; reader +`list H S` 6; handler `\bit0. bit0 Z cont` 13; zero arm +`Z = \unused \r. r next` 14; skip `S = list list list` 10; NEXT header 17; +ABS 40; APP 35. With `s = cons b r`, ```text s H S = H b r S S = s s s @@ -103,49 +156,65 @@ leading 1, `s s = r r`, and by induction a unary code `1^k 0 ++ N` gives - **Variable** `1^n 0 ++ N`: `S = N`, and `H F r S = cont r S = cont r N`, the 168's `cont list1 (list1 list1 list1)`. -Two moves make this pay. The skip is *hoisted*: the 168 computed it inside the -variable arm from `list1`; the 165 computes it once on the whole stream, -where its value happens to be what both arms need. And the Scott list's own -application `H b r S` *supplies* `list1` to the variable arm, so that arm is -`cont` itself and its return application disappears. Against the 168 this is -one λ more, one application fewer, and one bit less of index: `+2 − 4 − 1`. -The 168's module bound (§5) kept dispatch, VAR and skip in separate opaque -modules, which is exactly the boundary this crosses. - -The zero arm receives `list1` twice and must drop a copy; that is the extra λ. -Dropping it through `bit0`, which is `K` in that arm, costs one bit more -(166). Applying the copy to anything leaves an argument that reaches the rigid -`C`, and re-dispatching it through `H` runs into the uniform-handler -impossibility of §5. - -**Identities of the reader** (Codex). Write `R = \s. s H (s s s)` for the -reader with `next` and `cont` fixed, `H = \b. b Z cont` and `Z = \u r. r next`. -Off genuine streams the reader still computes: `R K = H`, `R F = F`, -`R I = \r. r next`, and `R (K a) = a (a (K a))`, so a constant stream is a -return instruction, `R (K (K X)) = X`. It also diagonalizes its own zero arm: -`R Z →* next next`, and in general `R Z_t →* t t` for `Z_t = \u r. r t` -whatever `next` and `cont` are, while `H R →* next next cont`. On streams, -`s (\x. x x)` is a conditional predecessor (`K` after a 0, the tail after a -1), two cells cross-apply as `cons b r (cons d t) = b d t r`, and unary codes -`U_k(N) = 1^k 0 ++ N` satisfy `U_{i+1}(N) U_{j+1}(M) = U_j(M) U_i(N)`. Proofs -and rigid-variable checks are in `data/self-interpreter/reasoning_165/` +Two moves made this pay against the 168. The skip is *hoisted*: the 168 +computed it inside the variable arm from `list1`; the 165 computes it once on +the whole stream, where its value happens to be what both arms need. And the +Scott list's own application `H b r S` *supplies* `list1` to the variable arm, +so that arm is `cont` itself and its return application disappears. Against +the 168 this is one λ more, one application fewer, and one bit less of index: +`+2 − 4 − 1`. The 168's module bound (§5) kept dispatch, VAR and skip in +separate opaque modules, which is exactly the boundary this crosses. + +The zero arm receives `list1` twice and must drop a copy; that is the extra λ, +and the duplicate is forced for every application-only whole-stream skip +(`protocol-obstructions.md`). Dropping it through `bit0`, which is `K` in that +arm, costs one bit more (166). Applying the copy to anything leaves an +argument that reaches the rigid `C`, and re-dispatching it through `H` runs +into the uniform-handler impossibility of §5. The 162 removes the drop by not +computing the skip in the zero arm at all. + +**Identities of the 165's reader** (Codex). Write `R = \s. s H (s s s)` for +the reader with `next` and `cont` fixed, `H = \b. b Z cont` and +`Z = \u r. r next`. Off genuine streams the reader still computes: `R K = H`, +`R F = F`, `R I = \r. r next`, and `R (K a) = a (a (K a))`, so a constant +stream is a return instruction, `R (K (K X)) = X`. It also diagonalizes its +own zero arm: `R Z →* next next`, and in general `R Z_t →* t t` for +`Z_t = \u r. r t` whatever `next` and `cont` are, while `H R →* next next cont`. +On streams, `s (\x. x x)` is a conditional predecessor (`K` after a 0, the +tail after a 1), two cells cross-apply as `cons b r (cons d t) = b d t r`, and +unary codes `U_k(N) = 1^k 0 ++ N` satisfy `U_{i+1}(N) U_{j+1}(M) = U_j(M) U_i(N)`. +Proofs and rigid-variable checks are in `data/self-interpreter/reasoning_165/` (`fresh/`, `knot/`, `algebra/`, `reader/`). ### The NEXT region -From `next` inward the 165 is the 168, at the same binder stack -`[cont, intL, x]`, and on genuine streams both readers satisfy the same parser -law. So a change confined to NEXT has the same size change and the same -battery outcome on both interpreters (select-first and the K-repair cell are -+1 on each in `merges.py`), and the 168's slot and module results for the -header, ABS, APP, the cell and the lift (§4, `slots.md`) bound the 165's NEXT -region too. +From `\bit1` inward the 162, the 165 and the 168 are the same term, one binder +deeper in the 162; on genuine streams all three readers satisfy the same +parser law. So a change confined to NEXT has the same size change and the +same battery outcome on all three (select-first and the K-repair cell are +1 +on each in `merges.py`), and the 168's slot and module results for the header, +ABS, APP, the cell and the lift (§4, `slots.md`) bound the NEXT region of the +others too. -## 3. Searches around the 165 +## 3. Searches around the 162 and the 165 Every search here is exact against the contract; "capped" means a candidate exhausted its budget without failing a probe, which is not a refutation. +Around the 162: + +| search | scope | result | evidence | +|---|---|---|---| +| let structure (`blam golf letopt`) | 167-bit core, 342 cuts, 0–3 cuts: 342 / 50,693 / 4,543,789 configurations | 162 unique minimum (one cut, the `intL` let); two cuts ≥ 166; three ≥ 172 | `letopt_162.log` | +| βη component | slack 16 / 20 / 24: 58,042 / 1,135,418 / 12,024,847 terms | none below 162, no tie | `component_162_slack24.log` | +| contextual component | slack 18: 575,104 distinct terms | none below 162, no tie | `component_162_contextual18.log` | + +The 162's reader with NEXT let-bound measures 166, and NEXT as the last +operand of a λ-handler `\b \r. b r (\t. cont r (r r t))` measures 168 +(`merges.py`). + +Around the 165: + | search | scope | result | evidence | |---|---|---|---| | let structure (`blam golf letopt`) | 181-bit core, 512 cuts, 0–3 cuts: 512 / 104,471 / 12,419,437 configurations | 165 unique minimum (two cuts); one 167; three cuts ≥ 170 | `letopt_165.log` | @@ -307,7 +376,7 @@ two arguments leaves an outer λ, which no reduct of `C (λz.M) N` has; with `n = 1` the head is `c`, the supplied stream is its last argument and arity forces it to equal `N`, but `⌜M⌝ ++ N ≠β N`. So `n = 2`; head `c` forces exactly two arguments, and head `s` needs one to consume the stream's outer λ. -Both shapes occur: the 165 and 168 are `s`-headed; parsing twice, +Both shapes occur: the 162, 165 and 168 are `s`-headed; parsing twice, `λc s. c (E (λv r. v) s) (E (λv r. r) s)`, is a correct `c`-headed interpreter. In the continuation-headed case, replacing every occurrence of `c` inside `A,B` by `s` preserves the contract and saves one bit per @@ -423,6 +492,13 @@ the 165 shows that the natural decomposition is false. ### Bounds within the 165's reader shape +These bound readers of the 165's shape with its `next` protocol. The 162's +reader lies outside them: it has three operands, and as a two-operand reader +its last operand is the bare `next`, a family they leave open. A +residual-tracing attempt to extend them to every reader shape was refuted +step by step in review, without a reader below 43 being found +(`data/self-interpreter/reasoning_floor/reader-proof/`, `verify/`). + These are Codex's handwritten proofs, with targeted reduction checks in `data/self-interpreter/reasoning_165/bounds/` (`proof_check.py`) and `tools/self-interpreter/theory/handler_bound.py`; none is in Lean. @@ -661,23 +737,24 @@ their optimal let structure (`blam golf letopt`, at most three cuts). ## 7. Boundaries -No verified sub-165 has been found in the tested neighbourhoods: its let -structure, βη and contextual components, every slot of its reader singly and -the handler and skip jointly through interpreters of 164 bits, and the NEXT -region it shares with the 168. Capped candidates remain unresolved. Another -fusion of the kind the reader uses is a promising constructive route: -work that two parts of the interpreter need, computed once where its value is -right for both, or a Scott structure whose own application supplies an -argument. +No verified sub-162 has been found: its let structure is minimal to three +cuts and its βη components to slack 24 hold nothing smaller (§3); the +searches around the 165 bound that reader shape. The 162 came from the move +that produced the 165, a Scott structure's own application doing a branch's +work (here `s I` makes the cell's selection deliver the tail as the zero +arm), combined with an operand that one branch uses and the other erases +(NEXT, the skip's junk on variables). Moves of that kind remain the +promising constructive route. Open: - readers outside the classes bounded in §5: other reader heads, joint handler/skip changes, exploitation of actual NEXT/parser behaviour, and readers with a different `next` protocol beyond those priced in §3 and §6; + the 162's reader shows this family is live; - the reader's diagonal `R Z →* next next` (§2): the 165 already contains the - self-application a knot needs, and a sub-165 along this line would have - `next`'s zero arm serve as the knot's generator. Built with a separate + self-application a knot needs, and a smaller interpreter along this line + would have `next`'s zero arm serve as the knot's generator. Built with a separate carrier it works at 192 and 199 bits; making `next` do both while keeping its Boolean cases is unsolved, and the exclusions of §5 rule out the current `next` and parser doing it unchanged; diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index d42029b2..2e86dab9 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -390,6 +390,33 @@ explicit mode flag). The proof covers this uniform, β-exact re-entry equation with the transparent contract, not every design with different internal values and a public adapter. +## The NEXT region + +Codex's handwritten results on NEXT with the 165's knot and reader fixed, +found correct by an independent review +(`data/self-interpreter/reasoning_floor/verify/vnext_codex.md`): + +- **Optimality of NEXT alone is a global problem.** Any closed + self-interpreter `Q` fills the NEXT slot as + `N_Q = λb t. Q c (λh. h K (λj. j b t))`, which rebuilds the two cells the + reader consumed and calls `Q` on the original stream, at exactly + `|Q| + 44` bits. So "every correct NEXT has at least 92 bits" would imply + a 48-bit floor for every interpreter. (With the 165, 282 bits; battery + passes.) +- **A conditional 92.** If NEXT meets the rigid canonical branch laws + `N K t = intL (λf. c (Abs f)) t` and `N F t = intL (λf. intL (λg. c (App f g))) t` + with `intL` rigid, is β-normal, and uses the tag only as `b U V`, then it + has at least 92 bits, uniquely the 165's: specializing repeated tests + never grows the term, and every remaining tree is one of nine forms of + 92–116 bits. The rigid laws are not forced by the contract: a 184-bit + interpreter whose ABS returns through the actual parser, + `intL f (λu v. c (Abs f))`, meets the contract but not the rigid law. +- **A shared argument with one bare branch head is erased.** With normal + adapters and a tag-free shared argument, a bare `c` (or `intL`) head forces + the other adapter to discard it (96 and 97 bits); a shared pair + `λh. h (Abs f) (App f)` projected by both adapters escapes this at 132 bits + of NEXT (205 overall). + ## APP cannot supply the full parser through an idempotent control response The semantic application `lambda e.f e (g e)` already duplicates an diff --git a/docs/classical/self-interpreter/structural-bounds.md b/docs/classical/self-interpreter/structural-bounds.md index 45aef309..b77683eb 100644 --- a/docs/classical/self-interpreter/structural-bounds.md +++ b/docs/classical/self-interpreter/structural-bounds.md @@ -3,7 +3,7 @@ These results concern the repository's actual closed-source, beta-exact contract. They do not assume a parser architecture, an environment representation, or correctness on open source programs. They do not prove -165-bit optimality. The constructions in `normal.md` and `typed-normal.md` +162-bit optimality. The constructions in `normal.md` and `typed-normal.md` also show why several plausible qualitative restrictions are false. ## At least two nonlinear binders @@ -77,7 +77,7 @@ not an application; abstraction-rooted interpreters then need four abstractions (27 bits), and minimal application-rooted ones below 27 bits are classified and refuted by finite head reduction. The proof uses `Classical.choice`. A literal `λc s.B` costs at least 31 there. These are -small numeric consequences, not approximations to a 165-bit bound; the +small numeric consequences, not approximations to a 162-bit bound; the handwritten floor is 37 (`global-floor.md`). The nonlinear count is sharp, even among beta-normal interpreters. diff --git a/docs/classical/self-interpreter/universal.md b/docs/classical/self-interpreter/universal.md index b1eb0460..0058afee 100644 --- a/docs/classical/self-interpreter/universal.md +++ b/docs/classical/self-interpreter/universal.md @@ -16,16 +16,20 @@ F = \x. (\intL. B) (x x) ``` where `B` is a parser body `\cont. …` whose only free variable is `intL`, used -twice. Around the 165's body (143 bits, `interpreter.md`) they are **175** and -**187** bits (`data/self-interpreter/machines/uni175.lam`, `uni187.lam`); -around the 168's body (146 bits) they are Tromp's 178 and 190. *Strict* means, -in BLC.tex's words, that "any attempt to apply free indices diverges", so the -machine forces closed programs; the strict wiring gets this from an Ω base -environment, which the 165's reader leaves untouched, since it changes only how -the code is read. **No machine below 175, and no strict machine below 187, is -known.** This record states what has been searched; the self-interpreter's own -record is `interpreter.md`. Most of the searches below were run around the -168's body, so their bounds are 178 and 190; §1 and §2 say which. +twice. Around the 162's body (140 bits, `interpreter.md`) they are **172** and +**184** bits (`data/self-interpreter/machines/uni172.lam`, `uni184.lam`; both +pass the battery, the 184 all seven strictness probes, and `blam golf letopt` +finds no smaller rendering of either); around the 165's body (143 bits) they +are 175 and 187 (`uni175.lam`, `uni187.lam`), and around the 168's (146 bits) +Tromp's 178 and 190. *Strict* means, in BLC.tex's words, that "any attempt to +apply free indices diverges", so the machine forces closed programs; the +strict wiring gets this from an Ω base environment, which the 162's and the +165's readers leave untouched, since they change only how the code is read. +**No machine below 172, and no strict machine below 184, is known.** This +record states what has been searched; the self-interpreter's own record is +`interpreter.md`. Most of the searches below were run around the 168's body, +so their bounds are 178 and 190, and the rest around the 165's; §1 and §2 say +which. None has yet been run around the 162's body. U's contract leaves the output boundary to the machine: there is no `λz` and no external `C`. So a protocol that lost for the self-interpreter only at diff --git a/lean/Blc.lean b/lean/Blc.lean index b16a4de6..b2b9c080 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -16,6 +16,7 @@ import Blc.Wire import Blc.Selfint import Blc.SelfintProof import Blc.Selfint165 +import Blc.Selfint162 import Blc.SelfintLowerBound import Blc.SelfintNonlinearChain import Blc.SelfintNormal diff --git a/lean/Blc/Selfint162.lean b/lean/Blc/Selfint162.lean new file mode 100644 index 00000000..fdde1a26 --- /dev/null +++ b/lean/Blc/Selfint162.lean @@ -0,0 +1,484 @@ +/- +The 162-bit interpreter `intL162` (pinned to its wire by `wire_intL162`) +IS a self-interpreter: `selfint_contract162`, for every closed M and any +terms C, N, + + intL162 C (⌜M⌝ ++ N) →β* C (λz. M) N, + +with `isSelfInterpreter_intL162` and `not_selfintSizeBound_163`. + +The 162 is the 165 (`Blc/Selfint165.lean`) with a different reader. Where +the 165 runs the stream on `(\next \list. list H (list list list)) NEXT`, +the 162 runs `\list. list I V NEXT` with `I = \a. a`, `V = \u. list +(\q. cont) (list list u)`, and NEXT (the 165's zero branch) inlined as the +third operand. With `s = cons b r`, `s I V NEXT → I b r V NEXT → b r V +NEXT`: + +* `b = 0`: `K r V NEXT → r NEXT`, the 165's zero branch, now reached + without the `s s s` skip — the tail `r` is a literal stream cell; +* `b = 1` (a variable, `r = 1^i 0 ++ N`): `F r V NEXT → V NEXT → s (\q. + cont) (s s NEXT) → cont r (s s NEXT)`, since `s s → r r → K N` + (`skip_self`) and `K N NEXT → N`. + +So the VAR residual is `s s (next K)`: it names the continuation `K`. The +165's `Parses` shape (one residual per stream, uniform in the +continuation) therefore does not hold for the 162, and its parser theorem +(`parse162`) quantifies the residual AFTER the continuation: for every +argument `S` that spine-reduces to the stream and every `K`, one residual +`U` spine-reducing to the tail with `parser162 K S →* K (λ.B) U`. The +closures, `Den`, `Implements`, NEXT, ABS, APP and the cell runs are the +168's; new here are the knot, the four-step unfold, the reader +(`run_zero162`, `run_var162a/b`), and the corollaries restated with the +residual inside the continuation quantifier (`selfint_contract162`, +`parserStatement162`, `selfint_open162`, `isSelfInterpreter_intL162`). + +No `sorry`; the axioms are `propext` and `Quot.sound`. +-/ + +import Blc.Selfint165 + +namespace Blc +open Term + +-- --------------------------------------------------------------------------- +-- §1. The 162, named by its parts. + +/-- `\a. a`, the reader's first operand. -/ +def idT : Term := .lam (.var 0) + +/-- The variable arm `\u. list (\q. cont) (list list u)`, under +`\intL \cont \list`. -/ +def varArm162 : Term := + .lam (.app (.app (.var 1) (.lam (.var 3))) (.app (.app (.var 1) (.var 1)) (.var 0))) + +/-- The zero branch `\bit1. intL (\exp. bit1 (cont ABS) (intL (\exp2. cont +APP)))`, under `\intL \cont \list` (the 168's `nextT` one binder deeper). -/ +def nextT162 : Term := + .lam (.app (.var 3) (.lam (.app (.app (.var 1) (.app (.var 3) absVt)) + (.app (.var 4) (.lam (.app (.var 4) appVt)))))) + +/-- `\intL \cont \list. list I V NEXT`. -/ +def bodyT162 : Term := + .lam (.lam (.lam (.app (.app (.app (.var 0) idT) varArm162) nextT162))) + +/-- The knot's generator `\x. body (x x)`. -/ +def knotW162 : Term := .lam (.app bodyT162 (.app (.var 0) (.var 0))) + +/-- The parser: `intL162`'s first head reduct, and the value of every +recursive call. -/ +def parser162 : Term := .app knotW162 knotW162 + +/-- The 162-bit self-interpreter `(\x. x x) (\x. body (x x))`, 0-indexed de +Bruijn. `wire_intL162` pins it to its wire. -/ +def intL162 : Term := .app (.lam (.app (.var 0) (.var 0))) knotW162 + +/-- The wire of `tmp/overnight/self/int162.blc`. -/ +def intL162Wire : List Bool := [false, true, false, false, false, true, true, false, true, false, false, false, false, true, false, false, false, false, false, false, false, true, false, true, false, true, true, false, false, false, true, false, false, false, false, true, false, true, true, true, false, false, false, true, true, true, true, false, false, true, false, true, true, true, false, true, true, false, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, false, true, true, true, false, false, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, false, true, false, true, true, true, false, true, true, true, false, false, true, true, false, true, true, true, true, false, false, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, true, false, false, false, false, true, false, true, true, true, true, false, true, false, false, true, true, true, false, true, false, false, true, true, false, true, false] + +-- The raised recursion depth is an elaborator allowance for the 162-bit +-- computations below, not a proof-strength change. +set_option maxRecDepth 8192 + +/-- The kernel vouches the transcription: `intL162`'s code IS the 162-bit +wire. -/ +theorem wire_intL162 : blcCode intL162 = intL162Wire := by decide + +theorem intL162_size : intL162Wire.length = 162 := by decide + +theorem intL162_closed : Closed intL162 := by decide + +theorem parser162_closed : Closed parser162 := by decide + +theorem shift_parser162 (d c : Nat) : shift d c parser162 = parser162 := + shift_closed d c parser162_closed + +theorem substDec_parser162 (j : Nat) (s : Term) : substDec j s parser162 = parser162 := + substDec_closed j s parser162_closed + +theorem substDec_idT (j : Nat) (s : Term) : substDec j s idT = idT := + substDec_closed j s (by decide) + +/-- The variable arm after the unfold, with `cont` free at 0 and the +stream `list` free at 1: `\u. list (\q. cont) (list list u)`. -/ +def vc162 : Term := + .lam (.app (.app (.var 2) (.lam (.var 2))) (.app (.app (.var 2) (.var 2)) (.var 0))) + +/-- The zero branch after the unfold, `cont` free at 0 and `intL` resolved +to the parser (the 165's `next165 0` on this parser). -/ +def nextc162 : Term := + .lam (.app parser162 (.lam (.app (.app (.var 1) (.app (.var 2) absVt)) + (.app parser162 (.lam (.app (.var 3) appVt)))))) + +/-- The first parse's continuation, with `cont` free at index 0 and the +second tag bit `b` substituted (the 168's `kont`, calling this parser). -/ +def kont162 (b : Term) : Term := + .lam (.app (.app b (.app (.var 1) absVt)) (.app parser162 (.lam (.app (.var 2) appVt)))) + +theorem substDec_nextc162 (j : Nat) (s : Term) (h : 1 ≤ j) : + substDec j s nextc162 = nextc162 := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +theorem substDec_kont162T (j : Nat) (s : Term) (h : 1 ≤ j) : + substDec j s (kont162 churchTrue) = kont162 churchTrue := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +theorem substDec_kont162F (j : Nat) (s : Term) (h : 1 ≤ j) : + substDec j s (kont162 churchFalse) = kont162 churchFalse := + substDec_of_freeUnder _ j s (freeUnder_mono h (by decide)) + +/-- The variable arm, closed over `cont = K` and `list = S`: +`\u. S (\q. K) (S S u)`. -/ +def vK162 (K S : Term) : Term := + .lam (.app (.app (shift 1 0 S) (.lam (shift 2 0 K))) + (.app (.app (shift 1 0 S) (shift 1 0 S)) (.var 0))) + +/-- The zero branch, closed over `cont = K`. -/ +def nxt162 (K : Term) : Term := substDec 0 K nextc162 + +/-- ABS's continuation, closed over `cont = K`. -/ +def kA162 (K : Term) : Term := substDec 0 K (kont162 churchTrue) + +/-- APP's first continuation, closed over `cont = K`. -/ +def kB162 (K : Term) : Term := substDec 0 K (kont162 churchFalse) + +-- --------------------------------------------------------------------------- +-- §2. The machine runs, replayed by the kernel on placeholder terms. +-- Placeholders: `cont = var 0`, the stream `var 1`, its tail `var 2`. + +/-- The knot: `intL162` head-steps to the parser. -/ +theorem run_knot162 : spineSteps 1 intL162 = some parser162 := by decide + +/-- The parser unfolds and runs the stream on `I`, the variable arm and +the zero branch. -/ +theorem run_unfold162 : + spineSteps 4 (.app (.app parser162 (.var 0)) (.var 1)) + = some (.app (.app (.app (.var 1) idT) vc162) nextc162) := by + decide + +/-- Tag `0`: the cell selects its tail, which receives the zero branch. -/ +theorem run_zero162 : + spineSteps 4 (.app (.app (.app (pairT churchTrue (.var 2)) idT) vc162) nextc162) + = some (.app (.var 2) nextc162) := by + decide + +/-- Tag `1`: the cell selects the variable arm, which reopens the stream +on `\q. cont` with residual `list list NEXT`. -/ +theorem run_var162a : + spineSteps 5 (.app (.app (.app (pairT churchFalse (.var 2)) idT) vc162) nextc162) + = some (.app (.app (.var 1) (.lam (.var 1))) (.app (.app (.var 1) (.var 1)) nextc162)) := by + decide + +/-- The reopened cell hands its tail to `cont`: `(1:r) (\q. K) X → K r X`. -/ +theorem run_var162b : + spineSteps 2 (.app (.app (pairT churchFalse (.var 1)) (.lam (.var 1))) (.var 2)) + = some (.app (.app (.var 0) (.var 1)) (.var 2)) := by + decide + +/-- Tags `00`: ABS parses its body under the ABS continuation. -/ +theorem run_lam162 : + spineSteps 2 (.app (pairT churchTrue (.var 1)) nextc162) + = some (.app (.app parser162 (kont162 churchTrue)) (.var 1)) := by + decide + +/-- Tags `01`: APP parses its function under the APP continuation. -/ +theorem run_app162 : + spineSteps 2 (.app (pairT churchFalse (.var 1)) nextc162) + = some (.app (.app parser162 (kont162 churchFalse)) (.var 1)) := by + decide + +/-- ABS returns its value. -/ +theorem run_retLam162 : + spineSteps 3 (.app (.app (kont162 churchTrue) (.var 1)) (.var 2)) + = some (.app (.app (.var 0) absVc) (.var 2)) := by + decide + +/-- APP's first parse continues into the second. -/ +theorem run_retApp1_162 : + spineSteps 3 (.app (.app (kont162 churchFalse) (.var 1)) (.var 2)) + = some (.app (.app parser162 kont2) (.var 2)) := by + decide + +-- --------------------------------------------------------------------------- +-- §3. The runs, lifted to arbitrary continuations, streams and closures. + +theorem spine_unfold162 (K S : Term) : + SpineReds (.app (.app parser162 K) S) (.app (.app (.app S idT) (vK162 K S)) (nxt162 K)) := by + have h := spineReds_instN [K, S] 0 (spineReds_of_spineSteps _ run_unfold162) + simpa [instN, vK162, vc162, nxt162, substDec, shift, substDec_parser162, substDec_idT, + substDec_nextc162, shift_shift0, substDec_shift0, shift_zero] using h + +/-- Tag `0`: `(0:r) I V N → r N`. -/ +theorem spine_zero162 (K S r : Term) : + SpineReds (.app (.app (.app (pairT churchTrue r) idT) (vK162 K S)) (nxt162 K)) + (.app r (nxt162 K)) := by + have h := spineReds_instN [K, S, r] 0 (spineReds_of_spineSteps _ run_zero162) + simpa [instN, vK162, vc162, nxt162, pairT, substDec, shift, shift_churchTrue, + substDec_churchTrue, substDec_idT, substDec_nextc162, shift_shift0, substDec_shift0, + shift_zero] using h + +/-- Tag `1`, first half: `(1:r) I (V K S) N → S (\q. K) (S S N)`. -/ +theorem spine_var162a (K S r : Term) : + SpineReds (.app (.app (.app (pairT churchFalse r) idT) (vK162 K S)) (nxt162 K)) + (.app (.app S (.lam (shift 1 0 K))) (.app (.app S S) (nxt162 K))) := by + have h := spineReds_instN [K, S, r] 0 (spineReds_of_spineSteps _ run_var162a) + simpa [instN, vK162, vc162, nxt162, pairT, substDec, shift, shift_churchFalse, + substDec_churchFalse, substDec_idT, substDec_nextc162, shift_shift0, substDec_shift0, + shift_zero] using h + +/-- Tag `1`, second half: `(1:r) (\q. K) X → K r X`. -/ +theorem spine_var162b (K r X : Term) : + SpineReds (.app (.app (pairT churchFalse r) (.lam (shift 1 0 K))) X) (.app (.app K r) X) := by + have h := spineReds_instN [K, r, X] 0 (spineReds_of_spineSteps _ run_var162b) + simpa [instN, pairT, substDec, shift, shift_churchFalse, substDec_churchFalse, + shift_shift0, substDec_shift0, shift_zero] using h + +/-- Tags `00`: `(0:r) (next K) → P (kA K) r`. -/ +theorem spine_lam162 (K r : Term) : + SpineReds (.app (pairT churchTrue r) (nxt162 K)) (.app (.app parser162 (kA162 K)) r) := by + have h := spineReds_instN [K, r] 0 (spineReds_of_spineSteps _ run_lam162) + simpa [instN, nxt162, kA162, pairT, substDec, shift, shift_parser162, substDec_parser162, + shift_churchTrue, substDec_churchTrue, substDec_nextc162, substDec_kont162T, shift_shift0, + substDec_shift0, shift_zero] using h + +/-- Tags `01`: `(1:r) (next K) → P (kB K) r`. -/ +theorem spine_app162 (K r : Term) : + SpineReds (.app (pairT churchFalse r) (nxt162 K)) (.app (.app parser162 (kB162 K)) r) := by + have h := spineReds_instN [K, r] 0 (spineReds_of_spineSteps _ run_app162) + simpa [instN, nxt162, kB162, pairT, substDec, shift, shift_parser162, substDec_parser162, + shift_churchFalse, substDec_churchFalse, substDec_nextc162, substDec_kont162F, shift_shift0, + substDec_shift0, shift_zero] using h + +theorem ret_lam162 (K e u : Term) : + SpineReds (.app (.app (kA162 K) e) u) (.app (.app K (absV e)) u) := by + have h := spineReds_instN [K, e, u] 0 (spineReds_of_spineSteps _ run_retLam162) + simpa [instN, kA162, absV, absVc, consP, substDec, shift, substDec_kont162T, + shift_shift0, substDec_shift0, shift_zero] using h + +theorem ret_app1_162 (K e u : Term) : + SpineReds (.app (.app (kB162 K) e) u) (.app (.app parser162 (kC K e)) u) := by + have h := spineReds_instN [K, e, u] 0 (spineReds_of_spineSteps _ run_retApp1_162) + simpa [instN, kB162, kC, substDec, shift, substDec_parser162, substDec_kont162F, + substDec_kont2, shift_shift0, substDec_shift0, shift_zero] using h + +-- --------------------------------------------------------------------------- +-- §4. The reader on a stream, and the VAR residual. + +/-- Tag `1`: for `S` reaching `(1:r)`, `P K S → K r (S S (next K))`. -/ +theorem spine_var162 (K r S : Term) (hS : SpineReds S (pairT churchFalse r)) : + SpineReds (.app (.app parser162 K) S) (.app (.app K r) (.app (.app S S) (nxt162 K))) := by + refine spineReds_trans (spine_unfold162 K S) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ (spineReds_appL _ hS))) ?_ + refine spineReds_trans (spine_var162a K S r) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ hS)) ?_ + exact spine_var162b K r _ + +/-- Tag `0`: for `S` reaching `(0:r)`, `P K S → r (next K)`. -/ +theorem spine_zero162' (K r S : Term) (hS : SpineReds S (pairT churchTrue r)) : + SpineReds (.app (.app parser162 K) S) (.app r (nxt162 K)) := by + refine spineReds_trans (spine_unfold162 K S) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ (spineReds_appL _ hS))) ?_ + exact spine_zero162 K S r + +/-- The VAR residual: for `S` reaching a variable stream `1 1^i 0 ++ R`, +`S S N → R` for any `N` (`s s → r r → K R`). -/ +theorem self_false162 (i : Nat) {S R : Term} (N : Term) + (h : SpineReds S (pairT churchFalse (streamOf (vbits i) R))) : + SpineReds (.app (.app S S) N) R := by + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ h)) ?_ + refine spineReds_trans (spineReds_appL _ (spine_pairT _ _ _)) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ (spineReds_appL _ h))) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ (spine_pairT _ _ _))) ?_ + refine spineReds_trans (spineReds_appL _ (spineReds_appL _ (spine_false2 _ _))) ?_ + refine spineReds_trans (spineReds_appL _ (skip_self i R)) ?_ + have hb := spine_beta (shift 1 0 R) N + have e : contract (shift 1 0 R) N = R := substDec_shift R _ 0 + rw [e] at hb + exact hb + +-- --------------------------------------------------------------------------- +-- §5. The parser theorem. + +/-- The open parser theorem for the 162: for every term `M` and tail `R`, +one closure `λ.B` denoting and implementing `M`, and for every argument +`S` that spine-reduces to M's stream and EVERY continuation `K`, one +residual `U` spine-reducing to `R` with `P K S →* K (λ.B) U`. The +residual sits inside the continuation quantifier because VAR's is +`S S (next K)`. -/ +theorem parse162 : ∀ (M R : Term), ∃ B, Den M B ∧ Implements (.lam B) M ∧ + ∀ S, SpineReds S (streamOf (blcCode M) R) → ∀ K, ∃ U, SpineReds U R ∧ + SpineReds (.app (.app parser162 K) S) (.app (.app K (.lam B)) U) := by + intro M + induction M with + | var i => + intro R + rw [code_var, streamOf_cons] + have himpl : Implements (streamOf (vbits i) R) (.var i) := by + intro env R' h + exact headReduces_of_spineReds (engine i env R' R _ (List.getElem?_eq_getElem h)) + cases i with + | zero => + exact ⟨_, den_var0 R, himpl, fun S hS K => + ⟨_, self_false162 0 (nxt162 K) hS, spine_var162 K (streamOf (vbits 0) R) S hS⟩⟩ + | succ j => + rw [stream_vbits_succ] at himpl ⊢ + refine ⟨_, den_varS j R, himpl, fun S hS K => ⟨_, ?_, spine_var162 K _ S hS⟩⟩ + have hS' : SpineReds S (pairT churchFalse (streamOf (vbits (j + 1)) R)) := by + rw [stream_vbits_succ]; exact hS + exact self_false162 (j + 1) (nxt162 K) hS' + | lam M ih => + intro R + obtain ⟨B, hD, hI, hP⟩ := ih R + refine ⟨_, den_lam hD, ⟨.lam B, hI, fun ρ a => + headReduces_of_spineReds (spine_absImpl (.lam B) ρ a)⟩, fun S hS K => ?_⟩ + obtain ⟨U, hU, hK⟩ := hP _ (SpineReds.refl _) (kA162 K) + refine ⟨U, hU, ?_⟩ + have hS' : SpineReds S (pairT churchTrue (pairT churchTrue (streamOf (blcCode M) R))) := hS + refine spineReds_trans (spine_zero162' K _ S hS') ?_ + refine spineReds_trans (spine_lam162 K _) ?_ + exact spineReds_trans hK (ret_lam162 K (.lam B) U) + | app M N ihM ihN => + intro R + obtain ⟨B₁, hD₁, hI₁, hP₁⟩ := ihM (streamOf (blcCode N) R) + obtain ⟨B₂, hD₂, hI₂, hP₂⟩ := ihN R + refine ⟨_, den_app hD₁ hD₂, ⟨.lam B₁, .lam B₂, hI₁, hI₂, fun ρ => + headReduces_of_spineReds (spine_appImpl (.lam B₁) (.lam B₂) ρ)⟩, fun S hS K => ?_⟩ + obtain ⟨U₁, hU₁, hK₁⟩ := hP₁ _ (SpineReds.refl _) (kB162 K) + obtain ⟨U₂, hU₂, hK₂⟩ := hP₂ U₁ hU₁ (kC K (.lam B₁)) + refine ⟨U₂, hU₂, ?_⟩ + have hS' : SpineReds S + (pairT churchTrue (pairT churchFalse (streamOf (blcCode M) (streamOf (blcCode N) R)))) := by + have e : streamOf (blcCode (.app M N)) R + = pairT churchTrue (pairT churchFalse (streamOf (blcCode M) (streamOf (blcCode N) R))) := by + simp only [blcCode, streamOf_cons, streamOf_append]; rfl + rw [← e]; exact hS + refine spineReds_trans (spine_zero162' K _ S hS') ?_ + refine spineReds_trans (spine_app162 K _) ?_ + refine spineReds_trans hK₁ ?_ + refine spineReds_trans (ret_app1_162 K (.lam B₁) U₁) ?_ + exact spineReds_trans hK₂ (ret_app2 K (.lam B₁) (.lam B₂) U₂) + +/-- The whole configuration: `intL162 C (⌜M⌝ ++ R)` spine-reduces to +`C (λ.B) U`, with `U` spine-reducing to `R`; the closure is uniform in +`C`, the residual is not. -/ +theorem intL162_parse (M R : Term) : ∃ B, Den M B ∧ Implements (.lam B) M ∧ + ∀ C, ∃ U, SpineReds U R ∧ + SpineReds (.app (.app intL162 C) (streamOf (blcCode M) R)) (.app (.app C (.lam B)) U) := by + obtain ⟨B, hD, hI, hP⟩ := parse162 M R + refine ⟨B, hD, hI, fun C => ?_⟩ + obtain ⟨U, hU, hK⟩ := hP _ (SpineReds.refl _) C + exact ⟨U, hU, spineReds_trans + (spineReds_appL _ (spineReds_appL _ (spineReds_of_spineSteps _ run_knot162))) hK⟩ + +-- --------------------------------------------------------------------------- +-- §6. The contract, and the size bound it moves. + +/-- **The self-interpreter contract for the 162.** For every closed `M` +and any terms `C`, `N`: `intL162 C (⌜M⌝ ++ N) →β* C (λz. M) N`. -/ +theorem selfint_contract162 (M : Term) (hM : Closed M) (C N : Term) : + Betas (.app (.app intL162 C) (streamOf (blcCode M) N)) (.app (.app C (.lam M)) N) := by + obtain ⟨B, hD, _, hP⟩ := intL162_parse M N + obtain ⟨U, hU, hK⟩ := hP C + have hB : Betas B M := by + have h := hD 0 1 [] (.var 0) Term.var hM (fun i hi => absurd hi (Nat.not_lt_zero i)) + have e : substDec 0 (envList [] (.var 0)) (shift 1 1 B) = B := substDec_var_shift B 0 + rw [e, inst_id M Term.var (fun _ => rfl)] at h + exact h + exact betas_trans (betas_of_spineReds hK) + (betas_app (betas_appR C (betas_lam hB)) (betas_of_spineReds hU)) + +/-- The contract on quoted programs, `⌜M⌝ = stream(M, FALSE)`. -/ +theorem selfint_quote162 (M : Term) (hM : Closed M) (C : Term) : + Betas (.app (.app intL162 C) (quote M)) (.app (.app C (.lam M)) falseT) := + selfint_contract162 M hM C falseT + +/-- The strategy-faithful parser statement for the 162: under head +reduction `intL162 C (⌜M⌝ ++ R)` reaches `C Q U` with `Q ⊨ P[M]` uniform +in `C` and `U` head-reducing to `R`; unlike the 168's and 165's +`ParserStatement`, the residual depends on `C` (VAR's is +`s s (next C)`). -/ +theorem parserStatement162 (M R : Term) : ∃ Q, Implements Q M ∧ + ∀ C, ∃ U, HeadReduces U R ∧ + HeadReduces (.app (.app intL162 C) (streamOf (blcCode M) R)) (.app (.app C Q) U) := by + obtain ⟨B, _, hI, hP⟩ := intL162_parse M R + refine ⟨.lam B, hI, fun C => ?_⟩ + obtain ⟨U, hU, hK⟩ := hP C + exact ⟨U, headReduces_of_spineReds hU, headReduces_of_spineReds hK⟩ + +/-- L1 for the 162, the residual reduced in argument position. -/ +theorem l1_beta162 (M R C : Term) : ∃ Q, Implements Q M ∧ + Betas (.app (.app intL162 C) (streamOf (blcCode M) R)) (.app (.app C Q) R) := by + obtain ⟨B, _, hI, hP⟩ := intL162_parse M R + obtain ⟨U, hU, hK⟩ := hP C + exact ⟨.lam B, hI, + betas_trans (betas_of_spineReds hK) (betas_appR _ (betas_of_spineReds hU))⟩ + +/-- The open-program contract for the 162. -/ +theorem selfint_open162 (M : Term) (d : Nat) (hM : FreeUnder d M) (C N : Term) : + ∃ Q U, Betas (.app (.app intL162 C) (streamOf (blcCode M) N)) (.app (.app C Q) U) ∧ + Betas U N ∧ + ∀ (env : List Term) (R : Term) (σ : Nat → Term), + (∀ i, i < d → env[i]? = some (σ i)) → + Betas (.app Q (envList env R)) (inst σ M) := by + obtain ⟨B, hD, _, hP⟩ := intL162_parse M N + obtain ⟨U, hU, hK⟩ := hP C + refine ⟨.lam B, U, betas_of_spineReds hK, betas_of_spineReds hU, ?_⟩ + intro env R σ hagree + have h := hD d 0 env R σ hM hagree + rw [shift_zero] at h + exact Betas.head (Beta.beta _ _) h + +/-- The 162 meets the contract. -/ +theorem isSelfInterpreter_intL162 : IsSelfInterpreter intL162 := + ⟨intL162_closed, fun M hM => ⟨_, selfint_contract162 M hM (.var 0) (.var 1), Betas.refl _⟩⟩ + +theorem intL162_length : (blcCode intL162).length = 162 := by + rw [wire_intL162]; exact intL162_size + +/-- No bound above 162 holds: optimality is `SelfintSizeBound 162`. -/ +theorem not_selfintSizeBound_163 : ¬ SelfintSizeBound 163 := by + intro h + have := h intL162 isSelfInterpreter_intL162 + rw [intL162_length] at this + omega + +-- --------------------------------------------------------------------------- +-- §7. Why the residual sits inside the continuation quantifier. + +/-- Spine reduction to a head normal form is unique (head reduction is +deterministic, `headStep_det`). -/ +theorem spineReds_hnf_unique {t u v : Term} (hu : SpineReds t u) (hv : SpineReds t v) + (nu : headStep u = none) (nv : headStep v = none) : u = v := by + induction hu with + | refl t => + cases hv with + | refl => rfl + | step _ h _ => rw [headStep_complete h] at nu; cases nu + | step _ h _ ih => + cases hv with + | refl => rw [headStep_complete h] at nv; cases nv + | step _ h' hs' => rw [headStep_det h h'] at ih; exact ih hs' nu + +/-- The 168/165 parse shape — one residual per stream, uniform in the +continuation (`Parses`) — fails for the 162: on `⌜var 0⌝ ++ R` the +residual is `s s (next C)`, which names `C`. -/ +theorem not_parses_intL162 : ¬ Parses intL162 := by + intro h + obtain ⟨B, U, _, _, _, hK⟩ := h (.var 0) (.var 1) + have hs : SpineReds (streamOf (blcCode (.var 0)) (.var 1)) + (pairT churchFalse (pairT churchTrue (.var 1))) := by + rw [code_var, streamOf_cons, stream_vbits_zero]; exact SpineReds.refl _ + have run : ∀ C, SpineReds (.app (.app intL162 C) (streamOf (blcCode (.var 0)) (.var 1))) + (.app (.app C (pairT churchTrue (.var 1))) + (.app (.app (streamOf (blcCode (.var 0)) (.var 1)) (streamOf (blcCode (.var 0)) (.var 1))) + (nxt162 C))) := fun C => + spineReds_trans (spineReds_appL _ (spineReds_appL _ (spineReds_of_spineSteps _ run_knot162))) + (spine_var162 C _ _ hs) + have e0 := spineReds_hnf_unique (hK (.var 0)) (run (.var 0)) rfl rfl + have e1 := spineReds_hnf_unique (hK (.var 1)) (run (.var 1)) rfl rfl + injection e0 with _ e0 + injection e1 with _ e1 + rw [e0] at e1 + injection e1 with _ e1 + exact absurd e1 (by decide) + +end Blc diff --git a/lean/Blc/Selfint165.lean b/lean/Blc/Selfint165.lean index d0026658..89cb0b46 100644 --- a/lean/Blc/Selfint165.lean +++ b/lean/Blc/Selfint165.lean @@ -377,7 +377,7 @@ theorem isSelfInterpreter_intL165 : IsSelfInterpreter intL165 := theorem intL165_length : (blcCode intL165).length = 165 := by rw [wire_intL165]; exact intL165_size -/-- No bound above 165 holds: optimality is `SelfintSizeBound 165`. -/ +/-- No bound above 165 holds; `Selfint162` lowers this to 162. -/ theorem not_selfintSizeBound_166 : ¬ SelfintSizeBound 166 := by intro h have := h intL165 isSelfInterpreter_intL165 diff --git a/lean/README.md b/lean/README.md index 392f010a..e26c9e1b 100644 --- a/lean/README.md +++ b/lean/README.md @@ -23,6 +23,11 @@ theorem selfint_contract165 : Closed M → -- propext, Quot.sound theorem not_selfintSizeBound_166 : ¬ SelfintSizeBound 166 -- propext, Quot.sound +theorem selfint_contract162 : Closed M → + Betas (intL162 C (streamOf (blcCode M) N)) (C (λ M) N) + -- propext, Quot.sound +theorem not_selfintSizeBound_163 : ¬ SelfintSizeBound 163 + -- propext, Quot.sound theorem selfintSizeBound_27 : SelfintSizeBound 27 -- propext, Classical.choice, Quot.sound ``` @@ -30,9 +35,9 @@ theorem selfintSizeBound_27 : SelfintSizeBound 27 The 32-bit term that the reference busy-beaver ledger excludes by hand has no normal form under arbitrary β-reduction. Palmer's 168-bit `intL` (pinned to its wire by `wire_intL`) is a self-interpreter: for every closed `M` and any terms -`C`, `N`, `intL C (⌜M⌝ ++ N)` β-reduces to `C (λz. M) N`. So is the 165-bit -`intL165` (`wire_intL165`), so no self-interpreter size bound above 165 -holds. The **general bridge** holds for +`C`, `N`, `intL C (⌜M⌝ ++ N)` β-reduces to `C (λz. M) N`. So are the 165-bit +`intL165` (`wire_intL165`) and the 162-bit `intL162` (`wire_intL162`), so no +self-interpreter size bound above 162 holds. The **general bridge** holds for every term, so any head-divergence certificate concludes no-normal-form with no side conditions. The **class assemblies** turn certificate *data* into that conclusion mechanically, and the **rigid-head argument bridge** lifts a spine @@ -199,8 +204,16 @@ Self-interpretation: and every run that does not name the parser are the 168's; eight runs are new. It proves `Parses intL165`, hence `selfint_contract165`, `selfint_open165`, `parserStatement165`, `isSelfInterpreter_intL165`, and - `not_selfintSizeBound_166` (the upper-bound half of optimality; the lower - bound `SelfintSizeBound 165` is stated, open). + `not_selfintSizeBound_166`. +- `Blc/Selfint162.lean` — the 162-bit interpreter: the 165's knot and NEXT + around the reader `list I V NEXT`, pinned to its wire (`wire_intL162`). + New reader runs; NEXT, ABS and APP reuse the 168's machinery. Its variable + residual `s s NEXT` names the continuation, so the parser statement puts + the residual inside the continuation quantifier, and + `not_parses_intL162` proves the uniform `Parses` fails. It proves + `selfint_contract162`, `isSelfInterpreter_intL162` and + `not_selfintSizeBound_163` (the upper-bound half of optimality; the lower + bound `SelfintSizeBound 162` is stated, open). - `Blc/SelfintLowerBound.lean` — every term with at most one syntactically nonlinear binder weakly normalizes. Consequently every self-interpreter has at least two, and an explicit `λc s.B` has two inside `B`. A syntax diff --git a/tools/self-interpreter/merges.py b/tools/self-interpreter/merges.py index 1a049452..877aa8fe 100644 --- a/tools/self-interpreter/merges.py +++ b/tools/self-interpreter/merges.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -"""Re-measure the protocol variants recorded in -docs/classical/self-interpreter/interpreter.md §5. +"""Re-measure the interpreters and protocol variants recorded in +docs/classical/self-interpreter/interpreter.md. Each variant is written out in full, compiled without the optimizer, sized, and run through battery.py's exact contract check. A negative control (APP @@ -42,8 +42,26 @@ def int165(reader): READER165 = r"(\bit0. bit0 (\unused \r. r next) cont)" INT165 = int165(READER165) GEN165 = rf"(\x. (\intL. {body165(READER165)}) (x x))" +NEXT = rf"(\bit1.intL (\exp.bit1 {ABS} {APP}))" +READER162 = r"(\a. a) (\u. list (\q. cont) (list list u))" +BODY162 = rf"\cont. \list. list {READER162} {NEXT}" +INT162 = knot(BODY162) +GEN162 = rf"(\x. (\intL. {BODY162}) (x x))" VARIANTS = [ + # interpreter.md §1–§2: the 162, how its reader arises, its universal + # machines. + ("162 (stream-selected reader, NEXT as its last operand)", INT162, False, + 162, True), + ("162's reader with NEXT let-bound", knot(rf"""\cont. + (\next. \list. list {READER162} next) {NEXT}"""), False, 166, True), + ("NEXT as the reader's last operand, lambda handler", knot(rf"""\cont. + \list. list (\bit0 \r. bit0 r (\t. cont r (r r t))) {NEXT}"""), + False, 168, True), + ("universal machine 172, non-strict (intL dbl around the 162)", + f"({INT162}) (\\x. x x)", True, 172, True), + ("universal machine 184, strict wiring around the 162", + rf"(\a. a {GEN162} (\b. b (a a))) (\a. a a)", True, 184, True), # interpreter.md §1–§3: the 165 and its nearest variants. ("165 (whole-stream skip)", INT165, False, 165, True), ("control: 165 zero arm with one binder", int165(r"(\bit0. bit0 (\r. r next) cont)"), From 5d27a332571b813f0368a0d2c2f06524caf65a0a Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 07:41:05 -0400 Subject: [PATCH 33/41] Record the golf lanes on the 162: no sub-162, variants 163-196 Two reasoning lanes on the new architecture found nothing smaller. Their correct variants (select-first 163, cont as the skip's erased operand 164, shared-return NEXT 166, whole-prefix variable value 169, the reader \b. b I W 169, dispatch before the first parse 170, a reader-diagonal knot 196) and the s I family's operand forcing are recorded in interpreter.md section 3; the lanes' reports and constructions are archived. --- .../reasoning_floor/README.md | 3 + .../reasoning_floor/golf162-claude/PROMPT.md | 51 +++ .../reasoning_floor/golf162-claude/REPORT.md | 91 +++++ .../golf162-claude/c144_trailing.lam | 8 + .../golf162-claude/c163_selectfirst.lam | 7 + .../golf162-claude/c169_Vbind.lam | 7 + .../golf162-claude/c169_handlerI.lam | 8 + .../reasoning_floor/golf162-claude/ident1.py | 40 ++ .../reasoning_floor/golf162-claude/ident2.py | 24 ++ .../reasoning_floor/golf162-claude/lab.py | 216 +++++++++++ .../reasoning_floor/golf162-claude/micro1.py | 74 ++++ .../reasoning_floor/golf162/PROMPT.md | 51 +++ .../reasoning_floor/golf162/REPORT.md | 367 ++++++++++++++++++ .../golf162/build_candidates.py | 64 +++ .../reasoning_floor/golf162/check.py | 55 +++ .../golf162/constant_stream_knot.lam | 5 + .../golf162/continuation_last.lam | 7 + .../reasoning_floor/golf162/diag161.lam | 7 + .../golf162/direct_dispatch.lam | 1 + .../reasoning_floor/golf162/handler157.lam | 1 + .../golf162/protocol_checks.json | 123 ++++++ .../golf162/protocol_checks.py | 66 ++++ .../reasoning_floor/golf162/reader_facts.json | 70 ++++ .../reasoning_floor/golf162/reader_facts.py | 80 ++++ .../reasoning_floor/golf162/reset_cont164.lam | 1 + .../reasoning_floor/golf162/shared_return.lam | 3 + .../reasoning_floor/golf162/whole_prefix.lam | 2 + .../golf162/whole_prefix_naive159.lam | 1 + .../classical/self-interpreter/interpreter.md | 12 +- 29 files changed, 1444 insertions(+), 1 deletion(-) create mode 100644 data/self-interpreter/reasoning_floor/golf162-claude/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/golf162-claude/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/golf162-claude/c144_trailing.lam create mode 100644 data/self-interpreter/reasoning_floor/golf162-claude/c163_selectfirst.lam create mode 100644 data/self-interpreter/reasoning_floor/golf162-claude/c169_Vbind.lam create mode 100644 data/self-interpreter/reasoning_floor/golf162-claude/c169_handlerI.lam create mode 100644 data/self-interpreter/reasoning_floor/golf162-claude/ident1.py create mode 100644 data/self-interpreter/reasoning_floor/golf162-claude/ident2.py create mode 100644 data/self-interpreter/reasoning_floor/golf162-claude/lab.py create mode 100644 data/self-interpreter/reasoning_floor/golf162-claude/micro1.py create mode 100644 data/self-interpreter/reasoning_floor/golf162/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/golf162/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/golf162/build_candidates.py create mode 100644 data/self-interpreter/reasoning_floor/golf162/check.py create mode 100644 data/self-interpreter/reasoning_floor/golf162/constant_stream_knot.lam create mode 100644 data/self-interpreter/reasoning_floor/golf162/continuation_last.lam create mode 100644 data/self-interpreter/reasoning_floor/golf162/diag161.lam create mode 100644 data/self-interpreter/reasoning_floor/golf162/direct_dispatch.lam create mode 100644 data/self-interpreter/reasoning_floor/golf162/handler157.lam create mode 100644 data/self-interpreter/reasoning_floor/golf162/protocol_checks.json create mode 100644 data/self-interpreter/reasoning_floor/golf162/protocol_checks.py create mode 100644 data/self-interpreter/reasoning_floor/golf162/reader_facts.json create mode 100644 data/self-interpreter/reasoning_floor/golf162/reader_facts.py create mode 100644 data/self-interpreter/reasoning_floor/golf162/reset_cont164.lam create mode 100644 data/self-interpreter/reasoning_floor/golf162/shared_return.lam create mode 100644 data/self-interpreter/reasoning_floor/golf162/whole_prefix.lam create mode 100644 data/self-interpreter/reasoning_floor/golf162/whole_prefix_naive159.lam diff --git a/data/self-interpreter/reasoning_floor/README.md b/data/self-interpreter/reasoning_floor/README.md index 38814809..ae3ac4eb 100644 --- a/data/self-interpreter/reasoning_floor/README.md +++ b/data/self-interpreter/reasoning_floor/README.md @@ -45,3 +45,6 @@ tag uses; reviewed correct, `verify/vnext_codex.md`; now in 181–240 bits, and a value-collision obstruction). The reader-proof lane's narrowed "Theorem S" was also refuted in review (`verify/vreaderS_codex.md`), which is where the 162's reader came from. +Golf lanes on the 162 (`golf162`, Codex; `golf162-claude`): no sub-162; +variants 163–196, refuted 157/161 attempts, the `s I` family's operand +forcing and a conditional minimality map (now in `interpreter.md` §3). diff --git a/data/self-interpreter/reasoning_floor/golf162-claude/PROMPT.md b/data/self-interpreter/reasoning_floor/golf162-claude/PROMPT.md new file mode 100644 index 00000000..51077c02 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162-claude/PROMPT.md @@ -0,0 +1,51 @@ +Lane "golf162": golf a brand-new 162-bit BLC self-interpreter. Lane directory +given at the end; write files only there. + +Contract: E C (⌜M⌝ ++ N) =β C (λz. M) N for every closed M (divergent +included), C and N rigid; ⌜λM⌝ = 00⌜M⌝, ⌜M N⌝ = 01⌜M⌝⌜N⌝, ⌜var n⌝ = 1ⁿ0 +(n ≥ 1); cons b r = λf. f b r; bit 0 = K = λx y. x, bit 1 = F = λx y. y. +|M| = 2L + 4A + 2 + X (X = sum of 0-based de Bruijn indices). + +The new record, found tonight (tmp/overnight/self/int162.lam; L 16, A 24, X 32): + + (\x. x x) (\x. (\intL. \cont. \list. + list (\a. a) (\u. list (\q. cont) (list list u)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) + +How it works: `list I` turns the first cell into its own selection `b r`. +On a 0-tag, `K r V NEXT → r NEXT = NEXT b2 r2` — the zero arm is the tail +itself, applied to NEXT, which is the reader's last operand (no `next` let, +no zero-arm lambdas). On a variable, `F r V NEXT → V NEXT`; V reopens the +stream, `list (\q. cont)` hands the tail r to cont, and `list list u` with +u = NEXT as junk is the skip (`r r →* K N`, so `K N NEXT → N`). Everything +from NEXT inward is the previous record's (the 165, docs/classical/ +self-interpreter/interpreter.md §1–§2, which explains values, environments +and the cell). Anatomy: knot + intL let 22, λcont λlist 4, reader +applications 6, `list` 2, `I` 4, V 28, NEXT 96 (the 165's 92, +4 because it +now sits under λlist). + +Goal: a 161-bit or smaller self-interpreter, by reasoning. The neighbourhood +of this architecture is unexplored (letopt ≤ 3 cuts and the βη component to +slack 20 find nothing smaller, so a win needs a protocol-level change). Look +for the kind of move that produced it: work two branches need computed once +where it is right for both; a Scott structure's own application supplying an +argument; an operand that one branch uses and the other erases. Questions +worth attacking: can V get r without reopening the stream; can NEXT avoid +the +4 depth tax (it has four references to cont/intL); can the knot or the +intL let interact with the new reader (the stream self-application +`list list` is there); can ABS/APP exploit that NEXT is now inside λlist. + +Tools (from /Users/a9lim/Work/blam): `python3 tools/self-interpreter/polish.py +FILE.lam` — exact battery (668 programs, ~2 s) then the optimal let structure; +`python3 tools/self-interpreter/battery.py FILE.lam --max-bits 21` for a +deeper check. Write candidates as .lam in named-lambda syntax (lets as +explicit redexes, unoptimized, so the printed size is the term as written). +Reason first; light checks only (seconds each, ≤ 2 threads, no enumeration +or sweeps). Report every complete interpreter (bits, battery line, polished +size, idea), every identity with proof, every obstruction with proof, and +your honest read. A sub-162 claim needs a file and a passing battery line. + +Your lane directory: /Users/a9lim/Work/blam/tmp/overnight/golf162-claude/ — write REPORT.md there (if the harness refuses, return the report as your final message). diff --git a/data/self-interpreter/reasoning_floor/golf162-claude/REPORT.md b/data/self-interpreter/reasoning_floor/golf162-claude/REPORT.md new file mode 100644 index 00000000..664ef811 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162-claude/REPORT.md @@ -0,0 +1,91 @@ +# Lane golf162 (Claude): golfing the 162-bit self-interpreter + +(Saved by the coordinating seat from the lane's final message; the harness +refused the lane's own write.) + +**No sub-162 interpreter found.** Inside the 162's architecture every component +sits at a local minimum that can either be proved by hand or pinned with a +bounded check, and the two moves that produced the 162 (the I-selection making +the zero arm free; NEXT as the trailing operand with the variable arm erasing +it) exhaust the cheap ways to route the second tag bit and the variable's +tail. A 161 needs a NEXT protocol or a recursion scheme the record has not +already priced at 166+. + +Files: `lab.py` (harness), `ident1.py`, `ident2.py` (identity checks with +rigid names), `micro1.py` (two bounded sub-piece searches, 412 terms), four +`.lam` files. Computation: five batteries (2 threads, ~2 s each), one +`polish.py` run on three files (44 s wall), a dozen normalizations. + +Notation: `K` = bit 0, `F` = bit 1, `[b]t = cons b t`, `s = [b]r` the whole +stream, `r = [b2]r2`, `N` the rest after a unary code. `V = λu. s (λq. cont) +(s s u)`, `NEXT = λbit1. intL (λexp. bit1 ABS APP)`. + +## 1. Complete interpreters built + +| file | bits | battery | letopt ≤3 cuts / `--no-inline` ≤2 | idea | +|---|---:|---|---:|---| +| `c163_selectfirst.lam` | 163 | `ok=667 skip=1 fail=0` | 163 / 163 | the 162 with select-first NEXT `intL (bit1 KA KB)`; +1 exactly as on the 165 | +| `c169_handlerI.lam` | 169 | `ok=667 skip=1 fail=0` | 169 / 169 | handler `λb. b I W`, `W = λr u. cont r (r r u)`, NEXT trailing | +| `c169_Vbind.lam` | 169 | `ok=667 skip=1 fail=0` | 169 / 169 | `V = λu. s (λq r. cont r (r r u))`: binding the tail instead of reopening | +| `c144_trailing.lam` | 144 | `ok=0 skip=1 fail=667` (fuel) | — | `s (λb. b I cont) NEXT`: the variable arm returns `cont r NEXT`; witness for §3.1 | + +## 2. Exact identities (checked; rigid `cont`/`intL`/`N`/`NEXT`) + +`E k s` is the 162's body `s I V_k NEXT_k` with the parser rigid. + +1. **The parser is its own skip and tail extractor.** On every variable + stream `E F (var n) = N` and `E K (var n) = r`. +2. **The parser on a Boolean is NEXT.** `E k K = E k F = NEXT_k`: a Boolean + fed to the parser as its stream loses the bit. +3. `E k I = k`. +4. `E k (K X) = X (λu. X (X u)) NEXT_k`, `E k (K (K X)) = X NEXT_k`. +5. `E k [1]X = k X (X X NEXT_k)`, `E k [0]X = X NEXT_k`. +6. `s s u →* r` (0-tag) and `N` (variable) for every `u`; + `s (λq. cont) = cont r` on both tags, so `V` is `cont r r` on a + constructor and `cont r N` on a variable. + +## 3. Obstructions and bounds (handwritten; leaves checked) + +**3.1 Trailing-operand principle for the `s I` family.** In `s I O₁ … O_k` +the arms are `r O₂…O_k` and `O₁ O₂…O_k`; correctness forces `k = 2`, +`O₂ =_η NEXT`, `O₁ NEXT = cont r N`. With `k ≥ 3` the extra operands reach +the rigid `C` through a variable's return (`c144_trailing.lam`), or NEXT must +bind them (+8 before depth). + +**3.2 `V` costs at least 28** (case analysis with a checked base). Of all 412 +terms ≤ 14 bits over `[u, list, cont]`, the only one equal to `cont r` on +`var 1..3` is `list (λq. cont)` (12); those equal to `N` are `list list u` +(12), `list list list` (13), `list list cont`, `list list I` (14). So +`B = A₁' A₂` costs ≥ 26, plus `λu` = 28. `cont A₁ A₂` directly costs ≥ 31; +binding `r` ≥ 35; a `u`-headed body parses; a redex head adds a let. Not +exhaustive through 27 bits (248,614 terms; outside this lane's compute brief). + +**3.3 The selector must be `I` or a handler.** Every other cheap `s X` +(`|X| ≤ 10`) loses `r` on the zero arm, puts the rigid `N` at the head on +the variable arm, or collides `var 1` with the constructor case. + +**3.4 Handler forms stay ≥ 168 with NEXT as operand** (`λb r. b r W` is +Grok's 168; `λb. b I W` 169). + +**3.5 Why NEXT keeps the +4 depth tax.** A let costs 7 and saves 4 (166); +one `cont` reference +8; APP's second parse cannot avoid the parser, so two +recursive references are forced and the `intL` let is optimal (the Lean knot +bound `26 + d₁ + d₂` is attained at depths 3, 4); binder exchanges +3 / +7. + +**3.6 Thunked rests cannot be forced for free.** The root `C` cannot force +`K N`; forcing elsewhere costs ≥ +8 or breaks continuation uniformity. + +**3.7 Nothing inside NEXT can use `list`** cheaply. + +**3.8 Conditional minimality.** Under the 162's NEXT protocol, raw-tail +variable values and the knot, the reader costs ≥ 42 + 4 with `X = I`, +≥ 48 + 4 with a handler and NEXT as operand, ≥ 49 with NEXT let-bound, so +162 is minimal in this architecture up to the exhaustiveness of §3.2. + +## 4. Honest read + +Where a 161 could hide: a different second-tag object (an operand right for +both arms in a weaker sense than `r | N`); fewer recursive references (one +syntactic `intL` parsing both children, which needs the first child's value +carried into a re-entry); or a proof — §3.1–3.4 are mechanizable, and §3.2 +becomes exhaustive with a 248,614-term hole check. diff --git a/data/self-interpreter/reasoning_floor/golf162-claude/c144_trailing.lam b/data/self-interpreter/reasoning_floor/golf162-claude/c144_trailing.lam new file mode 100644 index 00000000..5aba2fc0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162-claude/c144_trailing.lam @@ -0,0 +1,8 @@ +-- 144 bits, FAILS: handler \b. b I cont with NEXT trailing; the variable arm returns cont r NEXT (three +-- arguments at the rigid continuation on lambda-bodies that are variables). +(\x. x x) (\x. (\intL. \cont. \list. + list (\b. b (\a. a) cont) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/golf162-claude/c163_selectfirst.lam b/data/self-interpreter/reasoning_floor/golf162-claude/c163_selectfirst.lam new file mode 100644 index 00000000..c40d97d5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162-claude/c163_selectfirst.lam @@ -0,0 +1,7 @@ +-- 163 (predicted): the 162 with select-first NEXT, intL (bit1 KA KB). +(\x. x x) (\x. (\intL. \cont. \list. + list (\a. a) (\u. list (\q. cont) (list list u)) + (\bit1. intL (bit1 + (\exp. cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (\exp. intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/golf162-claude/c169_Vbind.lam b/data/self-interpreter/reasoning_floor/golf162-claude/c169_Vbind.lam new file mode 100644 index 00000000..1fa3787d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162-claude/c169_Vbind.lam @@ -0,0 +1,7 @@ +-- 169 (predicted): the 162 with V binding the tail explicitly, \u. list (\q \r. cont r (r r u)). +(\x. x x) (\x. (\intL. \cont. \list. + list (\a. a) (\u. list (\q \r. cont r (r r u))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/golf162-claude/c169_handlerI.lam b/data/self-interpreter/reasoning_floor/golf162-claude/c169_handlerI.lam new file mode 100644 index 00000000..4dae8aa2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162-claude/c169_handlerI.lam @@ -0,0 +1,8 @@ +-- 169 (predicted): handler form with the I zero arm and NEXT as the trailing operand, +-- variable arm W = \r \u. cont r (r r u) eats NEXT as the skip's forcer. +(\x. x x) (\x. (\intL. \cont. \list. + list (\b. b (\a. a) (\r \u. cont r (r r u))) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/golf162-claude/ident1.py b/data/self-interpreter/reasoning_floor/golf162-claude/ident1.py new file mode 100644 index 00000000..0e0261c3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162-claude/ident1.py @@ -0,0 +1,40 @@ +import sys; sys.path.insert(0, '.') +from lab import * +# The 162 reader pieces with rigid k (cont), p (intL): we treat NEXT as a rigid name "NEXT" to see reader behaviour. +R = r"\list. list (\a. a) (\u. list (\q. k) (list list u)) NEXT" +free = ["NEXT", "k"] +Rt = parse(R, free=free) +def ap(*ts): + return app(*ts) +tests = { + "R I": ap(Rt, I), + "R K": ap(Rt, K), + "R F": ap(Rt, F), + "R (K X)": ap(Rt, ("L", ("L", ("V", len(free)+2)))), # K X with X rigid = next free name index +} +# add rigid X as another free name +free2 = ["X"] + free # X innermost? careful: free list is innermost-first; show() uses same order +Rt2 = parse(R, free=free2) +tests2 = { + "R I": ap(Rt2, I), + "R K": ap(Rt2, K), + "R F": ap(Rt2, F), + "R (K X)": ap(Rt2, ("L", ("L", ("V", 1+0)))), # \a\b. X -> X is free index 0 in free2 -> inside 2 binders index 2 +} +Xref = ("V", 0) +KX = ("L", ("L", shift(2,0,Xref))) # \a \b. X where X = free 0 +KKX = ("L", ("L", ("L", shift(3,0,Xref)))) +tests2 = { + "R I": ap(Rt2, I), + "R K": ap(Rt2, K), + "R F": ap(Rt2, F), + "R (K X)": ap(Rt2, ("L", shift(1,0,Xref))), + "R (K (K X))": ap(Rt2, KX), + "R [0]X": ap(Rt2, cons(K, Xref)), + "R [1]X": ap(Rt2, cons(F, Xref)), + "R [1][0]X": ap(Rt2, cons(F, cons(K, Xref))), + "R [1][1][0]X": ap(Rt2, cons(F, cons(F, cons(K, Xref)))), +} +for n, t in tests2.items(): + print(n, "=", pretty(nf(t), free=free2)) +print("size of 162:", closed_size(open('/Users/a9lim/Work/blam/tmp/overnight/self/int162.lam').read())) diff --git a/data/self-interpreter/reasoning_floor/golf162-claude/ident2.py b/data/self-interpreter/reasoning_floor/golf162-claude/ident2.py new file mode 100644 index 00000000..a986caa1 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162-claude/ident2.py @@ -0,0 +1,24 @@ +import sys; sys.path.insert(0, '.') +from lab import * +# Reader with intL rigid (P), cont rigid (k), rest rigid (N). NEXT written out with P. +BODY = r"\cont. \list. list (\a. a) (\u. list (\q. cont) (list list u)) (\bit1. P (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (P (\exp2. cont (\args. exp args (exp2 args))))))" +free = ["N", "P"] +Eb = parse(BODY, free=free) +Nv = ("V", 0); Pv = ("V", 1) +kfree = ["k"] + free # k innermost +Eb2 = parse(BODY, free=kfree); Nv2 = ("V", 1); Pv2 = ("V", 2); kv = ("V", 0) +var1 = cons(F, cons(K, Nv2)); var2 = cons(F, cons(F, cons(K, Nv2))) +print("E F var1 =", pretty(nf(app(Eb2, F, var1)), kfree)) +print("E F var2 =", pretty(nf(app(Eb2, F, var2)), kfree)) +print("E K var1 =", pretty(nf(app(Eb2, K, var1)), kfree)) +print("E K var2 =", pretty(nf(app(Eb2, K, var2)), kfree)) +print("E k I =", pretty(nf(app(Eb2, kv, I)), kfree)) +NEXTk = parse(r"\bit1. P (\exp. bit1 (k (\args \arg. exp (\zx \zy. zx arg (zy args)))) (P (\exp2. k (\args. exp args (exp2 args)))))", free=kfree) +print("E k K == NEXT_k ?", nf(app(Eb2, kv, K)) == nf(NEXTk)) +print("E k F == NEXT_k ?", nf(app(Eb2, kv, F)) == nf(NEXTk)) +cands = { + "162": open('/Users/a9lim/Work/blam/tmp/overnight/self/int162.lam').read(), + "trailing_fail": r"(\x. x x) (\x. (\intL. \cont. \list. list (\b. b (\a. a) cont) (\bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args))))))) (x x))", +} +for n, s in cands.items(): + print(n, closed_size(s)) diff --git a/data/self-interpreter/reasoning_floor/golf162-claude/lab.py b/data/self-interpreter/reasoning_floor/golf162-claude/lab.py new file mode 100644 index 00000000..969df813 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162-claude/lab.py @@ -0,0 +1,216 @@ +#!/usr/bin/env python3 +"""Lane scratch harness: named-lambda parsing with rigid free names, a fuelled +normal-order normalizer, sizes, and the exact contract probe on one program. + + from lab import * + t = parse(r"\b. b Z c", free=["Z", "c"]) # free names become rigid + print(show(nf(t))) # named normal form + print(size(parse(SRC))) # BLC size of a closed term + probe(E_src, M_src) # contract check via blam +""" +import sys +from pathlib import Path + +ROOT = Path("/Users/a9lim/Work/blam") +sys.path.insert(0, str(ROOT / "tools")) +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +sys.setrecursionlimit(1000000) + +import blcc +import lc + +K = ("L", ("L", ("V", 1))) +F = ("L", ("L", ("V", 0))) +I = ("L", ("V", 0)) + + +def parse(src, free=()): + """Parse blcc .lam syntax; names in `free` (innermost first) become free + de Bruijn indices beyond the bound ones, i.e. rigid variables.""" + p = blcc.P(blcc.strip_comments(src)) + e = blcc.p_lc(p) + p.ws() + assert p.i == len(p.t), p.t[p.i:p.i + 40] + return blcc.to_db(e, tuple(free)) + + +def size(t): + return lc.size(t) + + +def enc(t): + return lc.enc(t) + + +def shift(d, c, t): + return lc.shift(d, c, t) + + +def nf(t, fuel=200000): + try: + return lc.nf(t, [fuel]) + except lc.Fuel: + return None + + +def whnf(t, fuel=200000): + f = [fuel] + while True: + if t[0] == "A": + h = whnf(t[1], f[0]) + if h is None: + return None + if h[0] == "L": + f[0] -= 1 + if f[0] < 0: + return None + t = lc.beta(h, t[2]) + continue + return ("A", h, t[2]) + return t + + +def show(t, free=()): + """Named display; free indices beyond the binders print as the given + names (innermost first), else #k.""" + names = list(free) + + def go(t, depth, prec): + if t[0] == "V": + i = t[1] + if i < depth: + return "v%d" % (depth - 1 - i) + j = i - depth + return names[j] if j < len(names) else "#%d" % j + if t[0] == "L": + vs = [] + b = t + while b[0] == "L": + vs.append("v%d" % (depth + len(vs))) + b = b[1] + s = "\\" + " ".join(vs) + ". " + go(b, depth + len(vs), 0) + return "(" + s + ")" if prec > 0 else s + s = go(t[1], depth, 1) + " " + go(t[2], depth, 2) + return "(" + s + ")" if prec > 1 else s + + return go(t, 0, 0) + + +def cons(b, r): + return ("L", ("A", ("A", ("V", 0), shift(1, 0, b)), shift(1, 0, r))) + + +def bits(s, tail): + """Scott stream of the bit string s (ASCII 0/1) ending in `tail`.""" + t = tail + for ch in reversed(s): + t = cons(K if ch == "0" else F, t) + return t + + +def code(t): + return lc.enc(t) + + +def app(*ts): + r = ts[0] + for x in ts[1:]: + r = ("A", r, x) + return r + + +def closed_size(src): + return size(parse(src)) + + +def eq(a, b, fuel=200000): + na, nb = nf(a, fuel), nf(b, fuel) + return na is not None and na == nb + + +def blam_nf(t, beta=1 << 20): + import subprocess + r = subprocess.run([str(ROOT / "target/release/blam"), "normalize", enc(t), + "--beta", str(beta)], capture_output=True, text=True) + out = r.stdout.split() + if r.returncode or not out or not set(out[0]) <= {"0", "1"}: + return None + return out[0] + + +def probe(E, M, beta=1 << 20): + """Exact contract on one program: \\c \\n. E c ( ++ n) vs \\c \\n. c (\\z.M) n.""" + want = ("L", ("L", ("A", ("A", ("V", 1), ("L", shift(3, 0, M))), ("V", 0)))) + got = ("L", ("L", ("A", ("A", shift(2, 0, E), ("V", 1)), + bits(code(M), ("V", 0))))) + w = blam_nf(want, 1 << 16) + g = blam_nf(got, beta) + if w is None: + return "skip" + if g is None: + return "fuel" + return "ok" if g == w else "WRONG" + + +def db(src): + """Parse Tromp 1-based de Bruijn notation.""" + import db as dbp + return dbp.parse(src) + + +if __name__ == "__main__": + for a in sys.argv[1:]: + t = parse(a) + print(size(t), show(t)) + + +def pretty(t, free=()): + """Like show, but prints Scott cons cells as [b]tail, K/F/I by name.""" + names = list(free) + + def is_cons(t, depth): + # \f. f B R with f = index 0 not free in B, R + if t[0] == "L" and t[1][0] == "A" and t[1][1][0] == "A" and t[1][1][1] == ("V", 0): + B, R = t[1][1][2], t[1][2] + if not occ(0, B) and not occ(0, R): + return shift(-1, 0, B), shift(-1, 0, R) + return None + + def occ(i, t): + if t[0] == "V": + return t[1] == i + if t[0] == "L": + return occ(i + 1, t[1]) + return occ(i, t[1]) or occ(i, t[2]) + + def go(t, depth, prec): + if t == K: + return "K" + if t == F: + return "F" + if t == I: + return "I" + c = is_cons(t, depth) + if c: + b, r = c + bs = go(b, depth, 2) + bs = {"K": "0", "F": "1"}.get(bs, bs) + return "[" + bs + "]" + go(r, depth, 2) + if t[0] == "V": + i = t[1] + if i < depth: + return "v%d" % (depth - 1 - i) + j = i - depth + return names[j] if j < len(names) else "#%d" % j + if t[0] == "L": + vs = [] + b = t + while b[0] == "L": + vs.append("v%d" % (depth + len(vs))) + b = b[1] + s = "\\" + " ".join(vs) + ". " + go(b, depth + len(vs), 0) + return "(" + s + ")" if prec > 0 else s + s = go(t[1], depth, 1) + " " + go(t[2], depth, 2) + return "(" + s + ")" if prec > 1 else s + + return go(t, 0, 0) diff --git a/data/self-interpreter/reasoning_floor/golf162-claude/micro1.py b/data/self-interpreter/reasoning_floor/golf162-claude/micro1.py new file mode 100644 index 00000000..18fc0832 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162-claude/micro1.py @@ -0,0 +1,74 @@ +r"""Micro-search (narrowed by hand): inside V = \u. B, frame [u, list, cont], which terms of <= S bits +normalize to `cont r` (resp. `N`) on the variable streams var1, var2, var3 with u, cont, N rigid?""" +import sys, functools; sys.path.insert(0, '.') +from lab import * +S = int(sys.argv[1]) if len(sys.argv) > 1 else 11 + +@functools.lru_cache(None) +def terms(n, k): + """DB terms of exactly n bits with free indices < k.""" + res = [] + if n >= 2 and n - 2 < k: + res.append(("V", n - 2)) + if n >= 4: + res += [("L", b) for b in terms(n - 2, k + 1)] + for i in range(2, n - 3): + res += [("A", f, a) for f in terms(i, k) for a in terms(n - 2 - i, k)] + return tuple(res) + +# frame: index0 = u, 1 = list, 2 = cont ; beyond: rigid N (3) +Nv = ("V", 0) # N at free index 0 in the stream; inst shifts it to the post-list frame +def var(n): # 1^n 0 N + t = cons(K, Nv) + for _ in range(n): t = cons(F, t) + return t +def subst_list(B, s): + # B has free u(0), list(1), cont(2), N(3). Replace list by s (which has free N only, as index 0 -> shift). + # do it via application: (\list. B') s where B' is B with list bound... simpler: build (\u \list \cont. B) applied. + return B # unused +def inst(B, s): + # (\list. B) s with u, cont, N staying free: B's free: 0=u,1=list,2=cont,3=N. + # abstract index 1: build \l. B[1 -> 0, 0 -> 1...]. Easier: swap indices 0 and 1 then abstract index 0. + def swap(t, d=0): + if t[0] == "V": + i = t[1] + if i == d: return ("V", d + 1) + if i == d + 1: return ("V", d) + return t + if t[0] == "L": return ("L", swap(t[1], d + 1)) + return ("A", swap(t[1], d), swap(t[2], d)) + Bs = swap(B) # now index0 = list, 1 = u + lam = ("L", Bs) # \list. ... free: 0=u,1=cont,2=N + s2 = s # s has free N at index 0; in the new context N is index 2 -> shift by 2 + s2 = shift(2, 0, s) + return app(lam, s2) + +targets_contr = {} +total = 0; hits_contr = []; hits_N = [] +for n in range(2, S + 1): + for B in terms(n, 3): + total += 1 + ok_c = True; ok_n = True + for m in (1, 2, 3): + s = var(m) + r = s # tail after the leading 1 + r = s[1][2] # cons(F, r) -> ('L', ('A', ('A', V0, F'), r')) ; r' shifted by 1 + r = shift(-1, 0, r) + t = inst(B, s) + # context after inst: free 0=u,1=cont,2=N + want_c = app(("V", 1), shift(2, 0, r)) # cont r (r has free N at 0 -> index 2) + want_n = ("V", 2) + got = nf(t, 20000) + if got != want_c: ok_c = False + if got != want_n: ok_n = False + if not ok_c and not ok_n: break + if ok_c: hits_contr.append((n, B)) + if ok_n: hits_N.append((n, B)) +print("terms checked:", total) +names = ["u", "list", "cont", "N"] +def sh(t): + return show(t, free=names) +print("== normalize to cont r on var1..3:") +for n, B in hits_contr: print(n, sh(B)) +print("== normalize to N on var1..3:") +for n, B in hits_N: print(n, sh(B)) diff --git a/data/self-interpreter/reasoning_floor/golf162/PROMPT.md b/data/self-interpreter/reasoning_floor/golf162/PROMPT.md new file mode 100644 index 00000000..f3ea99de --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/PROMPT.md @@ -0,0 +1,51 @@ +Lane "golf162": golf a brand-new 162-bit BLC self-interpreter. Lane directory +given at the end; write files only there. + +Contract: E C (⌜M⌝ ++ N) =β C (λz. M) N for every closed M (divergent +included), C and N rigid; ⌜λM⌝ = 00⌜M⌝, ⌜M N⌝ = 01⌜M⌝⌜N⌝, ⌜var n⌝ = 1ⁿ0 +(n ≥ 1); cons b r = λf. f b r; bit 0 = K = λx y. x, bit 1 = F = λx y. y. +|M| = 2L + 4A + 2 + X (X = sum of 0-based de Bruijn indices). + +The new record, found tonight (tmp/overnight/self/int162.lam; L 16, A 24, X 32): + + (\x. x x) (\x. (\intL. \cont. \list. + list (\a. a) (\u. list (\q. cont) (list list u)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) + +How it works: `list I` turns the first cell into its own selection `b r`. +On a 0-tag, `K r V NEXT → r NEXT = NEXT b2 r2` — the zero arm is the tail +itself, applied to NEXT, which is the reader's last operand (no `next` let, +no zero-arm lambdas). On a variable, `F r V NEXT → V NEXT`; V reopens the +stream, `list (\q. cont)` hands the tail r to cont, and `list list u` with +u = NEXT as junk is the skip (`r r →* K N`, so `K N NEXT → N`). Everything +from NEXT inward is the previous record's (the 165, docs/classical/ +self-interpreter/interpreter.md §1–§2, which explains values, environments +and the cell). Anatomy: knot + intL let 22, λcont λlist 4, reader +applications 6, `list` 2, `I` 4, V 28, NEXT 96 (the 165's 92, +4 because it +now sits under λlist). + +Goal: a 161-bit or smaller self-interpreter, by reasoning. The neighbourhood +of this architecture is unexplored (letopt ≤ 3 cuts and the βη component to +slack 20 find nothing smaller, so a win needs a protocol-level change). Look +for the kind of move that produced it: work two branches need computed once +where it is right for both; a Scott structure's own application supplying an +argument; an operand that one branch uses and the other erases. Questions +worth attacking: can V get r without reopening the stream; can NEXT avoid +the +4 depth tax (it has four references to cont/intL); can the knot or the +intL let interact with the new reader (the stream self-application +`list list` is there); can ABS/APP exploit that NEXT is now inside λlist. + +Tools (from /Users/a9lim/Work/blam): `python3 tools/self-interpreter/polish.py +FILE.lam` — exact battery (668 programs, ~2 s) then the optimal let structure; +`python3 tools/self-interpreter/battery.py FILE.lam --max-bits 21` for a +deeper check. Write candidates as .lam in named-lambda syntax (lets as +explicit redexes, unoptimized, so the printed size is the term as written). +Reason first; light checks only (seconds each, ≤ 2 threads, no enumeration +or sweeps). Report every complete interpreter (bits, battery line, polished +size, idea), every identity with proof, every obstruction with proof, and +your honest read. A sub-162 claim needs a file and a passing battery line. + +Your lane directory: /Users/a9lim/Work/blam/tmp/overnight/golf162/ — write REPORT.md there. diff --git a/data/self-interpreter/reasoning_floor/golf162/REPORT.md b/data/self-interpreter/reasoning_floor/golf162/REPORT.md new file mode 100644 index 00000000..36ec1904 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/REPORT.md @@ -0,0 +1,367 @@ +# golf162 + +No interpreter below 162 bits was found. The supplied 162 passes the exact +battery again. Six complete variants pass, at 164, 166, 169, 170, 182, and +196 bits before and after the stated let optimizations. Three smaller +constructions fail; the 157 and 161 have finite, closed-program refutations, +so their battery fuel failures are not unresolved candidates. + +The useful new results are the reader's constant-stream diagonal, exact +off-domain equations, a 169-bit whole-prefix variable protocol, and an +obstruction to extracting the bare continuation from unchanged NEXT. + +## Checked constructions + +All files and logs below are in this lane, except the supplied baseline. +Sizes are unoptimized BLC encodings of the named source as written. The +battery uses rigid continuation and remainder and compares beta normal +forms, without eta identification. + +| Source | Bits | Exact battery line | Letopt size | Idea | +|---|---:|---|---:|---| +| `../self/int162.lam` | 162 | `162 bits ok=667 skip=1 fail=0` | not rerun; caller reports 162 | Supplied reader, checked as a baseline. | +| `reset_cont164.lam` | 164 | `164 bits ok=667 skip=1 fail=0` | 164 | Replace the erased skip operand `u` by `cont`; obtains `E C F = C`. | +| `shared_return.lam` | 166 | `166 bits ok=667 skip=1 fail=0` | 166 | Let the second tag select both `cont`/`intL` and the meaning of their common argument. | +| `whole_prefix.lam` | 169 | `169 bits ok=667 skip=1 fail=0` | 169 | Return the entire unary stream as a variable value; change the environment cell to compensate for the extra leading one. | +| `direct_dispatch.lam` | 170 | `170 bits ok=667 skip=1 fail=0` | 170 | Select a complete ABS/APP parser before parsing the first child. | +| `continuation_last.lam` | 182 | `182 bits ok=667 skip=1 fail=0` | 182 | Supply the result continuation once as the final reader operand, and bind it in each selected arm. | +| `constant_stream_knot.lam` | 196 | `196 bits ok=667 skip=1 fail=0` | 196, no-inline | Factor the reader and use `R g g (lambda u v. g) = g g` for the outer knot. This is beta-equivalent to the supplied 162. | + +The whole-prefix protocol also passes the deeper battery: + +```text +169 bits ok=3341 skip=2 fail=0 whole_prefix.lam +``` + +Each complete machine, including the baseline, extracts the exact rigid +suffix on the three divergent source terms `Omega`, `lambda x. Omega`, and +`Omega Omega`. These fixed checks do not themselves prove the universal +contract; the algebraic correctness arguments are below. + +For candidates through 175 bits, the recorded let checks are the same two +configurations used by `polish.py`: core inlining with up to three cuts, and +no inlining with up to two cuts. The 182 uses core inlining with up to two +cuts. For the 196, core inlining reports that it does not finish; the +successful check is `--no-inline --max-cuts 2`. Thus 196 is the recorded +letopt result, not a claim that its beta-equivalence class has minimum 196: +the explicit reader identity already recovers the 162 construction. + +`check.py` calls the repository's battery with `threads=2`, invokes letopt +with `--threads 2`, and puts temporary files in this lane. The letopt calls +have a 30-second limit; none of the successful results above timed out. +There was no new term enumeration or beta-eta component search. + +## Reader equations, with proofs + +Use application associated to the left and define + +```text +K = lambda x y. x +F = lambda x y. y +I = lambda x. x +cons b r = lambda f. f b r +U_0(N) = cons K N +U_(n+1)(N) = cons F (U_n(N)) + +R q c s = s I (lambda u. s (lambda dummy. c) (s s u)) q. +``` + +The parameters in the equations below are arbitrary terms. Fresh rigid +parameters suffice for the displayed reduction proofs, and substitution +stability extends the equations to arbitrary terms, including divergers. + +### On genuine streams + +For every `n >= 0`, + +```text +U_n(N) U_n(N) ->* K N. +``` + +For `n=0`, `U_0 U_0 -> U_0 K N -> K K N N -> K N`. +For the successor, write `s=cons F r`; then +`s s -> s F r -> F F r r -> r r`, reducing to the induction hypothesis. +Consequently `s s a ->* N` for every operand `a`. + +For a zero tag, `s=cons K r` gives `s I -> K r`, so + +```text +R q c (cons K r) ->* r q. +``` + +For a variable, `s=U_n(N)` with `n>=1` and `r=U_(n-1)(N)`, +`s I -> I`; the selected arm is + +```text +s (K c) (s s q) ->* (K c) F r N ->* c r N. +``` + +These are exactly the existing parser's zero and variable laws. Replacing +the erased skip operand `u` by `c` leaves both laws unchanged, proving the +164's compatibility with the full source-term induction, without a +normalization hypothesis on the decoded program. + +### Off domain + +```text +R q c K ->* q +R q c F ->* q +R q c I ->* c +R q c (K a) ->* a (lambda u. a (a u)) q +R q c (K (K t)) ->* t q +R q c (lambda u r. r t) ->* t t t q +R q c (lambda f. f t) ->* t (lambda u. c (t t u)) q +``` + +Proofs, retaining the middle arm as `V` where convenient: + +* On `K`, `K I V q -> I q -> q`; the middle arm is erased. +* On `F`, `F I V q -> V q`, and + `V q = F (K c) (F F q) -> q`. +* On `I`, again the result is `V q`, now + `I (K c) (I I q) -> (K c) q -> c`. +* On `s=K a`, `s I -> a`, `s (K c) -> a`, and `s s u -> a u`. + Substitution gives the displayed `a (lambda u. a (a u)) q`. +* Setting `a=K t` in that equation gives `t q`. +* On `s=lambda u r. r t`, `s I -> lambda r. r t`, + `s (K c) -> lambda r. r t`, and `s s u -> u t`. + Thus `V u -> u t t`, and `s I V q -> V t q -> t t t q`. +* On `s=lambda f. f t`, `s I -> t`, `s (K c) -> c`, + and `s s u -> t t u`. Substitute these three results. + +In particular, the short constant synthetic stream gives + +```text +R g c (lambda u v. g) ->* g g +``` + +for any `c`. Taking `c=g` supplies the outer knot in +`constant_stream_knot.lam`. Its generator is +`G = lambda x. (lambda p. lambda c. R (NEXT_p,c) c) (x x)`. +The synthetic call reduces to `G G`, which is the ordinary recursive +parser after expanding the real-reader call. This proves beta equivalence +to the supplied interpreter. The resulting source costs 196; factoring the +reader is expensive enough to absorb the shorter synthetic stream. + +The reset variant instead uses + +```text +Rreset q c s = s I (lambda u. s (K c) (s s c)) q. +``` + +Its Boolean reset follows directly: +`Rreset q c F -> F (K c) (F F c) -> c`. + +`reader_facts.py` checks every displayed family at the stated fixed symbolic +instances with rigid beta normal forms; `reader_facts.json` records 12 +successful checks. The all-unary-length statement is the induction above, +not an extrapolation from those instances. + +## Whole-prefix variables: a complete 169-bit protocol + +The 159-bit tempting change is to use + +```text +VAR = lambda u. cont list (list list u) +``` + +instead of reopening the stream to obtain its tail. This saves three bits: +the variable arm shrinks from 28 to 25. Its value for variable index `n` is +now `U_n(N)` rather than `U_(n-1)(N)`. + +The following environment cell repairs the index shift: + +```text +D(a,e) = lambda unused r. r (lambda b. b (lambda discard. a) (e b)). +``` + +Write `H = lambda b. b (K a) (e b)`. The two exact lookup laws are + +```text +U_1(N) D(a,e) ->* a +U_(n+1)(N) D(a,e) ->* U_n(N) e (n >= 1). +``` + +For the first, `D F U_0 -> U_0 H -> H K N -> (K a) N -> a`. +For the second, `D F U_n -> U_n H -> H F U_(n-1)`; +this reduces to `e F U_(n-1)`, which is exactly the reduct of `U_n e`. +No property of the old environment `e` or the suffix `N` was assumed. + +Use `D(arg,args)` in ABS and leave APP unchanged. These are precisely the +lookup equations required for the original semantic induction, with variable +representation shifted by one. The syntax traversal and remainder laws are +unchanged. This gives the full contract for closed programs, divergent ones +included, as a handwritten proof transfer. It is not a new Lean proof. + +Unfortunately `D` costs 34 bits in the ABS cell frame, versus 24 for the +ordinary cell. The net change is `-3 + 10 = +7`, yielding 169. Letopt does +not improve it. `protocol_checks.py` verifies three rigid cell instances, +and the deeper battery gives `ok=3341 skip=2 fail=0`. + +## Other complete variants + +Let `A_e = lambda args arg. e (lambda x y. x arg (y args))` and +`T_e,f = lambda args. e args (f args)`. + +The 166 uses + +```text +NEXT = lambda b. p (lambda e. + (b c p) (lambda y. b + (lambda arg. e (lambda x z. x arg (z y))) + (c (lambda args. e args (y args))))) . +``` + +For `b=K` it reduces to `p (lambda e. c A_e)`; for `b=F` it +reduces to `p (lambda e. p (lambda f. c T_e,f))`. Thus both actual +second-tag cases are exactly the original ones. The extra use of the tag +costs more than the common argument saves. + +The 170 replaces NEXT by + +```text +lambda b. b (p (lambda e. c A_e)) + (p (lambda e. p (lambda f. c T_e,f))). +``` + +The two Boolean reductions give the same original clauses immediately. +Duplicating the first parser call makes it larger. + +The 182 moves `c` to the last reader operand. Its variable arm is +`lambda u c. s (K c) (s s u)` and its NEXT is +`lambda b r c. p (lambda e. b (c A_e) (p (lambda f. c T_e,f))) r`. +On zero input, `r1 NEXT c -> NEXT b2 r2 c` runs the usual clause. +On variable input, `VAR NEXT c -> c r N`. The explicit remainder and +continuation binders cost more than the saved captures. + +These Boolean and reader equations suffice to transfer the same recursive +source-term proof to each variant. The finite batteries are separate +verification evidence. + +## Refuted small constructions + +| Source | Bits | Exact battery line | Failure | +|---|---:|---|---| +| `handler157.lam` | 157 | `157 bits ok=0 skip=1 fail=667` | Replace `K cont` by NEXT itself. | +| `whole_prefix_naive159.lam` | 159 | `159 bits ok=25 skip=1 fail=642` | Whole-prefix values with the unchanged environment cell. | +| `diag161.lam` | 161 | `161 bits ok=0 skip=1 fail=667` | Replace `K cont` by `NEXT NEXT`. | + +No let optimization was run on these refuted candidates. + +### Finite refutations of 157 and 161 + +For either bad parser `P`, write + +```text +Q_k = lambda b. P (lambda e. b (k A_e) (P (lambda f. k T_e,f))) +D_k(t) = lambda e. t (k A_e) (P (lambda f. k T_e,f)). +``` + +Hence `Q_k t -> P D_k(t)`. Both bad readers still obey the zero law +`P k (cons K r) ->* r Q_k` and the off-domain law `P k F ->* Q_k`. + +For the 161 on `U_1(N)`, the changed variable arm yields + +```text +(Q_k Q_k) F U_0(N) N + ->* Q_(D_k(Q_k)) U_0(N) N + -> P (D_(D_k(Q_k))(U_0(N))) N + ->* N I (...) (...). +``` + +For the 157 it yields + +```text +Q_k F U_0(N) N + -> P D_k(F) U_0(N) N + ->* N Q_(D_k(F)) N. +``` + +For the closed source `I = lambda x. x`, encoded `0010`, the two leading +zero tags reach exactly these variable cases with +`k = lambda e. C A_e`. Therefore both complete probes have rigid head `N`, +whereas the required result has rigid head `C`. Reductions inside operands +cannot change either rigid head, so these terms cannot be beta-equivalent. +This argument does not require the bad operands to normalize. + +The finite head traces in `reader_facts.py` independently obtain head `N` +after 48 contractions for the 161 and 30 for the 157. The battery reports +fuel failures because it also tries to normalize their operands; those +timeouts are not the basis of the refutations. + +### Refutation of the naive whole-prefix change + +For the same closed source `I`, the 159 returns + +```text +C (lambda env arg. env K N) N +``` + +instead of `C (lambda env arg. arg) N`. Indeed, the whole unary value +`U_1(N)` applied to the ordinary cell steps once into the old environment, +so `U_1(N) (cell arg env) -> U_0(N) env -> env K N`. +These are distinct normal forms with rigid `C,N`. + +## Two protocol obstructions + +First, unchanged NEXT cannot supply a bare result continuation. Every free +occurrence of rigid `c` in `Q_c` is already applied, as `c A_e` or +`c T_e,f`. The parser `p` is closed and contributes no independent `c`. +Under beta reduction, a marked `c V` can be copied, erased, reduced inside, +or given more arguments; its first application cannot be removed. Thus any +term built only from `Q_c` and terms with no free `c` cannot reduce to `c` +or `K c`, whose surviving occurrence of `c` is unapplied. Confluence extends +this obstruction to beta equivalence with these normal targets. + +This rules out obtaining the literal `K c` needed by the current variable +arm from unchanged NEXT alone. It does not rule out obtaining an already +applied `c r N`, or changing NEXT to expose `c` in an additional mode. + +Second, reusing a stream-independent NEXT directly as the variable handler +has incompatible obligations under the usual rigid open-term parser laws. +The proposed reader + +```text +s I (lambda u. s u (s s u)) Q +``` + +would require `(Q F r) R = c r R` whenever `r` is a unary variable tail +ending in suffix `R`. Take `R = U_1(N)` and +`r = 1010 ++ N = U_1(R)`. This is a valid such tail, but it is also the +two-child stream for an APP node whose children are both variable 1. +The APP obligation requires `Q F r = c T N`, where +`T = lambda env. v1 env (v2 env)`. Consequently the variable case would +produce `c T N R`, with three arguments at rigid head `c`, whereas it must +produce `c r R`, with two. These cannot agree. This uses the full +variable equation; it does not cancel its correlated suffix argument. +This is a scoped open-parser obstruction, not a theorem about all machines +satisfying only the closed contract. It also does not cover a NEXT that +depends on the whole outer stream. The actual 157 is refuted separately on +the closed identity above. + +The direct attempt to float unchanged NEXT above `lambda list` also has an +exact cost balance: it saves four index bits in NEXT, but adds four bits +for the let, three for its use, and one for the deeper continuation capture +in VAR. The result is four bits larger, 166. This accounts only for that +literal refactoring, not arbitrary protocols or lets. + +## Assessment + +The constant-stream diagonal is a useful new equation, but its complete +construction gives no size gain. The best new protocol here, whole-prefix +variables, exposes a real three-bit reader saving and an exact ten-bit cell +cost; this cell is a construction, not a proved minimum for the shifted +protocol. + +A smaller interpreter could still come from a cheaper shifted cell, from a +NEXT with an additional continuation-extraction mode, or from a reader and +recursion scheme that avoid factoring the reader into a separately stored +function. The unchanged NEXT's continuation projection is blocked as +proved above. This lane establishes neither a sub-162 interpreter nor a +162-bit lower bound. + +Evidence: `*.check18.log`, `whole_prefix.check21.log`, `*.letopt*.log`, +`reader_facts.json`, and `protocol_checks.json`. Reproduction uses +`check.py`, `reader_facts.py`, and `protocol_checks.py`; candidate sources +are explicit named-lambda terms, with their generating formulas retained in +`build_candidates.py`. diff --git a/data/self-interpreter/reasoning_floor/golf162/build_candidates.py b/data/self-interpreter/reasoning_floor/golf162/build_candidates.py new file mode 100644 index 00000000..5a18b17b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/build_candidates.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 +"""Hand-derived alternatives; this is not a candidate enumeration.""" +from pathlib import Path + +LANE = Path(__file__).resolve().parent +ABS = r"(cont (\args \arg. exp (\zx \zy. zx arg (zy args))))" +APP = r"(intL (\exp2. cont (\args. exp args (exp2 args))))" +NEXT = rf"(\bit1. intL (\exp. bit1 {ABS} {APP}))" +VAR = r"(\u. list (\q. cont) (list list u))" + +def knot(body): + return rf"(\x. x x) (\x. (\intL. {body}) (x x))" + "\n" + +def reader(var=VAR, nxt=NEXT): + return rf"\cont. \list. list (\a. a) {var} {nxt}" + +# A new off-domain reset: E C F = C, at a two-bit source cost. +(LANE / "reset_cont164.lam").write_text(knot(reader(VAR.replace("list list u", "list list cont")))) + +# Reuse the second tag to select both the continuation/recursive parser and +# the meaning of its single argument. The ABS argument is the environment; +# the APP argument is the second parsed expression. +shared = r"""(\bit1. intL (\exp. (bit1 cont intL) + (\y. bit1 (\arg. exp (\zx \zy. zx arg (zy y))) + (cont (\args. exp args (y args))))))""" +(LANE / "shared_return.lam").write_text(knot(reader(nxt=shared))) + +# Select a complete parser before parsing the first child. +direct = rf"(\bit1. bit1 (intL (\exp. {ABS})) (intL (\exp. {APP})))" +(LANE / "direct_dispatch.lam").write_text(knot(reader(nxt=direct))) + +# The whole unary input, rather than its tail, denotes a variable. The cell +# skips its first (always F) selector and repairs the shifted index protocol. +whole_var = r"(\u. cont list (list list u))" +whole_abs = r"""(cont (\args \arg. exp + (\unused \r. r (\b. b (\discard. arg) (args b)))))""" +whole_next = rf"(\bit1. intL (\exp. bit1 {whole_abs} {APP}))" +(LANE / "whole_prefix.lam").write_text(knot(reader(whole_var, whole_next))) + +# The result continuation is supplied once as a final reader operand. +# Both arms acquire it as an explicit argument. +delayed = r"""\cont. \list. + list (\a. a) + (\u \c. list (\q. c) (list list u)) + (\bit1 \rest \c. intL (\exp. bit1 + (c (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. c (\args. exp args (exp2 args))))) rest) + cont""" +(LANE / "continuation_last.lam").write_text(knot(delayed)) + +# The new reader can diagonalize through a constant synthetic stream. +# R q c (K (K g)) = g q, so R g g (K (K g)) = g g. +reader_term = r"""(\next \cont \list. + list (\a. a) (\u. list (\q. cont) (list list u)) next)""" +diagonal = rf"""(\reader. + (\g. reader g g (\u \v. g)) + (\x. (\intL. \cont. reader {NEXT} cont) (x x))) +{reader_term} +""" +(LANE / "constant_stream_knot.lam").write_text(diagonal) + +# Two explicit negative controls isolate the protocol changes. +(LANE / "handler157.lam").write_text(knot(reader(r"(\u. list u (list list u))"))) +(LANE / "whole_prefix_naive159.lam").write_text(knot(reader(whole_var))) diff --git a/data/self-interpreter/reasoning_floor/golf162/check.py b/data/self-interpreter/reasoning_floor/golf162/check.py new file mode 100644 index 00000000..c73cbec7 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/check.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""Fixed candidate checks only; two workers and all temporary files in this lane.""" +import os +from pathlib import Path +import subprocess +import sys +import tempfile + +LANE = Path(__file__).resolve().parent +ROOT = LANE.parents[2] +os.environ["TMPDIR"] = str(LANE) +os.environ["PYTHONDONTWRITEBYTECODE"] = "1" +os.environ["RAYON_NUM_THREADS"] = "2" +tempfile.tempdir = str(LANE) +sys.dont_write_bytecode = True +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery + +max_bits = 18 +args = sys.argv[1:] +if "--max-bits" in args: + i = args.index("--max-bits") + max_bits = int(args[i + 1]) + del args[i:i + 2] +polish = "--polish" in args +args = [a for a in args if a != "--polish"] +for name in args: + path = Path(name) + E = battery.compile_lam(path.read_text()) + bits = battery.enc(E) + ok, skip, bad = battery.check(E, max_bits=max_bits, threads=2) + line = f"{len(bits)} bits ok={ok} skip={skip} fail={len(bad)} {path.name}" + print(line, flush=True) + lines = [line] + [f" {b} {why}" for b, why in bad[:5]] + print("\n".join(lines[1:]), flush=True) + if polish and not bad: + configurations = [["--max-cuts", "3"], ["--no-inline", "--max-cuts", "2"]] \ + if len(bits) <= 175 else [["--max-cuts", "2"]] + for i, flags in enumerate(configurations): + cmd = [battery.BLAM, "golf", "letopt", "--bits", bits, + "--report-le", "164", "--threads", "2", *flags] + try: + result = subprocess.run(cmd, capture_output=True, text=True, timeout=30) + log = result.stdout + result.stderr + if result.returncode: + print(log.strip(), flush=True) + if "inlining the lets does not finish" in log and "--no-inline" not in flags: + configurations.append(["--no-inline", "--max-cuts", "2"]) + except subprocess.TimeoutExpired: + log = "TIMEOUT at 30 seconds; no minimum claimed.\n" + (LANE / f"{path.stem}.letopt{i}.log").write_text(log) + summary = [s for s in log.splitlines() if "smallest rendering" in s or s.startswith("best ") or "TIMEOUT" in s] + print("\n".join(summary), flush=True) + lines.extend(summary) + (LANE / f"{path.stem}.check{max_bits}.log").write_text("\n".join(lines) + "\n") diff --git a/data/self-interpreter/reasoning_floor/golf162/constant_stream_knot.lam b/data/self-interpreter/reasoning_floor/golf162/constant_stream_knot.lam new file mode 100644 index 00000000..22e2c67e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/constant_stream_knot.lam @@ -0,0 +1,5 @@ +(\reader. + (\g. reader g g (\u \v. g)) + (\x. (\intL. \cont. reader (\bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args)))))) cont) (x x))) +(\next \cont \list. + list (\a. a) (\u. list (\q. cont) (list list u)) next) diff --git a/data/self-interpreter/reasoning_floor/golf162/continuation_last.lam b/data/self-interpreter/reasoning_floor/golf162/continuation_last.lam new file mode 100644 index 00000000..d66d0ad8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/continuation_last.lam @@ -0,0 +1,7 @@ +(\x. x x) (\x. (\intL. \cont. \list. + list (\a. a) + (\u \c. list (\q. c) (list list u)) + (\bit1 \rest \c. intL (\exp. bit1 + (c (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. c (\args. exp args (exp2 args))))) rest) + cont) (x x)) diff --git a/data/self-interpreter/reasoning_floor/golf162/diag161.lam b/data/self-interpreter/reasoning_floor/golf162/diag161.lam new file mode 100644 index 00000000..b6c327d6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/diag161.lam @@ -0,0 +1,7 @@ +-- Failed-protocol hypothesis: replace K cont with NEXT NEXT in VAR. +(\x. x x) (\x. (\intL. \cont. \list. + list (\a. a) (\u. list (u u) (list list u)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/data/self-interpreter/reasoning_floor/golf162/direct_dispatch.lam b/data/self-interpreter/reasoning_floor/golf162/direct_dispatch.lam new file mode 100644 index 00000000..86157f8a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/direct_dispatch.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. \list. list (\a. a) (\u. list (\q. cont) (list list u)) (\bit1. bit1 (intL (\exp. (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))))) (intL (\exp. (intL (\exp2. cont (\args. exp args (exp2 args)))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/golf162/handler157.lam b/data/self-interpreter/reasoning_floor/golf162/handler157.lam new file mode 100644 index 00000000..4eb55565 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/handler157.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. \list. list (\a. a) (\u. list u (list list u)) (\bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/golf162/protocol_checks.json b/data/self-interpreter/reasoning_floor/golf162/protocol_checks.json new file mode 100644 index 00000000..25ef1bcf --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/protocol_checks.json @@ -0,0 +1,123 @@ +{ + "cell": [ + { + "name": "shifted_cell_one", + "equal": true + }, + { + "name": "shifted_cell_two", + "equal": true + }, + { + "name": "shifted_cell_three", + "equal": true + } + ], + "suffix": [ + { + "machine": "int162.lam", + "program": "Omega", + "suffix_exact": true + }, + { + "machine": "int162.lam", + "program": "lambda_Omega", + "suffix_exact": true + }, + { + "machine": "int162.lam", + "program": "Omega_Omega", + "suffix_exact": true + }, + { + "machine": "reset_cont164.lam", + "program": "Omega", + "suffix_exact": true + }, + { + "machine": "reset_cont164.lam", + "program": "lambda_Omega", + "suffix_exact": true + }, + { + "machine": "reset_cont164.lam", + "program": "Omega_Omega", + "suffix_exact": true + }, + { + "machine": "shared_return.lam", + "program": "Omega", + "suffix_exact": true + }, + { + "machine": "shared_return.lam", + "program": "lambda_Omega", + "suffix_exact": true + }, + { + "machine": "shared_return.lam", + "program": "Omega_Omega", + "suffix_exact": true + }, + { + "machine": "direct_dispatch.lam", + "program": "Omega", + "suffix_exact": true + }, + { + "machine": "direct_dispatch.lam", + "program": "lambda_Omega", + "suffix_exact": true + }, + { + "machine": "direct_dispatch.lam", + "program": "Omega_Omega", + "suffix_exact": true + }, + { + "machine": "whole_prefix.lam", + "program": "Omega", + "suffix_exact": true + }, + { + "machine": "whole_prefix.lam", + "program": "lambda_Omega", + "suffix_exact": true + }, + { + "machine": "whole_prefix.lam", + "program": "Omega_Omega", + "suffix_exact": true + }, + { + "machine": "continuation_last.lam", + "program": "Omega", + "suffix_exact": true + }, + { + "machine": "continuation_last.lam", + "program": "lambda_Omega", + "suffix_exact": true + }, + { + "machine": "continuation_last.lam", + "program": "Omega_Omega", + "suffix_exact": true + }, + { + "machine": "constant_stream_knot.lam", + "program": "Omega", + "suffix_exact": true + }, + { + "machine": "constant_stream_knot.lam", + "program": "lambda_Omega", + "suffix_exact": true + }, + { + "machine": "constant_stream_knot.lam", + "program": "Omega_Omega", + "suffix_exact": true + } + ] +} diff --git a/data/self-interpreter/reasoning_floor/golf162/protocol_checks.py b/data/self-interpreter/reasoning_floor/golf162/protocol_checks.py new file mode 100644 index 00000000..8baf935f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/protocol_checks.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +"""Fixed shifted-cell equations and divergent-source suffix checks.""" +import json +import os +from pathlib import Path +import sys +import tempfile + +LANE = Path(__file__).resolve().parent +ROOT = LANE.parents[2] +os.environ["TMPDIR"] = str(LANE) +os.environ["PYTHONDONTWRITEBYTECODE"] = "1" +os.environ["RAYON_NUM_THREADS"] = "2" +sys.dont_write_bytecode = True +tempfile.tempdir = str(LANE) +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery + +K = r"(\x \y. x)" +F = r"(\x \y. y)" +D = r"(\u \r. r (\b. b (\discard. a) (e b)))" + +def cell(bit, rest): + return rf"(\f. f {bit} {rest})" + +u0 = cell(K, "n") +u1 = cell(F, u0) +u2 = cell(F, u1) +u3 = cell(F, u2) +checks = [ + ("shifted_cell_one", rf"{u1} {D}", "a"), + ("shifted_cell_two", rf"{u2} {D}", rf"{u1} e"), + ("shifted_cell_three", rf"{u3} {D}", rf"{u2} e"), +] +results = {"cell": [], "suffix": []} +for name, lhs, rhs in checks: + ln = battery.normalize(battery.enc(battery.compile_lam(r"\a \e \n. " + lhs)), 4096) + rn = battery.normalize(battery.enc(battery.compile_lam(r"\a \e \n. " + rhs)), 4096) + assert ln is not None and ln == rn, name + results["cell"].append({"name": name, "equal": True}) + print(f"{name}: rigid normal forms agree") + +omega = battery.compile_lam(r"(\x. x x) (\x. x x)") +programs = { + "Omega": omega, + "lambda_Omega": ("L", battery.shift(omega, 1)), + "Omega_Omega": ("A", omega, omega), +} +continuation = battery.compile_lam(r"\value \tail. tail") +machines = [ + ROOT / "tmp/overnight/self/int162.lam", + *[LANE / (s + ".lam") for s in ( + "reset_cont164", "shared_return", "direct_dispatch", "whole_prefix", + "continuation_last", "constant_stream_knot")], +] +for path in machines: + E = battery.compile_lam(path.read_text()) + for label, M in programs.items(): + stream = battery.bitlist(battery.enc(M), ("V", 0)) + probe = ("L", ("A", ("A", battery.shift(E, 1), battery.shift(continuation, 1)), stream)) + result = battery.normalize(battery.enc(probe), 1 << 16) + assert result == "0010", (path.name, label, result) + results["suffix"].append({"machine": path.name, "program": label, "suffix_exact": True}) + print(f"{path.name}: suffix exact on Omega, lambda_Omega, Omega_Omega") + +(LANE / "protocol_checks.json").write_text(json.dumps(results, indent=2) + "\n") diff --git a/data/self-interpreter/reasoning_floor/golf162/reader_facts.json b/data/self-interpreter/reasoning_floor/golf162/reader_facts.json new file mode 100644 index 00000000..b7033d0b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/reader_facts.json @@ -0,0 +1,70 @@ +{ + "identities": [ + { + "name": "zero_reader", + "equal": true + }, + { + "name": "unary_one", + "equal": true + }, + { + "name": "unary_two", + "equal": true + }, + { + "name": "reader_K", + "equal": true + }, + { + "name": "reader_F", + "equal": true + }, + { + "name": "reader_I", + "equal": true + }, + { + "name": "reader_constant", + "equal": true + }, + { + "name": "reader_double_constant", + "equal": true + }, + { + "name": "reader_Z", + "equal": true + }, + { + "name": "reader_singleton", + "equal": true + }, + { + "name": "reader_diagonal", + "equal": true + }, + { + "name": "reset_F", + "equal": true + } + ], + "head_obstructions": [ + { + "name": "diag161", + "program": "0010", + "head": "N", + "wanted_head": "C", + "arguments": 3, + "beta_steps": 48 + }, + { + "name": "handler157", + "program": "0010", + "head": "N", + "wanted_head": "C", + "arguments": 2, + "beta_steps": 30 + } + ] +} diff --git a/data/self-interpreter/reasoning_floor/golf162/reader_facts.py b/data/self-interpreter/reasoning_floor/golf162/reader_facts.py new file mode 100644 index 00000000..aee6cf65 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/reader_facts.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +"""Fixed symbolic identities and finite head traces; no candidate search.""" +import json +import os +from pathlib import Path +import sys +import tempfile + +LANE = Path(__file__).resolve().parent +ROOT = LANE.parents[2] +os.environ["TMPDIR"] = str(LANE) +os.environ["PYTHONDONTWRITEBYTECODE"] = "1" +os.environ["RAYON_NUM_THREADS"] = "2" +sys.dont_write_bytecode = True +tempfile.tempdir = str(LANE) +sys.path.insert(0, str(ROOT / "tools/self-interpreter")) +import battery +import lc + +R = r"(\s. s (\x. x) (\u. s (\dummy. c) (s s u)) q)" +K = r"(\x \y. x)" +F = r"(\x \y. y)" +I = r"(\x. x)" + +def cell(bit, rest): + return rf"(\f. f {bit} {rest})" + +u0 = cell(K, "n") +u1 = cell(F, u0) +u2 = cell(F, u1) +cases = [ + ("zero_reader", rf"{R} {cell(K, 'r')}", "r q"), + ("unary_one", rf"{R} {u1}", rf"c {u0} n"), + ("unary_two", rf"{R} {u2}", rf"c {u1} n"), + ("reader_K", rf"{R} {K}", "q"), + ("reader_F", rf"{R} {F}", "q"), + ("reader_I", rf"{R} {I}", "c"), + ("reader_constant", rf"{R} (\unused. a)", r"a (\u. a (a u)) q"), + ("reader_double_constant", rf"{R} (\u \v. t)", "t q"), + ("reader_Z", rf"{R} (\u \v. v t)", "t t t q"), + ("reader_singleton", rf"{R} (\f. f t)", r"t (\u. c (t t u)) q"), + ("reader_diagonal", rf"(\q. {R} (\u \v. q)) t", "t t"), + ("reset_F", rf"{R.replace('s s u', 's s c')} {F}", "c"), +] +output = {"identities": [], "head_obstructions": []} +for name, lhs, rhs in cases: + left = battery.compile_lam(r"\q \c \t \a \r \n. " + lhs) + right = battery.compile_lam(r"\q \c \t \a \r \n. " + rhs) + lnf = battery.normalize(battery.enc(left), 4096) + rnf = battery.normalize(battery.enc(right), 4096) + assert lnf is not None and lnf == rnf, (name, lnf, rnf) + output["identities"].append({"name": name, "equal": True}) + print(f"{name}: exact rigid normal forms agree") + +def head_trace(t, cap=256): + """Only left-spine beta contractions on two fixed 0010 probes.""" + args = [] + steps = 0 + while True: + if t[0] == "A": + args.append(t[2]) + t = t[1] + elif t[0] == "L" and args: + assert steps < cap + t = lc.beta(t, args.pop()) + steps += 1 + else: + return t, list(reversed(args)), steps + +for name in ("diag161", "handler157"): + E = battery.compile_lam((LANE / f"{name}.lam").read_text()) + stream = battery.bitlist("0010", ("V", 0)) + probe = ("A", ("A", battery.shift(E, 2), ("V", 1)), stream) + head, arguments, steps = head_trace(probe) + assert head == ("V", 0), (name, head) + row = {"name": name, "program": "0010", "head": "N", "wanted_head": "C", "arguments": len(arguments), "beta_steps": steps} + output["head_obstructions"].append(row) + print(f"{name} on 0010: {steps} head contractions -> rigid N with {len(arguments)} arguments; required head is C") + +(LANE / "reader_facts.json").write_text(json.dumps(output, indent=2) + "\n") diff --git a/data/self-interpreter/reasoning_floor/golf162/reset_cont164.lam b/data/self-interpreter/reasoning_floor/golf162/reset_cont164.lam new file mode 100644 index 00000000..234321c1 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/reset_cont164.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. \list. list (\a. a) (\u. list (\q. cont) (list list cont)) (\bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/golf162/shared_return.lam b/data/self-interpreter/reasoning_floor/golf162/shared_return.lam new file mode 100644 index 00000000..613dc44c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/shared_return.lam @@ -0,0 +1,3 @@ +(\x. x x) (\x. (\intL. \cont. \list. list (\a. a) (\u. list (\q. cont) (list list u)) (\bit1. intL (\exp. (bit1 cont intL) + (\y. bit1 (\arg. exp (\zx \zy. zx arg (zy y))) + (cont (\args. exp args (y args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/golf162/whole_prefix.lam b/data/self-interpreter/reasoning_floor/golf162/whole_prefix.lam new file mode 100644 index 00000000..ffbee31e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/whole_prefix.lam @@ -0,0 +1,2 @@ +(\x. x x) (\x. (\intL. \cont. \list. list (\a. a) (\u. cont list (list list u)) (\bit1. intL (\exp. bit1 (cont (\args \arg. exp + (\unused \r. r (\b. b (\discard. arg) (args b))))) (intL (\exp2. cont (\args. exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/golf162/whole_prefix_naive159.lam b/data/self-interpreter/reasoning_floor/golf162/whole_prefix_naive159.lam new file mode 100644 index 00000000..c98bef25 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/golf162/whole_prefix_naive159.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. \list. list (\a. a) (\u. cont list (list list u)) (\bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args))))))) (x x)) diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index 6127dbfb..ad5be3f0 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -211,7 +211,17 @@ Around the 162: The 162's reader with NEXT let-bound measures 166, and NEXT as the last operand of a λ-handler `\b \r. b r (\t. cont r (r r t))` measures 168 -(`merges.py`). +(`merges.py`). Two reasoning lanes on the 162 found nothing smaller; their +correct variants are select-first 163, `cont` as the skip's erased operand +164, a shared-return NEXT 166, a whole-prefix variable value with an adjusted +cell 169 (also 3,341/2/0 through 21 bits), the reader `λb. b I W` 169, a +dispatch before the first parse 170, and a reader-diagonal knot 196 that is +β-equivalent to the 162. Within the `s I` family the operands are forced: +with more than two, the surplus reaches the rigid `C` through a variable's +return; the second must be NEXT; and the variable arm costs at least 28 +bits by a case analysis whose base is checked on 412 terms through 14 bits, +though not exhaustively through 27 +(`data/self-interpreter/reasoning_floor/golf162*/`). Around the 165: From da5b3254a5c5ce432930d73e2ba9f24f3245bede Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 07:45:08 -0400 Subject: [PATCH 34/41] Record a second sub-165 architecture: a 164 with a dual skip operand The 165's handler with zero arm F and the operand list I (list list) NEXT, which is r NEXT on a 0-tag and N on a variable, renders at 164 by letopt (3341/2/0 through 21 bits). It came from splicing every review-witness reader of the night into the 165 and polishing; the others measure 167-198. --- data/self-interpreter/reasoning_floor/origin162/B46.lam | 1 + .../reasoning_floor/origin162/B51_alpha2.lam | 1 + data/self-interpreter/reasoning_floor/origin162/B57.lam | 1 + .../reasoning_floor/origin162/Bdual59.lam | 1 + .../reasoning_floor/origin162/Brebox53.lam | 1 + .../reasoning_floor/origin162/Bsecond52.lam | 1 + .../reasoning_floor/origin162/Bwalk76.lam | 1 + .../reasoning_floor/origin162/c169_handlerI.lam | 1 + .../reasoning_floor/origin162/int164_dual.blc | 1 + .../self-interpreter/reasoning_floor/origin162/r46_k1.lam | 1 + .../reasoning_floor/origin162/r49_beta.lam | 1 + .../reasoning_floor/origin162/r50_tnext.lam | 1 + .../reasoning_floor/origin162/r58_tau.lam | 1 + docs/classical/self-interpreter/interpreter.md | 8 +++++++- 14 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 data/self-interpreter/reasoning_floor/origin162/B46.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/B51_alpha2.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/B57.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/Bdual59.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/Brebox53.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/Bsecond52.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/Bwalk76.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/c169_handlerI.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/int164_dual.blc create mode 100644 data/self-interpreter/reasoning_floor/origin162/r46_k1.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/r49_beta.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/r50_tnext.lam create mode 100644 data/self-interpreter/reasoning_floor/origin162/r58_tau.lam diff --git a/data/self-interpreter/reasoning_floor/origin162/B46.lam b/data/self-interpreter/reasoning_floor/origin162/B46.lam new file mode 100644 index 00000000..b1bd2420 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/B46.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\b. b (\u \t. t) cont) (list (\a. a) (list list) next)) (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/B51_alpha2.lam b/data/self-interpreter/reasoning_floor/origin162/B51_alpha2.lam new file mode 100644 index 00000000..75616cdd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/B51_alpha2.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\b \r. b (r next) (list (\q. cont) (r r r)))) (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/B57.lam b/data/self-interpreter/reasoning_floor/origin162/B57.lam new file mode 100644 index 00000000..6005174c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/B57.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\b. b (\u \r. r next)) (\q \t. list (\w. cont)) (list list list)) (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/Bdual59.lam b/data/self-interpreter/reasoning_floor/origin162/Bdual59.lam new file mode 100644 index 00000000..71cc8138 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/Bdual59.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\b. b (\u \t. t) cont) (list (\b \r. b (r next) (r r r)))) (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/Brebox53.lam b/data/self-interpreter/reasoning_floor/origin162/Brebox53.lam new file mode 100644 index 00000000..400f7b15 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/Brebox53.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\b \r. b (r next) (cont (\h. r h) (r r r)))) (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/Bsecond52.lam b/data/self-interpreter/reasoning_floor/origin162/Bsecond52.lam new file mode 100644 index 00000000..cf6d6965 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/Bsecond52.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\b. b (\r. r next) (\r. list (\q. cont) (r r r)))) (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/Bwalk76.lam b/data/self-interpreter/reasoning_floor/origin162/Bwalk76.lam new file mode 100644 index 00000000..0a71ac53 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/Bwalk76.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\b. b (\u \r. r next) cont) ((\w. list w w) (\b \r \w. b r (r w w)))) (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/c169_handlerI.lam b/data/self-interpreter/reasoning_floor/origin162/c169_handlerI.lam new file mode 100644 index 00000000..5d5162d6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/c169_handlerI.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\b. b (\a. a) (\r \u. cont r (r r u))) next) (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/int164_dual.blc b/data/self-interpreter/reasoning_floor/origin162/int164_dual.blc new file mode 100644 index 00000000..054fb712 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/int164_dual.blc @@ -0,0 +1 @@ +01000110100001000000010110000101100000101110010101100010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/origin162/r46_k1.lam b/data/self-interpreter/reasoning_floor/origin162/r46_k1.lam new file mode 100644 index 00000000..f6206888 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/r46_k1.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\b \r. b (r next) (cont r (r r r)))) (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/r49_beta.lam b/data/self-interpreter/reasoning_floor/origin162/r49_beta.lam new file mode 100644 index 00000000..2f9b98ca --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/r49_beta.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\a. a) (\t. cont (list (\a \b. b)) (list list t)) next) (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/r50_tnext.lam b/data/self-interpreter/reasoning_floor/origin162/r50_tnext.lam new file mode 100644 index 00000000..babdac1e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/r50_tnext.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\b \r. b r (\t. cont r (r r t))) next) (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/origin162/r58_tau.lam b/data/self-interpreter/reasoning_floor/origin162/r58_tau.lam new file mode 100644 index 00000000..d9fb8edd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/r58_tau.lam @@ -0,0 +1 @@ +(\x. x x) (\x. (\intL. \cont. (\next. \list. list (\b \r. r (b next (\c \t. cont r (r r t))))) (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) (intL (\exp2.cont (\args.exp args (exp2 args))))))) (x x)) diff --git a/docs/classical/self-interpreter/interpreter.md b/docs/classical/self-interpreter/interpreter.md index ad5be3f0..0de81b41 100644 --- a/docs/classical/self-interpreter/interpreter.md +++ b/docs/classical/self-interpreter/interpreter.md @@ -211,7 +211,13 @@ Around the 162: The 162's reader with NEXT let-bound measures 166, and NEXT as the last operand of a λ-handler `\b \r. b r (\t. cont r (r r t))` measures 168 -(`merges.py`). Two reasoning lanes on the 162 found nothing smaller; their +(`merges.py`). The same splice-and-letopt route gives a second architecture +below the 165: the 165's handler with the zero arm `F`, +`list (\b. b F cont) (list I (list list) NEXT)`, where the dual operand is +`r NEXT` on a 0-tag and `N` on a variable, measures 164 (3,341/2/0 through 21 +bits); the other review-witness readers spliced into the 165 measure 167–198 +(`data/self-interpreter/reasoning_floor/origin162/`). Two reasoning lanes on +the 162 found nothing smaller; their correct variants are select-first 163, `cont` as the skip's erased operand 164, a shared-return NEXT 166, a whole-prefix variable value with an adjusted cell 169 (also 3,341/2/0 through 21 bits), the reader `λb. b I W` 169, a From ae0f4754848fb25fc10b69204858961c672f33fd Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 07:55:56 -0400 Subject: [PATCH 35/41] Archive the Claude NEXT-proof lane (unreviewed conditional 92) --- .../reasoning_floor/README.md | 6 + .../reasoning_floor/next-proof/PROMPT.md | 42 + .../reasoning_floor/next-proof/REPORT.md | 1083 +++++++++++++++++ .../next-proof/tools/cellF_check.py | 22 + .../next-proof/tools/helpers.py | 48 + .../next-proof/tools/identities.py | 53 + .../next-proof/tools/identities2.py | 46 + .../next-proof/tools/identities3.py | 29 + .../reasoning_floor/next-proof/tools/nt.py | 213 ++++ .../next-proof/tools/shapes_check.py | 28 + .../next-proof/tools/variants.py | 44 + .../next-proof/tools/variants2.py | 16 + 12 files changed, 1630 insertions(+) create mode 100644 data/self-interpreter/reasoning_floor/next-proof/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/next-proof/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/next-proof/tools/cellF_check.py create mode 100644 data/self-interpreter/reasoning_floor/next-proof/tools/helpers.py create mode 100644 data/self-interpreter/reasoning_floor/next-proof/tools/identities.py create mode 100644 data/self-interpreter/reasoning_floor/next-proof/tools/identities2.py create mode 100644 data/self-interpreter/reasoning_floor/next-proof/tools/identities3.py create mode 100644 data/self-interpreter/reasoning_floor/next-proof/tools/nt.py create mode 100644 data/self-interpreter/reasoning_floor/next-proof/tools/shapes_check.py create mode 100644 data/self-interpreter/reasoning_floor/next-proof/tools/variants.py create mode 100644 data/self-interpreter/reasoning_floor/next-proof/tools/variants2.py diff --git a/data/self-interpreter/reasoning_floor/README.md b/data/self-interpreter/reasoning_floor/README.md index ae3ac4eb..0fabf191 100644 --- a/data/self-interpreter/reasoning_floor/README.md +++ b/data/self-interpreter/reasoning_floor/README.md @@ -48,3 +48,9 @@ which is where the 162's reader came from. Golf lanes on the 162 (`golf162`, Codex; `golf162-claude`): no sub-162; variants 163–196, refuted 157/161 attempts, the `s I` family's operand forcing and a conditional minimality map (now in `interpreter.md` §3). +`next-proof` (Claude, not independently reviewed): from the contract alone, +with the 165's knot and reader and the body parsed first, the λ-value is +forced to `λy λa. e W` and the lift to `λz. e Y₀ (e₂ Y₁)` (≥ 19), via an +extraction lemma that uses Ω to pin output shapes; NEXT ≥ 92 on the 165's +skeleton under normality and the uniform cell interface; dispatch-first +≥ 99; an exact residual list. diff --git a/data/self-interpreter/reasoning_floor/next-proof/PROMPT.md b/data/self-interpreter/reasoning_floor/next-proof/PROMPT.md new file mode 100644 index 00000000..40d310c1 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof/PROMPT.md @@ -0,0 +1,42 @@ +Lane "next-proof": is the 165's NEXT region optimal? Read +/Users/a9lim/Work/blam/tmp/overnight/BRIEF.md (contract, the 165), then +docs/classical/self-interpreter/interpreter.md §2, §4 (module grammar), §5, +and these reports: + tmp/overnight/reader-proof/REPORT.md — a handwritten proof, by residual + tracing, that with the 165's knot and NEXT fixed every reader body costs + ≥ 43 (two reviews found it essentially right; gaps repaired). Its METHOD + is the model for this lane: a structure theorem from the laws, a + head-path decomposition, a role inventory priced at cheapest + realizations, and a minimization over a few shapes. + tmp/overnight/env/REPORT.md §3, §5 — cell ≥ 24 / lift ≥ 19 under weak laws. + tmp/overnight/nextfuse/REPORT.md — a catalogue of NEXT variants and a + decomposition heuristic for 92 (NOT a theorem: an independent review in + tmp/overnight/verify/vdispatch_codex.md §5–§6 refuted its shared-argument + lemma with a pair-packing construction and explained what a real proof + must specify). + +THE QUESTION. Fix the 165's knot and reader: + + E_N = (\x. x x) (\x. (\intL. \cont. (\next. \list. + list (\bit0. bit0 (\u \r. r next) cont) (list list list)) N) (x x)) + +where N is any term over the frame [cont, intL, x] (de Bruijn depths as in the +165). The 165 is N = \bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. +zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args))))), 92 bits. +Prove: if E_N is a self-interpreter (the exact contract) then |N| ≥ 92 — or +find a cheaper N (that IS a sub-165: build it, run +`python3 tools/self-interpreter/polish.py FILE.lam` from the repo root, and +report immediately in your final message). + +Note what is fixed and what is not: the reader hands N the second tag bit and +the stream after it (`r next = next b2 r2`), the variable value is the raw +unary code r with cont receiving (r, N); NEXT is free to choose how λ-values, +environments and APP values work, but the raw-code variable values force the +environment to answer `r env` as lookup, and the root forces λz.M values. +First derive the laws N must satisfy from the contract (on actual streams, +with actual intL = E_N behaviour, which N may exploit — do not assume intL +rigid unless you prove it can be). Then price. A complete theorem is the goal; +a precisely delimited conditional theorem plus an exact list of residual +cases is the fallback. Rigour first; mark handwritten vs checked. Small fixed +checks only (seconds), no enumeration of N, ≤ 2 threads. Write files only in +your lane directory (given in the prompt that sent you); REPORT.md there. diff --git a/data/self-interpreter/reasoning_floor/next-proof/REPORT.md b/data/self-interpreter/reasoning_floor/next-proof/REPORT.md new file mode 100644 index 00000000..02e7ebbf --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof/REPORT.md @@ -0,0 +1,1083 @@ +# Lane next-proof: is the 165's NEXT region optimal? + +Lane directory `tmp/overnight/next-proof/`. Everything here is new to this +lane except where a document, a Lean module, or another lane's report is +cited; no tracked file was modified, nothing committed, no candidate `N` +enumerated. Mechanical checks (`tools/`, each a few seconds, ≤ 2 threads): +`nt.py` (toolkit: named terms over `[cont, intL, x]`, assembly of `E_N`, +depth-bounded unfolding of the actual `intL`), `identities*.py`, +`shapes_check.py`, `cellF_check.py` (fixed identities), `variants.py`, +`variants2.py` (complete interpreters through the exact battery). The +Codex review of the reader proof (`verify/vreader_codex.md`) was read first; +none of the five refuted principles (signature-distinct origins, +dispatch-cell-only output nodes, disjoint compound sources, always-shrinking +leaf lets, three-contractions-imply-a-walker) is used anywhere below. Every +shape statement is a head-normal-form statement, every price is the size of +a syntactic piece under an explicit normality hypothesis, and the one +charging principle (Lemma 5.2) is proved for its specific role. + +## Summary + +**No sub-165 found.** No cheaper `N` was constructed; the seven complete +interpreters built here (Part 4.4, 5.1) are the measured costs of branches +the proof prices, all `≥ 166`. + +**What is proved unconditionally** (Parts 1–3; handwritten, finite +identities checked): + +1. The contract on `E_N` is exactly two laws on `N̂[C] = N[C/cont, P_N/intL, + G_N/x]`: `(ABS) N̂[C] K (⌜M₁⌝ ++ T) =β C (λz.λM₁) T` and + `(APP) N̂[C] F (⌜M₁⌝⌜M₂⌝ ++ T) =β C (λz. M₁M₂) T`, closed under + substitution for `C` and `T`; hence `intL k (⌜M⌝ ++ t) =β k (λz.M) t` for + every closed `M` and *every* continuation `k`. Open non-variable + subterms are constrained only through these (Remark 1.6). +2. An extraction lemma (1.8) that turns closed-program laws into + rigid-variable laws exactly when the parsed program stands at the head + of the required output, using only that `Ω → Ω`; it replaces the + ω-rule, which is invalid, and is why divergent programs must be in the + contract (1.9). +3. A structure theorem (2.3): `N`'s hnf has `≤ 2` leading lambdas and + falls into named shapes — the 165's **S1** (`λb. intL A`), dispatch-first + **D1/D2**, continuation-headed **C2**, first-cell-reading **R2**, and the + constructed-stream / modified-interpreter shapes **I0–I2, X0–X2** — + with the impossible head/arity combinations excluded. +4. For **S1**: the continuation `A` is dispatch-headed with two arms (or + continuation-headed, or exotic) (3.5); the ABS arm reduces to + `cont (λy λa. e W)` with a cell `W` obeying the two Boolean lookup + laws *on the actual arguments* (3.6–3.7); the APP arm reduces to + `intL (λe₂. cont W₂)` with `W₂ →* λz. e Y₀ (e₂ Y₁)` (3.9–3.11). These + shapes are theorems of the contract, not protocol assumptions. The + lift's `19` follows for normal `W₂` with no protocol hypothesis (3.12). + The constants alone do not price the cell: a 30-bit `λy λa. e (K (K a))` + meets them and fails `λλ.2` (3.8, checked). + +**Theorem 4.1 (conditional).** If `N` is β-normal, has the 165's control +skeleton (`λb. intL (λe. b B₁ B₂)` with `B₁ = cont V₁`, `B₂ = intL (λe₂. cont +W₂)`, no `intL`/`x`-headed subterm except the two parses), and its cell meets +the uniform lookup interface of the env lane (`W K n =β a`, `W F r =β r y`, +rigid `n, r, e`), then `|N| ≥ 92`, with equality iff `N` is the 165's. The +`b`-first variant of the skeleton costs `≥ 93` (select-first, 166), the +dispatch-first shape `≥ 99` (Theorem 5.1; 172). + +**Residual cases** (Part 5, exact list in 5.10): continuation-headed and +first-cell-reading shapes (heuristically `≥ 123`, best known 202), the +constructed-stream shapes (behaviour pinned by checked identities, best +known `≥ 186`, no bound), shared operands and lets (the quantitative +question is stated: no `≥ 10`-bit term common to both arms' forced shapes +was found, none excluded), the cell under actual-instance laws (delimited; +I believe (H-cell) is a theorem), and `N` with its own recursion (global). + +## 1. Complete interpreters built + +All correct (`python3 tools/self-interpreter/battery.py`-equivalent exact +check, 2 threads), none below 165, none new in idea: + +| `|N|` | `|E|` | battery | what it measures | +|---:|---:|---|---| +| 92 | 165 | `ok=667 skip=1 fail=0` | control | +| 93 | 166 | `ok=667 skip=1 fail=0` | select-first (`A = b KA KB`): the `+1` of 4.2 | +| 93 | 166 | `ok=667 skip=1 fail=0` | curried 25-bit cell | +| 97 | 170 | `ok=667 skip=1 fail=0` | shared heads with a second dispatch (`k = 3` operand) | +| 99 | 172 | `ok=667 skip=1 fail=0` | dispatch first `λb. b (intL KA) (intL KB)` (5.1) | +| 101 | 174 | `ok=667 skip=1 fail=0` | η-expanded APP continuation | +| 108 | 181 | `ok=667 skip=1 fail=0` | rest bound in the continuation (`m = 2`) | +| 129 | 202 | `ok=667 skip=1 fail=0` | continuation-headed `A`, lazy second parse (A-c2) | + +## 2. New exact identities (all checked) + +* `P_N k K s X →* s Z_k k X` (nextfuse's identity 1 restated for a stream + `s`): the handler fed a stream reads one cell and calls `N̂[k]` on the + *next* cell with an extra argument; new consequence: on the body `1` the + result is `N̂[k] K T k`, `T`-headed with three arguments. +* `P_N k I r →* r N̂[k]` (self-call on the next cell); `P_N k (λh. h F Y) + →* k Y (Y (λh. h F Y))` (fake variable cell). +* The derived cell laws of Lemma 3.7 on the 165's cell: `W[cons K T/e] K T + = a` and `W[U₁(T)/e, W^{out}/y] F (cons K T) = a` with `W^{out} = + W[V₁[U₁(T)]/e]`; and `V₁[V₁[U₁(T)]/e] = K K` (the body `λ.2`). +* Rigid-variable laws of the 165's arms: `A_K^C (K v) T = C (K (K v)) T`, + `A_K^C (cons K T) T = C F T`, `W₁[Kv] (K w) T = C (λz. v w) T`. +* The APP arm on a raw-code operand: `A_F^C (K v) (10 ++ T) = C (λz. v (z K + T)) T` — the operand variable's value in environment `z` is `z K T` + (not a law; the operand of a closed application is closed). + +## 3. Lower bounds: Parts 1–5 (handwritten; finite identities checked; one +Lean theorem cited, `wire_beta_delta`; one imported handwritten bound, the +env lane's cell ≥ 24). + +## 4. Honest read: Part 6. + +--- +# Part 1. Setting, the exact laws of NEXT, and the extraction lemma + +## 1.1 Notation + +`K = λa b. a`, `F = λa b. b`, `I = λa. a`, `Ω = (λa. a a)(λa. a a)`, +`cons b r = λf. f b r`. For a bit string `w = b₁…b_j` and a term `t`, +`w ++ t := cons b₁ (… (cons b_j t))` with `0 ↦ K`, `1 ↦ F`. The raw unary +codes are `U₀(t) = cons K t = 0 ++ t` and `U_{n+1}(t) = cons F U_n(t)`, so +`U_n(t) = 1ⁿ0 ++ t`. `⌜M⌝` is the BLC code of `M` (de Bruijn, 1-indexed, +`var n = 1ⁿ0`, `λ = 00`, application `01`). For a closed `M`, `λz. M` +denotes the abstraction over a fresh variable; `λz. M =β K M`, and for a +closed `M₁`, `λz. λM₁ =β K (K M₁)`; for the variable body, +`λz. λ.1 = λz. I = F` (α-equal). + +Size: `|M| = 2L + 4A + 2 + X` (`L` lambdas, `A` applications, `X` the sum +of 0-based indices over all leaves); equivalently every lambda and every +application costs 2 and a leaf of index `i` costs `i + 2`. The NEXT frame +is `Γ = [cont, intL, x]`, innermost first, so at depth `d` (number of +enclosing lambdas inside `N`) a leaf `cont` costs `2 + d`, `intL` `3 + d`, +`x` `4 + d`. + +"Rigid" means a free variable that nothing in the term under discussion +binds or substitutes; equations between terms with rigid variables are +β-equalities of open terms. All equalities below are `=β`, never `=βη`. + +## 1.2 The fixed context + +For any term `N` with `FV(N) ⊆ Γ`: + + H[next, cont] := λbit0. bit0 (λu. λr. r next) cont + B_N := λintL. λcont. (λnext. λlist. list H[next, cont] (list list list)) N + G_N := λx. B_N (x x) + E_N := (λx. x x) G_N + P_N := G_N G_N -- the actual value of intL + +`|E_N| = 73 + |N|` (`165 = 73 + 92`; checked, `tools/nt.py`). Write + + N̂[k] := N[k/cont, P_N/intL, G_N/x] -- N with its frame instantiated + Z_k := λu. λr. r N̂[k] + H_k := λb. b Z_k k + R_k := λs. s H_k (s s s) + +**Lemma 1.1 (unfolding).** `E_N →β P_N →β B_N P_N →β* λcont. R_cont`, where +`R_cont` is `R_k` with the variable `cont` for `k`. Hence for all terms +`k, s`: `P_N k s →* s H_k (s s s)`, i.e. with `intL := P_N`, +`intL k s =β s H_k (s s s)`. + +*Proof.* `E_N → G_N G_N = P_N → B_N (G_N G_N) = B_N P_N → λcont. (λnext λlist. +list H (list list list)) N[P_N/intL, G_N/x] → λcont. λlist. list H' (list +list list)` with `H' = λbit0. bit0 (λu r. r N[P_N/intL, G_N/x]) cont`. +Applying to `k` substitutes `k` for `cont` throughout, which turns +`N[P_N/intL, G_N/x]` into `N̂[k]`. ∎ + +**Lemma 1.2 (reader facts).** For all terms `k, b, r, S, t` and `n ≥ 1`: + +* (R0) `(cons b r) H_k S → H_k b r S → b Z_k k r S`. +* (R1) `(cons K r)(cons K r) →* K r`, hence `s s s →* r` for `s = cons K r`, + and `P_N k (cons K r) →* Z_k r r →* r N̂[k]`. If `r = cons b₂ r₂` then + `P_N k (cons K (cons b₂ r₂)) →* N̂[k] b₂ r₂`. +* (R2) `U_n(t) U_n(t) →* K t` (induction: `U₀ U₀ → U₀ K t → K K t t → K t`; + `U_{n+1} U_{n+1} → U_{n+1} F U_n → F F U_n U_n → U_n U_n`). Hence + `P_N k U_n(t) →* F Z_k k U_{n−1}(t) (U_n U_n U_n) →* k U_{n−1}(t) t`. +* (R3) Off streams (Codex's identities, re-checked here with the actual `N` + of the 165 unfolded one level, `tools/identities.py`): + `P_N k K →* H_k`, `P_N k F →* F`, `P_N k I →* λr. r N̂[k]`, + `P_N k (K a) →* a (a (K a))`, `P_N k (K (K a)) →* a`. + +*Proof.* Direct β-steps from Lemma 1.1; (R2) by the displayed induction. ∎ + +## 1.3 The laws of NEXT + +A closed `M` is `λM₁` or `M₁ M₂`, never a variable, so `⌜M⌝ ++ T = cons K +(cons b₂ r₂)` with `(b₂, r₂) = (K, ⌜M₁⌝ ++ T)` or `(F, ⌜M₁⌝⌜M₂⌝ ++ T)`. +By (R1), `E_N C (⌜M⌝ ++ T) =β N̂[C] b₂ r₂`. Therefore: + +**Definition / Lemma 1.3 (the laws).** `E_N` is a self-interpreter +(`E_N C (⌜M⌝ ++ T) =β C (λz. M) T` for all closed `M`, `C` and `T` rigid) +if and only if + + (ABS) N̂[C] K (⌜M₁⌝ ++ T) =β C (λz. λM₁) T for every M₁ with FV(M₁) ⊆ {1}, + (APP) N̂[C] F (⌜M₁⌝⌜M₂⌝ ++ T) =β C (λz. M₁ M₂) T for all closed M₁, M₂, + +with `C, T` distinct variables not free in `N`. The variable body `M₁ = 1` +is allowed in (ABS); there `⌜M₁⌝ ++ T = U₁(T) = 10 ++ T` and the right-hand +side is `C F T`. Bodies without normal form (`M₁ = Ω`) are included. ∎ + +**Lemma 1.4 (substitution closure).** The laws hold with arbitrary terms +substituted for `C` and `T`: for every `k` and `t`, +`N̂[k] K (⌜M₁⌝ ++ t) =β k (λz. λM₁) t` and +`N̂[k] F (⌜M₁⌝⌜M₂⌝ ++ t) =β k (λz. M₁ M₂) t`. +*Proof.* β-equality is closed under substitution; `C, T` do not occur in +`N`, `P_N`, `G_N`; and `N̂[C][k/C] = N̂[k]` (even when `k` contains `C`). ∎ + +**Corollary 1.5 (intL is an interpreter with any continuation).** For every +closed `M` (an abstraction or an application), every `k` and every `t`: +`P_N k (⌜M⌝ ++ t) =β k (λz. M) t`. For a variable code, +`P_N k U_n(t) =β k U_{n−1}(t) t` (R2). *Proof.* (R1) then Lemma 1.4. ∎ + +**Remark 1.6 (what is not a law).** For an open `M₁` that is not a +variable, `P_N k (⌜M₁⌝ ++ t) =β N̂[k] b₂ r₂` is constrained by nothing but +the closed instances (ABS)/(APP) of the terms that contain `M₁`. This is +NEXT's protocol freedom: how the value of an open subterm is represented, +and how it reaches the root value `λz. M`, is `N`'s choice. Everything +below that is unconditional uses only (ABS), (APP) and their consequences +1.4–1.5; everything that assumes a protocol says so. + +**Remark 1.7 (the contract fixes every value only through the root).** The +value a variable delivers is fixed by the reader (R2): the raw code +`U_{n−1}(t)` with the stream's own tail inside it, and the continuation +receives `(U_{n−1}(t), t)`. The value a closed subterm delivers is fixed by +1.5: `λz. M`. Only open non-variable subterms are free. + +## 1.4 The extraction lemma (replacing rigid-law hypotheses by proofs) + +The laws quantify over closed programs; a pricing argument wants laws in +rigid variables. The passage is an ω-rule step in general and is *not* +valid in λβ (Plotkin). The following lemma gives it exactly where the +required output has the substituted program at its *head*, which is enough +for the shape theorems of Part 3. It uses only that `Ω → Ω` is `Ω`'s only +reduction and that head normal forms are invariant under β-equality. + +**Lemma 1.8 (constant-head extraction).** Let `Q` be a term, `v` a variable +free in `Q` or not, and let `C, T` be variables not free in `Q`. + +(a) If `Q[M/v] =β C (K (K M)) T` for every closed `M`, then + `Q =β C (K (K v)) T`. +(b) If `Q[M/v] =β C (K M) T` for every closed `M`, then `Q =β C (K v) T`. +(c) If `Q[M/v] =β M` for every closed `M`, then `Q =β v`. +(d) If `Q[M/v] =β λz. M W` for every closed `M`, where `W` is a fixed term + with `v ∉ FV(W)`, then `Q →* λz. v W'` for some `W'` with `W'[I/v] =β W` + and `W'[K/v] =β W`. (Not: `W'[M/v] =β W` for every closed `M`; see the + proof.) + +*Proof.* (c) `Q[Ω/v] =β Ω`; the only reduct of `Ω` is `Ω`, so `Q[Ω/v] →* Ω`. +If `Q` were solvable with head normal form `λx⃗. h W⃗` and `h ≠ v`, then +`Q[Ω/v]` would have the head normal form `λx⃗. h W⃗[Ω/v]`, which is not +`Ω`; if `h = v` then `Q[Ω/v] →* λx⃗. Ω W⃗[Ω/v]`, whose head redex is `Ω → Ω` +forever, so it reduces to `Ω` only if `x⃗ = ∅` and `W⃗ = ∅`, i.e. `Q →* v`. +If `Q` were unsolvable, `Q[I/v]` would be unsolvable, but it is `=β I`. + +(a) Put `D := C (K (K v)) T`. `Q[Ω/v] =β C (K (K Ω)) T` is solvable with +head `C` and two arguments, so `Q` is solvable (unsolvability is closed +under substitution), with head normal form `λx⃗. h W⃗`. `h ≠ v`, else +`Q[Ω/v]` is unsolvable; so `Q[Ω/v]`'s head normal form is `λx⃗. h W⃗[Ω/v]`, +forcing `x⃗ = ∅`, `h = C`, `|W⃗| = 2`: `Q →* C Q₁ Q₂`. Then +`Q₂[M/v] =β T` for all closed `M`, and `Q₂ =β T` by the argument of (c) +with `T` for `Ω` (a rigid head stays rigid; `Q₂`'s head is not `v`, since +`Q₂[Ω/v]` is solvable). And `Q₁[M/v] =β K (K M) = λy λa. M` for all closed +`M`. `Q₁[Ω/v] =β λy λa. Ω` is unsolvable, so `Q₁` is unsolvable or has head +`v`; unsolvable is excluded by `M = I`. So `Q₁ →* λx⃗. v W⃗`, and +`Q₁[Ω/v] = λx⃗. Ω W⃗[Ω/v]` must reduce to a reduct of `λy λa. Ω`, whose only +reduct is itself. The head `Ω` never becomes an abstraction, so no `Wᵢ` is +ever consumed: `W⃗ = ∅` and `x⃗ = (y, a)`. Hence `Q₁ →* λy λa. v = K (K v)`. + +(b) As (a) with one lambda. + +(d) As in (a), `Q` is solvable with head `v` (the right-hand side's head +normal form `λz. M W` has the substituted `M` at its head; with `M = Ω` it +is `λz. Ω W`, whose reducts are `λz. Ω W''` with `W →* W''`). So +`Q →* λx⃗. v W⃗`, and `λx⃗. Ω W⃗[Ω/v] →* λz. Ω W''` forces `x⃗ = (z)` and +`|W⃗| = 1`: `Q →* λz. v W'`. Substituting `M` for `v`, `λz. M W'[M/v] =β +λz. M W`; for `M := I` this gives `W'[I/v] =β W`; for `M := K`, `K W'[K/v] +=β K W`, and `λb. X =β λb. Y` implies `X =β Y`, so `W'[K/v] =β W`. In +general `W'[M/v] =β W` cannot be cancelled against an arbitrary closed +`M` (e.g. `M = K X` erases its argument); the lemma asserts it only in the +weak form stated. (Part 3 does not use (d): Theorem 3.11 runs the same +head-normal-form argument directly, twice, and needs only the shape +`λz. v W'`.) ∎ + +**Remark 1.9 (why Ω is in the contract).** The brief insists that `M` +without a normal form are included. Lemma 1.8 is where that matters: the +Ω instance pins the *shape* of every reduct, because the head `Ω` can +neither disappear nor absorb arguments. Without the divergent programs the +laws would be closed-normal-form equations and the shape theorems of Part +3 would need the ω-rule. + +--- +# Part 2. The structure theorem for N (unconditional) + +Throughout, `N` satisfies (ABS) and (APP). "Head normal form" (hnf) is the +principal one; the number of leading lambdas, the head variable when it is +free, and the number of arguments of a solvable term's hnf are invariant +under `=β` (Church–Rosser). Reductions of a rigid-headed term `h W⃗` stay +`h`-headed with `|W⃗|` arguments. + +**Lemma 2.1 (N is solvable with at most two leading lambdas).** +`N̂[C] K (⌜I⌝ ++ T) =β C F T` is solvable, so `N̂[C]` is, so `N` is (an +unsolvable term has only unsolvable instances). Let `N`'s hnf be +`λy₁ … y_m. h A₁ … A_k`. If `m ≥ 3`, `N̂[C] K r₂ →* λy₃ …. (…)` is an +abstraction, but no reduct of `C F T` is one. So `m ≤ 2`. ∎ + +**Lemma 2.2 (N depends on its tag argument).** Take +`r₂ = ⌜I I⌝ ++ T = 01 0010 0010 ++ T`. As an ABS stream it is the body +`M₁ = I I` (closed), with required output `C (λz. λ.(I I)) T =β C (K F) T`; +as an APP stream it is `M₁ = M₂ = I`, with required output +`C (λz. I I) T =β C F T`. `K F ≠β F` (distinct normal forms). Hence +`N̂[C] K r₂ ≠β N̂[C] F r₂`: `N` cannot erase its first argument. In +particular, if `N = λb. B` then `b ∈ FV(B)`. ∎ + +**Theorem 2.3 (the shapes of N).** With hnf `λy⃗. h A⃗` as in 2.1 and the +frame values `cont := C`, `intL := P_N`, `x := G_N`, exactly one of the +following holds (names in brackets are used below): + +*Two leading lambdas, `N = λb λr. h A⃗`.* +* `h = cont`: then `k = 2` and `A₂[K/b, ⌜M₁⌝++T / r] =β T`, + `A₁[…] =β λz. λM₁` (and the APP analogues): the continuation is applied + to a separately computed value and a separately computed remainder. + [**C2**, "continuation-headed NEXT"] +* `h = b`: `k ≥ 2` (for `k = 1`, `K A₁ →β λd. A₁` is an abstraction). + [**D2**, dispatch first, stream bound] +* `h = r`: `N̂ b (cons b₃ r₃) →* A₁' b₃ r₃ A₂' … A_k'`: `N` reads the first + cell of the body code itself. [**R2**] +* `h = intL`: `N̂ b r₂ →* P_N A₁' … A_k'`; `k ≤ 1` leaves an abstraction + (`P_N`, or `R_{A₁'}`), so `k ≥ 2` and the term is + `A₂' H_{A₁'} (A₂' A₂' A₂') A₃' … A_k'`: the reader is run on a stream + `A₂'` built by `N` from `b` and `r₂`. [**I2**] +* `h = x`: `G_N A₁' … A_k'`; `k ≤ 2` leaves an abstraction (`G_N A₁' → + λcont. …`, `G_N A₁' A₂' → λlist. …`), so `k ≥ 3` and the term is + `A₃' H'' (A₃' A₃' A₃') A₄' …` where `H''` is the handler of a *modified* + interpreter with `cont := A₂'`, `intL := A₁' A₁'`, `x := A₁'`. [**X2**] + +*One leading lambda, `N = λb. h A⃗`, applied to `r₂` after `b`.* +* `h = cont`: impossible. (`k = 1` is forced by the argument count, and + then `r₂ =β T`; but `r₂ = ⌜M₁⌝ ++ T` is a β-normal abstraction.) +* `h = b`: `k ≥ 2` (`k = 1`: `K A₁ r₂ →* A₁[K/b]`, which does not contain + `T`, while every reduct of `C V T` does). [**D1**, dispatch first] +* `h = intL`, `k = 1`: `N̂ b r₂ →* r₂ H_{A₁'} (r₂ r₂ r₂)`, the genuine parse + of the body/operator code with continuation `A₁' = A₁[b/b, C/cont, …]`. + [**S1**, the 165's shape] +* `h = intL`, `k ≥ 2`: `A₂' H_{A₁'} (A₂' A₂' A₂') A₃' … A_k' r₂`, a + constructed stream `A₂'` (depending on `b` only) with `r₂` trailing. + [**I1**] +* `h = x`: `k = 1` leaves an abstraction; `k = 2` gives + `r₂ H'' (r₂ r₂ r₂)`, a genuine parse by a *modified* interpreter + (`cont := A₂'`, `intL := A₁' A₁'`, `x := A₁'`); `k ≥ 3` a constructed + stream. [**X1**] + +*No leading lambda, `N = h A⃗`, applied to `b r₂`.* +* `h = cont`: impossible (`k = 0` forced; `C K r₂ ≠β C V T` since + `r₂ ≠β T`). +* `h = intL`: `k = 0`: `P_N F r₂ →* F r₂ →* I` (R3), impossible; `k = 1`: + `P_N A₁' F r₂ →* F r₂ →* I`, impossible; `k ≥ 2`: `N̂ b r₂ = Q b r₂` with + the fixed term `Q := P_N A₁' … A_k'` (no `b`, no `r₂`), which must itself + satisfy the laws of `N`. [**I0**] +* `h = x`: `k ≤ 1` leaves an abstraction after `b`; `k = 2` gives + `b H'' (b b b) r₂`, and with `b = F` this is `(F F F) r₂ →* F r₂ →* I`, + impossible; `k ≥ 3`: `N̂ b r₂ = Q b r₂` with a fixed `Q := G_N A⃗'`. + [**X0**] + +(Checked on concrete instances, `tools/shapes_check.py`: `intL A₁` and +`λb. intL A₁ b` both return `I` on an APP stream; `x cont cont` returns `I`; +`λb. b (cont F)` returns `C F` without `T`; `λb. intL A₁ K` on the ABS body +`1` hands `N̂[A₁']` the cells `K, T` and a third argument, giving a +`T`-headed result with three arguments.) + +*Proof.* Each line is the computation displayed, using Lemma 1.1 for +`intL`-headed and `x`-headed terms (`G_N A →β B_N (A A) →β λcont. …`), (R3) +for `P_N k F →* F` and `F F F →* I`, and the invariance of hnf shape under +`=β`. The impossibilities compare the hnf of the left side with that of +`C V T` (head `C`, two arguments, no leading lambda). For `D1` with `k = 1` +and the `cont`-headed cases we also use that a rigid argument `T` of the +required output cannot be erased by reduction, so it must already occur in +the left side's syntax after the substitutions. ∎ + +**Corollary 2.4 (forced leaves).** `N` contains a leaf `cont` (the output's +head `C` has no other source: the reader's own `cont` leaf is erased on the +zero arm at the root, `K Z_C C → Z_C`, and every later `C` descends from +`N`'s substitution `cont := C` or from a continuation `k` built by `N`), and +a leaf `intL` or `x` or else `N` parses the body with its own recursion +(2.5). `N` depends on `b` (2.2). ∎ + +**Lemma 2.5 (recursion is necessary; the knot alone does not supply it).** +Suppose `N` contains no leaf `intL` and no leaf `x`. Then `N` is a term +over `[cont]` alone, and `E'_N := λcont. N` is a closed term with +`E' C K (⌜M₁⌝ ++ T) =β C (λz. λM₁) T` and `E' C F (⌜M₁⌝⌜M₂⌝ ++ T) =β C (λz. +M₁M₂) T`: an interpreter for tagless code. The reader and knot of `E_N` are +then dead weight: `E_N`'s only use of them is the first tag. Every +quantitative bound on `|N|` in this case is a global interpreter bound +(STATUS: handwritten floor 37 for a full interpreter, no technique near +92). This is **residual case R-own-recursion**; it is not priced here. ∎ + +**What Theorem 2.3 says.** Every NEXT either (i) hands the body/operator +code to the fixed reader at once with a continuation depending on the tag +(**S1**, the 165), (ii) dispatches on the tag before parsing (**D1/D2**), +(iii) computes value and remainder separately under a bare continuation +(**C2**), (iv) reads the body's first cell by itself (**R2**), or (v) +runs the reader, or a modified interpreter built from `x`, on a stream it +constructs (**I0/I1/I2/X0/X1/X2**). Part 3 analyses (i) to the leaf; Part 5 +treats (ii)–(v). + +**Checks (`tools/identities2.py`, `identities3.py`).** `P_N k I r →* r +N̂[k]` and `P_N k K →* H_k` with the actual 165 `N` unfolded; the APP arm of +the 165 fed the var-1 code `cons K T` as an operator code is `T`-headed +(`N̂[k] F (cons K T)` has hnf `T X`), which is the mechanism behind the +impossibilities for second-tag dispatch through `H_k` (Part 5). + +--- +# Part 3. Shape S1: what the continuation and its two arms must be + +Assume **S1**: `N`'s hnf is `λb. intL A` with a single argument `A`, +`FV(A) ⊆ [b, cont, intL, x]`. Write `A_b^k := A[b/b, k/cont, P_N/intL, +G_N/x]`; then `N̂[k] = λb. P_N A_b^k` up to the hnf, and by (R1)/(R2)/1.5 the +laws read + + (ABS) P_N A_K^C (⌜M₁⌝ ++ T) =β C (λz. λM₁) T, + (APP) P_N A_F^C (⌜M₁⌝⌜M₂⌝ ++ T) =β C (λz. M₁ M₂) T. + +## 3.1 The laws of the continuation + +**Lemma 3.1 (the ABS continuation on closed bodies).** For every closed +`M₁` (an abstraction or application): `A_K^C (λz. M₁) T =β C (λz. λM₁) T`, +i.e. `A_K^C (K M₁) T =β C (K (K M₁)) T`. By Lemma 1.8(a): + + (U1) A_K^C (K v) T =β C (K (K v)) T (v, T, C rigid). + +*Proof.* `P_N A_K^C (⌜M₁⌝ ++ T) =β A_K^C (λz. M₁) T` by 1.5 (the inner +parse returns the closed value with any continuation), and the left side +is `C (λz. λM₁) T` by (ABS). Apply 1.8(a) to `Q := A_K^C (K v) T`. ∎ + +**Lemma 3.2 (the ABS continuation on the variable body).** With `M₁ = 1`, +`⌜M₁⌝ ++ T = U₁(T)` and (R2) gives + + (U2) A_K^C (cons K T) T =β C F T (T, C rigid). ∎ + +**Lemma 3.3 (the APP continuation).** For all closed `M₁, M₂`: +`A_F^C (K M₁) (⌜M₂⌝ ++ T) =β C (λz. M₁ M₂) T`. *Proof.* 1.5 on the operator +parse, then (APP). ∎ + +**Lemma 3.4 (laws on open bodies are protocol).** For `M₁ = λM₁'` with +`FV(M₁') ⊆ {1, 2}` the inner parse is `P_N A_K^C (00 ⌜M₁'⌝ ++ T) =β +N̂[A_K^C] K (⌜M₁'⌝ ++ T) = P_N A_K^{A_K^C} (⌜M₁'⌝ ++ T)`: the same +continuation `A` instantiated with `cont := A_K^C` — the outer arm — and +the laws it obeys are whatever makes the outer law come out. Example used +below (`M = K = λλ.2`, `M₁ = λ.2`, `M₁' = 2`): + + A_K^{A_K^C} (U₁(T)) T =β C (λz. K) T =β C (K K) T, (U2') + +since `P_N k U₂(T) =β k U₁(T) T` by (R2). ∎ + +## 3.2 The hnf of A: the dispatch is at the head or the shape is exotic + +**Theorem 3.5.** `A` is solvable, its hnf `λy⃗. h W₁ … W_k` has `|y⃗| ≤ 2`, +and exactly one of the following holds. + +* (A-i) **dispatch-headed**: `h = b`, `k ≥ 2`. Then `A_K^C =β λy⃗. W₁' W₃' … + W_k'` and `A_F^C =β λy⃗. W₂' W₃' … W_k'` (`W'` the instantiated `W`); the + arms are `W₁` (ABS) and `W₂` (APP), and `W₃ … W_k` are **shared + operands** delivered to both. The 165 has `|y⃗| = 1`, `k = 2`; select-first + (166) has `|y⃗| = 0`, `k = 2`. +* (A-ii) **continuation-headed**: `h = cont`, `|y⃗| = 2`, `k = 2`: + `A = λe λr. cont W₁ W₂` with `W₂[K/b, Kv/e, T/r] =β T`, + `W₂[F/b, Kv/e, ⌜M₂⌝++T / r] =β T` (a remainder extractor over `b`) and + `W₁` the value in both arms. (`|y⃗| = 1` fails: `A_F^C (Kv) (⌜M₂⌝ ++ T) =β + C W₁' (⌜M₂⌝ ++ T)` has the wrong remainder; `|y⃗| = 0` fails by argument + count.) [**A-c2**] +* (A-iii) **reader-headed**: `h = intL`. `|y⃗| = 1, k = 1` is impossible + (`A_K^C (Kv) T →* P_N W₁' T →* T H (T T T)`, head `T`); `|y⃗| = 2, k = 2, + W₂ = r` is impossible for the same reason in the ABS arm (`P_N W₁' T`); + otherwise `A_b^C (Kv) t →* W₂' H_{W₁'} (W₂' W₂' W₂') W₃' … t`, the + reader on a stream `W₂'` constructed from `e, b` (and `r`). [**A-I**] +* (A-iv) **generator-headed**: `h = x`; as in Theorem 2.3, a modified + interpreter (`k = 2`, `|y⃗| ≥ 1`, parsing `t`) or a constructed stream. + [**A-X**] +* `h = e` or `h = r` (bound by `y⃗`): impossible. (`h = e`: `A_K^C (Kv) T →* + K v W⃗' …`, whose hnf has head `v` or is `λd. v`; `h = r`: head `T`.) + +*Proof.* `A_K^C (K v) T =β C (K (K v)) T` is solvable, hence `A` is. More +than two leading lambdas leave an abstraction. The head cases are the +computations displayed; for `h = cont` the argument counts are forced by +the two arguments at `C`; for `h = intL` use Lemma 1.1; for `h = x` Lemma +1.1 and the unfolding `G_N W₁' →β B_N (W₁' W₁')`. ∎ + +## 3.3 The ABS arm: the λ-value is `λy λa. e W` with `W` a lookup cell + +Assume (A-i) with `k = 2` and `|y⃗| ∈ {0, 1}` (the shared-operand case +`k ≥ 3` is Part 5). Write the ABS arm as a term `B₁` with `e` free: when +`|y⃗| = 1` (`A = λe. b W₁ W₂`) put `B₁ := W₁`; when `|y⃗| = 0` (`A = b W₁ W₂`) +the arm `W₁` receives the value itself, `W₁ (K v) T` is `C`-headed, so `W₁`'s +hnf has exactly one leading lambda, `W₁ →* λe. B₁`, and `B₁` is that body. +In both cases + + B₁[Kv/e] T =β C (K (K v)) T, (U1) + B₁[cons K T / e] T =β C F T, (U2) + +with `cont := C` inside `B₁`, and the instance (U2') with `cont := A_K^C`. + +**Lemma 3.6 (the ABS arm applies the continuation to one value).** `B₁` is +solvable with hnf `cont V₁` (no leading lambda, one argument) or +`λr. cont V₁ W` with `W[T/r] =β T` (an η-expansion of the first), or `B₁` +is `intL`-/`x`-headed (constructed stream, [A-I]/[A-X]), or `b`-headed +(`b := K` selects a branch, whose hnf is then one of these). + +*Proof.* `B₁[Kv] T =β C (K (K v)) T` is solvable with head `C`, two +arguments, no leading lambda. `B₁`'s hnf `λy⃗. h W⃗`: `|y⃗| ≤ 1` (two +lambdas would leave one). `h = e`: `K v W⃗' (T) →* v …` or `λd. v`, +impossible. `h = cont`: `|y⃗| = 0` forces `k = 1` (`C W₁' T`), `|y⃗| = 1` +forces `k = 2` with `W₂[T/r] =β T`. `h = r`: head `T`. `h = b`: `K W₁' W₂' +… →* W₁' W₃' …`, continue with that term. `h = intL, x`: Lemma 1.1. ∎ + +**Lemma 3.7 (the λ-value).** In the case `B₁ →* cont V₁` (and likewise +`λr. cont V₁ r`), `V₁` is a term with `e` free and + + V₁[Kv/e] =β K (K v) = λy λa. v, + V₁[cons K T/e] =β F = λy λa. a. + +Then `V₁ →* λy λa. e W` for a term `W` with `FV(W) ⊆ {a, y, e, b, cont, +intL, x}`, unless `V₁`'s hnf head is `b` (`:= K`, a selected branch), +`intL` or `x` (exotic). The cell `W` satisfies + + W[cons K T / e] K T =β a (cell-K) + +as open terms in `a, y, T`, and, from (U2') — the body `λ.2` — the +instance in which the inner cell receives `F` and `cons K T` and the +outer cell is its environment: + + W[U₁(T)/e, W^{out}/y, a'/a] F (cons K T) =β a, (cell-F) + where W^{out} := W[V₁[U₁(T)/e]/e, y/y, a/a], + +as open terms in `a, y, T` (the outer `a` is the required result; the inner +`a'` is a fresh variable that the inner lambda bound). + +*Proof.* `C V₁[Kv] T =β C (K (K v)) T` gives `V₁[Kv] =β K (K v)` by rigid-head +injectivity (common reducts of `C X T` and `C Y T` are `C Z T` with +`X →* Z`, `Y →* Z`). Let `V₁`'s hnf be `λy⃗. h W⃗`. If `h = e`: +`V₁[Kv] →* λy⃗. K v W⃗'`; with `|W⃗| = 0` this is `λy⃗ λd. v`, with `|W⃗| = 1` +it is `λy⃗. v`, with `|W⃗| ≥ 2` it is `v W₂' …`; only `|W⃗| = 1` with `|y⃗| = +2` is `λy λa. v` — or `|W⃗| = 0` with `|y⃗| = 1`, i.e. `V₁ →* λy. e`, which +fails (U2): `λy. cons K T ≠β λy λa. a`. So `V₁ →* λy λa. e W`. If `h` is +bound (`y` or `a`) or is `cont := C`, the head of `V₁[Kv]` is not `v`, +impossible. `h = b, intL, x` as stated. For (cell-K): `V₁[cons K T] →* λy +λa. (cons K T) W[cons K T/e] → λy λa. W[…] K T`, and this must be `=β λy +λa. a`; strip the two lambdas. For (cell-F): by (U2'), +`A_K^{A_K^C} U₁(T) T =β C (K K) T`; the arm `B₁` with `cont := A_K^C` and +`e := U₁(T)` is `A_K^C (V₁[U₁(T)/e]) T = B₁[C/cont, V₁[U₁(T)]/e] T →* C +(V₁[V₁[U₁(T)]/e]) T`, so `V₁[V₁[U₁(T)]/e] =β K K = λy λa λa'. a`. Unfold: +`V₁[V₁[U₁]/e] →* λy λa. V₁[U₁] W^{out} → λy λa. (λy' λa'. U₁(T) W[U₁/e, y', +a']) W^{out} → λy λa λa'. U₁(T) W[U₁/e, W^{out}/y', a'/a'] → +λy λa λa'. W[…] F (cons K T)`, which must be `λy λa λa'. a`. ∎ + +**What 3.7 establishes without any hypothesis.** Under S1 and (A-i, k=2), +the ABS arm *is* `cont (λy λa. e W)` up to β-reduction, with a cell `W` +that (i) returns the bound value `a` when applied to `K` and a tail, and +(ii) when applied to `F` and the shorter code, must reach the *outer* +value `a` through the environment `y` it was given. `W` therefore contains +leaves `a` and `y` (neither `K`, `T`, `cons K T`, `U₁(T)` nor `V₁[U₁(T)]` +contains the outer `a` except through `y`'s value `W^{out}`, and free +variables are never created). The 165's cell `λzx λzy. zx a (zy y)` is one +such `W`; the laws (cell-K)/(cell-F) are exactly the two Boolean lookup +laws *on the actual arguments* `(K, T)` and `(F, cons K T)` with the +environment `y := W^{out}`. + +**Lemma 3.8 (the constant laws alone do not price the cell).** The 30-bit +`λy λa. e (K (K a))` satisfies (U1) and (U2) (checked), and fails the +closed program `K = λλ.2` (checked, `tools/identities3.py`); so (cell-F), +i.e. the open-body protocol, is the load-bearing law for the cell's 24. ∎ + +## 3.4 The APP arm: a second parse whose continuation builds the S-shape + +Still (A-i), `k = 2`. The APP arm `B₂` (with `e` free, `cont := C`) obeys, +by 3.3, `B₂[K M₁/e] (⌜M₂⌝ ++ T) =β C (λz. M₁ M₂) T` for all closed `M₁, M₂`. + +**Lemma 3.9 (the APP arm's hnf).** `B₂` is solvable and its hnf is one of: +* (P1) `intL W₁` (no leading lambda): `B₂[e] t →* P_N W₁'[e] t`, a genuine + parse of the operand with continuation `W₁` — the 165; +* (P1η) `λr. intL W₁ r`, its η-expansion (`+6` and `+1` per free leaf of + `W₁`); `λr. intL W₁ W₂` with `W₂ ≠ r` is the constructed-stream case; +* (Pc) `λr. cont W₁ W₂` with `W₂[K M₁/e, ⌜M₂⌝++T / r] =β T` (a remainder + extractor) and `W₁[…] =β λz. M₁ M₂` (a value extractor): value and + remainder computed separately; +* (Pb) `b`-headed (`b := F` selects a branch); +* (PI/PX) `intL`-/`x`-headed with `≥ 2` arguments (constructed stream). + +`e`-headed and `r`-headed are impossible (head `K M₁ …` is not `C`; head +`t` is not `C`), `cont`-headed without a lambda has the wrong remainder. +*Proof.* As 3.6. ∎ + +**Lemma 3.10 (the second parse's continuation).** In case (P1), +`P_N W₁' (⌜M₂⌝ ++ T) =β W₁' (K M₂) T` by 1.5, so + + W₁[K M₁/e] (K M₂) T =β C (λz. M₁ M₂) T for all closed M₁, M₂. + +Then `W₁ →* λe₂. cont W₂` (or `λe₂ r. cont W₂ r`, `+6`), unless its head is +`b`, `intL` or `x`, and the **lift** `W₂` (free `e, e₂`) satisfies + + W₂[K M₁/e, K M₂/e₂] =β λz. M₁ M₂ for all closed M₁, M₂. (LIFT) + +*Proof.* `W₁[K M₁] (K M₂) T` is solvable, head `C`, two arguments: `W₁`'s +hnf has `≤ 2` lambdas; head `e₂` gives `K M₂ … →* M₂ …` (for `M₂ = Ω`, +unsolvable; for `M₂ = I`, not `C`-headed), head `e` likewise, head `r` +gives `T`; head `cont` with one lambda forces one argument (`C W₂' T`), +with two lambdas forces `W₃[T/r] =β T`. Rigid-head injectivity gives +(LIFT). ∎ + +**Theorem 3.11 (the lift is the S-shape).** Any `W₂` satisfying (LIFT) +reduces to + + W₂ →* λz. e Y₀ (e₂ Y₁) + +for some terms `Y₀, Y₁` (with `z, e, e₂` and the frame free), unless its +hnf head is `b` (`:= F`), `intL` or `x`. + +*Proof.* The argument is that of Lemma 1.8 run twice, once in each value. +Let `W₂`'s hnf be `λx⃗. h W⃗`. With `M₁ = Ω`, `W₂[KΩ/e, K M₂/e₂] =β λz. Ω M₂` is +unsolvable, so `W₂` is unsolvable or its head is `e` (a rigid head `C`, a +bound head, or `e₂` with `M₂ = I` would give a solvable instance of the +wrong shape; `b`, `intL`, `x` are the excluded heads). Unsolvable is +excluded by `M₁ = M₂ = I`. So `W₂ →* λx⃗. e W⃗`, and `λx⃗. K v W⃗' =β λz. v +w` forces `|W⃗| = 2`, `x⃗ = (z)`: `W₂ →* λz. e Y₀ Y`, with +`Y[Kv/e, Kw/e₂] =β w` for all closed instances `v := M₁, w := M₂`. Now +`Y[K M₁/e, K Ω/e₂] =β Ω` forces `Y` unsolvable or `e₂`-headed; unsolvable +is excluded by `M₂ = I`; so `Y →* λx⃗'. e₂ Y⃗`, and `λx⃗'. K w Y⃗' →* w` forces +`x⃗' = ∅`, `|Y⃗| = 1`: `Y →* e₂ Y₁`. ∎ + +**Corollary 3.12 (lift ≥ 19 without any protocol hypothesis).** If `W₂` is +β-normal and not `b`/`intL`/`x`-headed, then `W₂ = λz. e Y₀ (e₂ Y₁)` +syntactically, and in its frame `[z, e₂, e, b, cont, intL, x]` + + |W₂| = 2 + 3·2 + (2+2) + (1+2) + |Y₀| + |Y₁| ≥ 2 + 6 + 4 + 3 + 2 + 2 = 19, + +with equality iff `Y₀ = Y₁ = z` (index-0 leaves): the 165's lift, +uniquely. For a non-normal `W₂` the same holds for its normal form, and the +wire cost of a redex-free term is the cost of its syntax; a non-normal +`W₂` with a smaller source than its normal form would have to contain a +redex whose contraction *increases* size (Lean `wire_beta_delta`); Part 4 +prices that separately. ∎ + +**Remark 3.13 (what the 165 does and does not force).** Everything in 3.1– +3.12 is forced by the contract through S1 and the head-dispatch (A-i) +with two arms. The ABS arm is `cont (λy λa. e W)` and the APP arm is +`intL (λe₂. cont (λz. e Y₀ (e₂ Y₁)))`, up to β-reduction and up to the +exotic heads, for *every* correct `N` of that shape. No "environment +function" protocol was assumed: the S-shape of the lift and the +`λy λa. e W` shape of the λ-value are consequences of `λz. M₁ M₂` and +`λz. λM₁` having the parsed values at their heads, via Lemma 1.8. What is +not forced by these laws alone is the cell `W` (3.8), which Part 4 prices +under the uniform lookup interface. + +**Checks.** (U1), (U2), (U2') and (LIFT) on the 165's arms with rigid +`v, w, T, C` (`tools/identities.py`, `identities2.py`: `(U3r)`); the `λz. v +Ω` hnf shape on the divergent program `(λ1 1)(λ1 1)` (value position is an +abstraction, remainder reduces to `T`). + +--- +# Part 4. The conditional theorem: 92 on the 165's control skeleton + +## 4.1 Hypotheses + +Let `N` satisfy (ABS) and (APP). The hypotheses name exactly the branches +of Theorems 2.3, 3.5, 3.6, 3.9, 3.10, 3.11 that are *not* taken, plus two +assumptions that the laws do not supply. + +* **(H-NF) normality.** `N` is β-normal. (The 165's NEXT is. Consequence: every + hnf computed in Part 3 is the literal syntax of the corresponding subterm, + and the size of `N` is the sum of the sizes of the disjoint subterms the + skeleton names.) +* **(H-S1) first parse.** `N = λb. intL A` (Theorem 2.3, shape S1). +* **(H-D) head dispatch with two arms.** `A = λe. b B₁ B₂` or `A = b B₁ B₂` + (Theorem 3.5 (A-i) with `k = 2`). +* **(H-ctl) the 165's control.** `B₁ = cont V₁` (Lemma 3.6, first case) and + `B₂ = intL W₁` with `W₁ = λe₂. cont W₂` (Lemmas 3.9 (P1), 3.10); `V₁`'s + head is `e` (Lemma 3.7, main case) and `W₂`'s head is `e` (Theorem 3.11, + main case). Equivalently: no subterm of `N` is `intL`- or `x`-headed + except the two parse calls, and the η-expanded variants + (`λr. cont V₁ r`, `λe₂ λr. cont W₂ r`) are not used. +* **(H-cell) uniform lookup interface.** The cell `W` of Lemma 3.7 satisfies + `W K n =β a` and `W F r =β r y` as equations between open terms with `a, + y, n, r` rigid and `e` rigid (the interface of the env lane's Theorem, + `tmp/overnight/env/REPORT.md` §5: frame `[a, e, exp, bit1, cont, intL, x]`, + `bit1 := K`, the actual `intL`, `x`). Lemma 3.7 proves only the two + *instances* (cell-K), (cell-F), in which `n := T`, `r := cons K T`, + `e := cons K T` or `U₁(T)`, `y := W^{out}`. + +**Theorem 4.1.** Under (H-NF), (H-S1), (H-D), (H-ctl), (H-cell), + + |N| ≥ 92, with equality if and only if N is the 165's NEXT. + +Moreover `|N| ≥ 93` under (H-D) with `A = b B₁ B₂` (select-first), and the +only sub-92 room the hypotheses leave is listed in Part 5. + +## 4.2 Proof + +By (H-NF) and (H-S1), `N = λb. intL A` syntactically. Cost of the header: +`λb` 2, the application 2, `intL` at depth 1: 4. **8 bits**, plus `|A|`. + +*Dispatch.* By (H-D) and (H-NF), `A = λe. b B₁ B₂` (cost `2 + 4 + 3 = 9` +plus the arms, `b` at index 1) or `A = b B₁ B₂` (cost `4 + 2 = 6`, `b` at +index 0, but then each arm must bind `e` itself: `B₁ = λe. B₁'`, `B₂ = +λe. B₂'`, `+2` each, with the bodies `B₁', B₂'` in the same frame as the +`λe`-form's arms). So the second form costs `6 + 4 = 10 ≥ 9` for the same +arm bodies; it is the 166 (checked: `select-first 166 bits ok=667`). We +continue with `A = λe. b B₁ B₂`, frame of the arms `[e, b, cont, intL, x]`. + +*ABS arm.* By (H-ctl) and (H-NF), `B₁ = cont V₁` with `V₁ = λy λa. e W` +(Lemma 3.7: the hnf is `λy λa. e W` and a normal term is its own hnf). +Cost: `cont` application 2, `cont` at index 2: 4, `λy λa` 4, the +application `e W` 2, `e` at index 2 (under `λy λa`): 4. **16 bits** plus +`|W|`. The cell `W` lives in the frame `[a, y, e, b, cont, intL, x]`, which +is the env lane's frame `[a, e, exp, bit1, cont, intL, x]` leaf for leaf +(`y` is their `e`, `e` their `exp`, `b` their `bit1`), and by (H-cell) it +meets their hypotheses: so **`|W| ≥ 24`**, with equality only for +`λzx λzy. zx a (zy y)` (their Theorem, §5.A–B gives `≥ 24`; the uniqueness +of the 24-bit cell is the module grammar's exhaustive enumeration at the +reference size, `interpreter.md` §4, "every minimum is unique", and the +`cons'` slot search through 23 bits, 30,428 fills, no survivor). So +`|B₁| ≥ 40`, equality iff `B₁` is the 165's ABS arm. + +*APP arm.* By (H-ctl) and (H-NF), `B₂ = intL (λe₂. cont W₂)`. Cost: the +application 2, `intL` at index 3: 5, `λe₂` 2, the application 2, `cont` at +index 3: 5. **16 bits** plus `|W₂|`. By Theorem 3.11 and (H-NF), +`W₂ = λz. e Y₀ (e₂ Y₁)` in the frame `[z, e₂, e, b, cont, intL, x]`: +`λz` 2, three applications 6, `e` at index 2: 4, `e₂` at index 1: 3, and +`|Y₀|, |Y₁| ≥ 2` (every term has a leaf). **`|W₂| ≥ 19`**, equality iff +`Y₀ = Y₁ = z` (Corollary 3.12). So `|B₂| ≥ 35`, equality iff `B₂` is the +165's APP arm. + +*Total.* `8 + 9 + 40 + 35 = 92`, and equality forces each piece to its +unique minimum: `N` is the 165's NEXT. ∎ + +## 4.3 What each hypothesis buys, and what is proved without it + +| piece | bits | what forces it | hypothesis used | +|---|---:|---|---| +| `λb. intL ·` | 8 | shape S1 | (H-S1) | +| `λe. b · ·` | 9 | head dispatch, two arms | (H-D); `m = 0` costs 10 (proved) | +| `cont ·` in ABS | 6 | Lemma 3.6: the arm is `cont V₁` | (H-ctl) excludes η/exotic heads | +| `λy λa. e ·` | 10 | Lemma 3.7 (from (U1),(U2) by Lemma 1.8) | none beyond (H-NF) | +| cell `W` | 24 | env lane §5 under the uniform interface | (H-cell) | +| `intL (λe₂. cont ·)` | 16 | Lemmas 3.9, 3.10 | (H-ctl) | +| lift `λz. e Y₀ (e₂ Y₁)` | 19 | Theorem 3.11 (from (LIFT) by Lemma 1.8) | none beyond (H-NF) | + +The two λ-shapes — the λ-value `λy λa. e W` and the S-shaped lift — are +theorems of the contract (Part 3), not protocol assumptions: they follow +from the parsed values standing at the *head* of `λz. λM₁` (through `K M₁`) +and of `λz. M₁ M₂`, with the Ω program fixing the shape. The 24-bit cell +is the only imported module bound, and (H-cell) is the only place where a +rigid-variable law is *assumed* rather than derived. + +**On (H-cell).** The derived instances (cell-K), (cell-F) differ from the +uniform interface in two ways: (i) the tails are actual code streams (`T`, +`cons K T`) rather than rigid `n, r` — this is the ω-rule gap of Remark +1.9, which Lemma 1.8 does not close for the cell because the required +output `a` (resp. `r y`) does not have the substituted stream at its head; +(ii) the body value `e` is in scope and is *not* rigid in the instances, +so a cell may read it. The env lane's Theorem already admits `exp` +specialised to `F` and the actual `intL`, `x`; what it does not admit is a +body-dependent cell. Lemma 3.8 shows the constants alone leave a 30-bit +non-cell; the uniform interface closes that gap for one body-independent +`W`. A cell exploiting `e` must do so for every body value — raw codes +`U_n(t)`, the Booleans `F` (body `I`) and `K F` (body `λλ.1`), and every +compound λ-value — which is why I believe (H-cell) is removable, but I have +not proved it; it is residual case R-cell in Part 5. + +**On (H-NF).** Without normality the skeleton pieces could be assembled at +run time from shared syntax (lets, shared operands), and the sizes above +would bound the *normal forms* of the arms, not the source. By the exact +β wire-cost (Lean `Blc.SelfintWireCost.wire_beta_delta`), contracting a redex +`(λy. M) Q` with `m` occurrences of `y` changes the size by +`Δ = (m−1)|Q| + (fl(Q)−1)·D − 2m − 4 − f(M)`; a sub-92 non-normal `N` whose +normal form is a correct NEXT of `≥ 92` bits must contain a redex with +`Δ > 0`, hence `m ≥ 1` and `(m−1)|Q| + (fl(Q)−1)·D ≥ 2m + 5 + f(M)`, where +`f(M)` counts the body's free leaves (each deepened by the let). In the +skeleton the only repeated leaves are `cont`, `intL`, `e` (`|Q| ≤ 7`, so a +twice-used leaf has `Δ ≤ 7 − 8 − f(M) < 0`), and the two arms have no common +compound subterm in the forced shapes. The review of the reader proof +(`tmp/overnight/verify/vreader_codex.md` §5) shows that such local +conditions do not exclude lets in general (a leaf used five times under +two binders has `Δ = +2`), so (H-NF) stays a hypothesis; the quantitative +question it leaves open is whether a term can be shared between the ABS +and APP arms at a profit, and I found no candidate (Part 5, R-share). + +## 4.4 Measured neighbours (exact battery, 2 threads; `tools/variants.py`) + +| variant | `|N|` | battery | note | +|---|---:|---|---| +| the 165's NEXT | 92 | `165 bits ok=667 skip=1 fail=0` | control | +| select-first `intL (b KA KB)` (`m = 0`) | 93 | `166 bits ok=667 skip=1 fail=0` | the `+1` of 4.2 | +| rest bound, `λe λr. b (cont V r) (intL K₂ r)` | 108 | `181 bits ok=667 skip=1 fail=0` | `m = 2` | +| shared heads, second dispatch `b cont intL (b V K₂)` | 97 | `170 bits ok=667 skip=1 fail=0` | (A-i) with `k = 3`, shared operand with its own dispatch | +| continuation-headed A, lazy second parse | 129 | `202 bits ok=667 skip=1 fail=0` | (A-c2) | +| η-expanded APP continuation `λe₂ λr. cont W₂ r` | 101 | `174 bits ok=667 skip=1 fail=0` | the `+6` plus depth | +| curried cell `λzx. zx (λn. a) (λr. r y)` | 93 | `166 bits ok=667 skip=1 fail=0` | the 25-bit cell | + +None is new in idea (all are in the record or in `nextfuse/`); they are +listed because each is the measured cost of one branch the proof prices. + +--- +# Part 5. Outside the skeleton: exclusions, prices, and the exact residual list + +Every `N` not covered by Theorem 4.1 falls into one of the cases below +(Theorems 2.3, 3.5, 3.6, 3.9–3.11 are exhaustive case splits on head +normal forms). For each: what is proved, what is measured, what is open. +"Handwritten" means a proof written here; "measured" a complete +interpreter through the exact battery; "open" that I have neither. + +## 5.1 Dispatch before the parse (shapes D1, D2) — priced, handwritten + +**Theorem 5.1.** Under (H-NF), (H-cell) and the control hypothesis that each +arm is a single genuine parse with a continuation of the Part 3 form, a +dispatch-first NEXT `N = λb. b A₁ A₂` has `|N| ≥ 99`, and `N = λb λr. b A₁ A₂` +with `r` used has `|N| ≥ 103`. + +*Proof.* `N̂[C] K r₂ = A₁[K] r₂`, `N̂[C] F r₂ = A₂[F] r₂`, so `Y_K := A₁[K]` +and `Y_F := A₂[F]` satisfy `Y_K (⌜M₁⌝ ++ T) =β C (λz. λM₁) T` and +`Y_F (⌜M₁⌝⌜M₂⌝ ++ T) =β C (λz. M₁ M₂) T`. `Y_K` applied to one argument is +`C`-headed with two arguments, so its hnf is `intL W₁` (genuine parse, the +assumed case), or `λs. …` (`s`-headed: reads the first cell, 5.3; +`cont`-headed: value and remainder apart, 5.2; `intL W₁ s`: the η-form), +or exotic. With `A₁ = intL K_A`, `A₂ = intL K_B`, Lemmas 3.1–3.3 hold for +`K_A[C]` and `K_B[C]` in place of `A_K^C`, `A_F^C` (their proofs used only +what the continuation receives), and Lemmas 3.6–3.11 give +`K_A = λe. cont (λy λa. e W)` and `K_B = λe. intL (λe₂. cont (λz. e Y₀ (e₂ +Y₁)))` under (H-NF), (H-ctl)-analogues. Prices in the frames `[b, cont, intL, +x]`: `λb` 2, two applications 4, `b` at index 0: 2; `A₁`: application 2, +`intL` 4, `λe` 2, then the ABS arm body as in 4.2 (40) — but one lambda +deeper only for `cont` and `e`, which are already counted at their 4.2 +depths because `λe` replaces `λe` of the skeleton; total `A₁ = 48`; +`A₂`: 2 + 4 + 2 + 35 = 43. Sum `8 + 48 + 43 = 99`. For `λb λr. b A₁ A₂` each +arm must consume `r`: `intL K r` costs `+4` per arm, and every free leaf of +`K_A`, `K_B` is one deeper (`≥ +2` each arm): `≥ 99 + 4 + …`; the measured +form is 181 (`|N| = 108`, 4.4). ∎ + +Measured: `λb. b (intL K_A) (intL K_B)` is the record's 172 (`|N| = 99`; +re-measured here, `tools/variants2.py`: `172 bits ok=667 skip=1 fail=0`). + +## 5.2 Value and remainder computed apart (C2, A-c2) — bounded, handwritten sketch + +`N = λb λr. cont A₁ A₂` (C2) or `A = λe λr. cont W₁ W₂` (A-c2). The +remainder arm must map `⌜M₁⌝ ++ T ↦ T` on the ABS tag and +`⌜M₁⌝⌜M₂⌝ ++ T ↦ T` on the APP tag; with the reader available the cheapest +extractor is `intL F` (`P_N F (⌜M⌝ ++ T) =β F (λz.M) T = T`, and on the +variable body `P_N F U₁(T) =β F (cons K T) T = T`; Corollary 1.5 and (R2)), +so the APP remainder is `intL F (intL F r)`: two parses of the operand +code in the remainder arm alone. The value arm must build both value shapes +(`λy λa. e W` and `λz. e Y₀ (e₂ Y₁)`, forced as in Part 3 once the parsed +values are obtained) from parses of its own, since `r` is the only source +of `M₁`'s value. Under (H-NF) the two arms are disjoint subterms, each +dispatching on `b` (≥ 7 each), each containing at least one `intL` leaf +(≥ 5) with a continuation (`K`, `F`, or `λv t. …`: ≥ 6), and the value arm +containing the cell (24) and the lift (19) with their wrappers (10 and 9): +`4 + 6 + (7 + 11 + 10 + 24 + 9 + 19 + 11) + (7 + 11 + 11) ≥ 130`. This is a +sketch (it assumes the parses go through `intL` and are not shared); the +measured lazy form is `202` (`|N| = 129`, 4.4). **Status: open as a theorem, +heuristically ≥ 123, far from 92.** + +## 5.3 Reading the first cell of the body (R2) — open, dominated heuristically + +`N = λb λr. r A₁ A₂ …`: `A₁` receives the body's first bit `b₃` and tail +`r₃`. The only case where this helps is the ABS body `1`, where `b₃ = F` is +the required value `λz. I` and `r₃ = cons K T` yields `T` as `r₃ F`; every +constructor body still needs the full parse (through `intL k r`, which +re-reads `b₃`, or `intL k I r₃ →* N̂[k] b₄ r₄`, (R3)), and the APP tag never +has a variable operator. So `R2` adds a dispatch on `b₃` (≥ 7) and a +special-case output (≥ 10) to everything S1 needs. No construction built; +no proof. **Open.** + +## 5.4 Constructed streams and modified interpreters (I0–I2, X0–X2, A-I, A-X) — open; the identities that govern them + +These shapes run the reader (or a generator-built interpreter) on a term +`A₂'` that `N` constructs rather than on the input. What the reader does +with a constructed argument is governed by Lemma 1.2 (R3) and three facts +checked here (`tools/identities.py`, `identities3.py`, `shapes_check.py`): + +* `P_N k K s X →* s Z_k k X`: feeding the handler the body stream reads its + first cell and hands `N̂[k]` the *second* cell with an extra argument + (`N̂[k] b₄ r₄ k`); on the variable body `1` it hands `N̂[k]` the cells `K, + T` and the result is `T`-headed with three arguments. Any `N` using + `intL k K` as a second-tag dispatcher must therefore run a + three-argument continuation protocol; nextfuse's identity 1 prices that + at `≥ 186`. +* `P_N k I →* λr. r N̂[k]`: a self-call of `N` on the next cell, 11 bits + plus `|k|`. It saves nothing over `intL k` applied to the stream with its + tag, because the tag cell must be stripped first (the stream's own + application `s (λd. intL k I) → intL k I r'` costs more than `intL k s`). +* `P_N k (λh. h F Y) →* k Y (Y (λh. h F Y))`: a fake variable cell makes the + continuation receive `Y` and `Y` applied to the cell; `P_N k (K a) →* a (a + (K a))` and `P_N k (K (K X)) →* X` are the constant-stream returns (the + record's 191/207 use them as ABS return instructions). +* An `x`-headed term `x A₁ A₂ …` is an interpreter whose `intL` is `A₁ A₁` + and whose `x` is `A₁`; for it to parse correctly on all programs, `A₁ A₁` + must itself be a correct parser, i.e. `A₁` a correct generator. No + construction in the record uses `x` other than as `x x`, and `x x` is + dominated by `intL` (`10 + 2d` against `3 + d`, same value). + +In every one of these shapes the stream `A₂'` is a term over `b`, `C`, +`P_N`, `G_N` (and `r₂` in the `m = 2` shapes), so `N̂ b r₂ = Q_b r₂` (or +`Q_b` reading `r₂`'s cells) with a fixed `Q_b`, and `Q_b` must itself be a +correct NEXT body for its tag; the `intL`/`x` call is an *indirection* +whose only non-trivial payoff is access to `N̂[k]`, `Z_k`, `H_k` — the +recursion. I have no proof that this indirection cannot pay (it can +certainly express things that cannot be written without recursion), and I +found no construction in which it does. **Open.** Every known member of +these families is `≥ 186`. + +## 5.5 Exotic heads inside the arms (b-, intL-, x-headed subterms) — one exclusion + +**Lemma 5.2 (no dead branches).** Under (H-D), a minimum `N` has no subterm +of the form `b X Y Z⃗` inside either arm. *Proof.* Inside `B₁` the variable +`b` is always `K` (the arm is reached only after `K B₁ B₂ → B₁`; under `F` +it is erased), so replacing `b X Y Z⃗` by `X Z⃗` changes no reduct of any +instance and saves `≥ 2 + 2 + 3 + |Y| ≥ 9` bits; symmetrically in `B₂` +with `Y Z⃗`. ∎ (A leaf `b` used as a *cheap constant* `K`/`F` is not excluded +and is admitted by the imported cell bound, whose frame has `bit1 := K`; +the record's 171 is the curried cell borrowing it.) + +`intL`-/`x`-headed subterms inside `V₁`, `W`, `W₂` (a λ-value or lift or +cell built by running the reader on a constructed stream) are the arm-level +version of 5.4. **Open**, same remarks. + +## 5.6 Shared operands (A-i with k ≥ 3) — open, with the quantitative question stated + +`A = λe. b B₁ B₂ O₃ … O_k`: the arms receive the `Oᵢ`. Each `Oᵢ` costs +`2 + |Oᵢ| ≥ 4`; an arm that does not use `Oᵢ` must still consume it (a +lambda, 2, plus one depth bit on each of its free leaves; or `K`-selection, +≥ 7). An arm that uses `Oᵢ` through a bound variable saves at most +`|Oᵢ| − (2 + depth)` per use against writing `Oᵢ` inline. So a shared +operand pays only if the two arms would otherwise each contain a copy of +a subterm of `≥ 10` bits (or one arm two copies). In the forced shapes the +arms are `cont (λy λa. e W)` and `intL (λe₂. cont (λz. e Y₀ (e₂ Y₁)))`; +their common leaves are `cont`, `intL`, `e` (`≤ 7` bits each: a shared leaf +loses), and I found no common compound subterm: the cell is `Ψ a y` for +`Ψ = λp q f g. f p (g q)` (28 bits) while the lift is `λz. Ψ z z e e₂`, which +*loses* 8 bits against `λz. e z (e₂ z)`; the S-combinator saves 1 in the +lift and nothing in the cell. The review's pair-packing (`X = λz. c (z K)`, +`Y = λz. P (z F)`, `Z = λh. h A B`) costs `≥ +37`; the shared-head form +`b cont intL (b V K₂)` is 170 (4.4, `+5`); nextfuse's three shared-argument +rows are 169/169/170. **Open as a theorem**: what is missing is a proof that +no term of `≥ 10` bits can be β-equal, in the two arms' two contexts, to +subterms of both forced shapes. The forced shapes make that plausible (the +arms have different arities at every level: the λ-value takes `y` then `a`, +the lift takes `z` once and applies two values) but I have not proved it. + +## 5.7 Non-normal N (lets) — open; what the wire-cost formula says + +Discussed in 4.3. A sub-92 `N` with a redex must contain one whose +contraction *increases* size. The possible payoffs are the shared operands +of 5.6 in let form, or a let whose argument is used twice inside one arm; +inside the forced shapes the only repeated subterms are leaves. **Open**, +same missing lemma as 5.6. + +## 5.8 The cell under actual-instance laws (R-cell) — open, delimited + +(H-cell) assumes the two lookup laws for rigid `n, r` with `e` rigid. The +contract gives (cell-K) and (cell-F) (Lemma 3.7) and their analogues for +every body: the cell sees `e := V_{M₁}` for the body `M₁` it is wrapped +around (the raw code `U_j(t)` for a variable body, `F` for `I`, `K F` for +`λλ.1`, a compound λ-value otherwise), and tails that are code streams. A +cell outside (H-cell) would have to use `e` or the tail's structure +*consistently for all bodies*. The one 17-bit "cell" the env lane exhibits +works for a single favourable body and fails on `exp = F`; Lemma 3.8's +30-bit term meets the constants and fails `λλ.2`. I believe (H-cell) is a +theorem of the contract but did not prove it; the proof would redo env §5.A +with `exp` ranging over the actual body values and `n, r` over the actual +tails, which is a finite but long case analysis (every sub-24 syntax tree, +each against four body instances). **Open.** + +## 5.9 N without `intL` or `x` (R-own-recursion) — open, global + +Lemma 2.5: such an `N` is an interpreter for tagless code with its own +recursion; nothing in the record bounds it anywhere near 92 (the global +floor for a full interpreter is 37). **Open**, and unlikely to be settled +by anything short of an unconditional interpreter bound. + +## 5.10 Summary of the residual list + +| case | status | best known cost | +|---|---|---:| +| D1/D2 dispatch first | priced ≥ 99 / ≥ 103 under the skeleton hypotheses (5.1) | 172 / 181 | +| C2, A-c2 value and remainder apart | sketch ≥ 123 (5.2) | 202 | +| R2 read the first cell | open, dominated heuristically (5.3) | — | +| I*/X*, A-I/A-X constructed streams | open; identities fix their behaviour (5.4) | ≥ 186 | +| b-headed subterms in arms | excluded (Lemma 5.2) | — | +| shared operands `k ≥ 3` | open; quantitative question stated (5.6) | 169 | +| non-normal N | open (5.7) | — | +| cell under actual-instance laws | open, delimited (5.8) | — | +| own recursion, no `intL`/`x` | open, global (5.9) | — | + +--- +# Part 6. Honest read + +## 6.1 What this lane settles + +The NEXT region's three λ-shapes are not design choices. With the 165's +knot and reader fixed and the body parsed first (shape S1 with a +two-arm dispatch), the contract itself forces the ABS arm to apply `cont` +to `λy λa. e W` and the APP arm to parse once more and apply `cont` to an +S-shaped `λz. e Y₀ (e₂ Y₁)`; the proof is the extraction lemma on the two +output forms `λz. λM₁ = K (K M₁)` and `λz. M₁ M₂`, which have the parsed +value at their head, with the divergent program `Ω` fixing the shape. That +is 68 of the 92 bits priced from the laws alone, given normality and the +skeleton: header 8, dispatch 9, `cont ·` 6, `λy λa. e ·` 10, `intL (λe₂. +cont ·)` 16, lift 19. The remaining 24 are the cell, and there the laws the +contract supplies are the two Boolean lookup laws *on actual arguments*, +which is one ω-step short of the uniform interface under which the env +lane proved 24. So within the skeleton, 165 is optimal modulo one +hypothesis I believe is a theorem (5.8), and the control skeleton itself +is forced up to the shapes listed in 5.10. + +## 6.2 Where a sub-165 could still hide + +Not in the arms of the skeleton: their shapes are forced and their prices +are at the floor with one 2-bit slack each at most (`Y₀, Y₁`, which the +protocol then fixes to `z`). The places the proof does not reach, in the +order I would look: + +1. **Shared syntax between the two arms (5.6/5.7).** This is the only + mechanism by which a term β-equal to the skeleton's normal form can be + smaller than it. The arms' forced shapes differ in arity at every level, + and the one common combinator I found (`Ψ = λp q f g. f p (g q)`, cell = + `Ψ a y`, lift = `λz. Ψ z z e e₂`) loses. A proof needs a lemma of the + form "no term of ≥ 10 bits occurs, up to β, in both `λy λa. e W` and + `λz. e z (e₂ z)` in their two contexts"; that is a finite, concrete + statement about two normal terms and seems provable by inspecting the + subterms of the two normal forms and their β-expansions up to the budget. +2. **The constructed-stream shapes (5.4).** `intL k K`, `intL k I`, fake + cells and constant streams give cheap access to the recursion in forms + other than a parse: a second-tag dispatcher with a three-argument + continuation, a self-call on the next cell, a return instruction. Every + construction in these families is `≥ 186` because the extra arguments + have to be absorbed, but the family is where something genuinely + different from the 165 would live, and the record's exclusions + (`protocol-obstructions.md`) cover only specific protocols. The honest + statement is that the identities of 5.4 describe exactly what these calls + deliver, and that an `N` using them must absorb what they deliver; a + proof would price the absorption. +3. **A cell that reads the body value (5.8).** The 17-bit single-body cell + and the 30-bit constants-only term show that the cell's 24 rests on + uniformity across bodies. A cell using `e` would have to extract `a` + from `(K, T)` and reach `y` on `(F, cons K T)` for `e ∈ {U_j(t), F, K F, + compound λ-values}` simultaneously; I see no way, but the case analysis + is not written. +4. **Not** in the reader-protocol facts: that variable values are raw + codes and that `cont` receives `(value, rest)` are fixed by the brief, + and the `λz. M` root value is the contract. A different `next` protocol + is a different lane. + +## 6.3 The next proof step + +Two steps, both concrete: + +* **Close (H-cell) from the contract.** Redo env §5.A–B with `exp` ranging + over the actual body values and the tails over actual streams: show that + every sub-24 syntax tree in the frame `[a, y, e, b, cont, intL, x]` fails + one of the four instances (body `1` on `(K, T)`, body `λ.2` on `(F, cons K + T)`, body `I` with `e = F`, body `λλ.1` with `e = K F`). It is finite + (every term below 24 bits with the required leaves `a, y`), and the + three-application and four-application cases are the whole of it; the + env lane's step 2 (no redex at `A = 3`) and step 3 (`L = 2, A = 4, X ≤ 1` + closed lambdas) carry over, the new work is the `e`-headed and + `b`-constant cases. +* **Remove (H-NF) within the skeleton.** Prove the no-common-subterm lemma + of 6.2(1) and derive from `wire_beta_delta` that every redex of a sub-92 + skeleton `N` would have to be a let of a `≥ 10`-bit term used in both + arms. Together with Lemma 5.2 this would make Theorem 4.1 hold for all + `N` of the skeleton shape, normal or not. + +After those, what remains open is exactly the shape list of 5.10 minus the +skeleton — the dispatch-first shape (priced), the apart-computation shapes +(sketched), and the constructed-stream shapes, which are the real frontier +of this question. + +## 6.4 Status table + +| component | status | +|---|---| +| Laws (1.3–1.5), Remark 1.6 | handwritten, standard (Church–Rosser, substitutivity); (R0)–(R3) checked | +| Extraction lemma 1.8 (a)–(d) | handwritten; uses only hnf invariance and `Ω → Ω` | +| Structure theorem 2.3 | handwritten case split on hnf; impossibilities checked on instances | +| A's shapes 3.5; arm shapes 3.6, 3.7, 3.9, 3.10 | handwritten; (U1), (U2), (U2'), (cell-K), (cell-F) checked on the 165 | +| Lift is S-shaped 3.11, ≥ 19 (3.12) | handwritten from the laws; no protocol hypothesis | +| Lemma 3.8 (constants do not price the cell) | checked (30-bit term, fails `λλ.2`) | +| Theorem 4.1 (92 on the skeleton) | handwritten; imports env §5 cell ≥ 24 (handwritten, not independently reviewed) under (H-cell); (H-NF) assumed | +| Theorem 5.1 (dispatch first ≥ 99) | handwritten, same imports; measured 172 | +| Lemma 5.2 (no dead branches) | handwritten, hypothesis-free given (H-D) | +| 5.2–5.4, 5.6–5.9 | open; measured constructions and checked identities only | diff --git a/data/self-interpreter/reasoning_floor/next-proof/tools/cellF_check.py b/data/self-interpreter/reasoning_floor/next-proof/tools/cellF_check.py new file mode 100644 index 00000000..2244bf19 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof/tools/cellF_check.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +"""Check the derived cell laws (cell-K), (cell-F) of Lemma 3.7 on the 165's cell, +and the (U2') instance; also the e-headed/odd cells mentioned in Part 4.""" +from nt import * +from helpers import * +N = N165 +TT, CC, aa, yy, ee = V('T'), V('C'), V('a'), V('e'), V('e') +# the 165's cell W in frame [a, y, e, b, cont, intL, x]; here as a named term over a, y, e +W = L('zx', 'zy', A(V('zx'), V('a'), A(V('zy'), V('y')))) +V1 = lambda e: L('y', 'a', A(e, subst_frame(W, {'e': e}))) # \y \a. e W +# (cell-K): W[cons K T/e] K T = a +chk('(cell-K) W[consKT/e] K T = a', A(subst_frame(W, {'e': cons(K, TT)}), K, TT), aa) +# (cell-F): W[U1(T)/e, W^out/y, a'/a] F (cons K T) = a, W^out = W[V1[U1(T)]/e] +U1T = unary(1, TT) +Wout = subst_frame(W, {'e': V1(U1T)}) +Win = subst_frame(W, {'e': U1T, 'y': Wout, 'a': V('w')}) # a' := w +chk('(cell-F) W_in F (cons K T) = a', A(Win, F, cons(K, TT)), aa) +# (U2'): V1[V1[U1(T)]/e] = K K +chk("(U2') V1[V1[U1]] = K K", V1(V1(U1T)), A(K, K)) +# the actual run: E C (++T) = C (K K) T (K = \\.2) +chk('contract on K', A(E_of(N), CC, stream(quote(K), TT)), A(CC, A(K, K), TT), fuel=400000) +print('ALL OK' if all(o for _, o in checks) else 'SOME FAILED') diff --git a/data/self-interpreter/reasoning_floor/next-proof/tools/helpers.py b/data/self-interpreter/reasoning_floor/next-proof/tools/helpers.py new file mode 100644 index 00000000..4063b07d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof/tools/helpers.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 +"""Shared helpers: head normal form with fuel, frame substitution, check registry.""" +from nt import * + +def hnf(d, fuel=100000): + lam = 0 + while d[0] == 'L': + lam += 1; d = d[1] + spine = [] + while True: + if d[0] == 'A': + spine.append(d[2]); d = d[1]; continue + if d[0] == 'L' and spine: + fuel -= 1 + if fuel < 0: raise lc.Fuel() + d = lc.beta(d, spine.pop()); continue + break + return lam, d, list(reversed(spine)) + +def whnf(d, fuel=100000): + """weak head normal form: stop at a lambda or a rigid head.""" + spine = [] + while True: + if d[0] == 'A': + spine.append(d[2]); d = d[1]; continue + if d[0] == 'L' and spine: + fuel -= 1 + if fuel < 0: raise lc.Fuel() + d = lc.beta(d, spine.pop()); continue + break + return d, list(reversed(spine)) + +def show_hnf(t, fuel=100000, frame=None): + lam, h, args = hnf(to_db(t, frame), fuel) + return lam, lc.show(h), [lc.show(a) for a in args] + +def subst_frame(t, m): + def go(u): + if u[0] == 'V': return m.get(u[1], u) + if u[0] == 'L': return ('L', u[1], go(u[2])) + return ('A', go(u[1]), go(u[2])) + return go(t) + +checks = [] +def chk(name, a, b, fuel=200000): + ok = eq(a, b, fuel) + checks.append((name, ok)); print(('ok ' if ok else 'FAIL'), name) + return ok diff --git a/data/self-interpreter/reasoning_floor/next-proof/tools/identities.py b/data/self-interpreter/reasoning_floor/next-proof/tools/identities.py new file mode 100644 index 00000000..69e2b102 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof/tools/identities.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +"""Checked identities for the NEXT lane. Recursion is unfolded one level +(P_one) with the inner intL/x rigid (PR/GR), so every side has a normal form.""" +from nt import * +from helpers import * + + +N = N165 +P1 = P_one(N) +k = V('k') +Zk = Z_rigid(N, k); Hk = H_rigid(N, k); Nk = Nhat_rigid(N, k) + + +# 1. reader on non-stream arguments (one level) +chk('P k K = H_k', A(P1, k, K), Hk) +chk('P k F = F', A(P1, k, F), F) +chk('P k I = Z_k', A(P1, k, I), Zk) +a = V('a') +chk('P k (K a) = a (a (K a))', A(P1, k, A(K, a)), A(a, A(a, A(K, a)))) +chk('P k (K (K v)) = v', A(P1, k, A(K, A(K, V('v')))), V('v')) +b, r = V('a'), V('e') +chk('P k (0 b r) = N^[k] b r', A(P1, k, cons(K, cons(b, r))), A(Nk, b, r)) +for n in range(1, 5): + chk(f'P k (1^{n}0++T) = k (1^{n-1}0++T) T', A(P1, k, unary(n, V('T'))), A(k, unary(n - 1, V('T')), V('T'))) +# second-tag dispatch through H_k (fails for body = var 1) +chk('H_k K r2 X = X N^[k] (zero arm erases r2)', A(Hk, K, V('R'), V('XR')), A(V('XR'), Nk)) + +# 2. the 165's arms with PR for inner recursion; universal laws +Ak = L('exp', A(V('cont'), abs_value(V('exp')))) +Af = L('exp', A(V('intL'), L('exp2', A(V('cont'), lift(V('exp'), V('exp2')))))) +AkC = subst_frame(Ak, {'cont': V('C'), 'intL': P1, 'x': V('GR')}) +AfC = subst_frame(Af, {'cont': V('C'), 'intL': P_depth(N, 3), 'x': V('GR')}) +vv, TT, CC = V('v'), V('T'), V('C') +chk('(U1) A[K] (K v) T = C (K (K v)) T', A(AkC, A(K, vv), TT), A(CC, A(K, A(K, vv)), TT)) +chk('(U2) A[K] (cons K T) T = C F T', A(AkC, cons(K, TT), TT), A(CC, F, TT)) +chk('(U3) A[F] (K v) (++T) = C (\\z. v I) T', A(AfC, A(K, vv), stream(quote(I), TT)), A(CC, L('z', A(vv, I)), TT)) +chk('(U3b) A[F] (K v) (++T) = C (\\z. v K) T', A(AfC, A(K, vv), stream(quote(K), TT)), A(CC, L('z', A(vv, K)), TT)) +# exploratory (not a law: the operand of a closed application is closed): the APP arm on a raw-code operand +print('A[F] (K v) (10++T) ->', lc.show(nf(A(AfC, A(K, vv), unary(1, TT))))) + +# 3. value of an open body under the 165's protocol +body_code = quote_db(('A', ('V', 1), ('V', 0))) # code of (2 1): 01 110 10 +val = A(P_depth(N, 3), L('vv', 'rr', V('vv')), stream(body_code, TT)) # pick the value +print('value(2 1) e ->', lc.show(nf(A(val, V('e'))))) +body_code2 = quote_db(('L', ('A', ('V', 1), ('V', 0)))) # \.(2 1), FV={1} +val2 = A(P_depth(N, 4), L('vv', 'rr', V('vv')), stream(body_code2, TT)) +print('value(\\.(2 1)) e ->', lc.show(nf(A(val2, V('e'))))) +# the 165's environment cell laws +cell = L('zx', 'zy', A(V('zx'), V('a'), A(V('zy'), V('e')))) +chk('cell K n = a', A(cell, K, V('N')), V('a')) +chk('cell F r = r e', A(cell, F, V('R')), A(V('R'), V('e'))) + +print('ALL OK' if all(o for _, o in checks) else 'SOME FAILED') diff --git a/data/self-interpreter/reasoning_floor/next-proof/tools/identities2.py b/data/self-interpreter/reasoning_floor/next-proof/tools/identities2.py new file mode 100644 index 00000000..0ae4fecf --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof/tools/identities2.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +"""More checked identities: rigid universal laws for the 165's arms, exotic +intL-headed shapes, and the role of Omega in the laws.""" +from nt import * +from helpers import * +N = N165 +P3 = P_depth(N, 3) +vv, ww, TT, CC = V('v'), V('w'), V('T'), V('C') +Ak = L('exp', A(V('cont'), abs_value(V('exp')))) +Af = L('exp', A(V('intL'), L('exp2', A(V('cont'), lift(V('exp'), V('exp2')))))) +sub = lambda t: subst_frame(t, {'cont': CC, 'intL': P3, 'x': V('GR')}) +AkC, AfC = sub(Ak), sub(Af) +# the APP continuation W1 = \exp2. cont LIFT with exp := K v : rigid law +W1 = L('exp2', A(V('cont'), lift(A(K, vv), V('exp2')))) +chk('(U3r) W1[Kv] (K w) T = C (\\z. v w) T', A(sub(W1), A(K, ww), TT), A(CC, L('z', A(vv, ww)), TT)) +# ABS arm on an open body value: body = \.(2 1); expected value \z. \. \.(2 1) i.e. C (\z\a\b. a b) T +body2 = L('p', A(V('q'), V('p'))) # \.(2 1) with q free (= var 1 of the ABS) +code = quote_db(('L', ('A', ('V', 1), ('V', 0)))) +chk('ABS on body \\.(2 1): E C (<\\\\.(2 1)>++T) = C (\\z\\q\\p. q p) T', + A(E_of(N), CC, stream('00' + code, TT)), A(CC, L('z', 'q', 'p', A(V('q'), V('p'))), TT), fuel=400000) +# divergent program: E C (<(\1 1)(\1 1)>++T) must reduce to C (\z. Omega) T; check a bounded head reduction +lhs = to_db(A(E_of(N), CC, stream(quote(OMEGA), TT))) +lam, h, args = hnf(lhs, 100000) +print('Omega program hnf: lambdas', lam, 'head', lc.show(h), 'nargs', len(args)) +a1 = args[0] +w, sp = whnf(a1, 5000) +print(' value arg whnf: is lambda?', w[0] == 'L', 'spine args', len(sp)) +if w[0] == 'L': + w2, sp2 = whnf(w[1], 2000) if False else (None, None) + # body under the lambda: show the term after a few steps is Omega-shaped + print(' body under \\z (raw):', lc.show(w[1])[:120]) +print(' rest arg =', lc.show(args[1])) + +# exotic: N' = \b. intL A I == \b \r. r N^[A] (re-dispatch on the next tag with continuation A[b]) +k = V('k') +P1 = P_depth(N, 1) +chk('P k I r = r N^[k]', A(P1, k, I, V('R')), A(V('R'), Nhat_rigid(N, k))) +# N^[k] F (cons K T): the 165's APP arm fed the var-1 raw code as an "operator code" -> T-headed +t = A(Nhat_rigid(N, k), F, cons(K, TT)) +lam, h, args = show_hnf(A(P_depth(N, 1), k, I, cons(F, cons(K, TT))), 100000) +print('N^[k] F (cons K T) hnf:', lam, h, len(args), 'args') +# P k K r2: the handler H_k applied to the body stream: erases its first argument +lam, h, args = show_hnf(A(P1, k, K, cons(F, cons(K, TT)), V('XR')), 100000) +print('H_k (10++T) X hnf:', lam, h, args) +# P k (K a) = a (a (K a)); P k (K (K W)) = W; P k (cons K r) = r N^[k] +print('ALL OK' if all(o for _, o in checks) else 'SOME FAILED') diff --git a/data/self-interpreter/reasoning_floor/next-proof/tools/identities3.py b/data/self-interpreter/reasoning_floor/next-proof/tools/identities3.py new file mode 100644 index 00000000..d9a4418d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof/tools/identities3.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +"""Exotic shapes at depth 3, and cheap wrong ABS values.""" +from nt import * +from helpers import * +N = N165 +k, TT, CC, vv = V('k'), V('T'), V('C'), V('v') +P3 = P_depth(N, 3) +def Nhat_d(N, k, d): + return subst_frame(N, {'cont': k, 'intL': P_depth(N, d), 'x': V('GR')}) +# N^[k] F (cons K T): the APP arm on the var-1 code as operator code +lam, h, args = show_hnf(A(Nhat_d(N, k, 3), F, cons(K, TT)), 200000) +print('N^[k] F (cons K T) hnf: lambdas', lam, 'head', h, 'nargs', len(args)) +# H_k applied to the body stream 10++T and one more argument X (dispatching the second tag through H_k) +Hk = L('b', A(V('b'), L('u', 'r', A(V('r'), Nhat_d(N, k, 3))), k)) +lam, h, args = show_hnf(A(Hk, F, cons(K, TT), V('XR')), 200000) +print('H_k F (cons K T) X hnf:', lam, h, len(args), 'args (head should be k: variable path returns k r X)') +lam, h, args = show_hnf(A(Hk, K, cons(K, TT), V('XR')), 200000) +print('H_k K (cons K T) X hnf:', lam, h, len(args), '(zero arm: X N^[k])') +# cheap wrong ABS value: U1 = \y\a. e (K (K a)) meets (U1),(U2) but fails body \.2 +U1bad = L('y', 'a', A(V('e'), A(K, A(K, V('a'))))) +print('|U1bad| =', size(U1bad, ['e', 'b', 'cont', 'intL', 'x']), ' (165 value: 34)') +chk('U1bad[Kv] = K (K v)', subst_frame(U1bad, {'e': A(K, vv)}), A(K, A(K, vv))) +chk('U1bad[cons K T] = F', subst_frame(U1bad, {'e': cons(K, TT)}), F) +Nbad = L('bit1', A(V('intL'), L('exp', A(V('bit1'), + A(V('cont'), subst_frame(U1bad, {'e': V('exp')})), + A(V('intL'), L('exp2', A(V('cont'), lift(V('exp'), V('exp2'))))))))) +print('|Nbad| =', size(Nbad)) +print('Nbad on K=\\\\.2:', contract_ok(Nbad, K), ' on I:', contract_ok(Nbad, I), ' on F=\\\\.1:', contract_ok(Nbad, F)) +print('ALL OK' if all(o for _, o in checks) else 'SOME FAILED') diff --git a/data/self-interpreter/reasoning_floor/next-proof/tools/nt.py b/data/self-interpreter/reasoning_floor/next-proof/tools/nt.py new file mode 100644 index 00000000..45a1a6e8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof/tools/nt.py @@ -0,0 +1,213 @@ +#!/usr/bin/env python3 +"""NEXT-theory toolkit for the next-proof lane. + +Named lambda terms over the NEXT frame [cont, intL, x] (innermost first) with +rigid globals (C, T, v, R, N, ...). Sizes use |M| = 2L + 4A + 2 + X. +Normalization is normal-order with fuel (tools/self-interpreter/lc.py). + +E_N is assembled from a NEXT body N exactly as in the 165: + (\\x. x x) (\\x. (\\intL. \\cont. (\\next. \\list. + list (\\bit0. bit0 (\\u \\r. r next) cont) (list list list)) N) (x x)) +Nothing here enumerates terms; it checks specific identities and sizes. +""" +import sys +from pathlib import Path +sys.dont_write_bytecode = True +ROOT = Path('/Users/a9lim/Work/blam') +sys.path.insert(0, str(ROOT / 'tools/self-interpreter')) +import lc + +# ---------- named AST: ('V', name) | ('L', name, body) | ('A', f, a) ---------- +def V(n): return ('V', n) +def A(f, *xs): + for x in xs: f = ('A', f, x) + return f +def L(*xs): + body = xs[-1] + for n in reversed(xs[:-1]): body = ('L', n, body) + return body + +FRAME = ['cont', 'intL', 'x'] # innermost first +RIGID = ['C', 'T', 'v', 'w', 'R', 'N', 'a', 'y', 'e', 'f', 'g', 'z', 'k', 'q', 'beta', 'tau', 'PR', 'GR', 'XR'] + +def db(t, frame): + if t[0] == 'V': + if t[1] not in frame: + raise KeyError(f'unbound name {t[1]!r}; frame={frame}') + return ('V', frame.index(t[1])) + if t[0] == 'L': + return ('L', db(t[2], [t[1]] + frame)) + return ('A', db(t[1], frame), db(t[2], frame)) + +def to_db(t, frame=None): + return db(t, (frame if frame is not None else FRAME) + RIGID) + +def counts(t): + """(L, A, X) of a de Bruijn term; X is the sum of 0-based indices.""" + if t[0] == 'V': return 0, 0, t[1] + if t[0] == 'L': + l, a, x = counts(t[1]); return l + 1, a, x + lf, af, xf = counts(t[1]); la, aa, xa = counts(t[2]) + return lf + la, af + aa + 1, xf + xa + +def size(t, frame=None): + d = to_db(t, frame) + l, a, x = counts(d) + assert lc.size(d) == 2 * l + 4 * a + 2 + x + return lc.size(d) + +def nf(t, fuel=200000, frame=None): + return lc.nf(to_db(t, frame), [fuel]) + +def nf_db(d, fuel=200000): + return lc.nf(d, [fuel]) + +def show(d): return lc.show(d) + +def eq(a, b, fuel=200000, frame=None): + return nf(a, fuel, frame) == nf(b, fuel, frame) + +# ---------- data ---------- +K = L('ka', 'kb', V('ka')) +F = L('fa', 'fb', V('fb')) +I = L('ia', V('ia')) +OMEGA1 = L('oa', A(V('oa'), V('oa'))) +OMEGA = A(OMEGA1, OMEGA1) +def cons(b, r): return L('cs', A(V('cs'), b, r)) +def stream(bits, tail): + t = tail + for b in reversed(bits): + t = cons(K if b == '0' else F, t) + return t +def unary(n, tail): # 1^n 0 ++ tail + return stream('1' * n + '0', tail) + +# ---------- quotation of named closed programs (de Bruijn code) ---------- +def quote_db(d): + if d[0] == 'V': return '1' * (d[1] + 1) + '0' + if d[0] == 'L': return '00' + quote_db(d[1]) + return '01' + quote_db(d[1]) + quote_db(d[2]) + +def quote(t, frame=()): + """BLC code of a named term with the given (possibly empty) frame.""" + return quote_db(db(t, list(frame))) + +# ---------- the 165's NEXT and the E_N assembly ---------- +def abs_value(exp): + cell = L('zx', 'zy', A(V('zx'), V('arg'), A(V('zy'), V('args')))) + return L('args', 'arg', A(exp, cell)) +def lift(exp, exp2): + return L('args', A(exp, V('args'), A(exp2, V('args')))) +N165 = L('bit1', A(V('intL'), L('exp', A(V('bit1'), + A(V('cont'), abs_value(V('exp'))), + A(V('intL'), L('exp2', A(V('cont'), lift(V('exp'), V('exp2'))))))))) + +def reader_body(next_name='next', list_name='list'): + Z = L('u', 'r', A(V('r'), V(next_name))) + H = L('bit0', A(V('bit0'), Z, V('cont'))) + s = V(list_name) + return A(s, H, A(s, s, s)) + +def E_of(N): + """E_N as a named closed term (N is over [cont, intL, x]).""" + inner = L('next', 'list', reader_body()) + body = L('intL', 'cont', A(inner, N)) + G = L('x', A(body, A(V('x'), V('x')))) + return A(L('x', A(V('x'), V('x'))), G) + +def E_db(N): + return db(E_of(N), []) + +def contract_ok(N, M, fuel=400000, frame=None): + """E_N C ( ++ T) =? C (\\z. M) T for a named closed program M.""" + E = E_of(N) + code = quote(M) + lhs = A(E, V('C'), stream(code, V('T'))) + rhs = A(V('C'), L('z', M), V('T')) + return nf(lhs, fuel, frame) == nf(rhs, fuel, frame) + +# the actual intL value P = G G, and N^[k] = N[k/cont, P/intL, G/x] +def G_of(N): + inner = L('next', 'list', reader_body()) + body = L('intL', 'cont', A(inner, N)) + return L('x', A(body, A(V('x'), V('x')))) +def P_of(N): + G = G_of(N) + return A(G, G) +def Nhat(N, k): + """N with cont := k, intL := P, x := G (named, closed except for k's free names).""" + G = G_of(N); P = A(G, G) + def go(t): + if t[0] == 'V': + return {'cont': k, 'intL': P, 'x': G}.get(t[1], t) + if t[0] == 'L': return ('L', t[1], go(t[2])) + return ('A', go(t[1]), go(t[2])) + return go(N) + +def intL_call(N, k, s): + """P k s with the actual P for this N.""" + return A(P_of(N), k, s) + +# ---------- one-level unfolding with RIGID inner recursion ---------- +# P_one = \c \s. s H_c (s s s) with next := N[c/cont, PR/intL, GR/x]; PR, GR rigid. +# Exact for identities needing one tag level; inner calls appear as PR ... . +def Nhat_rigid(N, k): + def go(t): + if t[0] == 'V': + return {'cont': k, 'intL': V('PR'), 'x': V('GR')}.get(t[1], t) + if t[0] == 'L': return ('L', t[1], go(t[2])) + return ('A', go(t[1]), go(t[2])) + return go(N) +def P_one(N): + inner = L('next', 'list', reader_body()) + return L('cont', A(inner, Nhat_rigid(N, V('cont')))) +def P_depth(N, d): + """d-level unfolding of the actual intL; inner calls beyond depth d are the rigid PR.""" + if d == 0: + return V('PR') + inner_P = P_depth(N, d - 1) + def go(t): + if t[0] == 'V': + return {'intL': inner_P, 'x': V('GR')}.get(t[1], t) + if t[0] == 'L': return ('L', t[1], go(t[2])) + return ('A', go(t[1]), go(t[2])) + inner = L('next', 'list', reader_body()) + return L('cont', A(inner, go(N))) +def Z_rigid(N, k): + return L('r', A(V('r'), Nhat_rigid(N, k))) +def H_rigid(N, k): + return L('b', A(V('b'), L('u', 'r', A(V('r'), Nhat_rigid(N, k))), k)) + +# a few closed programs, named +PROGS = { + 'I': I, + 'K': K, + 'F': F, + 'omega': OMEGA1, + 'II': A(I, I), + 'KI': A(K, I), + 'S': L('a', 'b', 'c', A(V('a'), V('c'), A(V('b'), V('c')))), + 'l1_1': L('a', A(V('a'), V('a'))), + 'll21': L('a', 'b', A(V('a'), V('b'))), + 'll1_2': L('a', 'b', A(V('b'), V('a'))), + 'lll312': L('a', 'b', 'c', A(V('a'), V('b'), V('c'))), + 'omega_omega': OMEGA, +} + +if __name__ == '__main__': + print('|N165| =', size(N165), 'LAX =', counts(to_db(N165))) + assert size(N165) == 92 + E = E_db(N165) + print('|E_165| =', lc.size(E)) + assert lc.size(E) == 165 + for name, M in PROGS.items(): + if name == 'omega_omega': + continue # no normal form; checked separately below + print(name, contract_ok(N165, M)) + # divergent program: compare head normal forms by a bounded reduction + code = quote(OMEGA) + lhs = A(E_of(N165), V('C'), stream(code, V('T'))) + try: + nf(lhs, 2000) + except lc.Fuel: + print('omega omega: no nf within fuel (expected)') diff --git a/data/self-interpreter/reasoning_floor/next-proof/tools/shapes_check.py b/data/self-interpreter/reasoning_floor/next-proof/tools/shapes_check.py new file mode 100644 index 00000000..c97e7dc8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof/tools/shapes_check.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +"""Sanity checks for the impossibility lines of Theorem 2.3 on concrete exotic N's.""" +from nt import * +from helpers import * +N = N165 +TT, CC = V('T'), V('C') +A1 = L('exp', A(V('cont'), abs_value(V('exp')))) # some continuation (the 165's ABS arm) +def Nhat_d(Nx, k, d): return subst_frame(Nx, {'cont': k, 'intL': P_depth(N, d), 'x': V('GR')}) +r2 = stream(quote(A(I, I)), TT) # ++ T + +# I0 with k=1: N' = intL A1 ; N'^ F r2 -> I +Np = A(V('intL'), A1) +print('I0,k=1: N^ F r2 =', lc.show(nf(A(Nhat_d(Np, CC, 1), F, r2)))) +# I1 with A2 = b: N' = \b. intL A1 b ; APP case gives r2 back +Np = L('b', A(V('intL'), A1, V('b'))) +print('I1,A2=b: N^ F r2 =', lc.show(nf(A(Nhat_d(Np, CC, 1), F, r2)))[:60], '... (= r2 itself?)', + nf(A(Nhat_d(Np, CC, 1), F, r2)) == nf(r2)) +# X0 with k=2: N' = x A1 A2 ; APP: b H'' (b b b) r2 with b=F -> r2 +Np = A(V('x'), V('cont'), V('cont')) +print('X0,k=2: N^ F r2 == r2 ?', nf(A(Nhat_d(Np, CC, 1), F, r2)) == nf(r2)) +# D1 with k=1: N' = \b. b A ; ABS: K A r2 -> A (no T) +Np = L('b', A(V('b'), A(V('cont'), F))) +out = nf(A(Nhat_d(Np, CC, 1), K, r2)) +print('D1,k=1: N^ K r2 =', lc.show(out), ' (contains T?)', 'T' in str(to_db(V('T'))) and ('V', 4) in str(out)) +# I1 with A2 = K: ABS body var 1 -> continuation gets the raw code without the rest +Np = L('b', A(V('intL'), A1, K)) +lam, h, args = show_hnf(A(Nhat_d(Np, CC, 2), K, unary(1, TT)), 200000) +print('I1,A2=K on ABS var-1 body: hnf head', h, 'nargs', len(args), args) diff --git a/data/self-interpreter/reasoning_floor/next-proof/tools/variants.py b/data/self-interpreter/reasoning_floor/next-proof/tools/variants.py new file mode 100644 index 00000000..2c6b1a64 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof/tools/variants.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +"""Build complete interpreters for the NEXT variants discussed, measure, run the +exact battery (2 threads) on each. Writes v_*.lam-equivalent bit strings.""" +import sys, json +sys.path.insert(0, '/Users/a9lim/Work/blam/tools/self-interpreter') +from nt import * +import battery +def run(name, Nx): + E = E_db(Nx) + bits = lc.enc(E) + ok, skip, bad = battery.check(E, False, 18, threads=2) + line = f'{len(bits):5d} bits ok={ok} skip={skip} fail={len(bad)}' + print(f'{name:28s} |N|={size(Nx):3d} {line}') + return line +cell = lambda: L('zx', 'zy', A(V('zx'), V('arg'), A(V('zy'), V('args')))) +VABS = lambda e: L('args', 'arg', A(e, cell())) +LIFT = lambda e, e2: L('args', A(e, V('args'), A(e2, V('args')))) +K2 = lambda e: L('exp2', A(V('cont'), LIFT(e, V('exp2')))) +out = {} +out['165'] = run('165 (control)', N165) +# select-first: A = b KA KB (m = 0) +Nsf = L('bit1', A(V('intL'), A(V('bit1'), L('exp', A(V('cont'), VABS(V('exp')))), L('exp', A(V('intL'), K2(V('exp'))))))) +out['select_first'] = run('select-first (A-i, m=0)', Nsf) +# m = 2: A = \e \r. b (cont VABS r) (intL K2 r) +Nm2 = L('bit1', A(V('intL'), L('exp', 'r', A(V('bit1'), A(V('cont'), VABS(V('exp')), V('r')), A(V('intL'), K2(V('exp')), V('r')))))) +out['m2'] = run('A-i with m=2 (rest bound)', Nm2) +# double dispatch with shared heads: A = \e. b cont intL (b VABS K2) +Ndd = L('bit1', A(V('intL'), L('exp', A(V('bit1'), V('cont'), V('intL'), A(V('bit1'), VABS(V('exp')), K2(V('exp'))))))) +out['double_dispatch'] = run('shared heads, 2nd dispatch', Ndd) +# A-c2 (continuation-headed A): \e \r. cont (b VABS (\z. e z (intL K r z))) (b r (intL F r)) +Nc2 = L('bit1', A(V('intL'), L('exp', 'r', A(V('cont'), + A(V('bit1'), VABS(V('exp')), L('z', A(V('exp'), V('z'), A(V('intL'), K, V('r'), V('z'))))), + A(V('bit1'), V('r'), A(V('intL'), F, V('r'))))))) +out['A_c2_lazy'] = run('A-c2: lazy 2nd parse', Nc2) +# eta-expanded APP continuation: \exp2 \r. cont LIFT r +Neta = L('bit1', A(V('intL'), L('exp', A(V('bit1'), A(V('cont'), VABS(V('exp'))), + A(V('intL'), L('exp2', 'r', A(V('cont'), LIFT(V('exp'), V('exp2')), V('r')))))))) +out['eta_app_cont'] = run('eta-expanded APP continuation', Neta) +# curried cell (25): \zx. zx (\n. arg) (\r. r args) +Ncur = L('bit1', A(V('intL'), L('exp', A(V('bit1'), + A(V('cont'), L('args', 'arg', A(V('exp'), L('zx', A(V('zx'), L('n', V('arg')), L('r', A(V('r'), V('args')))))))), + A(V('intL'), K2(V('exp'))))))) +out['curried_cell'] = run('curried cell (25)', Ncur) +json.dump(out, open('/Users/a9lim/Work/blam/tmp/overnight/next-proof/variants.json', 'w'), indent=1) diff --git a/data/self-interpreter/reasoning_floor/next-proof/tools/variants2.py b/data/self-interpreter/reasoning_floor/next-proof/tools/variants2.py new file mode 100644 index 00000000..5ee7fa24 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/next-proof/tools/variants2.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +"""Dispatch-first NEXT (shape D1) measured.""" +import sys, json +sys.path.insert(0, '/Users/a9lim/Work/blam/tools/self-interpreter') +from nt import * +import battery +cell = lambda: L('zx', 'zy', A(V('zx'), V('arg'), A(V('zy'), V('args')))) +VABS = lambda e: L('args', 'arg', A(e, cell())) +LIFT = lambda e, e2: L('args', A(e, V('args'), A(e2, V('args')))) +K2 = lambda e: L('exp2', A(V('cont'), LIFT(e, V('exp2')))) +KA = L('exp', A(V('cont'), VABS(V('exp')))) +KB = L('exp', A(V('intL'), K2(V('exp')))) +Nd1 = L('bit1', A(V('bit1'), A(V('intL'), KA), A(V('intL'), KB))) +E = E_db(Nd1); bits = lc.enc(E) +ok, skip, bad = battery.check(E, False, 18, threads=2) +print(f'dispatch-first D1: |N|={size(Nd1)} {len(bits)} bits ok={ok} skip={skip} fail={len(bad)}') From 33a9d8bf585ba4d3f03982cacf4304580a00b051 Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 07:57:02 -0400 Subject: [PATCH 36/41] Carry the 162's reader to int4: 175 -> 172 The four-primitive-code interpreter takes the reader unchanged, since a variable's code after its tag bit is still a unary 1...10 run. Battery --int4 667/1/0; letopt to three cuts finds nothing smaller. The fork's golf branch is left untouched for a9's decision. --- .../reasoning_floor/origin162/int4_172.lam | 10 ++++++++++ docs/STATUS.md | 10 +++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 data/self-interpreter/reasoning_floor/origin162/int4_172.lam diff --git a/data/self-interpreter/reasoning_floor/origin162/int4_172.lam b/data/self-interpreter/reasoning_floor/origin162/int4_172.lam new file mode 100644 index 00000000..98fcca41 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/origin162/int4_172.lam @@ -0,0 +1,10 @@ +-- int4 (four-primitive code: 00 lambda, 01 application, 10 variable zero, +-- 11 successor) with the 162's reader: 172 bits, against 175 on the fork's +-- golf branch. battery.py --int4: 172 bits ok=667 skip=1 fail=0; letopt to +-- three cuts finds nothing smaller. +(\x. x x) (\x. (\intL. \cont. \list. + list (\a. a) (\u. list (\q. cont) (list list u)) + (\bit1. intL (\exp. bit1 + (cont (\args \arg. exp (\zx \zy. zx arg (zy (\tag \l. l args))))) + (intL (\exp2. cont (\args. exp args (exp2 args))))))) + (x x)) diff --git a/docs/STATUS.md b/docs/STATUS.md index b8ffe4a9..4d0e639c 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -549,9 +549,13 @@ GHC 9.10.3; `uni.rs` with rustc), all three harnesses in 11 minutes: handwritten and 27 kernel-checked; the next steps are an application-sensitive charge for residual control (`remainder.md`), which no structural count supplies, and a formalization of residual tracing. - Carrying the 162's reader into int4, ko2kp, nf and pairup_Kp on the - fork's golf branch, and upstreaming the 162, 172 and 184 to tromp/AIT, - are a9's call (`contrib/PR_KIT.md` still describes the 165). + The 162's reader carries to int4 unchanged (175 → 172, battery `--int4` + 667/1/0, letopt-minimal; `reasoning_floor/origin162/int4_172.lam`). In + ko2kp, nf and pairup_Kp NEXT also references the outer `abs`/`app`, so + moving it under the stream binder pays two more index bits and the + saving shrinks to about one bit each; those need `blam golf check`. + Updating the fork's golf branch (and with it tromp/AIT#13) and the PR kit, + which still describes the 165, are a9's call. 10. **`blam uni` throughput:** within 4× of `uni.c` on byte streams. The next lever is allocation: a slab with index-based reference counts (or the open global-allocator decision) would remove most of malloc/free and the From a923af9493f82d43c1d15ea53e06162fbb020b78 Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 08:16:10 -0400 Subject: [PATCH 37/41] Archive the reader zoo: 44 bodies, 84 splices, nothing below 162 --- .../reasoning_floor/README.md | 5 + .../reasoning_floor/zoo/PROMPT.md | 33 + .../reasoning_floor/zoo/REPORT.md | 148 +++ .../reasoning_floor/zoo/artifacts.json | 530 ++++++++ .../candidates/01_reference165_inline162.lam | 1 + .../zoo/candidates/01_reference165_let165.lam | 1 + .../candidates/02_reference162_inline162.lam | 1 + .../zoo/candidates/02_reference162_let165.lam | 1 + .../candidates/03_reference164_inline162.lam | 1 + .../zoo/candidates/03_reference164_let165.lam | 1 + .../candidates/04_shared_return_inline162.lam | 1 + .../candidates/04_shared_return_let165.lam | 1 + .../candidates/05_bound_suffix_inline162.lam | 1 + .../zoo/candidates/05_bound_suffix_let165.lam | 1 + .../zoo/candidates/06_bit_force_inline162.lam | 1 + .../zoo/candidates/06_bit_force_let165.lam | 1 + .../07_cell_owned_return_inline162.lam | 1 + .../07_cell_owned_return_let165.lam | 1 + .../08_split_tail_handlers_inline162.lam | 1 + .../08_split_tail_handlers_let165.lam | 1 + .../09_tail_opens_return_inline162.lam | 1 + .../09_tail_opens_return_let165.lam | 1 + .../candidates/10_whole_reopen_inline162.lam | 1 + .../zoo/candidates/10_whole_reopen_let165.lam | 1 + .../candidates/11_tail_thunk_inline162.lam | 1 + .../zoo/candidates/11_tail_thunk_let165.lam | 1 + .../candidates/12_whole_thunk_inline162.lam | 1 + .../zoo/candidates/12_whole_thunk_let165.lam | 1 + .../13_thunk_rebind_tail_inline162.lam | 1 + .../13_thunk_rebind_tail_let165.lam | 1 + .../14_projected_diagonal_inline162.lam | 1 + .../14_projected_diagonal_let165.lam | 1 + .../15_predecessor_return_inline162.lam | 1 + .../15_predecessor_return_let165.lam | 1 + .../16_selected_cross_inline162.lam | 1 + .../candidates/16_selected_cross_let165.lam | 1 + .../zoo/candidates/17_tail_dual_inline162.lam | 1 + .../zoo/candidates/17_tail_dual_let165.lam | 1 + .../candidates/18_split_force_dual_let165.lam | 1 + .../19_bit_force_dual_inline162.lam | 1 + .../candidates/19_bit_force_dual_let165.lam | 1 + .../candidates/20_projected_dual_let165.lam | 1 + .../21_predecessor_dual_inline162.lam | 1 + .../candidates/21_predecessor_dual_let165.lam | 1 + .../22_pred_adaptive_handler_inline162.lam | 1 + .../22_pred_adaptive_handler_let165.lam | 1 + .../candidates/23_false_pred_inline162.lam | 1 + .../zoo/candidates/23_false_pred_let165.lam | 1 + .../candidates/24_reference57_inline162.lam | 1 + .../zoo/candidates/24_reference57_let165.lam | 1 + .../candidates/25_reference65_inline162.lam | 1 + .../zoo/candidates/25_reference65_let165.lam | 1 + .../26_projected_pred_inline162.lam | 1 + .../candidates/26_projected_pred_let165.lam | 1 + .../27_projection_dispatch_inline162.lam | 1 + .../27_projection_dispatch_let165.lam | 1 + .../28_projection_tail_return_inline162.lam | 1 + .../28_projection_tail_return_let165.lam | 1 + .../29_projection_pred_skip_inline162.lam | 1 + .../29_projection_pred_skip_let165.lam | 1 + .../30_projection_cross_skip_let165.lam | 1 + .../candidates/31_reboxed_tail_inline162.lam | 1 + .../zoo/candidates/31_reboxed_tail_let165.lam | 1 + .../32_projected_rebox_inline162.lam | 1 + .../candidates/32_projected_rebox_let165.lam | 1 + .../33_function_operand_inline162.lam | 1 + .../candidates/33_function_operand_let165.lam | 1 + .../34_callable_suffix_inline162.lam | 1 + .../candidates/34_callable_suffix_let165.lam | 1 + .../candidates/35_cps_suffix_inline162.lam | 1 + .../zoo/candidates/35_cps_suffix_let165.lam | 1 + .../candidates/36_pair_operand_inline162.lam | 1 + .../zoo/candidates/36_pair_operand_let165.lam | 1 + .../37_diagonal_callback_inline162.lam | 1 + .../37_diagonal_callback_let165.lam | 1 + .../38_tail_supplied_force_inline162.lam | 1 + .../38_tail_supplied_force_let165.lam | 1 + .../39_selector_packet_inline162.lam | 1 + .../candidates/39_selector_packet_let165.lam | 1 + .../candidates/40_action_packet_inline162.lam | 1 + .../candidates/40_action_packet_let165.lam | 1 + .../candidates/41_cps_packet_inline162.lam | 1 + .../zoo/candidates/41_cps_packet_let165.lam | 1 + .../42_reverse_packet_inline162.lam | 1 + .../candidates/42_reverse_packet_let165.lam | 1 + .../43_constant_var_return_inline162.lam | 1 + .../43_constant_var_return_let165.lam | 1 + .../44_constant_zero_return_let165.lam | 1 + .../zoo/candidates/tmp0zan7uz_.blc | 1 + .../zoo/candidates/tmp1zyf8eh0.blc | 1 + .../zoo/candidates/tmp228xtoy6.blc | 1 + .../zoo/candidates/tmp3uq_dlap.blc | 1 + .../zoo/candidates/tmp4qsffwc3.blc | 1 + .../zoo/candidates/tmp4ww6p3xr.blc | 1 + .../reasoning_floor/zoo/collect.py | 76 ++ .../zoo/optimized/01_reference165.blc | 1 + .../zoo/optimized/01_reference165.lam | 1 + .../zoo/optimized/02_reference162.blc | 1 + .../zoo/optimized/02_reference162.lam | 1 + .../zoo/optimized/03_reference164.blc | 1 + .../zoo/optimized/03_reference164.lam | 1 + .../zoo/optimized/04_shared_return.blc | 1 + .../zoo/optimized/04_shared_return.lam | 1 + .../zoo/optimized/05_bound_suffix.blc | 1 + .../zoo/optimized/05_bound_suffix.lam | 1 + .../zoo/optimized/06_bit_force.blc | 1 + .../zoo/optimized/06_bit_force.lam | 1 + .../zoo/optimized/07_cell_owned_return.blc | 1 + .../zoo/optimized/07_cell_owned_return.lam | 1 + .../zoo/optimized/08_split_tail_handlers.blc | 1 + .../zoo/optimized/08_split_tail_handlers.lam | 1 + .../zoo/optimized/09_tail_opens_return.blc | 1 + .../zoo/optimized/09_tail_opens_return.lam | 1 + .../zoo/optimized/10_whole_reopen.blc | 1 + .../zoo/optimized/10_whole_reopen.lam | 1 + .../zoo/optimized/11_tail_thunk.blc | 1 + .../zoo/optimized/11_tail_thunk.lam | 1 + .../zoo/optimized/12_whole_thunk.blc | 1 + .../zoo/optimized/12_whole_thunk.lam | 1 + .../zoo/optimized/13_thunk_rebind_tail.blc | 1 + .../zoo/optimized/13_thunk_rebind_tail.lam | 1 + .../zoo/optimized/14_projected_diagonal.blc | 1 + .../zoo/optimized/14_projected_diagonal.lam | 1 + .../zoo/optimized/15_predecessor_return.blc | 1 + .../zoo/optimized/15_predecessor_return.lam | 1 + .../zoo/optimized/16_selected_cross.blc | 1 + .../zoo/optimized/16_selected_cross.lam | 1 + .../zoo/optimized/17_tail_dual.blc | 1 + .../zoo/optimized/17_tail_dual.lam | 1 + .../zoo/optimized/18_split_force_dual.blc | 1 + .../zoo/optimized/18_split_force_dual.lam | 1 + .../zoo/optimized/19_bit_force_dual.blc | 1 + .../zoo/optimized/19_bit_force_dual.lam | 1 + .../zoo/optimized/20_projected_dual.blc | 1 + .../zoo/optimized/20_projected_dual.lam | 1 + .../zoo/optimized/21_predecessor_dual.blc | 1 + .../zoo/optimized/21_predecessor_dual.lam | 1 + .../optimized/22_pred_adaptive_handler.blc | 1 + .../optimized/22_pred_adaptive_handler.lam | 1 + .../zoo/optimized/23_false_pred.blc | 1 + .../zoo/optimized/23_false_pred.lam | 1 + .../zoo/optimized/24_reference57.blc | 1 + .../zoo/optimized/24_reference57.lam | 1 + .../zoo/optimized/25_reference65.blc | 1 + .../zoo/optimized/25_reference65.lam | 1 + .../zoo/optimized/26_projected_pred.blc | 1 + .../zoo/optimized/26_projected_pred.lam | 1 + .../zoo/optimized/27_projection_dispatch.blc | 1 + .../zoo/optimized/27_projection_dispatch.lam | 1 + .../optimized/28_projection_tail_return.blc | 1 + .../optimized/28_projection_tail_return.lam | 1 + .../zoo/optimized/29_projection_pred_skip.blc | 1 + .../zoo/optimized/29_projection_pred_skip.lam | 1 + .../optimized/30_projection_cross_skip.blc | 1 + .../optimized/30_projection_cross_skip.lam | 1 + .../zoo/optimized/31_reboxed_tail.blc | 1 + .../zoo/optimized/31_reboxed_tail.lam | 1 + .../zoo/optimized/32_projected_rebox.blc | 1 + .../zoo/optimized/32_projected_rebox.lam | 1 + .../zoo/optimized/33_function_operand.blc | 1 + .../zoo/optimized/33_function_operand.lam | 1 + .../zoo/optimized/34_callable_suffix.blc | 1 + .../zoo/optimized/34_callable_suffix.lam | 1 + .../zoo/optimized/35_cps_suffix.blc | 1 + .../zoo/optimized/35_cps_suffix.lam | 1 + .../zoo/optimized/36_pair_operand.blc | 1 + .../zoo/optimized/36_pair_operand.lam | 1 + .../zoo/optimized/37_diagonal_callback.blc | 1 + .../zoo/optimized/37_diagonal_callback.lam | 1 + .../zoo/optimized/38_tail_supplied_force.blc | 1 + .../zoo/optimized/38_tail_supplied_force.lam | 1 + .../zoo/optimized/39_selector_packet.blc | 1 + .../zoo/optimized/39_selector_packet.lam | 1 + .../zoo/optimized/40_action_packet.blc | 1 + .../zoo/optimized/40_action_packet.lam | 1 + .../zoo/optimized/41_cps_packet.blc | 1 + .../zoo/optimized/41_cps_packet.lam | 1 + .../zoo/optimized/42_reverse_packet.blc | 1 + .../zoo/optimized/42_reverse_packet.lam | 1 + .../zoo/optimized/43_constant_var_return.blc | 1 + .../zoo/optimized/43_constant_var_return.lam | 1 + .../zoo/optimized/44_constant_zero_return.blc | 1 + .../zoo/optimized/44_constant_zero_return.lam | 1 + .../reasoning_floor/zoo/report.py | 175 +++ .../reasoning_floor/zoo/run_polish.py | 53 + .../reasoning_floor/zoo/zoo.json | 1126 +++++++++++++++++ .../reasoning_floor/zoo/zoo.py | 193 +++ 187 files changed, 2517 insertions(+) create mode 100644 data/self-interpreter/reasoning_floor/zoo/PROMPT.md create mode 100644 data/self-interpreter/reasoning_floor/zoo/REPORT.md create mode 100644 data/self-interpreter/reasoning_floor/zoo/artifacts.json create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/01_reference165_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/01_reference165_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/02_reference162_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/02_reference162_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/03_reference164_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/03_reference164_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/04_shared_return_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/04_shared_return_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/05_bound_suffix_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/05_bound_suffix_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/06_bit_force_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/06_bit_force_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/07_cell_owned_return_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/07_cell_owned_return_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/08_split_tail_handlers_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/08_split_tail_handlers_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/09_tail_opens_return_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/09_tail_opens_return_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/10_whole_reopen_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/10_whole_reopen_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/11_tail_thunk_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/11_tail_thunk_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/12_whole_thunk_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/12_whole_thunk_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/13_thunk_rebind_tail_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/13_thunk_rebind_tail_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/14_projected_diagonal_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/14_projected_diagonal_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/15_predecessor_return_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/15_predecessor_return_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/16_selected_cross_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/16_selected_cross_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/17_tail_dual_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/17_tail_dual_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/18_split_force_dual_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/19_bit_force_dual_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/19_bit_force_dual_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/20_projected_dual_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/21_predecessor_dual_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/21_predecessor_dual_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/22_pred_adaptive_handler_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/22_pred_adaptive_handler_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/23_false_pred_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/23_false_pred_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/24_reference57_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/24_reference57_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/25_reference65_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/25_reference65_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/26_projected_pred_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/26_projected_pred_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/27_projection_dispatch_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/27_projection_dispatch_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/28_projection_tail_return_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/28_projection_tail_return_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/29_projection_pred_skip_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/29_projection_pred_skip_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/30_projection_cross_skip_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/31_reboxed_tail_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/31_reboxed_tail_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/32_projected_rebox_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/32_projected_rebox_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/33_function_operand_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/33_function_operand_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/34_callable_suffix_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/34_callable_suffix_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/35_cps_suffix_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/35_cps_suffix_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/36_pair_operand_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/36_pair_operand_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/37_diagonal_callback_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/37_diagonal_callback_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/38_tail_supplied_force_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/38_tail_supplied_force_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/39_selector_packet_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/39_selector_packet_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/40_action_packet_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/40_action_packet_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/41_cps_packet_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/41_cps_packet_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/42_reverse_packet_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/42_reverse_packet_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/43_constant_var_return_inline162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/43_constant_var_return_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/44_constant_zero_return_let165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/tmp0zan7uz_.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/tmp1zyf8eh0.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/tmp228xtoy6.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/tmp3uq_dlap.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/tmp4qsffwc3.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/candidates/tmp4ww6p3xr.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/collect.py create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/01_reference165.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/01_reference165.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/02_reference162.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/02_reference162.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/03_reference164.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/03_reference164.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/04_shared_return.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/04_shared_return.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/05_bound_suffix.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/05_bound_suffix.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/06_bit_force.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/06_bit_force.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/07_cell_owned_return.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/07_cell_owned_return.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/08_split_tail_handlers.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/08_split_tail_handlers.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/09_tail_opens_return.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/09_tail_opens_return.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/10_whole_reopen.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/10_whole_reopen.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/11_tail_thunk.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/11_tail_thunk.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/12_whole_thunk.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/12_whole_thunk.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/13_thunk_rebind_tail.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/13_thunk_rebind_tail.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/14_projected_diagonal.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/14_projected_diagonal.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/15_predecessor_return.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/15_predecessor_return.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/16_selected_cross.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/16_selected_cross.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/17_tail_dual.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/17_tail_dual.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/18_split_force_dual.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/18_split_force_dual.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/19_bit_force_dual.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/19_bit_force_dual.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/20_projected_dual.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/20_projected_dual.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/21_predecessor_dual.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/21_predecessor_dual.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/22_pred_adaptive_handler.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/22_pred_adaptive_handler.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/23_false_pred.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/23_false_pred.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/24_reference57.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/24_reference57.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/25_reference65.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/25_reference65.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/26_projected_pred.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/26_projected_pred.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/27_projection_dispatch.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/27_projection_dispatch.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/28_projection_tail_return.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/28_projection_tail_return.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/29_projection_pred_skip.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/29_projection_pred_skip.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/30_projection_cross_skip.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/30_projection_cross_skip.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/31_reboxed_tail.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/31_reboxed_tail.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/32_projected_rebox.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/32_projected_rebox.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/33_function_operand.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/33_function_operand.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/34_callable_suffix.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/34_callable_suffix.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/35_cps_suffix.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/35_cps_suffix.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/36_pair_operand.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/36_pair_operand.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/37_diagonal_callback.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/37_diagonal_callback.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/38_tail_supplied_force.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/38_tail_supplied_force.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/39_selector_packet.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/39_selector_packet.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/40_action_packet.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/40_action_packet.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/41_cps_packet.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/41_cps_packet.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/42_reverse_packet.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/42_reverse_packet.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/43_constant_var_return.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/43_constant_var_return.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/44_constant_zero_return.blc create mode 100644 data/self-interpreter/reasoning_floor/zoo/optimized/44_constant_zero_return.lam create mode 100644 data/self-interpreter/reasoning_floor/zoo/report.py create mode 100644 data/self-interpreter/reasoning_floor/zoo/run_polish.py create mode 100644 data/self-interpreter/reasoning_floor/zoo/zoo.json create mode 100644 data/self-interpreter/reasoning_floor/zoo/zoo.py diff --git a/data/self-interpreter/reasoning_floor/README.md b/data/self-interpreter/reasoning_floor/README.md index 0fabf191..a44c2e29 100644 --- a/data/self-interpreter/reasoning_floor/README.md +++ b/data/self-interpreter/reasoning_floor/README.md @@ -54,3 +54,8 @@ forced to `λy λa. e W` and the lift to `λz. e Y₀ (e₂ Y₁)` (≥ 19), via extraction lemma that uses Ω to pin output shapes; NEXT ≥ 92 on the 165's skeleton under normality and the uniform cell interface; dispatch-first ≥ 99; an exact residual list. +`zoo` (Codex): 44 hand-reasoned reader bodies in 18 families (shared +suffixes, dual operands, conditional predecessors, projected Booleans, +callback and packet operands, constant-stream returns), 836 reader-law +probes, 84 complete splices into the 165 and 162 frames, all correct; best +renderings 162 and 164 (the known ones), the rest 165–229. diff --git a/data/self-interpreter/reasoning_floor/zoo/PROMPT.md b/data/self-interpreter/reasoning_floor/zoo/PROMPT.md new file mode 100644 index 00000000..f86b2733 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/PROMPT.md @@ -0,0 +1,33 @@ +Lane "zoo": below 162 by the method that found the 162. Lane directory: +/Users/a9lim/Work/blam/tmp/overnight/zoo/ (write only there). + +Read first: docs/classical/self-interpreter/interpreter.md §1–§3 (now about +the 162-bit record) and data/self-interpreter/reasoning_floor/README.md. + +How the 162 was found: a reviewer refuting a proof built a VALID 44-bit reader +body (a counterexample witness) for the 165's frame — `s I (λu. s (λq. cont) +(s s u)) next`. Spliced into the 165 it gave a 166; `blam golf letopt` then +inlined NEXT into the reader's operand slot and produced 162. Splicing every +other witness reader of the night gave a 164 (`list (λb. b F cont) (list I +(list list) NEXT)`) and 167–198. Reader *bodies* that look worse in isolation +can become better after letopt rearranges lets around them. + +Your job: generate, by reasoning about the stream algebra, a ZOO of genuinely +different valid reader bodies and second-stage objects — not variations on +one idea — then splice each into the 165's frame + (\x. x x) (\x. (\intL. \cont. (\next. \list. BODY) NEXT) (x x)) + NEXT = (\bit1. intL (\exp. bit1 (cont (\args \arg. exp (\zx \zy. zx arg (zy args)))) (intL (\exp2. cont (\args. exp args (exp2 args)))))) +and into the 162's frame where it makes sense, and run +`python3 tools/self-interpreter/polish.py FILE.lam` on each (battery + letopt, +~10–20 s). A body is valid when B[cons K R/s] →* R next and +B[1ⁿ0 ++ N/s] →* cont (1ⁿ⁻¹0 ++ N) N; check that with a small normalizer +before splicing. Useful identities (interpreter.md §2, reasoning_floor): +s s →* K r' (rest after the whole stream's first 0); s I = b r (the cell's +own selection); s K = b; s F = r; cons b r (cons d t) = b d t r; U_{i+1}U_{j+1} += U_j U_i; s (λx. x x) is a conditional predecessor; R(K(K X)) = X. Favour +bodies where some piece is right for both branches, or where an operand is +used by one branch and erased by the other, or where NEXT/next appears once +(letopt can then inline it). Aim for 30–60 distinct bodies, each reasoned, +not enumerated; no sweeps, ≤ 2 threads, nothing over ~2 minutes. Report a +table (body, isolated size, interpreter size, polished size, battery line), +and lead with any sub-162 (file + battery line). Write REPORT.md. diff --git a/data/self-interpreter/reasoning_floor/zoo/REPORT.md b/data/self-interpreter/reasoning_floor/zoo/REPORT.md new file mode 100644 index 00000000..379567c0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/REPORT.md @@ -0,0 +1,148 @@ +**No sub-162 interpreter found.** The complete zoo has 44 hand-written reader bodies in 18 organizational families, 44 distinct open beta-normal forms, 836 successful rigid reader-law probes, and 84 complete interpreter splices. Every splice passed `ok=667 skip=1 fail=0`. Every smallest rendering listed below has a saved wire artifact with that same battery result. The 162 and 164 controls were reproduced; none of the other constructions improved them. + +The best artifact is [optimized/02_reference162.blc](optimized/02_reference162.blc), with [lambda source](optimized/02_reference162.lam): **`162 bits ok=667 skip=1 fail=0`**. It is the already known record, not a new interpreter. The dual-operand control is [optimized/03_reference164.blc](optimized/03_reference164.blc): **`164 bits ok=667 skip=1 fail=0`**. + +The constructions cover shared suffixes, separately selected tail handlers, input-owned output applications, NEXT-last thunks, unequal-role cross applications, dual operands, conditional predecessors, projected Booleans, rebuilt Scott cells, ordinary/CPS/pair callback operands, self-applied callbacks, selector/action/CPS packets, and constant streams as return instructions. Related variants are grouped explicitly; beta-normal distinctness alone is not being used as a claim of architectural novelty. Rows 01–03, 11, 24–25 and the relevant callback/reboxing mechanisms have antecedents in the supplied record and are useful reference points. No claim of global originality is made for the other individual syntax trees. + +**Conventions and measured table.** `s = list`, `c = cont`, `I = λa.a`, `K = λa b.a`, `F = λa b.b`, `D = λa.a a`. Every macro is expanded before counting. `RDR = λt.t (λb.b (λu r.r next) c) (t t t)` is the 165 reader as a function. The isolated body is counted in the exact frame `[s, next, c, intL, x]`. The `let165` column keeps NEXT let-bound, hence its raw size is the isolated size plus 122. The `inline162` column substitutes the complete fixed NEXT under `λs`. This frame is included when the body has one occurrence of `next`; four bodies with two occurrences retain only their let frame. Each raw-size link is its complete `.lam` candidate; each polished-size link is the unmodified `polish.py` log. + +| ID | Body | Isolated bits | Raw let165 / inline162 | Polished let165 / inline162 | Smallest saved artifact and battery | +|---|---|---:|---|---|---| +| 01_reference165 | `s (λb.b (λu λr.r next) c) (s s s)` | 43 | [165](candidates/01_reference165_let165.lam) / [170](candidates/01_reference165_inline162.lam) | [165](logs/01_reference165_let165.log) / [165](logs/01_reference165_inline162.log) | [165 bits; ok=667 skip=1 fail=0](optimized/01_reference165.blc) | +| 02_reference162 | `s I (λu.s (λq.c) (s s u)) next` | 44 | [166](candidates/02_reference162_let165.lam) / [162](candidates/02_reference162_inline162.lam) | [162](logs/02_reference162_let165.log) / [162](logs/02_reference162_inline162.log) | [162 bits; ok=667 skip=1 fail=0](optimized/02_reference162.blc) | +| 03_reference164 | `s (λb.b F c) (s I (s s) next)` | 46 | [168](candidates/03_reference164_let165.lam) / [164](candidates/03_reference164_inline162.lam) | [164](logs/03_reference164_let165.log) / [164](logs/03_reference164_inline162.log) | [164 bits; ok=667 skip=1 fail=0](optimized/03_reference164.blc) | +| 04_shared_return | `s (λb λr.b (λt.t next) (c r)) (s s s)` | 49 | [171](candidates/04_shared_return_let165.lam) / [176](candidates/04_shared_return_inline162.lam) | [171](logs/04_shared_return_let165.log) / [171](logs/04_shared_return_inline162.log) | [171 bits; ok=667 skip=1 fail=0](optimized/04_shared_return.blc) | +| 05_bound_suffix | `s (λb λr λt.b (t next) (c r t)) (s s s)` | 56 | [178](candidates/05_bound_suffix_let165.lam) / [183](candidates/05_bound_suffix_inline162.lam) | [178](logs/05_bound_suffix_let165.log) / [178](logs/05_bound_suffix_inline162.log) | [178 bits; ok=667 skip=1 fail=0](optimized/05_bound_suffix.blc) | +| 06_bit_force | `s (λb λr.b (r next) (c r (s s b)))` | 51 | [173](candidates/06_bit_force_let165.lam) / [175](candidates/06_bit_force_inline162.lam) | [173](logs/06_bit_force_let165.log) / [173](logs/06_bit_force_inline162.log) | [173 bits; ok=667 skip=1 fail=0](optimized/06_bit_force.blc) | +| 07_cell_owned_return | `s (λb λr.b (r next) (s (λq.c) (r r b)))` | 52 | [174](candidates/07_cell_owned_return_let165.lam) / [176](candidates/07_cell_owned_return_inline162.lam) | [174](logs/07_cell_owned_return_let165.log) / [174](logs/07_cell_owned_return_inline162.log) | [174 bits; ok=667 skip=1 fail=0](optimized/07_cell_owned_return.blc) | +| 08_split_tail_handlers | `s (λb.b (λr.r next) (λr.c r (r r r)))` | 47 | [169](candidates/08_split_tail_handlers_let165.lam) / [171](candidates/08_split_tail_handlers_inline162.lam) | [169](logs/08_split_tail_handlers_let165.log) / [169](logs/08_split_tail_handlers_inline162.log) | [169 bits; ok=667 skip=1 fail=0](optimized/08_split_tail_handlers.blc) | +| 09_tail_opens_return | `s (λb λr.b (r next) (r (λq λt.c r) (r r r)))` | 58 | [180](candidates/09_tail_opens_return_let165.lam) / [182](candidates/09_tail_opens_return_inline162.lam) | [180](logs/09_tail_opens_return_let165.log) / [180](logs/09_tail_opens_return_inline162.log) | [180 bits; ok=667 skip=1 fail=0](optimized/09_tail_opens_return.blc) | +| 10_whole_reopen | `s (λb λr.b (r next) (s (λq.c) (s s s)))` | 57 | [179](candidates/10_whole_reopen_let165.lam) / [181](candidates/10_whole_reopen_inline162.lam) | [179](logs/10_whole_reopen_let165.log) / [179](logs/10_whole_reopen_inline162.log) | [179 bits; ok=667 skip=1 fail=0](optimized/10_whole_reopen.blc) | +| 11_tail_thunk | `s (λb λr.b r (λu.c r (r r u))) next` | 50 | [172](candidates/11_tail_thunk_let165.lam) / [168](candidates/11_tail_thunk_inline162.lam) | [168](logs/11_tail_thunk_let165.log) / [168](logs/11_tail_thunk_inline162.log) | [168 bits; ok=667 skip=1 fail=0](optimized/11_tail_thunk.blc) | +| 12_whole_thunk | `s (λb λr.b r (λu.s (λq.c) (s s u))) next` | 59 | [181](candidates/12_whole_thunk_let165.lam) / [177](candidates/12_whole_thunk_inline162.lam) | [177](logs/12_whole_thunk_let165.log) / [177](logs/12_whole_thunk_inline162.log) | [177 bits; ok=667 skip=1 fail=0](optimized/12_whole_thunk.blc) | +| 13_thunk_rebind_tail | `s I (λu.s (λb λr.c r (r r u))) next` | 51 | [173](candidates/13_thunk_rebind_tail_let165.lam) / [169](candidates/13_thunk_rebind_tail_inline162.lam) | [169](logs/13_thunk_rebind_tail_let165.log) / [169](logs/13_thunk_rebind_tail_inline162.log) | [169 bits; ok=667 skip=1 fail=0](optimized/13_thunk_rebind_tail.blc) | +| 14_projected_diagonal | `s I (λu.s (λq.c) ((s F) (s F) u)) next` | 60 | [182](candidates/14_projected_diagonal_let165.lam) / [178](candidates/14_projected_diagonal_inline162.lam) | [175](logs/14_projected_diagonal_let165.log) / [175](logs/14_projected_diagonal_inline162.log) | [175 bits; ok=667 skip=1 fail=0](optimized/14_projected_diagonal.blc) | +| 15_predecessor_return | `s I (λu.(s D) (λq λr.s (λa.c)) (s s u)) next` | 67 | [189](candidates/15_predecessor_return_let165.lam) / [185](candidates/15_predecessor_return_inline162.lam) | [185](logs/15_predecessor_return_let165.log) / [185](logs/15_predecessor_return_inline162.log) | [185 bits; ok=667 skip=1 fail=0](optimized/15_predecessor_return.blc) | +| 16_selected_cross | `s I (λu.s (λq.c) (s (s I s) u)) next` | 55 | [177](candidates/16_selected_cross_let165.lam) / [173](candidates/16_selected_cross_inline162.lam) | [173](logs/16_selected_cross_let165.log) / [173](logs/16_selected_cross_inline162.log) | [173 bits; ok=667 skip=1 fail=0](optimized/16_selected_cross.blc) | +| 17_tail_dual | `s (λb.b F c) (s (λb λr.b r (r r)) next)` | 53 | [175](candidates/17_tail_dual_let165.lam) / [171](candidates/17_tail_dual_inline162.lam) | [171](logs/17_tail_dual_let165.log) / [171](logs/17_tail_dual_inline162.log) | [171 bits; ok=667 skip=1 fail=0](optimized/17_tail_dual.blc) | +| 18_split_force_dual | `s (λb.b F c) (s (λb λr.b (r next) (r r next)))` | 62 | [184](candidates/18_split_force_dual_let165.lam) / — | [184](logs/18_split_force_dual_let165.log) / — | [184 bits; ok=667 skip=1 fail=0](optimized/18_split_force_dual.blc) | +| 19_bit_force_dual | `s (λb.b F c) (s (λb λr.b (r next) (s s b)))` | 64 | [186](candidates/19_bit_force_dual_let165.lam) / [188](candidates/19_bit_force_dual_inline162.lam) | [186](logs/19_bit_force_dual_let165.log) / [186](logs/19_bit_force_dual_inline162.log) | [186 bits; ok=667 skip=1 fail=0](optimized/19_bit_force_dual.blc) | +| 20_projected_dual | `s (λb.b F c) ((s K) ((s F) next) (s s next))` | 66 | [188](candidates/20_projected_dual_let165.lam) / — | [188](logs/20_projected_dual_let165.log) / — | [188 bits; ok=667 skip=1 fail=0](optimized/20_projected_dual.blc) | +| 21_predecessor_dual | `s (λb.b F c) (s I ((s D) (s D)) next)` | 66 | [188](candidates/21_predecessor_dual_let165.lam) / [184](candidates/21_predecessor_dual_inline162.lam) | [180](logs/21_predecessor_dual_let165.log) / [180](logs/21_predecessor_dual_inline162.log) | [180 bits; ok=667 skip=1 fail=0](optimized/21_predecessor_dual.blc) | +| 22_pred_adaptive_handler | `s D (s (λb λr.b (r next) (λq λt.c r))) (s s s)` | 68 | [190](candidates/22_pred_adaptive_handler_let165.lam) / [192](candidates/22_pred_adaptive_handler_inline162.lam) | [190](logs/22_pred_adaptive_handler_let165.log) / [190](logs/22_pred_adaptive_handler_inline162.log) | [190 bits; ok=667 skip=1 fail=0](optimized/22_pred_adaptive_handler.blc) | +| 23_false_pred | `s (λb.b F) (λq λt.s (λa.c)) (s I (s s) next)` | 60 | [182](candidates/23_false_pred_let165.lam) / [178](candidates/23_false_pred_inline162.lam) | [178](logs/23_false_pred_let165.log) / [178](logs/23_false_pred_inline162.log) | [178 bits; ok=667 skip=1 fail=0](optimized/23_false_pred.blc) | +| 24_reference57 | `s (λb.b (λu λr.r next)) (λq λt.s (λa.c)) (s s s)` | 57 | [179](candidates/24_reference57_let165.lam) / [184](candidates/24_reference57_inline162.lam) | [179](logs/24_reference57_let165.log) / [179](logs/24_reference57_inline162.log) | [179 bits; ok=667 skip=1 fail=0](optimized/24_reference57.blc) | +| 25_reference65 | `s (λb λr.s b (b (r next) (λq λt.c r))) (s s s)` | 65 | [187](candidates/25_reference65_let165.lam) / [189](candidates/25_reference65_inline162.lam) | [187](logs/25_reference65_let165.log) / [187](logs/25_reference65_inline162.log) | [187 bits; ok=667 skip=1 fail=0](optimized/25_reference65.blc) | +| 26_projected_pred | `s (s K) (s (λb λr.b (r next) (λq λt.c r))) (s s s)` | 71 | [193](candidates/26_projected_pred_let165.lam) / [195](candidates/26_projected_pred_inline162.lam) | [193](logs/26_projected_pred_let165.log) / [193](logs/26_projected_pred_inline162.log) | [193 bits; ok=667 skip=1 fail=0](optimized/26_projected_pred.blc) | +| 27_projection_dispatch | `(s K) ((s F) next) (s (λq.c) (s s s))` | 53 | [175](candidates/27_projection_dispatch_let165.lam) / [171](candidates/27_projection_dispatch_inline162.lam) | [171](logs/27_projection_dispatch_let165.log) / [171](logs/27_projection_dispatch_inline162.log) | [171 bits; ok=667 skip=1 fail=0](optimized/27_projection_dispatch.blc) | +| 28_projection_tail_return | `(s K) ((s F) next) ((s F) (λb λr.c (s F)) (s s s))` | 78 | [200](candidates/28_projection_tail_return_let165.lam) / [196](candidates/28_projection_tail_return_inline162.lam) | [195](logs/28_projection_tail_return_let165.log) / [195](logs/28_projection_tail_return_inline162.log) | [195 bits; ok=667 skip=1 fail=0](optimized/28_projection_tail_return.blc) | +| 29_projection_pred_skip | `(s K) ((s F) next) (s (λq.c) ((s D) (s D) s))` | 73 | [195](candidates/29_projection_pred_skip_let165.lam) / [191](candidates/29_projection_pred_skip_inline162.lam) | [187](logs/29_projection_pred_skip_let165.log) / [187](logs/29_projection_pred_skip_inline162.log) | [187 bits; ok=667 skip=1 fail=0](optimized/29_projection_pred_skip.blc) | +| 30_projection_cross_skip | `(s K) ((s F) next) (s (λq.c) (s (s I s) next))` | 64 | [186](candidates/30_projection_cross_skip_let165.lam) / — | [186](logs/30_projection_cross_skip_let165.log) / — | [186 bits; ok=667 skip=1 fail=0](optimized/30_projection_cross_skip.blc) | +| 31_reboxed_tail | `s (λb λr.b (r next) (c (λh.s (λq λt.t h)) (r r r)))` | 65 | [187](candidates/31_reboxed_tail_let165.lam) / [189](candidates/31_reboxed_tail_inline162.lam) | [187](logs/31_reboxed_tail_let165.log) / [187](logs/31_reboxed_tail_inline162.log) | [187 bits; ok=667 skip=1 fail=0](optimized/31_reboxed_tail.blc) | +| 32_projected_rebox | `s (λb λr.b (r next) (c (s (λq λt.λh.h (t K) (t F))) (r r r)))` | 85 | [207](candidates/32_projected_rebox_let165.lam) / [209](candidates/32_projected_rebox_inline162.lam) | [207](logs/32_projected_rebox_let165.log) / [207](logs/32_projected_rebox_inline162.log) | [207 bits; ok=667 skip=1 fail=0](optimized/32_projected_rebox.blc) | +| 33_function_operand | `s (λb λr λf.b (r next) (f r)) (λr.c r (r r r))` | 61 | [183](candidates/33_function_operand_let165.lam) / [188](candidates/33_function_operand_inline162.lam) | [183](logs/33_function_operand_let165.log) / [183](logs/33_function_operand_inline162.log) | [183 bits; ok=667 skip=1 fail=0](optimized/33_function_operand.blc) | +| 34_callable_suffix | `s (λb λr λf.b ((f s) next) (c r (f s))) (s s)` | 66 | [188](candidates/34_callable_suffix_let165.lam) / [193](candidates/34_callable_suffix_inline162.lam) | [188](logs/34_callable_suffix_let165.log) / [188](logs/34_callable_suffix_inline162.log) | [188 bits; ok=667 skip=1 fail=0](optimized/34_callable_suffix.blc) | +| 35_cps_suffix | `s (λb λr λf.b (f (λt.t next)) (f (c r))) (λk.k (s s s))` | 72 | [194](candidates/35_cps_suffix_let165.lam) / [202](candidates/35_cps_suffix_inline162.lam) | [194](logs/35_cps_suffix_let165.log) / [194](logs/35_cps_suffix_inline162.log) | [194 bits; ok=667 skip=1 fail=0](optimized/35_cps_suffix.blc) | +| 36_pair_operand | `s (λb λr λp.b (p (λa λt.a next)) (p c)) (λf.f (s F) (s s s))` | 84 | [206](candidates/36_pair_operand_let165.lam) / [217](candidates/36_pair_operand_inline162.lam) | [206](logs/36_pair_operand_let165.log) / [206](logs/36_pair_operand_inline162.log) | [206 bits; ok=667 skip=1 fail=0](optimized/36_pair_operand.blc) | +| 37_diagonal_callback | `s (λb λr λf.b (r next) (f f r)) (λf λr.c r (r r f))` | 69 | [191](candidates/37_diagonal_callback_let165.lam) / [196](candidates/37_diagonal_callback_inline162.lam) | [191](logs/37_diagonal_callback_let165.log) / [191](logs/37_diagonal_callback_inline162.log) | [191 bits; ok=667 skip=1 fail=0](optimized/37_diagonal_callback.blc) | +| 38_tail_supplied_force | `s (λb λr λf.b (r next) (r f r)) (λd λt λr.c r (r r d))` | 74 | [196](candidates/38_tail_supplied_force_let165.lam) / [201](candidates/38_tail_supplied_force_inline162.lam) | [196](logs/38_tail_supplied_force_let165.log) / [196](logs/38_tail_supplied_force_inline162.log) | [196 bits; ok=667 skip=1 fail=0](optimized/38_tail_supplied_force.blc) | +| 39_selector_packet | `s (λb λr λt.b (r (t b)) (t b r (r r t))) (λb.b next c)` | 77 | [199](candidates/39_selector_packet_let165.lam) / [198](candidates/39_selector_packet_inline162.lam) | [198](logs/39_selector_packet_let165.log) / [198](logs/39_selector_packet_inline162.log) | [198 bits; ok=667 skip=1 fail=0](optimized/39_selector_packet.blc) | +| 40_action_packet | `s (λb λr λt.b (t b r) (t b r (r r t))) (λb.b (λr.r next) c)` | 84 | [206](candidates/40_action_packet_let165.lam) / [208](candidates/40_action_packet_inline162.lam) | [206](logs/40_action_packet_let165.log) / [206](logs/40_action_packet_inline162.log) | [206 bits; ok=667 skip=1 fail=0](optimized/40_action_packet.blc) | +| 41_cps_packet | `s (λb λr λt.t b (b (λu.r u) (λu.u r (r r b)))) (λb λf.f (b next c))` | 95 | [217](candidates/41_cps_packet_let165.lam) / [219](candidates/41_cps_packet_inline162.lam) | [217](logs/41_cps_packet_let165.log) / [217](logs/41_cps_packet_inline162.log) | [217 bits; ok=667 skip=1 fail=0](optimized/41_cps_packet.blc) | +| 42_reverse_packet | `s (λb λr λt.b (r (t F)) (t K r (r r t))) (λa.a c next)` | 82 | [204](candidates/42_reverse_packet_let165.lam) / [203](candidates/42_reverse_packet_inline162.lam) | [203](logs/42_reverse_packet_let165.log) / [203](logs/42_reverse_packet_inline162.log) | [203 bits; ok=667 skip=1 fail=0](optimized/42_reverse_packet.blc) | +| 43_constant_var_return | `(λread.read (s (λb λr.b s (λu λv.c r (r r r))))) RDR` | 113 | [235](candidates/43_constant_var_return_let165.lam) / [242](candidates/43_constant_var_return_inline162.lam) | [229](logs/43_constant_var_return_let165.log) / [229](logs/43_constant_var_return_inline162.log) | [229 bits; ok=667 skip=1 fail=0](optimized/43_constant_var_return.blc) | +| 44_constant_zero_return | `(λread.read (s (λb λr.b (λu λv.r next) s))) RDR` | 94 | [216](candidates/44_constant_zero_return_let165.lam) / — | [210](logs/44_constant_zero_return_let165.log) / — | [210 bits; ok=667 skip=1 fail=0](optimized/44_constant_zero_return.blc) | + +**Uniform reduction arguments.** Write `Z_R = cons K R`, `U_n(N) = 1ⁿ0 ++ N`, and `r = U_(n−1)(N)` in the variable branch. The following identities suffice for every row: + +| Expression | `s = Z_R` | `s = U_n(N)`, `n ≥ 1` | +|---|---|---| +| `s (λq.c)` | `c R` | `c r` | +| `s I` | `K R` | `I` | +| `s K` | `K` | `F` | +| `s F` | `R` | `r` | +| `s s` | `K R` | `K N` | +| `s D` and `s (s K)` | `K` | `r` | +| `s (λb.b F)` | `F` | `r` | +| `s I s` | `R` | `s` | +| `s I (s s) next` | `R next` | `N` | + +The only unbounded step here is the standard equal-index diagonal: `U_0(N) U_0(N) →* K N`, and `U_(m+1)(N) U_(m+1)(N) →* U_m(N) U_m(N)`. Therefore `U_m(N) U_m(N) a →* N` for every `m ≥ 0` and every argument `a`. All other identities are fixed cell/Boolean reductions. A variable tail is always a Scott cell, including `r = U_0(N)` at index one. Thus rebuilding it as `λh.r h` or `λh.h (r K) (r F)` is beta-correct on these inputs; no free-tail eta equality is assumed. + +For the two constant-stream constructions, `T = K(K X)` satisfies `T H (T T T) →* X`, so `RDR T →* X` for arbitrary rigid `X`. Row 43 transforms only the variable branch into that instruction; row 44 transforms only the zero branch. The original stream is retained in the other branch. + +1. **01_reference165 (control).** The shared suffix is R at zero and N at a variable; K drops the duplicate tail, F selects c. +2. **02_reference162 (control).** s I is K R at zero and I at a variable. V next reopens s for c r and forces the diagonal with next. +3. **03_reference164 (control).** The dual operand is R next at zero and N at a variable. The outer K branch uses F to discard the tail. +4. **04_shared_return (shared suffix).** Select a function of the shared suffix: application to next at zero, and c r at a variable. +5. **05_bound_suffix (shared suffix).** Bind the common suffix once and use it either as the second-tag stream or the return remainder. +6. **06_bit_force (branch-local diagonal).** Direct Boolean dispatch; the first bit itself is the erased force of the whole-stream diagonal. +7. **07_cell_owned_return (branch-local diagonal).** The first cell supplies c with r; the separately bound r supplies the diagonal suffix, forced by b. +8. **08_split_tail_handlers (split tail handlers).** Dispatch before binding the tail. Each selected handler then receives r from the stream cell. +9. **09_tail_opens_return (input-owned return).** A variable tail is always a cell. Its two fields are discarded to expose c r before the suffix is supplied. +10. **10_whole_reopen (input-owned return).** The outer opening supplies only the zero tail; both variable output positions are recovered from another whole-stream opening. +11. **11_tail_thunk (NEXT last).** The zero branch is r itself. The variable branch receives next as the erased diagonal force; this is the known 168 witness. +12. **12_whole_thunk (NEXT last).** Use an explicit bit/tail dispatcher but reopen the whole stream inside the selected variable thunk. +13. **13_thunk_rebind_tail (NEXT last).** The variable thunk opens s and binds r once for both its returned index and its skip diagonal. +14. **14_projected_diagonal (NEXT last).** The variable thunk computes the suffix by diagonalizing two independently projected tails. +15. **15_predecessor_return (NEXT last).** In the selected variable branch, s D is r. Opening that cell with a constant handler yields c r. +16. **16_selected_cross (cross application).** s I s equals s on variables and R on zero. The variable-only cross application therefore diagonalizes equal whole streams. +17. **17_tail_dual (dual operand).** The dual operand chooses R or the tail diagonal before receiving next, giving R next or N. +18. **18_split_force_dual (dual operand).** Both arms of the dual operand consume next: the zero arm retains it, the variable arm erases it. +19. **19_bit_force_dual (dual operand).** The dual operand dispatches directly and uses its locally bound first bit to force the whole-stream skip. +20. **20_projected_dual (dual operand).** A projected Boolean selects between tail application and diagonal forcing; neither arm binds the tail. +21. **21_predecessor_dual (conditional predecessor).** Only in the variable branch, both conditional predecessors equal r; their diagonal is K N. The zero branch erases them. +22. **22_pred_adaptive_handler (conditional predecessor).** s D is K at zero and r at a variable. The adaptive operand is R next or a two-field constant returning c r. +23. **23_false_pred (conditional predecessor).** The head is F at zero and r at a variable. F keeps the dual operand; r opens the constant handler to produce c r. +24. **24_reference57 (cell-borrowed dispatch).** The known beta-prime witness: zero selects the drop-and-apply handler; the variable tail opens a constant handler. +25. **25_reference65 (cell-borrowed dispatch).** The known delta witness: s b is K or r, while a separate opening retains the original tail. +26. **26_projected_pred (cell-borrowed dispatch).** s (s K) is K at zero and r at a variable. It controls the same adaptive result/handler interface without a source diagonal lambda. +27. **27_projection_dispatch (projected Boolean).** Project the first bit to choose the two complete computations; the variable return uses stream-owned applications. +28. **28_projection_tail_return (projected Boolean).** Under the variable selection, the projected tail is a cell whose fields can be discarded to produce c of another tail projection. +29. **29_projection_pred_skip (projected Boolean).** Only the selected variable arm diagonalizes conditional predecessors; the whole stream is its erased force. +30. **30_projection_cross_skip (cross application).** The variable arm cross-applies s to the conditional R-or-s object, which equals s there; next is erased there. +31. **31_reboxed_tail (rebuilt tail).** The returned tail is rebuilt by opening s inside a fresh handler lambda. On a variable r is a Scott cell, so the reconstruction beta-reduces to r. +32. **32_projected_rebox (rebuilt tail).** A variable tail is a cell; independently projecting its bit and remainder rebuilds that exact cell, including at index one. +33. **33_function_operand (callback operand).** Pass the entire variable action as a final operand. The selected Boolean decides whether to apply it to the original tail. +34. **34_callable_suffix (callback operand).** The operand is a constant suffix function K R or K N; force it with s at either use. +35. **35_cps_suffix (CPS operand).** A CPS suffix receives application-to-next at zero, or the partially applied return continuation at a variable. +36. **36_pair_operand (pair operand).** The operand packages tail and skip. The zero callback ignores the skip; c consumes both in the variable branch. +37. **37_diagonal_callback (callback operand).** Self-apply the variable callback, using the callback itself only as the erased force of r r. +38. **38_tail_supplied_force (input-owned callback).** The variable tail supplies its own bit d and suffix t to the callback; the final operand restores the whole original tail, and d forces its diagonal. +39. **39_selector_packet (second-stage packet).** The packet maps the first bit to next or c. The zero branch uses it as a tag reader and the variable branch as the return continuation. +40. **40_action_packet (second-stage packet).** The packet stores zero action lambda r.r next and variable action c. Its selected action consumes the same original tail in either branch. +41. **41_cps_packet (second-stage packet).** The packet receives both the tag and a selected consumer; it supplies next or c to that consumer, using b as the variable skip force. +42. **42_reverse_packet (second-stage packet).** A reversed Church pair stores c before next; explicit selectors extract the requested component in the two branches. +43. **43_constant_var_return (constant-stream instruction).** Preprocess variables into K(K(c r N)) and leave zero streams intact. The 165 reader sends double constants to their stored result. +44. **44_constant_zero_return (constant-stream instruction).** Preprocess zero streams into K(K(R next)) and leave variable streams intact. The reader constant-stream identity supplies the other branch. + +**Second-stage objects.** These are explicit valid constructions, not just renamed readers: + +| Object | Role | Completed reader rows | +|---|---|---| +| `s I (s s) next` | Second-tag result at zero, suffix at a variable | 03, 23 | +| `s (λb r.b r (r r)) next` | Select a tail or a suffix thunk before handing it NEXT | 17 | +| `s I ((s D) (s D)) next` | Erased conditional predecessors become the variable diagonal | 21 | +| `s (λb r.b (r next) (λq t.c r))` | A zero result or a handler for another input cell | 22, 26 | +| `λr.c r (r r r)` | A complete variable-return action | 33 | +| `s s` | A constant suffix callable by either branch | 34 | +| `λk.k (s s s)` | A suffix delivered to a selected continuation | 35 | +| `λf.f (s F) (s s s)` | A pair consumed as a zero action or directly by `c` | 36 | +| `λf r.c r (r r f)` | A callback using itself as its erased skip force | 37 | +| `λb.b next c` | A tag-selected NEXT/continuation packet | 39 | +| `λb.b (λr.r next) c` | A tag-selected zero/variable action packet | 40 | +| `λb f.f (b next c)` | A selected operand delivered in CPS | 41 | +| `λa.a c next` | Reversed continuation/NEXT pair | 42 | +| `K(K X)` | An off-stream return instruction recognized by the reader | 43, 44 | + +**What was checked.** [zoo.py](zoo.py) contains the 44 literal hand-written terms and their arguments. No grammar, Cartesian product, term enumeration, or candidate sweep was used. The small de Bruijn normalizer in the repository checked both reader laws before any splicing: `Z_R` with rigid `R`, and `U_n(N)` for `n = 1..16, 31, 64` with rigid `N`, `next`, and `c`. [zoo.json](zoo.json) records all probe counts, exact expanded bodies, bit costs, and normal-form hashes. The all-length reasoning is given above; these are hand reductions, not new Lean theorems. + +Every full candidate was run through the actual repository command `python3 tools/self-interpreter/polish.py FILE.lam`. [run_polish.py](run_polish.py) only supplies resource controls and records the logs. A lane-local `sitecustomize.py` caps battery worker pools at two, points subprocesses at a frozen binary, and places compiler temporary files inside this lane. Letopt used its explicit two-thread option. Its configured budgets were three cuts plus a two-cut no-inline run for inputs through 175 bits, and two cuts for larger inputs. These are the requested polish operations, not an unrestricted search. + +**Tooling detail resolved for the deliverable.** `polish.py` uses `--report-le 164`. Letopt can therefore print `smallest rendering ...: 169 bits` while its final `best` wire is still 173 bits: the histogram tracks all configurations, but `best_t` is updated only from rendered reporting hits (`src/cli/golf/letopt.rs`, lines 815–858). This does not hide a sub-162 result, because every such result would be inside the reporting threshold. To avoid presenting an unmaterialized size as a verified artifact, [collect.py](collect.py) rerendered each needed minimum with its own reporting threshold and at most two cuts, then battery-checked any wire not already checked as an input candidate. This required 6 new wire checks. [artifacts.json](artifacts.json) links every saved minimum to its actual battery log. The source tree was not modified to change this reporting behavior. + +All 84 polish invocations completed without timeout or battery failure; the slowest took 21.922 seconds. Their summed wall time was 434.658 seconds. Individual letopt subprocesses had a 100-second cap and whole polish process groups had a 115-second cap. There was one active candidate job at a time. No other lane was written, and no agent was consulted. The frozen executable SHA-256 is `5266a7fc450c2bc6050a2baf7f7a23f06589fdf99a8a6470d73b83dcb324c112`. + +**Assessment.** The successful cross-branch constructions really do have different source/stream ownership: output nodes may come from the first cell, from the variable tail, from a callback, or from a transformed constant stream. Several larger isolated readers shrink after let placement, confirming the reason to test complete splices. In this catalogue the extra tail binding, re-opening, or packet dispatch costs more than the sharing saves. That is an observation about these constructions, not a lower bound on readers or interpreters. The simplest dual operand remains the 164 control; the 162 control remains the only 162-bit result. + +To reproduce, run `PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/zoo/zoo.py`, then `PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/zoo/run_polish.py`, `PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/zoo/collect.py`, and `PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/zoo/report.py` from the repository root. `run_polish.py` resumes from the existing `polish.jsonl`; a fresh reproduction needs that file moved aside inside the lane. diff --git a/data/self-interpreter/reasoning_floor/zoo/artifacts.json b/data/self-interpreter/reasoning_floor/zoo/artifacts.json new file mode 100644 index 00000000..eef9eb1e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/artifacts.json @@ -0,0 +1,530 @@ +[ + { + "name": "01_reference165", + "bits": 165, + "wire": "010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/01_reference165.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/01_reference165.lam", + "battery_line": "165 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/01_reference165_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "02_reference162", + "bits": 162, + "wire": "010001101000010000000101011000100001011100011110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/02_reference162.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/02_reference162.lam", + "battery_line": "162 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/02_reference162_inline162.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "03_reference164", + "bits": 164, + "wire": "01000110100001000000010110000101100000101110010101100010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/03_reference164.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/03_reference164.lam", + "battery_line": "164 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/03_reference164_inline162.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "04_shared_return", + "bits": 171, + "wire": "010001101000010000010000010110000001011100001101111100111111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/04_shared_return.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/04_shared_return.lam", + "battery_line": "171 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/04_shared_return_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "05_bound_suffix", + "bits": 178, + "wire": "0100011010000100000100000101100000000101111001101111100101111111011010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/05_bound_suffix.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/05_bound_suffix.lam", + "battery_line": "178 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/05_bound_suffix_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "06_bit_force", + "bits": 173, + "wire": "01000110100001000001000001100000010111001101111001011111101001011110111011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/06_bit_force.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/06_bit_force.lam", + "battery_line": "173 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/06_bit_force_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "07_cell_owned_return", + "bits": 174, + "wire": "010001101000010000010000011000000101110011011110010111100011111100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/07_cell_owned_return.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/07_cell_owned_return.lam", + "battery_line": "174 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/07_cell_owned_return_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "08_split_tail_handlers", + "bits": 169, + "wire": "0100011010000100000100000110000101100001101111000010111111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/08_split_tail_handlers.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/08_split_tail_handlers.lam", + "battery_line": "169 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/08_split_tail_handlers_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "09_tail_opens_return", + "bits": 180, + "wire": "010001101000010000010000011000000101110011011110010110000001111111101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/09_tail_opens_return.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/09_tail_opens_return.lam", + "battery_line": "180 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/09_tail_opens_return_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "10_whole_reopen", + "bits": 179, + "wire": "01000110100001000001000001100000010111001101111001011110001111110010111101110111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/10_whole_reopen.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/10_whole_reopen.lam", + "battery_line": "179 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/10_whole_reopen_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "11_tail_thunk", + "bits": 168, + "wire": "010001101000010000000101100000010111010000101111110110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/11_tail_thunk.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/11_tail_thunk.lam", + "battery_line": "168 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/11_tail_thunk_inline162.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "12_whole_thunk", + "bits": 177, + "wire": "010001101000010000000101100000010111010000101111100011111100101111101111010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/12_whole_thunk.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/12_whole_thunk.lam", + "battery_line": "177 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/12_whole_thunk_inline162.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "13_thunk_rebind_tail", + "bits": 169, + "wire": "0100011010000100000001010110001000011100000010111111010010110101110000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/13_thunk_rebind_tail.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/13_thunk_rebind_tail.lam", + "battery_line": "169 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/13_thunk_rebind_tail_inline162.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "14_projected_diagonal", + "bits": 175, + "wire": "0100011010000100000001010110001000010111000111100101000110100111000001010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/14_projected_diagonal.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/14_projected_diagonal.lam", + "battery_line": "175 bits ok=667 skip=1 fail=0 bits", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/14_projected_diagonal_optimized_battery.log", + "rechecked": true, + "materialize_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/14_projected_diagonal_materialize.log", + "seconds": 1.988 + }, + { + "name": "15_predecessor_return", + "bits": 185, + "wire": "01000110100001000000010101100010000101011100001101000000111110001111110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/15_predecessor_return.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/15_predecessor_return.lam", + "battery_line": "185 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/15_predecessor_return_inline162.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "16_selected_cross", + "bits": 173, + "wire": "01000110100001000000010101100010000101110001111001011100101110001011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/16_selected_cross.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/16_selected_cross.lam", + "battery_line": "173 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/16_selected_cross_inline162.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "17_tail_dual", + "bits": 171, + "wire": "010001101000010000000101100001011000001011100101100000010111010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/17_tail_dual.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/17_tail_dual.lam", + "battery_line": "171 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/17_tail_dual_inline162.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "18_split_force_dual", + "bits": 184, + "wire": "0100011010000100000100000101100001011000001011110011000000101110011011110010110101111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/18_split_force_dual.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/18_split_force_dual.lam", + "battery_line": "184 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/18_split_force_dual_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "19_bit_force_dual", + "bits": 186, + "wire": "010001101000010000010000010110000101100000101111001100000010111001101111001011110111011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/19_bit_force_dual.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/19_bit_force_dual.lam", + "battery_line": "186 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/19_bit_force_dual_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.002 + }, + { + "name": "20_projected_dual", + "bits": 188, + "wire": "01000110100001000001000001011000010110000010111100101011000001100101100000101100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/20_projected_dual.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/20_projected_dual.lam", + "battery_line": "188 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/20_projected_dual_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "21_predecessor_dual", + "bits": 180, + "wire": "010001101000010000000101100001011000001011100101011000100100011010011000011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/21_predecessor_dual.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/21_predecessor_dual.lam", + "battery_line": "180 bits ok=667 skip=1 fail=0 bits", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/21_predecessor_dual_optimized_battery.log", + "rechecked": true, + "materialize_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/21_predecessor_dual_materialize.log", + "seconds": 1.974 + }, + { + "name": "22_pred_adaptive_handler", + "bits": 190, + "wire": "0100011010000100000100000101011000011010011000000101110011011110000001111111101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/22_pred_adaptive_handler.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/22_pred_adaptive_handler.lam", + "battery_line": "190 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/22_pred_adaptive_handler_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "23_false_pred", + "bits": 178, + "wire": "0100011010000100000001010110000110000010000001111000111110010101100010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/23_false_pred.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/23_false_pred.lam", + "battery_line": "178 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/23_false_pred_inline162.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "24_reference57", + "bits": 179, + "wire": "01000110100001000001000001010110000110000001101111100000011110001111110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/24_reference57.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/24_reference57.lam", + "battery_line": "179 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/24_reference57_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "25_reference65", + "bits": 187, + "wire": "0100011010000100000100000101100000010111101100101110011011110000001111111101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/25_reference65.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/25_reference65.lam", + "battery_line": "187 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/25_reference65_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "26_projected_pred", + "bits": 193, + "wire": "0100011010000100000100000101011001100000110011000000101110011011110000001111111101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/26_projected_pred.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/26_projected_pred.lam", + "battery_line": "193 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/26_projected_pred_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.002 + }, + { + "name": "27_projection_dispatch", + "bits": 171, + "wire": "010001101000010000000101011000001100101100000100001111100001011100111110000001111000000101110111001101111001111110000111111000010111101001110100101100011100101101010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/27_projection_dispatch.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/27_projection_dispatch.lam", + "battery_line": "171 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/27_projection_dispatch_inline162.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "28_projection_tail_return", + "bits": 195, + "wire": "010001101000010000000101011000001100101100000100001111100001011100111110000001111000000101110111001101111001111110000111111000010111101001110100101000110000001111110111001100000100101101010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/28_projection_tail_return.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/28_projection_tail_return.lam", + "battery_line": "195 bits ok=667 skip=1 fail=0 bits", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/28_projection_tail_return_optimized_battery.log", + "rechecked": true, + "materialize_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/28_projection_tail_return_materialize.log", + "seconds": 2.029 + }, + { + "name": "29_projection_pred_skip", + "bits": 187, + "wire": "0100011010000100000001010110000011001011000001000011111000010111001111100000011110000001011101110011011110011111100001111110000101111010011101001011000111001010001101001100001101010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/29_projection_pred_skip.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/29_projection_pred_skip.lam", + "battery_line": "187 bits ok=667 skip=1 fail=0 bits", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/29_projection_pred_skip_optimized_battery.log", + "rechecked": true, + "materialize_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/29_projection_pred_skip_materialize.log", + "seconds": 1.996 + }, + { + "name": "30_projection_cross_skip", + "bits": 186, + "wire": "010001101000010000010000010101100000110010110000010110010110001111001011001011000101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/30_projection_cross_skip.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/30_projection_cross_skip.lam", + "battery_line": "186 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/30_projection_cross_skip_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "31_reboxed_tail", + "bits": 187, + "wire": "0100011010000100000100000110000001011100110111100101111110000111110000001101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/31_reboxed_tail.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/31_reboxed_tail.lam", + "battery_line": "187 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/31_reboxed_tail_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "32_projected_rebox", + "bits": 207, + "wire": "010001101000010000010000011000000101110011011110010111111001111000000001011001110000011001110000010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/32_projected_rebox.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/32_projected_rebox.lam", + "battery_line": "207 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/32_projected_rebox_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.002 + }, + { + "name": "33_function_operand", + "bits": 183, + "wire": "010001101000010000010000010110000000010111100111011111001101100001011111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/33_function_operand.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/33_function_operand.lam", + "battery_line": "183 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/33_function_operand_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "34_callable_suffix", + "bits": 188, + "wire": "01000110100001000001000001011000000001011110010110111101111100101111111011001101111001101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/34_callable_suffix.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/34_callable_suffix.lam", + "battery_line": "188 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/34_callable_suffix_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "35_cps_suffix", + "bits": 194, + "wire": "01000110100001000001000001011000000001011110011000011011111100110011111110110000110010111011011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/35_cps_suffix.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/35_cps_suffix.lam", + "battery_line": "194 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/35_cps_suffix_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "36_pair_operand", + "bits": 206, + "wire": "01000110100001000001000001011000000001011110011000000111011111110011011111100001011001110000010010111011011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/36_pair_operand.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/36_pair_operand.lam", + "battery_line": "206 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/36_pair_operand_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "37_diagonal_callback", + "bits": 191, + "wire": "01000110100001000001000001011000000001011110011101111100101101011000000101111110100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/37_diagonal_callback.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/37_diagonal_callback.lam", + "battery_line": "191 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/37_diagonal_callback_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "38_tail_supplied_force", + "bits": 196, + "wire": "0100011010000100000100000101100000000101111001110111110010111010110000000010111111101001011010111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/38_tail_supplied_force.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/38_tail_supplied_force.lam", + "battery_line": "196 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/38_tail_supplied_force_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "39_selector_packet", + "bits": 198, + "wire": "010001101000010000000101100000000101111001110011011100101011011101100101110110100001011000011111100001011100111111000000111100000010111011100110111100111111100001111111000010111101001110101110011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/39_selector_packet.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/39_selector_packet.lam", + "battery_line": "198 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/39_selector_packet_inline162.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "40_action_packet", + "bits": 206, + "wire": "01000110100001000001000001011000000001011110010110111011001010110111011001011101101000010110000110111101111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/40_action_packet.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/40_action_packet.lam", + "battery_line": "206 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/40_action_packet_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "41_cps_packet", + "bits": 217, + "wire": "0100011010000100000100000101100000000101101110010111100001111010000101101110010111101110111100000011001011101111011111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/41_cps_packet.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/41_cps_packet.lam", + "battery_line": "217 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/41_cps_packet_let165.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "42_reverse_packet", + "bits": 203, + "wire": "01000110100001000000010110000000010111100111001100000100101011000001101100101110110100001011011100001111110000101110011111100000011110000001011101110011011110011111110000111111100001011110100111010011010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/42_reverse_packet.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/42_reverse_packet.lam", + "battery_line": "203 bits ok=667 skip=1 fail=0", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/42_reverse_packet_inline162.log", + "rechecked": false, + "materialize_log": null, + "seconds": 0.0 + }, + { + "name": "43_constant_var_return", + "bits": 229, + "wire": "0100011010000001000001000101100001011000000110111111011111001011010100110000001011101110000001011111111011100101111011101110000101111011100001011100111100000011110000001011101110011011110010111110111100001111100001011110100111010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/43_constant_var_return.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/43_constant_var_return.lam", + "battery_line": "229 bits ok=667 skip=1 fail=0 bits", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/43_constant_var_return_optimized_battery.log", + "rechecked": true, + "materialize_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/43_constant_var_return_materialize.log", + "seconds": 2.544 + }, + { + "name": "44_constant_zero_return", + "bits": 210, + "wire": "010001101000000100000100010110000101100000011011111101111100101101010011000000101110000001111011111101110000101111011100001011100111100000011110000001011101110011011110010111110111100001111100001011110100111010", + "blc": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/44_constant_zero_return.blc", + "lam": "/Users/a9lim/Work/blam/tmp/overnight/zoo/optimized/44_constant_zero_return.lam", + "battery_line": "210 bits ok=667 skip=1 fail=0 bits", + "battery_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/44_constant_zero_return_optimized_battery.log", + "rechecked": true, + "materialize_log": "/Users/a9lim/Work/blam/tmp/overnight/zoo/logs/44_constant_zero_return_materialize.log", + "seconds": 11.473 + } +] diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/01_reference165_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/01_reference165_inline162.lam new file mode 100644 index 00000000..38cc06d2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/01_reference165_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b.b (\u \r.r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) c) (s s s)) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/01_reference165_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/01_reference165_let165.lam new file mode 100644 index 00000000..aeaee8aa --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/01_reference165_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b.b (\u \r.r next) c) (s s s)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/02_reference162_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/02_reference162_inline162.lam new file mode 100644 index 00000000..bd6feb09 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/02_reference162_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\a.a) (\u.s (\q.c) (s s u)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/02_reference162_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/02_reference162_let165.lam new file mode 100644 index 00000000..6713c8e4 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/02_reference162_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\a.a) (\u.s (\q.c) (s s u)) next) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/03_reference164_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/03_reference164_inline162.lam new file mode 100644 index 00000000..48a42a7e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/03_reference164_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b.b (\a \b.b) c) (s (\a.a) (s s) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args)))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/03_reference164_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/03_reference164_let165.lam new file mode 100644 index 00000000..3e3840d5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/03_reference164_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b.b (\a \b.b) c) (s (\a.a) (s s) next)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/04_shared_return_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/04_shared_return_inline162.lam new file mode 100644 index 00000000..703b7376 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/04_shared_return_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r.b (\t.t (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (c r)) (s s s)) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/04_shared_return_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/04_shared_return_let165.lam new file mode 100644 index 00000000..3d0637a5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/04_shared_return_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r.b (\t.t next) (c r)) (s s s)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/05_bound_suffix_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/05_bound_suffix_inline162.lam new file mode 100644 index 00000000..d91a2dd5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/05_bound_suffix_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r \t.b (t (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (c r t)) (s s s)) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/05_bound_suffix_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/05_bound_suffix_let165.lam new file mode 100644 index 00000000..9bdc3def --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/05_bound_suffix_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r \t.b (t next) (c r t)) (s s s)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/06_bit_force_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/06_bit_force_inline162.lam new file mode 100644 index 00000000..4febf8fa --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/06_bit_force_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r.b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (c r (s s b)))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/06_bit_force_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/06_bit_force_let165.lam new file mode 100644 index 00000000..0944e637 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/06_bit_force_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r.b (r next) (c r (s s b)))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/07_cell_owned_return_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/07_cell_owned_return_inline162.lam new file mode 100644 index 00000000..90ed4a65 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/07_cell_owned_return_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r.b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (s (\q.c) (r r b)))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/07_cell_owned_return_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/07_cell_owned_return_let165.lam new file mode 100644 index 00000000..77c3ca36 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/07_cell_owned_return_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r.b (r next) (s (\q.c) (r r b)))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/08_split_tail_handlers_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/08_split_tail_handlers_inline162.lam new file mode 100644 index 00000000..050a9b73 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/08_split_tail_handlers_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b.b (\r.r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (\r.c r (r r r)))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/08_split_tail_handlers_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/08_split_tail_handlers_let165.lam new file mode 100644 index 00000000..80d8bd41 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/08_split_tail_handlers_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b.b (\r.r next) (\r.c r (r r r)))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/09_tail_opens_return_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/09_tail_opens_return_inline162.lam new file mode 100644 index 00000000..909a8600 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/09_tail_opens_return_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r.b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (r (\q \t.c r) (r r r)))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/09_tail_opens_return_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/09_tail_opens_return_let165.lam new file mode 100644 index 00000000..478bd971 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/09_tail_opens_return_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r.b (r next) (r (\q \t.c r) (r r r)))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/10_whole_reopen_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/10_whole_reopen_inline162.lam new file mode 100644 index 00000000..404b940c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/10_whole_reopen_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r.b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (s (\q.c) (s s s)))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/10_whole_reopen_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/10_whole_reopen_let165.lam new file mode 100644 index 00000000..55523912 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/10_whole_reopen_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r.b (r next) (s (\q.c) (s s s)))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/11_tail_thunk_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/11_tail_thunk_inline162.lam new file mode 100644 index 00000000..ac7f240f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/11_tail_thunk_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r.b r (\u.c r (r r u))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/11_tail_thunk_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/11_tail_thunk_let165.lam new file mode 100644 index 00000000..6d89fb46 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/11_tail_thunk_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r.b r (\u.c r (r r u))) next) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/12_whole_thunk_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/12_whole_thunk_inline162.lam new file mode 100644 index 00000000..abf014db --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/12_whole_thunk_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r.b r (\u.s (\q.c) (s s u))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/12_whole_thunk_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/12_whole_thunk_let165.lam new file mode 100644 index 00000000..cd16cd97 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/12_whole_thunk_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r.b r (\u.s (\q.c) (s s u))) next) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/13_thunk_rebind_tail_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/13_thunk_rebind_tail_inline162.lam new file mode 100644 index 00000000..164b799c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/13_thunk_rebind_tail_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\a.a) (\u.s (\b \r.c r (r r u))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/13_thunk_rebind_tail_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/13_thunk_rebind_tail_let165.lam new file mode 100644 index 00000000..480ccb9e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/13_thunk_rebind_tail_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\a.a) (\u.s (\b \r.c r (r r u))) next) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/14_projected_diagonal_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/14_projected_diagonal_inline162.lam new file mode 100644 index 00000000..77b55dc8 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/14_projected_diagonal_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\a.a) (\u.s (\q.c) ((s (\a \b.b)) (s (\a \b.b)) u)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/14_projected_diagonal_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/14_projected_diagonal_let165.lam new file mode 100644 index 00000000..b9b6bc06 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/14_projected_diagonal_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\a.a) (\u.s (\q.c) ((s (\a \b.b)) (s (\a \b.b)) u)) next) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/15_predecessor_return_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/15_predecessor_return_inline162.lam new file mode 100644 index 00000000..389940c6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/15_predecessor_return_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\a.a) (\u.(s (\a.a a)) (\q \r.s (\a.c)) (s s u)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/15_predecessor_return_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/15_predecessor_return_let165.lam new file mode 100644 index 00000000..50d0f090 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/15_predecessor_return_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\a.a) (\u.(s (\a.a a)) (\q \r.s (\a.c)) (s s u)) next) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/16_selected_cross_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/16_selected_cross_inline162.lam new file mode 100644 index 00000000..3faada6f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/16_selected_cross_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\a.a) (\u.s (\q.c) (s (s (\a.a) s) u)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/16_selected_cross_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/16_selected_cross_let165.lam new file mode 100644 index 00000000..bd56f53a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/16_selected_cross_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\a.a) (\u.s (\q.c) (s (s (\a.a) s) u)) next) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/17_tail_dual_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/17_tail_dual_inline162.lam new file mode 100644 index 00000000..502099fc --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/17_tail_dual_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b.b (\a \b.b) c) (s (\b \r.b r (r r)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args)))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/17_tail_dual_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/17_tail_dual_let165.lam new file mode 100644 index 00000000..d43ccbce --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/17_tail_dual_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b.b (\a \b.b) c) (s (\b \r.b r (r r)) next)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/18_split_force_dual_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/18_split_force_dual_let165.lam new file mode 100644 index 00000000..eeed7d5f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/18_split_force_dual_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b.b (\a \b.b) c) (s (\b \r.b (r next) (r r next)))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/19_bit_force_dual_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/19_bit_force_dual_inline162.lam new file mode 100644 index 00000000..84b6dce5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/19_bit_force_dual_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b.b (\a \b.b) c) (s (\b \r.b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (s s b)))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/19_bit_force_dual_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/19_bit_force_dual_let165.lam new file mode 100644 index 00000000..1d9f4e8e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/19_bit_force_dual_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b.b (\a \b.b) c) (s (\b \r.b (r next) (s s b)))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/20_projected_dual_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/20_projected_dual_let165.lam new file mode 100644 index 00000000..977e4949 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/20_projected_dual_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b.b (\a \b.b) c) ((s (\a \b.a)) ((s (\a \b.b)) next) (s s next))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/21_predecessor_dual_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/21_predecessor_dual_inline162.lam new file mode 100644 index 00000000..c643f552 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/21_predecessor_dual_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b.b (\a \b.b) c) (s (\a.a) ((s (\a.a a)) (s (\a.a a))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args)))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/21_predecessor_dual_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/21_predecessor_dual_let165.lam new file mode 100644 index 00000000..ba1def30 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/21_predecessor_dual_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b.b (\a \b.b) c) (s (\a.a) ((s (\a.a a)) (s (\a.a a))) next)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/22_pred_adaptive_handler_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/22_pred_adaptive_handler_inline162.lam new file mode 100644 index 00000000..6eea57a5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/22_pred_adaptive_handler_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\a.a a) (s (\b \r.b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (\q \t.c r))) (s s s)) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/22_pred_adaptive_handler_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/22_pred_adaptive_handler_let165.lam new file mode 100644 index 00000000..26275bad --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/22_pred_adaptive_handler_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\a.a a) (s (\b \r.b (r next) (\q \t.c r))) (s s s)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/23_false_pred_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/23_false_pred_inline162.lam new file mode 100644 index 00000000..27ee81b5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/23_false_pred_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b.b (\a \b.b)) (\q \t.s (\a.c)) (s (\a.a) (s s) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args)))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/23_false_pred_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/23_false_pred_let165.lam new file mode 100644 index 00000000..528cfed4 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/23_false_pred_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b.b (\a \b.b)) (\q \t.s (\a.c)) (s (\a.a) (s s) next)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/24_reference57_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/24_reference57_inline162.lam new file mode 100644 index 00000000..ca9f6f31 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/24_reference57_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b.b (\u \r.r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args)))))))) (\q \t.s (\a.c)) (s s s)) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/24_reference57_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/24_reference57_let165.lam new file mode 100644 index 00000000..84e35667 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/24_reference57_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b.b (\u \r.r next)) (\q \t.s (\a.c)) (s s s)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/25_reference65_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/25_reference65_inline162.lam new file mode 100644 index 00000000..bc969eb7 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/25_reference65_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r.s b (b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (\q \t.c r))) (s s s)) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/25_reference65_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/25_reference65_let165.lam new file mode 100644 index 00000000..eb73b769 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/25_reference65_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r.s b (b (r next) (\q \t.c r))) (s s s)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/26_projected_pred_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/26_projected_pred_inline162.lam new file mode 100644 index 00000000..1b0fdd74 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/26_projected_pred_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (s (\a \b.a)) (s (\b \r.b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (\q \t.c r))) (s s s)) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/26_projected_pred_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/26_projected_pred_let165.lam new file mode 100644 index 00000000..12057859 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/26_projected_pred_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (s (\a \b.a)) (s (\b \r.b (r next) (\q \t.c r))) (s s s)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/27_projection_dispatch_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/27_projection_dispatch_inline162.lam new file mode 100644 index 00000000..830635dd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/27_projection_dispatch_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.(s (\a \b.a)) ((s (\a \b.b)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (s (\q.c) (s s s))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/27_projection_dispatch_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/27_projection_dispatch_let165.lam new file mode 100644 index 00000000..109a4ff9 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/27_projection_dispatch_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.(s (\a \b.a)) ((s (\a \b.b)) next) (s (\q.c) (s s s))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/28_projection_tail_return_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/28_projection_tail_return_inline162.lam new file mode 100644 index 00000000..1b37318f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/28_projection_tail_return_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.(s (\a \b.a)) ((s (\a \b.b)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) ((s (\a \b.b)) (\b \r.c (s (\a \b.b))) (s s s))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/28_projection_tail_return_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/28_projection_tail_return_let165.lam new file mode 100644 index 00000000..e1955a35 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/28_projection_tail_return_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.(s (\a \b.a)) ((s (\a \b.b)) next) ((s (\a \b.b)) (\b \r.c (s (\a \b.b))) (s s s))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/29_projection_pred_skip_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/29_projection_pred_skip_inline162.lam new file mode 100644 index 00000000..b4601895 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/29_projection_pred_skip_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.(s (\a \b.a)) ((s (\a \b.b)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (s (\q.c) ((s (\a.a a)) (s (\a.a a)) s))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/29_projection_pred_skip_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/29_projection_pred_skip_let165.lam new file mode 100644 index 00000000..339a573c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/29_projection_pred_skip_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.(s (\a \b.a)) ((s (\a \b.b)) next) (s (\q.c) ((s (\a.a a)) (s (\a.a a)) s))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/30_projection_cross_skip_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/30_projection_cross_skip_let165.lam new file mode 100644 index 00000000..303bd1b0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/30_projection_cross_skip_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.(s (\a \b.a)) ((s (\a \b.b)) next) (s (\q.c) (s (s (\a.a) s) next))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/31_reboxed_tail_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/31_reboxed_tail_inline162.lam new file mode 100644 index 00000000..d5000ebd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/31_reboxed_tail_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r.b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (c (\h.s (\q \t.t h)) (r r r)))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/31_reboxed_tail_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/31_reboxed_tail_let165.lam new file mode 100644 index 00000000..82ea3803 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/31_reboxed_tail_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r.b (r next) (c (\h.s (\q \t.t h)) (r r r)))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/32_projected_rebox_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/32_projected_rebox_inline162.lam new file mode 100644 index 00000000..31a032b7 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/32_projected_rebox_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r.b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (c (s (\q \t.\h.h (t (\a \b.a)) (t (\a \b.b)))) (r r r)))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/32_projected_rebox_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/32_projected_rebox_let165.lam new file mode 100644 index 00000000..5d3dd0b0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/32_projected_rebox_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r.b (r next) (c (s (\q \t.\h.h (t (\a \b.a)) (t (\a \b.b)))) (r r r)))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/33_function_operand_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/33_function_operand_inline162.lam new file mode 100644 index 00000000..df571ed9 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/33_function_operand_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r \f.b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (f r)) (\r.c r (r r r))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/33_function_operand_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/33_function_operand_let165.lam new file mode 100644 index 00000000..df424720 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/33_function_operand_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r \f.b (r next) (f r)) (\r.c r (r r r))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/34_callable_suffix_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/34_callable_suffix_inline162.lam new file mode 100644 index 00000000..30f61637 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/34_callable_suffix_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r \f.b ((f s) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (c r (f s))) (s s)) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/34_callable_suffix_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/34_callable_suffix_let165.lam new file mode 100644 index 00000000..6d8bf572 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/34_callable_suffix_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r \f.b ((f s) next) (c r (f s))) (s s)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/35_cps_suffix_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/35_cps_suffix_inline162.lam new file mode 100644 index 00000000..3c6f11d7 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/35_cps_suffix_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r \f.b (f (\t.t (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args)))))))) (f (c r))) (\k.k (s s s))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/35_cps_suffix_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/35_cps_suffix_let165.lam new file mode 100644 index 00000000..091dec93 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/35_cps_suffix_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r \f.b (f (\t.t next)) (f (c r))) (\k.k (s s s))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/36_pair_operand_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/36_pair_operand_inline162.lam new file mode 100644 index 00000000..e0e36a3d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/36_pair_operand_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r \p.b (p (\a \t.a (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args)))))))) (p c)) (\f.f (s (\a \b.b)) (s s s))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/36_pair_operand_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/36_pair_operand_let165.lam new file mode 100644 index 00000000..7f30b5fc --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/36_pair_operand_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r \p.b (p (\a \t.a next)) (p c)) (\f.f (s (\a \b.b)) (s s s))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/37_diagonal_callback_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/37_diagonal_callback_inline162.lam new file mode 100644 index 00000000..3d9ce2c1 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/37_diagonal_callback_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r \f.b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (f f r)) (\f \r.c r (r r f))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/37_diagonal_callback_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/37_diagonal_callback_let165.lam new file mode 100644 index 00000000..b83b8da2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/37_diagonal_callback_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r \f.b (r next) (f f r)) (\f \r.c r (r r f))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/38_tail_supplied_force_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/38_tail_supplied_force_inline162.lam new file mode 100644 index 00000000..14ac53be --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/38_tail_supplied_force_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r \f.b (r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (r f r)) (\d \t \r.c r (r r d))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/38_tail_supplied_force_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/38_tail_supplied_force_let165.lam new file mode 100644 index 00000000..d4a398eb --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/38_tail_supplied_force_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r \f.b (r next) (r f r)) (\d \t \r.c r (r r d))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/39_selector_packet_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/39_selector_packet_inline162.lam new file mode 100644 index 00000000..77b05e07 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/39_selector_packet_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r \t.b (r (t b)) (t b r (r r t))) (\b.b (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args)))))) c)) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/39_selector_packet_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/39_selector_packet_let165.lam new file mode 100644 index 00000000..efdd7c75 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/39_selector_packet_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r \t.b (r (t b)) (t b r (r r t))) (\b.b next c)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/40_action_packet_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/40_action_packet_inline162.lam new file mode 100644 index 00000000..874ec119 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/40_action_packet_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r \t.b (t b r) (t b r (r r t))) (\b.b (\r.r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) c)) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/40_action_packet_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/40_action_packet_let165.lam new file mode 100644 index 00000000..ed794b68 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/40_action_packet_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r \t.b (t b r) (t b r (r r t))) (\b.b (\r.r next) c)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/41_cps_packet_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/41_cps_packet_inline162.lam new file mode 100644 index 00000000..8c8fd676 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/41_cps_packet_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r \t.t b (b (\u.r u) (\u.u r (r r b)))) (\b \f.f (b (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args)))))) c))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/41_cps_packet_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/41_cps_packet_let165.lam new file mode 100644 index 00000000..282258fa --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/41_cps_packet_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r \t.t b (b (\u.r u) (\u.u r (r r b)))) (\b \f.f (b next c))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/42_reverse_packet_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/42_reverse_packet_inline162.lam new file mode 100644 index 00000000..65e039f2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/42_reverse_packet_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.s (\b \r \t.b (r (t (\a \b.b))) (t (\a \b.a) r (r r t))) (\a.a c (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args)))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/42_reverse_packet_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/42_reverse_packet_let165.lam new file mode 100644 index 00000000..d0e6e7fc --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/42_reverse_packet_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.s (\b \r \t.b (r (t (\a \b.b))) (t (\a \b.a) r (r r t))) (\a.a c next)) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/43_constant_var_return_inline162.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/43_constant_var_return_inline162.lam new file mode 100644 index 00000000..5cc453bb --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/43_constant_var_return_inline162.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.\s.(\read.read (s (\b \r.b s (\u \v.c r (r r r))))) (\t.t (\b.b (\u \r.r (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) c) (t t t))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/43_constant_var_return_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/43_constant_var_return_let165.lam new file mode 100644 index 00000000..3fde7a7d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/43_constant_var_return_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.(\read.read (s (\b \r.b s (\u \v.c r (r r r))))) (\t.t (\b.b (\u \r.r next) c) (t t t))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/44_constant_zero_return_let165.lam b/data/self-interpreter/reasoning_floor/zoo/candidates/44_constant_zero_return_let165.lam new file mode 100644 index 00000000..9e783a1a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/44_constant_zero_return_let165.lam @@ -0,0 +1 @@ +(\x.x x) (\x.(\intL.\c.(\next.\s.(\read.read (s (\b \r.b (\u \v.r next) s))) (\t.t (\b.b (\u \r.r next) c) (t t t))) (\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))) (x x)) diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/tmp0zan7uz_.blc b/data/self-interpreter/reasoning_floor/zoo/candidates/tmp0zan7uz_.blc new file mode 100644 index 00000000..054fb712 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/tmp0zan7uz_.blc @@ -0,0 +1 @@ +01000110100001000000010110000101100000101110010101100010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/tmp1zyf8eh0.blc b/data/self-interpreter/reasoning_floor/zoo/candidates/tmp1zyf8eh0.blc new file mode 100644 index 00000000..ce926778 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/tmp1zyf8eh0.blc @@ -0,0 +1 @@ +010001101000010000000101011000100001011100011110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/tmp228xtoy6.blc b/data/self-interpreter/reasoning_floor/zoo/candidates/tmp228xtoy6.blc new file mode 100644 index 00000000..054fb712 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/tmp228xtoy6.blc @@ -0,0 +1 @@ +01000110100001000000010110000101100000101110010101100010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/tmp3uq_dlap.blc b/data/self-interpreter/reasoning_floor/zoo/candidates/tmp3uq_dlap.blc new file mode 100644 index 00000000..ce926778 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/tmp3uq_dlap.blc @@ -0,0 +1 @@ +010001101000010000000101011000100001011100011110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/tmp4qsffwc3.blc b/data/self-interpreter/reasoning_floor/zoo/candidates/tmp4qsffwc3.blc new file mode 100644 index 00000000..ce926778 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/tmp4qsffwc3.blc @@ -0,0 +1 @@ +010001101000010000000101011000100001011100011110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/candidates/tmp4ww6p3xr.blc b/data/self-interpreter/reasoning_floor/zoo/candidates/tmp4ww6p3xr.blc new file mode 100644 index 00000000..054fb712 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/candidates/tmp4ww6p3xr.blc @@ -0,0 +1 @@ +01000110100001000000010110000101100000101110010101100010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/collect.py b/data/self-interpreter/reasoning_floor/zoo/collect.py new file mode 100644 index 00000000..4000ee8f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/collect.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""Materialize reported minima and check any newly rendered wire artifacts.""" +import json +import os +from pathlib import Path +import re +import subprocess +import sys +import time + +LANE = Path(__file__).resolve().parent +ROOT = LANE.parents[2] +sys.dont_write_bytecode = True +sys.path.insert(0, str(LANE)) +from zoo import parse +import lc +env = dict(os.environ, PYTHONDONTWRITEBYTECODE='1', PYTHONPATH=str(LANE / 'runtime'), + TMPDIR=str(LANE / 'scratch'), RAYON_NUM_THREADS='2') +rows = json.loads((LANE / 'zoo.json').read_text()) +results = list(map(json.loads, (LANE / 'polish.jsonl').read_text().splitlines())) +bykey = {(r['name'], r['frame']): r for r in results} +assert len(bykey) == sum(len(r['frames']) for r in rows), 'Polishing is not finished' +assert all(r['returncode'] == 0 and not r['timeout'] and r['batteries'] for r in results) +assert all(b[1:] == [667, 1, 0] for r in results for b in r['batteries']) +checked_wires = {f['wire']: bykey[(r['name'], label)]['log'] + for r in rows for label, f in r['frames'].items()} +destination = LANE / 'optimized' +destination.mkdir(exist_ok=True) +artifacts = [] +for row in rows: + start = time.monotonic() + available = [bykey[(row['name'], label)] for label in row['frames']] + best = min(r['polished_bits'] for r in available) + source = next((f for f in row['frames'].values() if f['bits'] == best), None) + retrieval = None + if source: + wire = source['wire'] + else: + result = min(available, key=lambda r: r['polished_bits']) + source = row['frames'][result['frame']] + command = [str(LANE / 'blam-frozen'), 'golf', 'letopt', '--bits', source['wire'], + '--report-le', str(best), '--max-cuts', '2', '--threads', '2'] + run = subprocess.run(command, capture_output=True, text=True, env=env, timeout=100) + retrieval = str(LANE / 'logs' / (row['name'] + '_materialize.log')) + Path(retrieval).write_text(run.stdout + run.stderr) + assert run.returncode == 0, (row['name'], run.returncode) + found = re.search(r'^best (\d+) ([01]+)$', run.stdout, re.M) + assert found and int(found[1]) <= best, (row['name'], best, run.stdout) + best, wire = int(found[1]), found[2] + assert len(wire) == best + term, end = lc.decode(wire) + assert end == len(wire) + src = lc.show(term) + assert parse(src) == term + bitpath = destination / (row['name'] + '.blc') + lampath = destination / (row['name'] + '.lam') + bitpath.write_text(wire + '\n') + lampath.write_text(src + '\n') + recheck = wire not in checked_wires + if recheck: + command = [sys.executable, str(ROOT / 'tools/self-interpreter/battery.py'), '--bits', wire] + run = subprocess.run(command, capture_output=True, text=True, env=env, timeout=100) + batterylog = str(LANE / 'logs' / (row['name'] + '_optimized_battery.log')) + Path(batterylog).write_text(run.stdout + run.stderr) + line = run.stdout.strip() + assert run.returncode == 0 and 'ok=667 skip=1 fail=0' in line, (row['name'], line) + checked_wires[wire] = batterylog + else: + batterylog = checked_wires[wire] + line = f'{best} bits ok=667 skip=1 fail=0' + artifact = dict(name=row['name'], bits=best, wire=wire, blc=str(bitpath), lam=str(lampath), + battery_line=line, battery_log=batterylog, rechecked=recheck, + materialize_log=retrieval, seconds=round(time.monotonic()-start, 3)) + artifacts.append(artifact) + print(json.dumps({k:v for k,v in artifact.items() if k != 'wire'}), flush=True) +(LANE / 'artifacts.json').write_text(json.dumps(artifacts, indent=2) + '\n') diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/01_reference165.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/01_reference165.blc new file mode 100644 index 00000000..5c37eb3e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/01_reference165.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/01_reference165.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/01_reference165.lam new file mode 100644 index 00000000..76db82ac --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/01_reference165.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f.f (\g\h.h d) c) (e e e)) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/02_reference162.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/02_reference162.blc new file mode 100644 index 00000000..ce926778 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/02_reference162.blc @@ -0,0 +1 @@ +010001101000010000000101011000100001011100011110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/02_reference162.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/02_reference162.lam new file mode 100644 index 00000000..6ce8f66b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/02_reference162.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e.e) (\e.d (\f.c) (d d e)) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/03_reference164.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/03_reference164.blc new file mode 100644 index 00000000..054fb712 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/03_reference164.blc @@ -0,0 +1 @@ +01000110100001000000010110000101100000101110010101100010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/03_reference164.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/03_reference164.lam new file mode 100644 index 00000000..651ba6bb --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/03_reference164.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e.e (\f\g.g) c) (d (\e.e) (d d) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h)))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/04_shared_return.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/04_shared_return.blc new file mode 100644 index 00000000..361844d6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/04_shared_return.blc @@ -0,0 +1 @@ +010001101000010000010000010110000001011100001101111100111111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/04_shared_return.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/04_shared_return.lam new file mode 100644 index 00000000..84025b7b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/04_shared_return.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g.f (\h.h d) (c g)) (e e e)) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/05_bound_suffix.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/05_bound_suffix.blc new file mode 100644 index 00000000..3a33a28d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/05_bound_suffix.blc @@ -0,0 +1 @@ +0100011010000100000100000101100000000101111001101111100101111111011010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/05_bound_suffix.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/05_bound_suffix.lam new file mode 100644 index 00000000..05c4ebde --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/05_bound_suffix.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g\h.f (h d) (c g h)) (e e e)) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/06_bit_force.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/06_bit_force.blc new file mode 100644 index 00000000..372cd623 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/06_bit_force.blc @@ -0,0 +1 @@ +01000110100001000001000001100000010111001101111001011111101001011110111011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/06_bit_force.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/06_bit_force.lam new file mode 100644 index 00000000..a84e7113 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/06_bit_force.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g.f (g d) (c g (e e f)))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/07_cell_owned_return.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/07_cell_owned_return.blc new file mode 100644 index 00000000..98a3dd08 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/07_cell_owned_return.blc @@ -0,0 +1 @@ +010001101000010000010000011000000101110011011110010111100011111100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/07_cell_owned_return.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/07_cell_owned_return.lam new file mode 100644 index 00000000..0a084e58 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/07_cell_owned_return.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g.f (g d) (e (\h.c) (g g f)))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/08_split_tail_handlers.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/08_split_tail_handlers.blc new file mode 100644 index 00000000..4c2ca54f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/08_split_tail_handlers.blc @@ -0,0 +1 @@ +0100011010000100000100000110000101100001101111000010111111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/08_split_tail_handlers.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/08_split_tail_handlers.lam new file mode 100644 index 00000000..a2c74c70 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/08_split_tail_handlers.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f.f (\g.g d) (\g.c g (g g g)))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/09_tail_opens_return.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/09_tail_opens_return.blc new file mode 100644 index 00000000..d71c159d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/09_tail_opens_return.blc @@ -0,0 +1 @@ +010001101000010000010000011000000101110011011110010110000001111111101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/09_tail_opens_return.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/09_tail_opens_return.lam new file mode 100644 index 00000000..fbeb57ae --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/09_tail_opens_return.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g.f (g d) (g (\h\i.c g) (g g g)))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/10_whole_reopen.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/10_whole_reopen.blc new file mode 100644 index 00000000..13fe02cd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/10_whole_reopen.blc @@ -0,0 +1 @@ +01000110100001000001000001100000010111001101111001011110001111110010111101110111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/10_whole_reopen.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/10_whole_reopen.lam new file mode 100644 index 00000000..fb88c37f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/10_whole_reopen.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g.f (g d) (e (\h.c) (e e e)))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/11_tail_thunk.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/11_tail_thunk.blc new file mode 100644 index 00000000..67da55cc --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/11_tail_thunk.blc @@ -0,0 +1 @@ +010001101000010000000101100000010111010000101111110110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/11_tail_thunk.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/11_tail_thunk.lam new file mode 100644 index 00000000..a87a8c90 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/11_tail_thunk.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e\f.e f (\g.c f (f f g))) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/12_whole_thunk.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/12_whole_thunk.blc new file mode 100644 index 00000000..c11fd79f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/12_whole_thunk.blc @@ -0,0 +1 @@ +010001101000010000000101100000010111010000101111100011111100101111101111010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/12_whole_thunk.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/12_whole_thunk.lam new file mode 100644 index 00000000..89c7e402 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/12_whole_thunk.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e\f.e f (\g.d (\h.c) (d d g))) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/13_thunk_rebind_tail.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/13_thunk_rebind_tail.blc new file mode 100644 index 00000000..505a8753 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/13_thunk_rebind_tail.blc @@ -0,0 +1 @@ +0100011010000100000001010110001000011100000010111111010010110101110000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/13_thunk_rebind_tail.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/13_thunk_rebind_tail.lam new file mode 100644 index 00000000..20166a99 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/13_thunk_rebind_tail.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e.e) (\e.d (\f\g.c g (g g e))) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/14_projected_diagonal.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/14_projected_diagonal.blc new file mode 100644 index 00000000..ec1833e1 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/14_projected_diagonal.blc @@ -0,0 +1 @@ +0100011010000100000001010110001000010111000111100101000110100111000001010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/14_projected_diagonal.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/14_projected_diagonal.lam new file mode 100644 index 00000000..1b97791a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/14_projected_diagonal.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e.e) (\e.d (\f.c) ((\f.f f) (d (\f\g.g)) e)) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/15_predecessor_return.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/15_predecessor_return.blc new file mode 100644 index 00000000..bd2fae7c --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/15_predecessor_return.blc @@ -0,0 +1 @@ +01000110100001000000010101100010000101011100001101000000111110001111110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/15_predecessor_return.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/15_predecessor_return.lam new file mode 100644 index 00000000..28f5b1b3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/15_predecessor_return.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e.e) (\e.d (\f.f f) (\f\g.d (\h.c)) (d d e)) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/16_selected_cross.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/16_selected_cross.blc new file mode 100644 index 00000000..922b2566 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/16_selected_cross.blc @@ -0,0 +1 @@ +01000110100001000000010101100010000101110001111001011100101110001011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/16_selected_cross.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/16_selected_cross.lam new file mode 100644 index 00000000..cf22bb5f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/16_selected_cross.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e.e) (\e.d (\f.c) (d (d (\f.f) d) e)) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/17_tail_dual.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/17_tail_dual.blc new file mode 100644 index 00000000..5c8dd928 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/17_tail_dual.blc @@ -0,0 +1 @@ +010001101000010000000101100001011000001011100101100000010111010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/17_tail_dual.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/17_tail_dual.lam new file mode 100644 index 00000000..8d8bed56 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/17_tail_dual.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e.e (\f\g.g) c) (d (\e\f.e f (f f)) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h)))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/18_split_force_dual.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/18_split_force_dual.blc new file mode 100644 index 00000000..ae43b59d --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/18_split_force_dual.blc @@ -0,0 +1 @@ +0100011010000100000100000101100001011000001011110011000000101110011011110010110101111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/18_split_force_dual.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/18_split_force_dual.lam new file mode 100644 index 00000000..5e16b2d3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/18_split_force_dual.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f.f (\g\h.h) c) (e (\f\g.f (g d) (g g d)))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/19_bit_force_dual.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/19_bit_force_dual.blc new file mode 100644 index 00000000..cbe79403 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/19_bit_force_dual.blc @@ -0,0 +1 @@ +010001101000010000010000010110000101100000101111001100000010111001101111001011110111011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/19_bit_force_dual.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/19_bit_force_dual.lam new file mode 100644 index 00000000..bc719fe2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/19_bit_force_dual.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f.f (\g\h.h) c) (e (\f\g.f (g d) (e e f)))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/20_projected_dual.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/20_projected_dual.blc new file mode 100644 index 00000000..44e27f29 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/20_projected_dual.blc @@ -0,0 +1 @@ +01000110100001000001000001011000010110000010111100101011000001100101100000101100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/20_projected_dual.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/20_projected_dual.lam new file mode 100644 index 00000000..0cf5b948 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/20_projected_dual.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f.f (\g\h.h) c) (e (\f\g.f) (e (\f\g.g) d) (e e d))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/21_predecessor_dual.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/21_predecessor_dual.blc new file mode 100644 index 00000000..51dc2a5a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/21_predecessor_dual.blc @@ -0,0 +1 @@ +010001101000010000000101100001011000001011100101011000100100011010011000011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/21_predecessor_dual.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/21_predecessor_dual.lam new file mode 100644 index 00000000..a66b4e30 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/21_predecessor_dual.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e.e (\f\g.g) c) (d (\e.e) ((\e.e e) (d (\e.e e))) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h)))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/22_pred_adaptive_handler.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/22_pred_adaptive_handler.blc new file mode 100644 index 00000000..76424941 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/22_pred_adaptive_handler.blc @@ -0,0 +1 @@ +0100011010000100000100000101011000011010011000000101110011011110000001111111101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/22_pred_adaptive_handler.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/22_pred_adaptive_handler.lam new file mode 100644 index 00000000..d5cf3e5f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/22_pred_adaptive_handler.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f.f f) (e (\f\g.f (g d) (\h\i.c g))) (e e e)) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/23_false_pred.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/23_false_pred.blc new file mode 100644 index 00000000..2b428448 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/23_false_pred.blc @@ -0,0 +1 @@ +0100011010000100000001010110000110000010000001111000111110010101100010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/23_false_pred.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/23_false_pred.lam new file mode 100644 index 00000000..e6c52bca --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/23_false_pred.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e.e (\f\g.g)) (\e\f.d (\g.c)) (d (\e.e) (d d) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h)))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/24_reference57.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/24_reference57.blc new file mode 100644 index 00000000..a5a29221 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/24_reference57.blc @@ -0,0 +1 @@ +01000110100001000001000001010110000110000001101111100000011110001111110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/24_reference57.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/24_reference57.lam new file mode 100644 index 00000000..bed5ead6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/24_reference57.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f.f (\g\h.h d)) (\f\g.e (\h.c)) (e e e)) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/25_reference65.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/25_reference65.blc new file mode 100644 index 00000000..324b7e2b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/25_reference65.blc @@ -0,0 +1 @@ +0100011010000100000100000101100000010111101100101110011011110000001111111101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/25_reference65.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/25_reference65.lam new file mode 100644 index 00000000..cb5f84e4 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/25_reference65.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g.e f (f (g d) (\h\i.c g))) (e e e)) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/26_projected_pred.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/26_projected_pred.blc new file mode 100644 index 00000000..7472cb90 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/26_projected_pred.blc @@ -0,0 +1 @@ +0100011010000100000100000101011001100000110011000000101110011011110000001111111101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/26_projected_pred.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/26_projected_pred.lam new file mode 100644 index 00000000..a81371e3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/26_projected_pred.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (e (\f\g.f)) (e (\f\g.f (g d) (\h\i.c g))) (e e e)) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/27_projection_dispatch.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/27_projection_dispatch.blc new file mode 100644 index 00000000..4316aaaa --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/27_projection_dispatch.blc @@ -0,0 +1 @@ +010001101000010000000101011000001100101100000100001111100001011100111110000001111000000101110111001101111001111110000111111000010111101001110100101100011100101101010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/27_projection_dispatch.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/27_projection_dispatch.lam new file mode 100644 index 00000000..af5173b2 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/27_projection_dispatch.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e\f.e) (d (\e\f.f) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h))))))) (d (\e.c) (d d d))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/28_projection_tail_return.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/28_projection_tail_return.blc new file mode 100644 index 00000000..8c4a55c9 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/28_projection_tail_return.blc @@ -0,0 +1 @@ +010001101000010000000101011000001100101100000100001111100001011100111110000001111000000101110111001101111001111110000111111000010111101001110100101000110000001111110111001100000100101101010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/28_projection_tail_return.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/28_projection_tail_return.lam new file mode 100644 index 00000000..56d189c6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/28_projection_tail_return.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e\f.e) (d (\e\f.f) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h))))))) ((\e.e (\f\g.c e)) (d (\e\f.f)) (d d d))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/29_projection_pred_skip.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/29_projection_pred_skip.blc new file mode 100644 index 00000000..fdf31f38 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/29_projection_pred_skip.blc @@ -0,0 +1 @@ +0100011010000100000001010110000011001011000001000011111000010111001111100000011110000001011101110011011110011111100001111110000101111010011101001011000111001010001101001100001101010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/29_projection_pred_skip.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/29_projection_pred_skip.lam new file mode 100644 index 00000000..bb04c75e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/29_projection_pred_skip.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e\f.e) (d (\e\f.f) (\e.b (\f.e (c (\g\h.f (\i\j.i h (j g)))) (b (\g.c (\h.f h (g h))))))) (d (\e.c) ((\e.e e) (d (\e.e e)) d))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/30_projection_cross_skip.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/30_projection_cross_skip.blc new file mode 100644 index 00000000..be4630fe --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/30_projection_cross_skip.blc @@ -0,0 +1 @@ +010001101000010000010000010101100000110010110000010110010110001111001011001011000101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/30_projection_cross_skip.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/30_projection_cross_skip.lam new file mode 100644 index 00000000..47afa058 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/30_projection_cross_skip.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g.f) (e (\f\g.g) d) (e (\f.c) (e (e (\f.f) e) d))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/31_reboxed_tail.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/31_reboxed_tail.blc new file mode 100644 index 00000000..e7c8f26b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/31_reboxed_tail.blc @@ -0,0 +1 @@ +0100011010000100000100000110000001011100110111100101111110000111110000001101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/31_reboxed_tail.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/31_reboxed_tail.lam new file mode 100644 index 00000000..38ec2cb1 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/31_reboxed_tail.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g.f (g d) (c (\h.e (\i\j.j h)) (g g g)))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/32_projected_rebox.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/32_projected_rebox.blc new file mode 100644 index 00000000..388f9489 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/32_projected_rebox.blc @@ -0,0 +1 @@ +010001101000010000010000011000000101110011011110010111111001111000000001011001110000011001110000010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/32_projected_rebox.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/32_projected_rebox.lam new file mode 100644 index 00000000..4a0e89ba --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/32_projected_rebox.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g.f (g d) (c (e (\h\i\j.j (i (\k\l.k)) (i (\k\l.l)))) (g g g)))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/33_function_operand.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/33_function_operand.blc new file mode 100644 index 00000000..09de1cb1 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/33_function_operand.blc @@ -0,0 +1 @@ +010001101000010000010000010110000000010111100111011111001101100001011111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/33_function_operand.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/33_function_operand.lam new file mode 100644 index 00000000..74c79ce4 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/33_function_operand.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g\h.f (g d) (h g)) (\f.c f (f f f))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/34_callable_suffix.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/34_callable_suffix.blc new file mode 100644 index 00000000..e958966a --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/34_callable_suffix.blc @@ -0,0 +1 @@ +01000110100001000001000001011000000001011110010110111101111100101111111011001101111001101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/34_callable_suffix.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/34_callable_suffix.lam new file mode 100644 index 00000000..e9411c48 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/34_callable_suffix.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g\h.f (h e d) (c g (h e))) (e e)) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/35_cps_suffix.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/35_cps_suffix.blc new file mode 100644 index 00000000..b9fcc334 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/35_cps_suffix.blc @@ -0,0 +1 @@ +01000110100001000001000001011000000001011110011000011011111100110011111110110000110010111011011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/35_cps_suffix.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/35_cps_suffix.lam new file mode 100644 index 00000000..ce664faa --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/35_cps_suffix.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g\h.f (h (\i.i d)) (h (c g))) (\f.f (e e e))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/36_pair_operand.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/36_pair_operand.blc new file mode 100644 index 00000000..1669bcf6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/36_pair_operand.blc @@ -0,0 +1 @@ +01000110100001000001000001011000000001011110011000000111011111110011011111100001011001110000010010111011011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/36_pair_operand.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/36_pair_operand.lam new file mode 100644 index 00000000..31912b49 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/36_pair_operand.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g\h.f (h (\i\j.i d)) (h c)) (\f.f (e (\g\h.h)) (e e e))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/37_diagonal_callback.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/37_diagonal_callback.blc new file mode 100644 index 00000000..42fb7745 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/37_diagonal_callback.blc @@ -0,0 +1 @@ +01000110100001000001000001011000000001011110011101111100101101011000000101111110100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/37_diagonal_callback.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/37_diagonal_callback.lam new file mode 100644 index 00000000..c163493b --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/37_diagonal_callback.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g\h.f (g d) (h h g)) (\f\g.c g (g g f))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/38_tail_supplied_force.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/38_tail_supplied_force.blc new file mode 100644 index 00000000..c82ba452 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/38_tail_supplied_force.blc @@ -0,0 +1 @@ +0100011010000100000100000101100000000101111001110111110010111010110000000010111111101001011010111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/38_tail_supplied_force.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/38_tail_supplied_force.lam new file mode 100644 index 00000000..b642d7a5 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/38_tail_supplied_force.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g\h.f (g d) (g h g)) (\f\g\h.c h (h h f))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/39_selector_packet.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/39_selector_packet.blc new file mode 100644 index 00000000..c784c3fb --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/39_selector_packet.blc @@ -0,0 +1 @@ +010001101000010000000101100000000101111001110011011100101011011101100101110110100001011000011111100001011100111111000000111100000010111011100110111100111111100001111111000010111101001110101110011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/39_selector_packet.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/39_selector_packet.lam new file mode 100644 index 00000000..9b58ca21 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/39_selector_packet.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e\f\g.e (f (g e)) (g e f (f f g))) (\e.e (\f.b (\g.f (c (\h\i.g (\j\k.j i (k h)))) (b (\h.c (\i.g i (h i)))))) c)) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/40_action_packet.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/40_action_packet.blc new file mode 100644 index 00000000..9c47453f --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/40_action_packet.blc @@ -0,0 +1 @@ +01000110100001000001000001011000000001011110010110111011001010110111011001011101101000010110000110111101111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/40_action_packet.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/40_action_packet.lam new file mode 100644 index 00000000..d2acacd6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/40_action_packet.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g\h.f (h f g) (h f g (g g h))) (\f.f (\g.g d) c)) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/41_cps_packet.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/41_cps_packet.blc new file mode 100644 index 00000000..8792f345 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/41_cps_packet.blc @@ -0,0 +1 @@ +0100011010000100000100000101100000000101101110010111100001111010000101101110010111101110111100000011001011101111011111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/41_cps_packet.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/41_cps_packet.lam new file mode 100644 index 00000000..41280bbf --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/41_cps_packet.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c.(\d\e.e (\f\g\h.h f (f (\i.g i) (\i.i g (g g f)))) (\f\g.g (f d c))) (\d.b (\e.d (c (\f\g.e (\h\i.h g (i f)))) (b (\f.c (\g.e g (f g))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/42_reverse_packet.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/42_reverse_packet.blc new file mode 100644 index 00000000..6c4c0df3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/42_reverse_packet.blc @@ -0,0 +1 @@ +01000110100001000000010110000000010111100111001100000100101011000001101100101110110100001011011100001111110000101110011111100000011110000001011101110011011110011111110000111111100001011110100111010011010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/42_reverse_packet.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/42_reverse_packet.lam new file mode 100644 index 00000000..8bb13b79 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/42_reverse_packet.lam @@ -0,0 +1 @@ +(\a.a a) (\a.(\b\c\d.d (\e\f\g.e (f (g (\h\i.i))) (g (\h\i.h) f (f f g))) (\e.e c (\f.b (\g.f (c (\h\i.g (\j\k.j i (k h)))) (b (\h.c (\i.g i (h i)))))))) (a a)) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/43_constant_var_return.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/43_constant_var_return.blc new file mode 100644 index 00000000..e9a0d7c6 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/43_constant_var_return.blc @@ -0,0 +1 @@ +0100011010000001000001000101100001011000000110111111011111001011010100110000001011101110000001011111111011100101111011101110000101111011100001011100111100000011110000001011101110011011110010111110111100001111100001011110100111010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/43_constant_var_return.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/43_constant_var_return.lam new file mode 100644 index 00000000..51263acd --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/43_constant_var_return.lam @@ -0,0 +1 @@ +(\a.a a) (\a\b.(\c\d.(\e.e (\f.f (\g\h.h c) b) (e e e)) (d (\e\f.e d (\g\h.b f (f f f))))) (\c.a a (\d.c (b (\e\f.d (\g\h.g f (h e)))) (a a (\e.b (\f.d f (e f))))))) diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/44_constant_zero_return.blc b/data/self-interpreter/reasoning_floor/zoo/optimized/44_constant_zero_return.blc new file mode 100644 index 00000000..223d7159 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/44_constant_zero_return.blc @@ -0,0 +1 @@ +010001101000000100000100010110000101100000011011111101111100101101010011000000101110000001111011111101110000101111011100001011100111100000011110000001011101110011011110010111110111100001111100001011110100111010 diff --git a/data/self-interpreter/reasoning_floor/zoo/optimized/44_constant_zero_return.lam b/data/self-interpreter/reasoning_floor/zoo/optimized/44_constant_zero_return.lam new file mode 100644 index 00000000..7ddca6d3 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/optimized/44_constant_zero_return.lam @@ -0,0 +1 @@ +(\a.a a) (\a\b.(\c\d.(\e.e (\f.f (\g\h.h c) b) (e e e)) (d (\e\f.e (\g\h.f c) d))) (\c.a a (\d.c (b (\e\f.d (\g\h.g f (h e)))) (a a (\e.b (\f.d f (e f))))))) diff --git a/data/self-interpreter/reasoning_floor/zoo/report.py b/data/self-interpreter/reasoning_floor/zoo/report.py new file mode 100644 index 00000000..0113654e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/report.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python3 +"""Render the requested table and the reduction arguments from measured files.""" +import hashlib +import json +from pathlib import Path + +LANE = Path(__file__).resolve().parent +rows = json.loads((LANE / 'zoo.json').read_text()) +polish = list(map(json.loads, (LANE / 'polish.jsonl').read_text().splitlines())) +results = {(r['name'], r['frame']):r for r in polish} +artifacts = {r['name']:r for r in json.loads((LANE / 'artifacts.json').read_text())} +assert len(artifacts) == len(rows) +best = min(a['bits'] for a in artifacts.values()) +checks = sum(r['probes'] for r in rows) +family_count = len({r['family'] for r in rows}) +unique_nf = len({r['beta_normal_hash'] for r in rows}) +assert all(not r['failures'] for r in rows) +assert all(a['bits'] >= 162 for a in artifacts.values()), 'Update the headline for a new record' + +def rel(path): + return str(Path(path).relative_to(LANE)) + +text = [ + '**No sub-162 interpreter found.** The complete zoo has 44 hand-written reader bodies in ' + f'{family_count} organizational families, {unique_nf} distinct open beta-normal forms, ' + f'{checks} successful rigid reader-law probes, and {len(polish)} complete interpreter splices. ' + 'Every splice passed `ok=667 skip=1 fail=0`. Every smallest rendering listed below has a saved wire artifact ' + 'with that same battery result. The 162 and 164 controls were reproduced; none of the other constructions improved them.', + '', + 'The best artifact is [optimized/02_reference162.blc](optimized/02_reference162.blc), ' + 'with [lambda source](optimized/02_reference162.lam): **`162 bits ok=667 skip=1 fail=0`**. ' + 'It is the already known record, not a new interpreter. ' + 'The dual-operand control is [optimized/03_reference164.blc](optimized/03_reference164.blc): ' + '**`164 bits ok=667 skip=1 fail=0`**.', + '', + 'The constructions cover shared suffixes, separately selected tail handlers, input-owned output applications, ' + 'NEXT-last thunks, unequal-role cross applications, dual operands, conditional predecessors, projected Booleans, ' + 'rebuilt Scott cells, ordinary/CPS/pair callback operands, self-applied callbacks, selector/action/CPS packets, ' + 'and constant streams as return instructions. Related variants are grouped explicitly; beta-normal distinctness ' + 'alone is not being used as a claim of architectural novelty. Rows 01–03, 11, 24–25 and the relevant callback/reboxing ' + 'mechanisms have antecedents in the supplied record and are useful reference points. No claim of global originality ' + 'is made for the other individual syntax trees.', + '', + '**Conventions and measured table.** `s = list`, `c = cont`, `I = λa.a`, `K = λa b.a`, ' + '`F = λa b.b`, `D = λa.a a`. Every macro is expanded before counting. ' + '`RDR = λt.t (λb.b (λu r.r next) c) (t t t)` is the 165 reader as a function. ' + 'The isolated body is counted in the exact frame `[s, next, c, intL, x]`. ' + 'The `let165` column keeps NEXT let-bound, hence its raw size is the isolated size plus 122. ' + 'The `inline162` column substitutes the complete fixed NEXT under `λs`. This frame is included when the body ' + 'has one occurrence of `next`; four bodies with two occurrences retain only their let frame. ' + 'Each raw-size link is its complete `.lam` candidate; each polished-size link is the unmodified `polish.py` log.', + '', + '| ID | Body | Isolated bits | Raw let165 / inline162 | Polished let165 / inline162 | Smallest saved artifact and battery |', + '|---|---|---:|---|---|---|', +] +for row in rows: + raw, opt = [], [] + for label in ('let165', 'inline162'): + if label in row['frames']: + frame = row['frames'][label] + result = results[(row['name'], label)] + raw.append(f'[{frame["bits"]}]({rel(frame["path"])})') + opt.append(f'[{result["polished_bits"]}]({rel(result["log"])})') + else: + raw.append('—') + opt.append('—') + artifact = artifacts[row['name']] + body = row['body'].replace('\\', 'λ') + line = f'{artifact["bits"]} bits; ok=667 skip=1 fail=0' + text.append(f'| {row["name"]} | `{body}` | {row["isolated_bits"]} | {" / ".join(raw)} | {" / ".join(opt)} | [{line}]({rel(artifact["blc"])}) |') + +text += [ + '', + '**Uniform reduction arguments.** Write `Z_R = cons K R`, `U_n(N) = 1ⁿ0 ++ N`, ' + 'and `r = U_(n−1)(N)` in the variable branch. The following identities suffice for every row:', + '', + '| Expression | `s = Z_R` | `s = U_n(N)`, `n ≥ 1` |', + '|---|---|---|', + '| `s (λq.c)` | `c R` | `c r` |', + '| `s I` | `K R` | `I` |', + '| `s K` | `K` | `F` |', + '| `s F` | `R` | `r` |', + '| `s s` | `K R` | `K N` |', + '| `s D` and `s (s K)` | `K` | `r` |', + '| `s (λb.b F)` | `F` | `r` |', + '| `s I s` | `R` | `s` |', + '| `s I (s s) next` | `R next` | `N` |', + '', + 'The only unbounded step here is the standard equal-index diagonal: ' + '`U_0(N) U_0(N) →* K N`, and ' + '`U_(m+1)(N) U_(m+1)(N) →* U_m(N) U_m(N)`. ' + 'Therefore `U_m(N) U_m(N) a →* N` for every `m ≥ 0` and every argument `a`. ' + 'All other identities are fixed cell/Boolean reductions. A variable tail is always a Scott cell, ' + 'including `r = U_0(N)` at index one. Thus rebuilding it as `λh.r h` or ' + '`λh.h (r K) (r F)` is beta-correct on these inputs; no free-tail eta equality is assumed.', + '', + 'For the two constant-stream constructions, `T = K(K X)` satisfies ' + '`T H (T T T) →* X`, so `RDR T →* X` for arbitrary rigid `X`. ' + 'Row 43 transforms only the variable branch into that instruction; row 44 transforms only the zero branch. ' + 'The original stream is retained in the other branch.', + '', +] +for row in rows: + text.append(f'{int(row["name"][:2])}. **{row["name"]} ({row["family"]}).** {row["argument"]}') + +text += [ + '', + '**Second-stage objects.** These are explicit valid constructions, not just renamed readers:', + '', + '| Object | Role | Completed reader rows |', + '|---|---|---|', + '| `s I (s s) next` | Second-tag result at zero, suffix at a variable | 03, 23 |', + '| `s (λb r.b r (r r)) next` | Select a tail or a suffix thunk before handing it NEXT | 17 |', + '| `s I ((s D) (s D)) next` | Erased conditional predecessors become the variable diagonal | 21 |', + '| `s (λb r.b (r next) (λq t.c r))` | A zero result or a handler for another input cell | 22, 26 |', + '| `λr.c r (r r r)` | A complete variable-return action | 33 |', + '| `s s` | A constant suffix callable by either branch | 34 |', + '| `λk.k (s s s)` | A suffix delivered to a selected continuation | 35 |', + '| `λf.f (s F) (s s s)` | A pair consumed as a zero action or directly by `c` | 36 |', + '| `λf r.c r (r r f)` | A callback using itself as its erased skip force | 37 |', + '| `λb.b next c` | A tag-selected NEXT/continuation packet | 39 |', + '| `λb.b (λr.r next) c` | A tag-selected zero/variable action packet | 40 |', + '| `λb f.f (b next c)` | A selected operand delivered in CPS | 41 |', + '| `λa.a c next` | Reversed continuation/NEXT pair | 42 |', + '| `K(K X)` | An off-stream return instruction recognized by the reader | 43, 44 |', + '', + '**What was checked.** [zoo.py](zoo.py) contains the 44 literal hand-written terms and their arguments. ' + 'No grammar, Cartesian product, term enumeration, or candidate sweep was used. ' + 'The small de Bruijn normalizer in the repository checked both reader laws before any splicing: ' + '`Z_R` with rigid `R`, and `U_n(N)` for `n = 1..16, 31, 64` with rigid `N`, `next`, and `c`. ' + '[zoo.json](zoo.json) records all probe counts, exact expanded bodies, bit costs, and normal-form hashes. ' + 'The all-length reasoning is given above; these are hand reductions, not new Lean theorems.', + '', + 'Every full candidate was run through the actual repository command ' + '`python3 tools/self-interpreter/polish.py FILE.lam`. ' + '[run_polish.py](run_polish.py) only supplies resource controls and records the logs. ' + 'A lane-local `sitecustomize.py` caps battery worker pools at two, points subprocesses at a frozen binary, ' + 'and places compiler temporary files inside this lane. Letopt used its explicit two-thread option. ' + 'Its configured budgets were three cuts plus a two-cut no-inline run for inputs through 175 bits, ' + 'and two cuts for larger inputs. These are the requested polish operations, not an unrestricted search.', + '', + '**Tooling detail resolved for the deliverable.** `polish.py` uses `--report-le 164`. ' + 'Letopt can therefore print `smallest rendering ...: 169 bits` while its final `best` wire is still 173 bits: ' + 'the histogram tracks all configurations, but `best_t` is updated only from rendered reporting hits ' + '(`src/cli/golf/letopt.rs`, lines 815–858). This does not hide a sub-162 result, because every such result ' + 'would be inside the reporting threshold. To avoid presenting an unmaterialized size as a verified artifact, ' + '[collect.py](collect.py) rerendered each needed minimum with its own reporting threshold and at most two cuts, ' + 'then battery-checked any wire not already checked as an input candidate. ' + f'This required {sum(a["rechecked"] for a in artifacts.values())} new wire checks. ' + '[artifacts.json](artifacts.json) links every saved minimum to its actual battery log. ' + 'The source tree was not modified to change this reporting behavior.', + '', + f'All {len(polish)} polish invocations completed without timeout or battery failure; ' + f'the slowest took {max(r["seconds"] for r in polish):.3f} seconds. ' + f'Their summed wall time was {sum(r["seconds"] for r in polish):.3f} seconds. ' + 'Individual letopt subprocesses had a 100-second cap and whole polish process groups had a 115-second cap. ' + 'There was one active candidate job at a time. No other lane was written, and no agent was consulted. ' + 'The frozen executable SHA-256 is `' + + hashlib.sha256((LANE / 'blam-frozen').read_bytes()).hexdigest() + '`.', + '', + '**Assessment.** The successful cross-branch constructions really do have different source/stream ownership: ' + 'output nodes may come from the first cell, from the variable tail, from a callback, or from a transformed constant stream. ' + 'Several larger isolated readers shrink after let placement, confirming the reason to test complete splices. ' + 'In this catalogue the extra tail binding, re-opening, or packet dispatch costs more than the sharing saves. ' + 'That is an observation about these constructions, not a lower bound on readers or interpreters. ' + 'The simplest dual operand remains the 164 control; the 162 control remains the only 162-bit result.', + '', + 'To reproduce, run `PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/zoo/zoo.py`, then ' + '`PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/zoo/run_polish.py`, ' + '`PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/zoo/collect.py`, and ' + '`PYTHONDONTWRITEBYTECODE=1 python3 tmp/overnight/zoo/report.py` from the repository root. ' + '`run_polish.py` resumes from the existing `polish.jsonl`; a fresh reproduction needs that file moved aside inside the lane.', +] +(LANE / 'REPORT.md').write_text('\n'.join(text) + '\n') +print(f'Wrote REPORT.md: {len(rows)} bodies, {len(polish)} splices, best {best} bits') diff --git a/data/self-interpreter/reasoning_floor/zoo/run_polish.py b/data/self-interpreter/reasoning_floor/zoo/run_polish.py new file mode 100644 index 00000000..1cfb59fa --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/run_polish.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +"""Sequentially polish the fixed, checked zoo; one job, at most two workers.""" +import json +import os +from pathlib import Path +import re +import signal +import subprocess +import sys +import time + +LANE = Path(__file__).resolve().parent +ROOT = LANE.parents[2] +env = dict(os.environ, PYTHONDONTWRITEBYTECODE='1', PYTHONUNBUFFERED='1', + PYTHONPATH=str(LANE / 'runtime'), RAYON_NUM_THREADS='2', + TMPDIR=str(LANE / 'scratch')) +rows = json.loads((LANE / 'zoo.json').read_text()) +outpath = LANE / 'polish.jsonl' +done = set() +if outpath.exists(): + done = {(r['name'], r['frame']) for r in map(json.loads, outpath.read_text().splitlines())} +for row in rows: + for label, frame in row['frames'].items(): + if (row['name'], label) in done: + continue + logfile = LANE / 'logs' / (row['name'] + '_' + label + '.log') + start = time.monotonic() + command = [sys.executable, str(ROOT / 'tools/self-interpreter/polish.py'), frame['path']] + timeout = False + with logfile.open('w') as log: + child = subprocess.Popen(command, cwd=ROOT, env=env, stdout=log, stderr=subprocess.STDOUT, + start_new_session=True) + try: + code = child.wait(timeout=115) + except subprocess.TimeoutExpired: + timeout = True + os.killpg(child.pid, signal.SIGTERM) + try: + child.wait(timeout=2) + except subprocess.TimeoutExpired: + os.killpg(child.pid, signal.SIGKILL) + child.wait() + code = child.returncode + text = logfile.read_text() + sizes = list(map(int, re.findall(r'smallest (\d+)', text))) + checked = [tuple(map(int, m)) for m in re.findall(r'(\d+) bits\s+ok=(\d+) skip=(\d+) fail=(\d+)', text)] + item = dict(name=row['name'], frame=label, input_bits=frame['bits'], + polished_bits=min([frame['bits'], *sizes]), letopt_sizes=sizes, + batteries=checked, timeout=timeout, returncode=code, + seconds=round(time.monotonic()-start, 3), log=str(logfile)) + with outpath.open('a') as out: + out.write(json.dumps(item) + '\n') + print(json.dumps(item), flush=True) diff --git a/data/self-interpreter/reasoning_floor/zoo/zoo.json b/data/self-interpreter/reasoning_floor/zoo/zoo.json new file mode 100644 index 00000000..aeac4fd0 --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/zoo.json @@ -0,0 +1,1126 @@ +[ + { + "name": "01_reference165", + "family": "control", + "body": "s (\\b.b (\\u \\r.r next) c) (s s s)", + "expanded_body": "s (\\b.b (\\u \\r.r next) c) (s s s)", + "argument": "The shared suffix is R at zero and N at a variable; K drops the duplicate tail, F selects c.", + "isolated_bits": 43, + "beta_normal_bits": 43, + "beta_normal_hash": "73d752d604dbbfd04fb43356309be8f6616b3785e8fa365fd6ebf828c45bb039", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.104, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/01_reference165_let165.lam", + "bits": 165, + "wire": "010001101000010000010000010110000101100000011011111011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/01_reference165_inline162.lam", + "bits": 170, + "wire": "01000110100001000000010110000101100000011000011111111000010111001111111100000011110000001011101110011011110011111111100001111111110000101111010011101011100101101010011010" + } + } + }, + { + "name": "02_reference162", + "family": "control", + "body": "s I (\\u.s (\\q.c) (s s u)) next", + "expanded_body": "s (\\a.a) (\\u.s (\\q.c) (s s u)) next", + "argument": "s I is K R at zero and I at a variable. V next reopens s for c r and forces the diagonal with next.", + "isolated_bits": 44, + "beta_normal_bits": 44, + "beta_normal_hash": "9032704949db8fa384459b87ce1ad3b0c64cafbc9f9d3f2cdec198800eb316a3", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.1, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/02_reference162_let165.lam", + "bits": 166, + "wire": "0100011010000100000100000101011000100001011100011111001011101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/02_reference162_inline162.lam", + "bits": 162, + "wire": "010001101000010000000101011000100001011100011110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010" + } + } + }, + { + "name": "03_reference164", + "family": "control", + "body": "s (\\b.b F c) (s I (s s) next)", + "expanded_body": "s (\\b.b (\\a \\b.b) c) (s (\\a.a) (s s) next)", + "argument": "The dual operand is R next at zero and N at a variable. The outer K branch uses F to discard the tail.", + "isolated_bits": 46, + "beta_normal_bits": 46, + "beta_normal_hash": "2d19043ed48b667bbc5a53e2fbb4a2ea5d515b121b83400a0e36981883b0a7ba", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.1, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/03_reference164_let165.lam", + "bits": 168, + "wire": "010001101000010000010000010110000101100000101111001010110001001101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/03_reference164_inline162.lam", + "bits": 164, + "wire": "01000110100001000000010110000101100000101110010101100010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010" + } + } + }, + { + "name": "04_shared_return", + "family": "shared suffix", + "body": "s (\\b \\r.b (\\t.t next) (c r)) (s s s)", + "expanded_body": "s (\\b \\r.b (\\t.t next) (c r)) (s s s)", + "argument": "Select a function of the shared suffix: application to next at zero, and c r at a variable.", + "isolated_bits": 49, + "beta_normal_bits": 49, + "beta_normal_hash": "c54a78db80d3fbca8afb03b0132e012f0fb138d85aef06af8de7d33d0e959a44", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.1, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/04_shared_return_let165.lam", + "bits": 171, + "wire": "010001101000010000010000010110000001011100001101111100111111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/04_shared_return_inline162.lam", + "bits": 176, + "wire": "01000110100001000000010110000001011100001100001111111100001011100111111110000001111000000101110111001101111001111111110000111111111000010111101001110100111110100101101010011010" + } + } + }, + { + "name": "05_bound_suffix", + "family": "shared suffix", + "body": "s (\\b \\r \\t.b (t next) (c r t)) (s s s)", + "expanded_body": "s (\\b \\r \\t.b (t next) (c r t)) (s s s)", + "argument": "Bind the common suffix once and use it either as the second-tag stream or the return remainder.", + "isolated_bits": 56, + "beta_normal_bits": 56, + "beta_normal_hash": "a4086622051170c4be2aa9bf492e32e0d7fd3a1ef1e6f52fbaba6f187b4d6c1f", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.118, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/05_bound_suffix_let165.lam", + "bits": 178, + "wire": "0100011010000100000100000101100000000101111001101111100101111111011010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/05_bound_suffix_inline162.lam", + "bits": 183, + "wire": "010001101000010000000101100000000101111001100001111111100001011100111111110000001111000000101110111001101111001111111110000111111111000010111101001110100101111110110100101101010011010" + } + } + }, + { + "name": "06_bit_force", + "family": "branch-local diagonal", + "body": "s (\\b \\r.b (r next) (c r (s s b)))", + "expanded_body": "s (\\b \\r.b (r next) (c r (s s b)))", + "argument": "Direct Boolean dispatch; the first bit itself is the erased force of the whole-stream diagonal.", + "isolated_bits": 51, + "beta_normal_bits": 51, + "beta_normal_hash": "da9aaa5eb9f88b711282299b06126484ed28cc985a97039fb1c6fc9db0f07dbd", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.123, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/06_bit_force_let165.lam", + "bits": 173, + "wire": "01000110100001000001000001100000010111001101111001011111101001011110111011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/06_bit_force_inline162.lam", + "bits": 175, + "wire": "0100011010000100000001100000010111001100001111111000010111001111111000000111100000010111011100110111100111111110000111111110000101111010011101001011111010010111101110110011010" + } + } + }, + { + "name": "07_cell_owned_return", + "family": "branch-local diagonal", + "body": "s (\\b \\r.b (r next) (s (\\q.c) (r r b)))", + "expanded_body": "s (\\b \\r.b (r next) (s (\\q.c) (r r b)))", + "argument": "The first cell supplies c with r; the separately bound r supplies the diagonal suffix, forced by b.", + "isolated_bits": 52, + "beta_normal_bits": 52, + "beta_normal_hash": "0d88c90430aed4bf9b55d079450a73be171151d08631a1545cfd5fb87fedbb15", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.106, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/07_cell_owned_return_let165.lam", + "bits": 174, + "wire": "010001101000010000010000011000000101110011011110010111100011111100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/07_cell_owned_return_inline162.lam", + "bits": 176, + "wire": "01000110100001000000011000000101110011000011111110000101110011111110000001111000000101110111001101111001111111100001111111100001011110100111010010111100011111001011010110011010" + } + } + }, + { + "name": "08_split_tail_handlers", + "family": "split tail handlers", + "body": "s (\\b.b (\\r.r next) (\\r.c r (r r r)))", + "expanded_body": "s (\\b.b (\\r.r next) (\\r.c r (r r r)))", + "argument": "Dispatch before binding the tail. Each selected handler then receives r from the stream cell.", + "isolated_bits": 47, + "beta_normal_bits": 47, + "beta_normal_hash": "f000fd79fef11d6b249771d953d8aeea42baf41eaa6430d04549ee661b4bf360", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.094, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/08_split_tail_handlers_let165.lam", + "bits": 169, + "wire": "0100011010000100000100000110000101100001101111000010111111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/08_split_tail_handlers_inline162.lam", + "bits": 171, + "wire": "010001101000010000000110000101100001100001111111000010111001111111000000111100000010111011100110111100111111110000111111110000101111010011101000010111110100101101010011010" + } + } + }, + { + "name": "09_tail_opens_return", + "family": "input-owned return", + "body": "s (\\b \\r.b (r next) (r (\\q \\t.c r) (r r r)))", + "expanded_body": "s (\\b \\r.b (r next) (r (\\q \\t.c r) (r r r)))", + "argument": "A variable tail is always a cell. Its two fields are discarded to expose c r before the suffix is supplied.", + "isolated_bits": 58, + "beta_normal_bits": 58, + "beta_normal_hash": "b96cdb2578048ab4df1df6c849a86f69caf838f11f79317e13c73031e0dd8688", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.105, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/09_tail_opens_return_let165.lam", + "bits": 180, + "wire": "010001101000010000010000011000000101110011011110010110000001111111101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/09_tail_opens_return_inline162.lam", + "bits": 182, + "wire": "01000110100001000000011000000101110011000011111110000101110011111110000001111000000101110111001101111001111111100001111111100001011110100111010010110000001111111011100101101010011010" + } + } + }, + { + "name": "10_whole_reopen", + "family": "input-owned return", + "body": "s (\\b \\r.b (r next) (s (\\q.c) (s s s)))", + "expanded_body": "s (\\b \\r.b (r next) (s (\\q.c) (s s s)))", + "argument": "The outer opening supplies only the zero tail; both variable output positions are recovered from another whole-stream opening.", + "isolated_bits": 57, + "beta_normal_bits": 57, + "beta_normal_hash": "ce730e1199d892fe483eda2f79709cdda8bcf10edd41a823b9ea024b6769b6f3", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.147, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/10_whole_reopen_let165.lam", + "bits": 179, + "wire": "01000110100001000001000001100000010111001101111001011110001111110010111101110111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/10_whole_reopen_inline162.lam", + "bits": 181, + "wire": "0100011010000100000001100000010111001100001111111000010111001111111000000111100000010111011100110111100111111110000111111110000101111010011101001011110001111100101111011101110011010" + } + } + }, + { + "name": "11_tail_thunk", + "family": "NEXT last", + "body": "s (\\b \\r.b r (\\u.c r (r r u))) next", + "expanded_body": "s (\\b \\r.b r (\\u.c r (r r u))) next", + "argument": "The zero branch is r itself. The variable branch receives next as the erased diagonal force; this is the known 168 witness.", + "isolated_bits": 50, + "beta_normal_bits": 50, + "beta_normal_hash": "3632fa2ed73fa63eabd9f74eadd3ad6e2f92e3553c4b0756c2d28fd0255c62cd", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.095, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/11_tail_thunk_let165.lam", + "bits": 172, + "wire": "0100011010000100000100000101100000010111010000101111111011001011101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/11_tail_thunk_inline162.lam", + "bits": 168, + "wire": "010001101000010000000101100000010111010000101111110110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010" + } + } + }, + { + "name": "12_whole_thunk", + "family": "NEXT last", + "body": "s (\\b \\r.b r (\\u.s (\\q.c) (s s u))) next", + "expanded_body": "s (\\b \\r.b r (\\u.s (\\q.c) (s s u))) next", + "argument": "Use an explicit bit/tail dispatcher but reopen the whole stream inside the selected variable thunk.", + "isolated_bits": 59, + "beta_normal_bits": 59, + "beta_normal_hash": "b221505a919d7117ddc96e25fd7eca3f6e14b45ed3ccb0860d877ba9b68dc7d9", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.136, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/12_whole_thunk_let165.lam", + "bits": 181, + "wire": "0100011010000100000100000101100000010111010000101111100011111110010111110111101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/12_whole_thunk_inline162.lam", + "bits": 177, + "wire": "010001101000010000000101100000010111010000101111100011111100101111101111010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010" + } + } + }, + { + "name": "13_thunk_rebind_tail", + "family": "NEXT last", + "body": "s I (\\u.s (\\b \\r.c r (r r u))) next", + "expanded_body": "s (\\a.a) (\\u.s (\\b \\r.c r (r r u))) next", + "argument": "The variable thunk opens s and binds r once for both its returned index and its skip diagonal.", + "isolated_bits": 51, + "beta_normal_bits": 51, + "beta_normal_hash": "28158f6cda250d24fc21869a4390f7eb9bfd7b15ef0f700b34e131478d6eaad2", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.093, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/13_thunk_rebind_tail_let165.lam", + "bits": 173, + "wire": "01000110100001000001000001010110001000011100000010111111101001011010111011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/13_thunk_rebind_tail_inline162.lam", + "bits": 169, + "wire": "0100011010000100000001010110001000011100000010111111010010110101110000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010" + } + } + }, + { + "name": "14_projected_diagonal", + "family": "NEXT last", + "body": "s I (\\u.s (\\q.c) ((s F) (s F) u)) next", + "expanded_body": "s (\\a.a) (\\u.s (\\q.c) ((s (\\a \\b.b)) (s (\\a \\b.b)) u)) next", + "argument": "The variable thunk computes the suffix by diagonalizing two independently projected tails.", + "isolated_bits": 60, + "beta_normal_bits": 60, + "beta_normal_hash": "0f7aab487baa61b6f81201a0b4887375f3fac8f8575a06975fb2aeadcbc7c845", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.094, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/14_projected_diagonal_let165.lam", + "bits": 182, + "wire": "01000110100001000001000001010110001000010111000111110010101110000010011100000101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/14_projected_diagonal_inline162.lam", + "bits": 178, + "wire": "0100011010000100000001010110001000010111000111100101011100000100111000001010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010" + } + } + }, + { + "name": "15_predecessor_return", + "family": "NEXT last", + "body": "s I (\\u.(s D) (\\q \\r.s (\\a.c)) (s s u)) next", + "expanded_body": "s (\\a.a) (\\u.(s (\\a.a a)) (\\q \\r.s (\\a.c)) (s s u)) next", + "argument": "In the selected variable branch, s D is r. Opening that cell with a constant handler yields c r.", + "isolated_bits": 67, + "beta_normal_bits": 67, + "beta_normal_hash": "b092bfaad9ef6e3ef44728a3ab1e355534c61cd0631a820c9d6e3fce91d1f4f0", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.111, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/15_predecessor_return_let165.lam", + "bits": 189, + "wire": "010001101000010000010000010101100010000101011100001101000000111110001111111001011101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/15_predecessor_return_inline162.lam", + "bits": 185, + "wire": "01000110100001000000010101100010000101011100001101000000111110001111110010111011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010" + } + } + }, + { + "name": "16_selected_cross", + "family": "cross application", + "body": "s I (\\u.s (\\q.c) (s (s I s) u)) next", + "expanded_body": "s (\\a.a) (\\u.s (\\q.c) (s (s (\\a.a) s) u)) next", + "argument": "s I s equals s on variables and R on zero. The variable-only cross application therefore diagonalizes equal whole streams.", + "isolated_bits": 55, + "beta_normal_bits": 55, + "beta_normal_hash": "0667480d8d6f4152b13fb01afcdf076502b9b9e3c8c1e747591ce3967b360d8c", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.106, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/16_selected_cross_let165.lam", + "bits": 177, + "wire": "010001101000010000010000010101100010000101110001111100101110010111000101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/16_selected_cross_inline162.lam", + "bits": 173, + "wire": "01000110100001000000010101100010000101110001111001011100101110001011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010" + } + } + }, + { + "name": "17_tail_dual", + "family": "dual operand", + "body": "s (\\b.b F c) (s (\\b \\r.b r (r r)) next)", + "expanded_body": "s (\\b.b (\\a \\b.b) c) (s (\\b \\r.b r (r r)) next)", + "argument": "The dual operand chooses R or the tail diagonal before receiving next, giving R next or N.", + "isolated_bits": 53, + "beta_normal_bits": 53, + "beta_normal_hash": "51582783cea78132310529717d834b0d1ce2169bad651d23fca09d36ac3467d4", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.093, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/17_tail_dual_let165.lam", + "bits": 175, + "wire": "0100011010000100000100000101100001011000001011110010110000001011101001101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/17_tail_dual_inline162.lam", + "bits": 171, + "wire": "010001101000010000000101100001011000001011100101100000010111010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010" + } + } + }, + { + "name": "18_split_force_dual", + "family": "dual operand", + "body": "s (\\b.b F c) (s (\\b \\r.b (r next) (r r next)))", + "expanded_body": "s (\\b.b (\\a \\b.b) c) (s (\\b \\r.b (r next) (r r next)))", + "argument": "Both arms of the dual operand consume next: the zero arm retains it, the variable arm erases it.", + "isolated_bits": 62, + "beta_normal_bits": 62, + "beta_normal_hash": "914c2ccfa1f6c75eaca19732e73a2ad3b20f1cdb6b24d6073ba5fce19aca519a", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.094, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/18_split_force_dual_let165.lam", + "bits": 184, + "wire": "0100011010000100000100000101100001011000001011110011000000101110011011110010110101111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + } + } + }, + { + "name": "19_bit_force_dual", + "family": "dual operand", + "body": "s (\\b.b F c) (s (\\b \\r.b (r next) (s s b)))", + "expanded_body": "s (\\b.b (\\a \\b.b) c) (s (\\b \\r.b (r next) (s s b)))", + "argument": "The dual operand dispatches directly and uses its locally bound first bit to force the whole-stream skip.", + "isolated_bits": 64, + "beta_normal_bits": 64, + "beta_normal_hash": "6fa52aa476ab7494880b548cc2ce243eb3ce10ab79b0c41f9372f2c0e70d27df", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.123, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/19_bit_force_dual_let165.lam", + "bits": 186, + "wire": "010001101000010000010000010110000101100000101111001100000010111001101111001011110111011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/19_bit_force_dual_inline162.lam", + "bits": 188, + "wire": "01000110100001000000010110000101100000101110011000000101110011000011111110000101110011111110000001111000000101110111001101111001111111100001111111100001011110100111010010111101110110011010" + } + } + }, + { + "name": "20_projected_dual", + "family": "dual operand", + "body": "s (\\b.b F c) ((s K) ((s F) next) (s s next))", + "expanded_body": "s (\\b.b (\\a \\b.b) c) ((s (\\a \\b.a)) ((s (\\a \\b.b)) next) (s s next))", + "argument": "A projected Boolean selects between tail application and diagonal forcing; neither arm binds the tail.", + "isolated_bits": 66, + "beta_normal_bits": 66, + "beta_normal_hash": "7bbb743af024fac2e02ad25b82ad95490b27b0d4582916fcac26af2aac39e4f4", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.101, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/20_projected_dual_let165.lam", + "bits": 188, + "wire": "01000110100001000001000001011000010110000010111100101011000001100101100000101100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + } + } + }, + { + "name": "21_predecessor_dual", + "family": "conditional predecessor", + "body": "s (\\b.b F c) (s I ((s D) (s D)) next)", + "expanded_body": "s (\\b.b (\\a \\b.b) c) (s (\\a.a) ((s (\\a.a a)) (s (\\a.a a))) next)", + "argument": "Only in the variable branch, both conditional predecessors equal r; their diagonal is K N. The zero branch erases them.", + "isolated_bits": 66, + "beta_normal_bits": 66, + "beta_normal_hash": "6b9e714b38fe3c83b3257b6f17706b668d70aa2e2514a7cb0e365818c32c2eaa", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.095, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/21_predecessor_dual_let165.lam", + "bits": 188, + "wire": "01000110100001000001000001011000010110000010111100101011000100101100001101001100001101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/21_predecessor_dual_inline162.lam", + "bits": 184, + "wire": "0100011010000100000001011000010110000010111001010110001001011000011010011000011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010" + } + } + }, + { + "name": "22_pred_adaptive_handler", + "family": "conditional predecessor", + "body": "s D (s (\\b \\r.b (r next) (\\q \\t.c r))) (s s s)", + "expanded_body": "s (\\a.a a) (s (\\b \\r.b (r next) (\\q \\t.c r))) (s s s)", + "argument": "s D is K at zero and r at a variable. The adaptive operand is R next or a two-field constant returning c r.", + "isolated_bits": 68, + "beta_normal_bits": 68, + "beta_normal_hash": "a84bfdeaf4a1c69f1fb18537c30e932b674e500e09b1185b1494df3bbf700ce1", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.112, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/22_pred_adaptive_handler_let165.lam", + "bits": 190, + "wire": "0100011010000100000100000101011000011010011000000101110011011110000001111111101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/22_pred_adaptive_handler_inline162.lam", + "bits": 192, + "wire": "010001101000010000000101011000011010011000000101110011000011111110000101110011111110000001111000000101110111001101111001111111100001111111100001011110100111010000001111111011100101101010011010" + } + } + }, + { + "name": "23_false_pred", + "family": "conditional predecessor", + "body": "s (\\b.b F) (\\q \\t.s (\\a.c)) (s I (s s) next)", + "expanded_body": "s (\\b.b (\\a \\b.b)) (\\q \\t.s (\\a.c)) (s (\\a.a) (s s) next)", + "argument": "The head is F at zero and r at a variable. F keeps the dual operand; r opens the constant handler to produce c r.", + "isolated_bits": 60, + "beta_normal_bits": 60, + "beta_normal_hash": "2beb89471db000c7263f85e633b5ce9cc4e99b771d33f4667d5f6b7a726e50d1", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.111, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/23_false_pred_let165.lam", + "bits": 182, + "wire": "01000110100001000001000001010110000110000010000001111000111111001010110001001101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/23_false_pred_inline162.lam", + "bits": 178, + "wire": "0100011010000100000001010110000110000010000001111000111110010101100010011010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010011010" + } + } + }, + { + "name": "24_reference57", + "family": "cell-borrowed dispatch", + "body": "s (\\b.b (\\u \\r.r next)) (\\q \\t.s (\\a.c)) (s s s)", + "expanded_body": "s (\\b.b (\\u \\r.r next)) (\\q \\t.s (\\a.c)) (s s s)", + "argument": "The known beta-prime witness: zero selects the drop-and-apply handler; the variable tail opens a constant handler.", + "isolated_bits": 57, + "beta_normal_bits": 57, + "beta_normal_hash": "8108d8614e9367581daf0fbf49213835afb48f7082d46817f63e8b1feb4fa51e", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.11, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/24_reference57_let165.lam", + "bits": 179, + "wire": "01000110100001000001000001010110000110000001101111100000011110001111110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/24_reference57_inline162.lam", + "bits": 184, + "wire": "0100011010000100000001010110000110000001100001111111100001011100111111110000001111000000101110111001101111001111111110000111111111000010111101001110100000011110001111100101101010011010" + } + } + }, + { + "name": "25_reference65", + "family": "cell-borrowed dispatch", + "body": "s (\\b \\r.s b (b (r next) (\\q \\t.c r))) (s s s)", + "expanded_body": "s (\\b \\r.s b (b (r next) (\\q \\t.c r))) (s s s)", + "argument": "The known delta witness: s b is K or r, while a separate opening retains the original tail.", + "isolated_bits": 65, + "beta_normal_bits": 65, + "beta_normal_hash": "74f2eb3e2c10d53151b4b701fea60aaccbec2dc121b416a5960466a032a57929", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.13, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/25_reference65_let165.lam", + "bits": 187, + "wire": "0100011010000100000100000101100000010111101100101110011011110000001111111101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/25_reference65_inline162.lam", + "bits": 189, + "wire": "010001101000010000000101100000010111101100101110011000011111110000101110011111110000001111000000101110111001101111001111111100001111111100001011110100111010000001111111011100101101010011010" + } + } + }, + { + "name": "26_projected_pred", + "family": "cell-borrowed dispatch", + "body": "s (s K) (s (\\b \\r.b (r next) (\\q \\t.c r))) (s s s)", + "expanded_body": "s (s (\\a \\b.a)) (s (\\b \\r.b (r next) (\\q \\t.c r))) (s s s)", + "argument": "s (s K) is K at zero and r at a variable. It controls the same adaptive result/handler interface without a source diagonal lambda.", + "isolated_bits": 71, + "beta_normal_bits": 71, + "beta_normal_hash": "c0235f7581dd7478a464155e342e6ff4b16cc104710db70d1c1b2048486b4647", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.118, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/26_projected_pred_let165.lam", + "bits": 193, + "wire": "0100011010000100000100000101011001100000110011000000101110011011110000001111111101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/26_projected_pred_inline162.lam", + "bits": 195, + "wire": "010001101000010000000101011001100000110011000000101110011000011111110000101110011111110000001111000000101110111001101111001111111100001111111100001011110100111010000001111111011100101101010011010" + } + } + }, + { + "name": "27_projection_dispatch", + "family": "projected Boolean", + "body": "(s K) ((s F) next) (s (\\q.c) (s s s))", + "expanded_body": "(s (\\a \\b.a)) ((s (\\a \\b.b)) next) (s (\\q.c) (s s s))", + "argument": "Project the first bit to choose the two complete computations; the variable return uses stream-owned applications.", + "isolated_bits": 53, + "beta_normal_bits": 53, + "beta_normal_hash": "12d762a72f52253399ef15ca69181336e2abb708af405abe6f71da57fc60535a", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.1, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/27_projection_dispatch_let165.lam", + "bits": 175, + "wire": "0100011010000100000100000101011000001100101100000101100101100011110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/27_projection_dispatch_inline162.lam", + "bits": 171, + "wire": "010001101000010000000101011000001100101100000100001111100001011100111110000001111000000101110111001101111001111110000111111000010111101001110100101100011100101101010011010" + } + } + }, + { + "name": "28_projection_tail_return", + "family": "projected Boolean", + "body": "(s K) ((s F) next) ((s F) (\\b \\r.c (s F)) (s s s))", + "expanded_body": "(s (\\a \\b.a)) ((s (\\a \\b.b)) next) ((s (\\a \\b.b)) (\\b \\r.c (s (\\a \\b.b))) (s s s))", + "argument": "Under the variable selection, the projected tail is a cell whose fields can be discarded to produce c of another tail projection.", + "isolated_bits": 78, + "beta_normal_bits": 78, + "beta_normal_hash": "d41e03f207ec70b622ad65a00434507735acb199621a3ef1f6d756e59793ddd1", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.113, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/28_projection_tail_return_let165.lam", + "bits": 200, + "wire": "01000110100001000001000001010110000011001011000001011001010110000010000001111110011110000010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/28_projection_tail_return_inline162.lam", + "bits": 196, + "wire": "0100011010000100000001010110000011001011000001000011111000010111001111100000011110000001011101110011011110011111100001111110000101111010011101001010110000010000001111100111100000100101101010011010" + } + } + }, + { + "name": "29_projection_pred_skip", + "family": "projected Boolean", + "body": "(s K) ((s F) next) (s (\\q.c) ((s D) (s D) s))", + "expanded_body": "(s (\\a \\b.a)) ((s (\\a \\b.b)) next) (s (\\q.c) ((s (\\a.a a)) (s (\\a.a a)) s))", + "argument": "Only the selected variable arm diagonalizes conditional predecessors; the whole stream is its erased force.", + "isolated_bits": 73, + "beta_normal_bits": 73, + "beta_normal_hash": "d8c3fe043aa562914e309498436264bb53eb01f2fbd1ac30fddba46eb3155e3b", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.095, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/29_projection_pred_skip_let165.lam", + "bits": 195, + "wire": "010001101000010000010000010101100000110010110000010110010110001111001010110000110100110000110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/29_projection_pred_skip_inline162.lam", + "bits": 191, + "wire": "01000110100001000000010101100000110010110000010000111110000101110011111000000111100000010111011100110111100111111000011111100001011110100111010010110001110010101100001101001100001101010011010" + } + } + }, + { + "name": "30_projection_cross_skip", + "family": "cross application", + "body": "(s K) ((s F) next) (s (\\q.c) (s (s I s) next))", + "expanded_body": "(s (\\a \\b.a)) ((s (\\a \\b.b)) next) (s (\\q.c) (s (s (\\a.a) s) next))", + "argument": "The variable arm cross-applies s to the conditional R-or-s object, which equals s there; next is erased there.", + "isolated_bits": 64, + "beta_normal_bits": 64, + "beta_normal_hash": "2e18e2d8bc1d701dc549dce33f5712fbf34e7f09bb8072e4a6ba91bee36632fb", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.107, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/30_projection_cross_skip_let165.lam", + "bits": 186, + "wire": "010001101000010000010000010101100000110010110000010110010110001111001011001011000101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + } + } + }, + { + "name": "31_reboxed_tail", + "family": "rebuilt tail", + "body": "s (\\b \\r.b (r next) (c (\\h.s (\\q \\t.t h)) (r r r)))", + "expanded_body": "s (\\b \\r.b (r next) (c (\\h.s (\\q \\t.t h)) (r r r)))", + "argument": "The returned tail is rebuilt by opening s inside a fresh handler lambda. On a variable r is a Scott cell, so the reconstruction beta-reduces to r.", + "isolated_bits": 65, + "beta_normal_bits": 65, + "beta_normal_hash": "23720bc5ee22564e242829ae63cc2cf398b502eb92a1fa2805f3a7635d4d76d1", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.106, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/31_reboxed_tail_let165.lam", + "bits": 187, + "wire": "0100011010000100000100000110000001011100110111100101111110000111110000001101110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/31_reboxed_tail_inline162.lam", + "bits": 189, + "wire": "010001101000010000000110000001011100110000111111100001011100111111100000011110000001011101110011011110011111111000011111111000010111101001110100101111100001111100000011011100101101010011010" + } + } + }, + { + "name": "32_projected_rebox", + "family": "rebuilt tail", + "body": "s (\\b \\r.b (r next) (c (s (\\q \\t.\\h.h (t K) (t F))) (r r r)))", + "expanded_body": "s (\\b \\r.b (r next) (c (s (\\q \\t.\\h.h (t (\\a \\b.a)) (t (\\a \\b.b)))) (r r r)))", + "argument": "A variable tail is a cell; independently projecting its bit and remainder rebuilds that exact cell, including at index one.", + "isolated_bits": 85, + "beta_normal_bits": 85, + "beta_normal_hash": "0550a039a1e2b3c99f2f05b9d60fa4fff842198b833bfad1842c496cd3a56018", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.109, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/32_projected_rebox_let165.lam", + "bits": 207, + "wire": "010001101000010000010000011000000101110011011110010111111001111000000001011001110000011001110000010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/32_projected_rebox_inline162.lam", + "bits": 209, + "wire": "01000110100001000000011000000101110011000011111110000101110011111110000001111000000101110111001101111001111111100001111111100001011110100111010010111110011110000000010110011100000110011100000100101101010011010" + } + } + }, + { + "name": "33_function_operand", + "family": "callback operand", + "body": "s (\\b \\r \\f.b (r next) (f r)) (\\r.c r (r r r))", + "expanded_body": "s (\\b \\r \\f.b (r next) (f r)) (\\r.c r (r r r))", + "argument": "Pass the entire variable action as a final operand. The selected Boolean decides whether to apply it to the original tail.", + "isolated_bits": 61, + "beta_normal_bits": 61, + "beta_normal_hash": "82427124d87ef250971535303ac688a85bf6b91c59ef274a4071f317cc6f6dc6", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.095, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/33_function_operand_let165.lam", + "bits": 183, + "wire": "010001101000010000010000010110000000010111100111011111001101100001011111010010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/33_function_operand_inline162.lam", + "bits": 188, + "wire": "01000110100001000000010110000000010111100111000011111111000010111001111111100000011110000001011101110011011110011111111100001111111110000101111010011101001101100001011110100101101010011010" + } + } + }, + { + "name": "34_callable_suffix", + "family": "callback operand", + "body": "s (\\b \\r \\f.b ((f s) next) (c r (f s))) (s s)", + "expanded_body": "s (\\b \\r \\f.b ((f s) next) (c r (f s))) (s s)", + "argument": "The operand is a constant suffix function K R or K N; force it with s at either use.", + "isolated_bits": 66, + "beta_normal_bits": 66, + "beta_normal_hash": "00f57e25ca179f0020c2accb89d7a220c83b3f54a5e95eb48eaf6f49ee6e00ef", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.159, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/34_callable_suffix_let165.lam", + "bits": 188, + "wire": "01000110100001000001000001011000000001011110010110111101111100101111111011001101111001101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/34_callable_suffix_inline162.lam", + "bits": 193, + "wire": "0100011010000100000001011000000001011110010110111100001111111100001011100111111110000001111000000101110111001101111001111111110000111111111000010111101001110100101111110110011011110011010011010" + } + } + }, + { + "name": "35_cps_suffix", + "family": "CPS operand", + "body": "s (\\b \\r \\f.b (f (\\t.t next)) (f (c r))) (\\k.k (s s s))", + "expanded_body": "s (\\b \\r \\f.b (f (\\t.t next)) (f (c r))) (\\k.k (s s s))", + "argument": "A CPS suffix receives application-to-next at zero, or the partially applied return continuation at a variable.", + "isolated_bits": 72, + "beta_normal_bits": 72, + "beta_normal_hash": "df80fd5ab32cb66260ea91676b45cb881f9ecd68cad3bf7088991d832544853f", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.138, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/35_cps_suffix_let165.lam", + "bits": 194, + "wire": "01000110100001000001000001011000000001011110011000011011111100110011111110110000110010111011011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/35_cps_suffix_inline162.lam", + "bits": 202, + "wire": "0100011010000100000001011000000001011110011000011000011111111100001011100111111111000000111100000010111011100110111100111111111100001111111111000010111101001110100110011111101100001100101110110110011010" + } + } + }, + { + "name": "36_pair_operand", + "family": "pair operand", + "body": "s (\\b \\r \\p.b (p (\\a \\t.a next)) (p c)) (\\f.f (s F) (s s s))", + "expanded_body": "s (\\b \\r \\p.b (p (\\a \\t.a next)) (p c)) (\\f.f (s (\\a \\b.b)) (s s s))", + "argument": "The operand packages tail and skip. The zero callback ignores the skip; c consumes both in the variable branch.", + "isolated_bits": 84, + "beta_normal_bits": 84, + "beta_normal_hash": "ebb980ef870830b6e2fff58d6460c58bd923559ea489095127dc51a5f09237c4", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.104, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/36_pair_operand_let165.lam", + "bits": 206, + "wire": "01000110100001000001000001011000000001011110011000000111011111110011011111100001011001110000010010111011011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/36_pair_operand_inline162.lam", + "bits": 217, + "wire": "0100011010000100000001011000000001011110011000000111000011111111110000101110011111111110000001111000000101110111001101111001111111111100001111111111100001011110100111010011011111000010110011100000100101110110110011010" + } + } + }, + { + "name": "37_diagonal_callback", + "family": "callback operand", + "body": "s (\\b \\r \\f.b (r next) (f f r)) (\\f \\r.c r (r r f))", + "expanded_body": "s (\\b \\r \\f.b (r next) (f f r)) (\\f \\r.c r (r r f))", + "argument": "Self-apply the variable callback, using the callback itself only as the erased force of r r.", + "isolated_bits": 69, + "beta_normal_bits": 69, + "beta_normal_hash": "71c74e1adc3c904e8affdd11aca96750497f16a049f5b2ab182c727971738cfe", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.095, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/37_diagonal_callback_let165.lam", + "bits": 191, + "wire": "01000110100001000001000001011000000001011110011101111100101101011000000101111110100101101011000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/37_diagonal_callback_inline162.lam", + "bits": 196, + "wire": "0100011010000100000001011000000001011110011100001111111100001011100111111110000001111000000101110111001101111001111111110000111111111000010111101001110100101101011000000101111101001011010110011010" + } + } + }, + { + "name": "38_tail_supplied_force", + "family": "input-owned callback", + "body": "s (\\b \\r \\f.b (r next) (r f r)) (\\d \\t \\r.c r (r r d))", + "expanded_body": "s (\\b \\r \\f.b (r next) (r f r)) (\\d \\t \\r.c r (r r d))", + "argument": "The variable tail supplies its own bit d and suffix t to the callback; the final operand restores the whole original tail, and d forces its diagonal.", + "isolated_bits": 74, + "beta_normal_bits": 74, + "beta_normal_hash": "f57c3421601a5129f21497bda0c8b701e12fa69cfcfb8e2fedd107555515ee08", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.097, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/38_tail_supplied_force_let165.lam", + "bits": 196, + "wire": "0100011010000100000100000101100000000101111001110111110010111010110000000010111111101001011010111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/38_tail_supplied_force_inline162.lam", + "bits": 201, + "wire": "010001101000010000000101100000000101111001110000111111110000101110011111111000000111100000010111011100110111100111111111000011111111100001011110100111010010111010110000000010111111010010110101110011010" + } + } + }, + { + "name": "39_selector_packet", + "family": "second-stage packet", + "body": "s (\\b \\r \\t.b (r (t b)) (t b r (r r t))) (\\b.b next c)", + "expanded_body": "s (\\b \\r \\t.b (r (t b)) (t b r (r r t))) (\\b.b next c)", + "argument": "The packet maps the first bit to next or c. The zero branch uses it as a tag reader and the variable branch as the return continuation.", + "isolated_bits": 77, + "beta_normal_bits": 77, + "beta_normal_hash": "3bb842b76d722e038eabbef7a9f5e53ae5228e8ed108ee5a16e56b5ec95f895b", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.097, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/39_selector_packet_let165.lam", + "bits": 199, + "wire": "0100011010000100000100000101100000000101111001110011011100101011011101100101110110100001011011101111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/39_selector_packet_inline162.lam", + "bits": 198, + "wire": "010001101000010000000101100000000101111001110011011100101011011101100101110110100001011000011111100001011100111111000000111100000010111011100110111100111111100001111111000010111101001110101110011010" + } + } + }, + { + "name": "40_action_packet", + "family": "second-stage packet", + "body": "s (\\b \\r \\t.b (t b r) (t b r (r r t))) (\\b.b (\\r.r next) c)", + "expanded_body": "s (\\b \\r \\t.b (t b r) (t b r (r r t))) (\\b.b (\\r.r next) c)", + "argument": "The packet stores zero action lambda r.r next and variable action c. Its selected action consumes the same original tail in either branch.", + "isolated_bits": 84, + "beta_normal_bits": 84, + "beta_normal_hash": "33bebaac3db906d65d5c364327a27f486f513e62121646d0493e0bd3771c8468", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.097, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/40_action_packet_let165.lam", + "bits": 206, + "wire": "01000110100001000001000001011000000001011110010110111011001010110111011001011101101000010110000110111101111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/40_action_packet_inline162.lam", + "bits": 208, + "wire": "0100011010000100000001011000000001011110010110111011001010110111011001011101101000010110000110000111111100001011100111111100000011110000001011101110011011110011111111000011111111000010111101001110101110011010" + } + } + }, + { + "name": "41_cps_packet", + "family": "second-stage packet", + "body": "s (\\b \\r \\t.t b (b (\\u.r u) (\\u.u r (r r b)))) (\\b \\f.f (b next c))", + "expanded_body": "s (\\b \\r \\t.t b (b (\\u.r u) (\\u.u r (r r b)))) (\\b \\f.f (b next c))", + "argument": "The packet receives both the tag and a selected consumer; it supplies next or c to that consumer, using b as the variable skip force.", + "isolated_bits": 95, + "beta_normal_bits": 95, + "beta_normal_hash": "ab29744925e3eef355bde43b90ecdb822acf7c7474d2a3b3b6b64a72a4a91444", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.099, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/41_cps_packet_let165.lam", + "bits": 217, + "wire": "0100011010000100000100000101100000000101101110010111100001111010000101101110010111101110111100000011001011101111011111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/41_cps_packet_inline162.lam", + "bits": 219, + "wire": "010001101000010000000101100000000101101110010111100001111010000101101110010111101110111100000011001011100001111111000010111001111111000000111100000010111011100110111100111111110000111111110000101111010011101011110011010" + } + } + }, + { + "name": "42_reverse_packet", + "family": "second-stage packet", + "body": "s (\\b \\r \\t.b (r (t F)) (t K r (r r t))) (\\a.a c next)", + "expanded_body": "s (\\b \\r \\t.b (r (t (\\a \\b.b))) (t (\\a \\b.a) r (r r t))) (\\a.a c next)", + "argument": "A reversed Church pair stores c before next; explicit selectors extract the requested component in the two branches.", + "isolated_bits": 82, + "beta_normal_bits": 82, + "beta_normal_hash": "f0dfd39881d61c69ffad5dec1b62d5608477dd9879e880fa62ce37dc27322045", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.096, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/42_reverse_packet_let165.lam", + "bits": 204, + "wire": "010001101000010000010000010110000000010111100111001100000100101011000001101100101110110100001011011110111000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/42_reverse_packet_inline162.lam", + "bits": 203, + "wire": "01000110100001000000010110000000010111100111001100000100101011000001101100101110110100001011011100001111110000101110011111100000011110000001011101110011011110011111110000111111100001011110100111010011010" + } + } + }, + { + "name": "43_constant_var_return", + "family": "constant-stream instruction", + "body": "(\\read.read (s (\\b \\r.b s (\\u \\v.c r (r r r))))) RDR", + "expanded_body": "(\\read.read (s (\\b \\r.b s (\\u \\v.c r (r r r))))) (\\t.t (\\b.b (\\u \\r.r next) c) (t t t))", + "argument": "Preprocess variables into K(K(c r N)) and leave zero streams intact. The 165 reader sends double constants to their stored result.", + "isolated_bits": 113, + "beta_normal_bits": 255, + "beta_normal_hash": "bacb67d2dd7cf3f6e7d84e0a31021fee469b0532804792045499cbc29b12d24a", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.268, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/43_constant_var_return_let165.lam", + "bits": 235, + "wire": "0100011010000100000100000100011001110000001011101111000000101111111110111001011110111011100001011000010110000001101111110111110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + }, + "inline162": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/43_constant_var_return_inline162.lam", + "bits": 242, + "wire": "01000110100001000000010001100111000000101110111100000010111111110111001011110111011100001011000010110000001100001111111110000101110011111111100000011110000001011101110011011110011111111110000111111111100001011110100111010111100101101010011010" + } + } + }, + { + "name": "44_constant_zero_return", + "family": "constant-stream instruction", + "body": "(\\read.read (s (\\b \\r.b (\\u \\v.r next) s))) RDR", + "expanded_body": "(\\read.read (s (\\b \\r.b (\\u \\v.r next) s))) (\\t.t (\\b.b (\\u \\r.r next) c) (t t t))", + "argument": "Preprocess zero streams into K(K(R next)) and leave variable streams intact. The reader constant-stream identity supplies the other branch.", + "isolated_bits": 94, + "beta_normal_bits": 179, + "beta_normal_hash": "13a9786e16dce0751ada6fcb36d3989cd5b621b411bdc2935724ec06c0f6bb1d", + "duplicate": null, + "probes": 19, + "failures": [], + "check_seconds": 0.147, + "frames": { + "let165": { + "path": "/Users/a9lim/Work/blam/tmp/overnight/zoo/candidates/44_constant_zero_return_let165.lam", + "bits": 216, + "wire": "010001101000010000010000010001100111000000101110000001111011111110111100001011000010110000001101111110111110010110101000011110000101110011110000001111000000101110111001101111001111100001111100001011110100111010011010" + } + } + } +] diff --git a/data/self-interpreter/reasoning_floor/zoo/zoo.py b/data/self-interpreter/reasoning_floor/zoo/zoo.py new file mode 100644 index 00000000..02b1248e --- /dev/null +++ b/data/self-interpreter/reasoning_floor/zoo/zoo.py @@ -0,0 +1,193 @@ +#!/usr/bin/env python3 +"""Hand-written reader zoo. No term generation or candidate enumeration.""" +import hashlib +import json +import os +from pathlib import Path +import re +import sys +import time + +LANE = Path(__file__).resolve().parent +ROOT = LANE.parents[2] +sys.dont_write_bytecode = True +sys.path.insert(0, str(ROOT / 'tools')) +sys.path.insert(0, str(ROOT / 'tools/self-interpreter')) +import blcc +import lc + +MACROS = { + 'I': r'(\a.a)', + 'K': r'(\a \b.a)', + 'F': r'(\a \b.b)', + 'D': r'(\a.a a)', + 'RDR': r'(\t.t (\b.b (\u \r.r next) c) (t t t))', +} +NEXT = r'(\bit1.intL (\exp.bit1 (c (\args \arg.exp (\zx \zy.zx arg (zy args)))) (intL (\exp2.c (\args.exp args (exp2 args))))))' + +# Every row is individually constructed. The explanatory fields are reduction +# arguments, not guesses inferred from the finite check. +CASES = [ +('01_reference165', 'control', r's (\b.b (\u \r.r next) c) (s s s)', + 'The shared suffix is R at zero and N at a variable; K drops the duplicate tail, F selects c.'), +('02_reference162', 'control', r's I (\u.s (\q.c) (s s u)) next', + 's I is K R at zero and I at a variable. V next reopens s for c r and forces the diagonal with next.'), +('03_reference164', 'control', r's (\b.b F c) (s I (s s) next)', + 'The dual operand is R next at zero and N at a variable. The outer K branch uses F to discard the tail.'), +('04_shared_return', 'shared suffix', r's (\b \r.b (\t.t next) (c r)) (s s s)', + 'Select a function of the shared suffix: application to next at zero, and c r at a variable.'), +('05_bound_suffix', 'shared suffix', r's (\b \r \t.b (t next) (c r t)) (s s s)', + 'Bind the common suffix once and use it either as the second-tag stream or the return remainder.'), +('06_bit_force', 'branch-local diagonal', r's (\b \r.b (r next) (c r (s s b)))', + 'Direct Boolean dispatch; the first bit itself is the erased force of the whole-stream diagonal.'), +('07_cell_owned_return', 'branch-local diagonal', r's (\b \r.b (r next) (s (\q.c) (r r b)))', + 'The first cell supplies c with r; the separately bound r supplies the diagonal suffix, forced by b.'), +('08_split_tail_handlers', 'split tail handlers', r's (\b.b (\r.r next) (\r.c r (r r r)))', + 'Dispatch before binding the tail. Each selected handler then receives r from the stream cell.'), +('09_tail_opens_return', 'input-owned return', r's (\b \r.b (r next) (r (\q \t.c r) (r r r)))', + 'A variable tail is always a cell. Its two fields are discarded to expose c r before the suffix is supplied.'), +('10_whole_reopen', 'input-owned return', r's (\b \r.b (r next) (s (\q.c) (s s s)))', + 'The outer opening supplies only the zero tail; both variable output positions are recovered from another whole-stream opening.'), +('11_tail_thunk', 'NEXT last', r's (\b \r.b r (\u.c r (r r u))) next', + 'The zero branch is r itself. The variable branch receives next as the erased diagonal force; this is the known 168 witness.'), +('12_whole_thunk', 'NEXT last', r's (\b \r.b r (\u.s (\q.c) (s s u))) next', + 'Use an explicit bit/tail dispatcher but reopen the whole stream inside the selected variable thunk.'), +('13_thunk_rebind_tail', 'NEXT last', r's I (\u.s (\b \r.c r (r r u))) next', + 'The variable thunk opens s and binds r once for both its returned index and its skip diagonal.'), +('14_projected_diagonal', 'NEXT last', r's I (\u.s (\q.c) ((s F) (s F) u)) next', + 'The variable thunk computes the suffix by diagonalizing two independently projected tails.'), +('15_predecessor_return', 'NEXT last', r's I (\u.(s D) (\q \r.s (\a.c)) (s s u)) next', + 'In the selected variable branch, s D is r. Opening that cell with a constant handler yields c r.'), +('16_selected_cross', 'cross application', r's I (\u.s (\q.c) (s (s I s) u)) next', + 's I s equals s on variables and R on zero. The variable-only cross application therefore diagonalizes equal whole streams.'), +('17_tail_dual', 'dual operand', r's (\b.b F c) (s (\b \r.b r (r r)) next)', + 'The dual operand chooses R or the tail diagonal before receiving next, giving R next or N.'), +('18_split_force_dual', 'dual operand', r's (\b.b F c) (s (\b \r.b (r next) (r r next)))', + 'Both arms of the dual operand consume next: the zero arm retains it, the variable arm erases it.'), +('19_bit_force_dual', 'dual operand', r's (\b.b F c) (s (\b \r.b (r next) (s s b)))', + 'The dual operand dispatches directly and uses its locally bound first bit to force the whole-stream skip.'), +('20_projected_dual', 'dual operand', r's (\b.b F c) ((s K) ((s F) next) (s s next))', + 'A projected Boolean selects between tail application and diagonal forcing; neither arm binds the tail.'), +('21_predecessor_dual', 'conditional predecessor', r's (\b.b F c) (s I ((s D) (s D)) next)', + 'Only in the variable branch, both conditional predecessors equal r; their diagonal is K N. The zero branch erases them.'), +('22_pred_adaptive_handler', 'conditional predecessor', r's D (s (\b \r.b (r next) (\q \t.c r))) (s s s)', + 's D is K at zero and r at a variable. The adaptive operand is R next or a two-field constant returning c r.'), +('23_false_pred', 'conditional predecessor', r's (\b.b F) (\q \t.s (\a.c)) (s I (s s) next)', + 'The head is F at zero and r at a variable. F keeps the dual operand; r opens the constant handler to produce c r.'), +('24_reference57', 'cell-borrowed dispatch', r's (\b.b (\u \r.r next)) (\q \t.s (\a.c)) (s s s)', + 'The known beta-prime witness: zero selects the drop-and-apply handler; the variable tail opens a constant handler.'), +('25_reference65', 'cell-borrowed dispatch', r's (\b \r.s b (b (r next) (\q \t.c r))) (s s s)', + 'The known delta witness: s b is K or r, while a separate opening retains the original tail.'), +('26_projected_pred', 'cell-borrowed dispatch', r's (s K) (s (\b \r.b (r next) (\q \t.c r))) (s s s)', + 's (s K) is K at zero and r at a variable. It controls the same adaptive result/handler interface without a source diagonal lambda.'), +('27_projection_dispatch', 'projected Boolean', r'(s K) ((s F) next) (s (\q.c) (s s s))', + 'Project the first bit to choose the two complete computations; the variable return uses stream-owned applications.'), +('28_projection_tail_return', 'projected Boolean', r'(s K) ((s F) next) ((s F) (\b \r.c (s F)) (s s s))', + 'Under the variable selection, the projected tail is a cell whose fields can be discarded to produce c of another tail projection.'), +('29_projection_pred_skip', 'projected Boolean', r'(s K) ((s F) next) (s (\q.c) ((s D) (s D) s))', + 'Only the selected variable arm diagonalizes conditional predecessors; the whole stream is its erased force.'), +('30_projection_cross_skip', 'cross application', r'(s K) ((s F) next) (s (\q.c) (s (s I s) next))', + 'The variable arm cross-applies s to the conditional R-or-s object, which equals s there; next is erased there.'), +('31_reboxed_tail', 'rebuilt tail', r's (\b \r.b (r next) (c (\h.s (\q \t.t h)) (r r r)))', + 'The returned tail is rebuilt by opening s inside a fresh handler lambda. On a variable r is a Scott cell, so the reconstruction beta-reduces to r.'), +('32_projected_rebox', 'rebuilt tail', r's (\b \r.b (r next) (c (s (\q \t.\h.h (t K) (t F))) (r r r)))', + 'A variable tail is a cell; independently projecting its bit and remainder rebuilds that exact cell, including at index one.'), +('33_function_operand', 'callback operand', r's (\b \r \f.b (r next) (f r)) (\r.c r (r r r))', + 'Pass the entire variable action as a final operand. The selected Boolean decides whether to apply it to the original tail.'), +('34_callable_suffix', 'callback operand', r's (\b \r \f.b ((f s) next) (c r (f s))) (s s)', + 'The operand is a constant suffix function K R or K N; force it with s at either use.'), +('35_cps_suffix', 'CPS operand', r's (\b \r \f.b (f (\t.t next)) (f (c r))) (\k.k (s s s))', + 'A CPS suffix receives application-to-next at zero, or the partially applied return continuation at a variable.'), +('36_pair_operand', 'pair operand', r's (\b \r \p.b (p (\a \t.a next)) (p c)) (\f.f (s F) (s s s))', + 'The operand packages tail and skip. The zero callback ignores the skip; c consumes both in the variable branch.'), +('37_diagonal_callback', 'callback operand', r's (\b \r \f.b (r next) (f f r)) (\f \r.c r (r r f))', + 'Self-apply the variable callback, using the callback itself only as the erased force of r r.'), +('38_tail_supplied_force', 'input-owned callback', r's (\b \r \f.b (r next) (r f r)) (\d \t \r.c r (r r d))', + 'The variable tail supplies its own bit d and suffix t to the callback; the final operand restores the whole original tail, and d forces its diagonal.'), +('39_selector_packet', 'second-stage packet', r's (\b \r \t.b (r (t b)) (t b r (r r t))) (\b.b next c)', + 'The packet maps the first bit to next or c. The zero branch uses it as a tag reader and the variable branch as the return continuation.'), +('40_action_packet', 'second-stage packet', r's (\b \r \t.b (t b r) (t b r (r r t))) (\b.b (\r.r next) c)', + 'The packet stores zero action lambda r.r next and variable action c. Its selected action consumes the same original tail in either branch.'), +('41_cps_packet', 'second-stage packet', r's (\b \r \t.t b (b (\u.r u) (\u.u r (r r b)))) (\b \f.f (b next c))', + 'The packet receives both the tag and a selected consumer; it supplies next or c to that consumer, using b as the variable skip force.'), +('42_reverse_packet', 'second-stage packet', r's (\b \r \t.b (r (t F)) (t K r (r r t))) (\a.a c next)', + 'A reversed Church pair stores c before next; explicit selectors extract the requested component in the two branches.'), +('43_constant_var_return', 'constant-stream instruction', r'(\read.read (s (\b \r.b s (\u \v.c r (r r r))))) RDR', + 'Preprocess variables into K(K(c r N)) and leave zero streams intact. The 165 reader sends double constants to their stored result.'), +('44_constant_zero_return', 'constant-stream instruction', r'(\read.read (s (\b \r.b (\u \v.r next) s))) RDR', + 'Preprocess zero streams into K(K(R next)) and leave variable streams intact. The reader constant-stream identity supplies the other branch.'), +] + +def expand(src): + for name, replacement in MACROS.items(): + src = re.sub(r'\b' + name + r'\b', lambda _: replacement, src) + return src + +def parse(src, frame=()): + p = blcc.P(src) + named = blcc.p_lc(p) + p.ws() + assert p.i == len(src), (p.i, src[p.i:]) + return blcc.to_db(named, frame) + +def wrap(body, inline=False): + if inline: + body = re.sub(r'\bnext\b', lambda _: NEXT, body) + inner = r'\s.' + body + else: + inner = r'(\next.\s.' + body + ') ' + NEXT + return r'(\x.x x) (\x.(\intL.\c.' + inner + ') (x x))' + +def main(): + rows, seen = [], {} + for name, family, display, argument in CASES: + start = time.monotonic() + body = expand(display) + term = parse(body, ('s', 'next', 'c', 'intL', 'x')) + size = blcc.size(term) + normal = lc.nf(term, [30000]) + normhash = hashlib.sha256(lc.enc(normal).encode()).hexdigest() + duplicate = seen.get(normhash) + seen.setdefault(normhash, name) + # Fixed probes, not a candidate search. next, c, intL, x, R, N are rigid. + frame = ('next', 'c', 'intL', 'x', 'R', 'N') + fn = parse(r'\s.' + body, frame) + cases = [('zero', lc.pair(lc.TRUE, ('V', 4)), ('A', ('V', 4), ('V', 0)))] + for n in [*range(1, 17), 31, 64]: + stream = lc.bitlist('1' * n + '0', ('V', 5)) + tail = lc.bitlist('1' * (n - 1) + '0', ('V', 5)) + want = ('A', ('A', ('V', 1), tail), ('V', 5)) + cases.append((str(n), stream, want)) + failures = [] + for tag, stream, want in cases: + try: + got = lc.nf(('A', fn, stream), [30000]) + correct = got == lc.nf(want, [30000]) + if not correct: + failures.append({'probe': tag, 'got': lc.show(got), 'want': lc.show(want)}) + except lc.Fuel: + failures.append({'probe': tag, 'fuel': True}) + row = dict(name=name, family=family, body=display, expanded_body=body, + argument=argument, isolated_bits=size, beta_normal_bits=blcc.size(normal), + beta_normal_hash=normhash, duplicate=duplicate, probes=len(cases), + failures=failures, check_seconds=round(time.monotonic()-start, 3), frames={}) + if not failures: + for label, inline in [('let165', False), ('inline162', True)]: + # Inlining NEXT is sensible here only when it occurs once. + if inline and len(re.findall(r'\bnext\b', body)) != 1: + continue + src = wrap(body, inline) + full = parse(src) + path = LANE / 'candidates' / (name + '_' + label + '.lam') + path.write_text(src + '\n') + row['frames'][label] = dict(path=str(path), bits=blcc.size(full), + wire=lc.enc(full)) + rows.append(row) + print(f'{name}: body {size}, frames {[v["bits"] for v in row["frames"].values()]}, checks {len(cases)-len(failures)}/{len(cases)}, duplicate={duplicate}', flush=True) + if failures: + print(json.dumps(failures[:2])) + (LANE / 'zoo.json').write_text(json.dumps(rows, indent=2) + '\n') + print(f'{len(rows)} hand-written bodies; {len(seen)} distinct beta-normal forms; {sum(not r["failures"] for r in rows)} valid on probes') + +if __name__ == '__main__': + main() From 8e0a2bc6f047d93eebecaa19335edbb8c9b15b48 Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 09:19:21 -0400 Subject: [PATCH 38/41] Record the 162's reader on the golf branch, and the PR edits for a9 The fork's golf branch (tromp/AIT#13) now carries the 162's reader in int.lam 162, uni.lam 184/172, int4 172, ko2kp 540, nf 535 and pairup_Kp 1270, each verified against its previous version; the branch saves 1,159 bits across 40 programs. golf.md, STATUS, the README and the golf machine artifacts follow. contrib/PR_KIT.md gains the suggested title, body and comment edits for a9 to make, the credits for the 162, and the letter bullets. --- README.md | 6 +-- contrib/PR_KIT.md | 72 +++++++++++++++++++++++++++----- data/golf/machines/int4.blc | 2 +- data/golf/machines/int4.lam | 38 +++++++++-------- data/golf/machines/ko2kp.blc | 2 +- data/golf/machines/ko2kp.lam | 10 ++--- data/golf/machines/nf.blc | 2 +- data/golf/machines/nf.lam | 6 +-- data/golf/machines/pairup_Kp.blc | 2 +- data/golf/machines/pairup_Kp.lam | 9 ++-- docs/STATUS.md | 23 +++++----- docs/classical/golf.md | 61 ++++++++++++++++----------- 12 files changed, 148 insertions(+), 85 deletions(-) diff --git a/README.md b/README.md index d62dddbb..c1e6b717 100644 --- a/README.md +++ b/README.md @@ -130,10 +130,10 @@ proven. ([universal](docs/classical/self-interpreter/universal.md)). - **The rest of tromp/AIT** ([golf](docs/classical/golf.md), sent upstream as [tromp/AIT#13](https://github.com/tromp/AIT/pull/13)): 40 programs shrink by - 1,143 bits in all. The IOCCC BLC8 universal machine goes from 43 bytes to 38 + 1,159 bits in all. The IOCCC BLC8 universal machine goes from 43 bytes to 38 (strict) and 36 (non-strict), the bytewise BLC2 machine from 500 to 390 - bits, KP(x) ≤ KO(x) + c from c = 615 to 541, the symmetry-of-information - constants by up to 129 bits, and Loader's number fits in 1781 bits. + bits, KP(x) ≤ KO(x) + c from c = 615 to 540, the symmetry-of-information + constants by up to 132 bits, and Loader's number fits in 1781 bits. The qBLC operator census covers the same population. Its successful mass is `3424188513 / 2^40`; entangled successful outputs first occur at 41 bits. diff --git a/contrib/PR_KIT.md b/contrib/PR_KIT.md index d9768502..bb95aae1 100644 --- a/contrib/PR_KIT.md +++ b/contrib/PR_KIT.md @@ -10,10 +10,12 @@ instrumental, so they can be written out in full when the PRs go up. - `uni-rs`: one commit, `uni.rs` at the repo root. Not opened yet. - `golf`: [tromp/AIT#13](https://github.com/tromp/AIT/pull/13), opened 2026-10-20 with a short body; Tromp is travelling and will review at the - end of October. 54 commits, one per program and change, so Tromp can take + end of October. 61 commits, one per program and change, so Tromp can take any subset: the original fourteen (uni8, uni28, int4, ko2kp, nf, the - pairups, then the 165's reader in six programs) and forty more pushed - the same day (below). + pairups, then the 165's reader in six programs), forty more pushed the + same day, and on 2026-10-21 the 162's reader in the same six programs + (int.lam, uni.lam, int4, ko2kp, nf, pairup_Kp) plus a comment fix in + ko2kp. The branch now changes 40 programs and saves 1,159 bits. - blam 3.0.0 is released: point links at the `v3.0.0` tag where the content predates it, and at a `dev` commit permalink for the 165's record, the Lean self-interpreter proofs, and the golf record (`docs/classical/golf.md`). @@ -42,6 +44,16 @@ instrumental, so they can be written out in full when the PRs go up. Codex, in a fresh-context consult. Carrying it into `uni.lam`, `int4`, `ko2kp`, `nf` and `pairup_Kp`, the verification, and the Lean proofs that the 168 and the 165 are self-interpreters: Claude. + - The 162-bit reader (the stream selects its own tail; the second-tag + stage becomes the reader's last operand), found 2026-10-21 by combining + three agents' work: + - the 44-bit reader itself: Codex, which built it as a counterexample + while reviewing a reader-optimality proof of Claude's; + - passing the second-tag stage as a reader operand: Grok (xAI); + - splicing the reader into the 165 and letting blam's let optimizer + find the 162, carrying it into the other five programs, the + verification, and the Lean proof: Claude; + - an independent adversarial review of the 162: Codex. - The pairup programs: Codex (keep the old loop only to record `ps`). - The second round (2026-10-20), by part: - `uni8` 321 → 304 / 283, `uni28` 416 → 390 / 370, `blc.lam` 195 → 186, @@ -96,8 +108,38 @@ instrumental, so they can be written out in full when the PRs go up. a9 opened it with the title "165 bit self-interpreter" and a two-line body. The commit messages carry each change's design note and verification, so -the body can stay short; the comment below summarizes the whole branch for -the review. a9 posted an edited version on 2026-10-20. +the body can stay short. a9 posted a summary comment with a size table on +2026-10-20; the draft it was edited from is kept below. + +**Suggested edits after the 162 (2026-10-21; a9 makes them):** + +- Title: `162 bit self-interpreter`. +- Body, second line, if Grok should be credited there too: + `Found with the help of Claude, Codex and Grok.` +- In the 2026-10-20 summary comment, six rows of the table change: + + | program | before | after | + |---|---:|---:| + | `int.lam` | 168 | 162 | + | `uni.lam` | 190; non-strict 178 | 184; non-strict 172 | + | `int4` | 189 | 172 | + | `ko2kp` | 615 | 540 | + | `nf` | 600 | 535 | + | `pairup_Kp` | 1402 | 1270 | +- A short new comment announcing the push (draft): + + > Pushed seven more commits: a new reader for the self-interpreter, + > 165 → 162 bits, carried into the five programs that share it (uni.lam + > 184 strict / 172 non-strict, int4 172, ko2kp 540, nf 535, pairup_Kp + > 1270). The reader is `list I V next`: `list I` makes the first cell its + > own selection, so after a 0 tag the zero branch is the tail itself, + > applied to `next`, which is now the reader's last operand instead of a + > let; after a 1, `V` reopens the stream, hands the tail to `cont`, and + > skips with `next` as the erased third operand of `list list`. Each + > commit has its check; the 162 also has a Lean proof that it is a + > self-interpreter for every closed program: + > https://github.com/a9lim/blam/blob/94c692c58cfe0f9d9c640051bff62f70d6ab9bce/lean/Blc/Selfint162.lean + > The branch now saves 1,159 bits across the same 40 programs. **Draft comment for #13 (as drafted):** @@ -154,15 +196,15 @@ the review. a9 posted an edited version on 2026-10-20. ## Letter to John -**Subject:** two PRs, including a 165-bit self-interpreter +**Subject:** two PRs, including a 162-bit self-interpreter - **Who:** a9, building a Rust engine for BLC/AIT experiments (github.com/a9lim/blam); say up front that Claude and Codex did most of the work. - **The two PRs.** - `uni.rs`: byte-identical with uni.py, about 18× faster. - - `golf` (#13, already open): int.lam 168 → 165, uni.lam 190 → 187 - (non-strict 178 → 175), and 38 more programs, 1,143 bits in all. + - `golf` (#13, already open): int.lam 168 → 162, uni.lam 190 → 184 + (non-strict 178 → 172), and 38 more programs, 1,159 bits in all. - **His tools in blam (3.0.0).** `blam blc ACTION FILE` is his `blc`, all 31 actions, without GHC; `blam uni` is his universal machine. - Checked byte for byte against his own `blc`, built from AIT with GHC @@ -174,10 +216,20 @@ the review. a9 posted an edited version on 2026-10-20. `blam blc blc` reproduces every checked-in `.blc`. - Maybe useful to him: a GHC-free `blc` for people trying the repo. - The golf sources: the IOCCC BLC8 machine is down from 43 bytes to 38 - (36 non-strict), KP(x) ≤ KO(x) + 541, pairup_Kp 1402 → 1273, Loader's + (36 non-strict), KP(x) ≤ KO(x) + 540, pairup_Kp 1402 → 1270, Loader's number in 1781 bits, and int.lam's parser is now in ko2kp, nf, int4 and the pairup programs. -- **The self-interpreter: 165 bits.** +- **The self-interpreter: 162 bits** (165 when the PR was opened). + - The 162's reader: `list I` makes the first cell its own selection, so + the zero branch is the tail itself, and the second-tag stage is passed + as the reader's last operand, which the variable branch erases inside + its skip. Found by combining a counterexample Codex built while + reviewing a proof of Claude's, Grok's idea of passing that stage as an + operand, and blam's let optimizer. Lean-proved; independently reviewed. + - Universal machines 184 strict / 172 non-strict; int4 172. + - Lower bounds from the same night: every self-interpreter has at least + 37 bits (handwritten, reviewed twice) and 27 kernel-checked in Lean. +- **The 165, the step before:** - Palmer's 168 with one change to the reader: skipvar applied to the whole stream before the tag is read is right for both cases (the stream past a 0-tag; the rest past a variable), and `list H (skipvar list)` hands diff --git a/data/golf/machines/int4.blc b/data/golf/machines/int4.blc index d68a2ba5..3dc61e6b 100644 --- a/data/golf/machines/int4.blc +++ b/data/golf/machines/int4.blc @@ -1 +1 @@ -0100011010000100000100000101100001011000000110111110111100101101010000111100001011100111100000011110000001011101110011000000110111111001111100001111100001011110100111010011010 \ No newline at end of file +0100011010000100000001010110001000010111000111100101110110100001111100001011100111110000001111000000101110111001100000011011111100111111000011111100001011110100111010011010 \ No newline at end of file diff --git a/data/golf/machines/int4.lam b/data/golf/machines/int4.lam index b24c7b45..922d5486 100644 --- a/data/golf/machines/int4.lam +++ b/data/golf/machines/int4.lam @@ -1,24 +1,26 @@ --- Self-interpreter for binary LC with four primitives (tromp/AIT int4.lam: --- 00 = lambda, 01 = application, 10 = variable zero, 11 = successor), --- rebuilt on the design of int.lam: 189 -> 175 bits (178 with the 168's --- reader; 175 with the 165's, which applies skipvar to the whole stream). --- intL cont bits = cont (\free.parsed) unparsed_bits, as before. --- A variable's code after its tag bit reads 1^(2n-2) 0, so skipvar --- (\l. l l l, which skips every 1 and the first 0) carries over unchanged; --- the lookup carries over with one change: each environment cell also --- swallows the successor tag bit that follows a 1. Verified with the exact --- self-interpreter contract E c ( ++ n) = c (\z.M) n on every closed --- term of 4..16 bits plus deep-index extras, 4-primitive-encoded (236 --- programs, all exact; the original passes the same battery): --- tools/self-interpreter/battery.py data/golf/machines/int4.lam --int4 --max-bits 16. +-- self-interpreter for binary LC with four primitives +-- (00 = lambda, 01 = application, 10 = variable zero, 11 = successor): 172 bits +-- a9lim rebuilt it from 189 bits on the design of int.lam. After its tag bit +-- a variable's code reads 1^(2n-2) 0, so the unary skip (list list, which +-- skips every 1 and the first 0) carries over unchanged, and so does the +-- lookup by the variable's own code, once each environment cell also swallows +-- the successor tag bit that follows a 1. The reader is int.lam's: the stream +-- selects its own tail as the zero branch, and the variable branch reopens +-- the stream, hands its tail to cont, and skips with next as the erased third +-- operand of list list. let -- cells skip the succ tag bit that follows each 1 in a variable's code cons4 = \x\y\zx\zy. zx x (zy (\tag\l. l y)); - skipvar = \l. l l l; intL = (\x. x x) (\x. let intL = x x in - \cont. - let next = (\bit1.intL (\exp.bit1 + \cont. \list. list (\a. a) (\next. list (\_. cont) (list list next)) + (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (cons4 arg args))) - (intL (\exp2.cont (\args.exp args (exp2 args)))))) - in \list.list (\bit0.bit0 (\list1\rest. rest next) cont) (skipvar list)); + (intL (\exp2.cont (\args.exp args (exp2 args))))))); + + -- loop + omega = omega; + + -- binary LC universal machine for closed programs + uni = intL (\z.z omega); + in intL diff --git a/data/golf/machines/ko2kp.blc b/data/golf/machines/ko2kp.blc index 9039fb27..69fdf94c 100644 --- a/data/golf/machines/ko2kp.blc +++ b/data/golf/machines/ko2kp.blc @@ -1 +1 @@ -0000010001000101111001010101100010001000011010111100101000100010001011011110000101111111000000001010101111111100101111111001111101001110000000101010011000011111000011111001111111100000011100001011100101110100111100001111100111111101011110001000010110000000000111101111011000010101100010110001100111000000101011000011110011000000011010101111000000111100000010000010110000101100000011011111011110010110101000011110000101110011110000111111110000111100000010111011100110111100111110000111110000101111111100111101001110100001000110100001110011010 +000001000100010111100101010110001000100001101011110010100010001000101101111000010111111100000000101010111111110010111111100111110100111000000010101001100001111100001111100111111110000001110000101110010111010011110000111110011111110101111000100001011000000000011110111101100001010110001011000110011100000010101100001111001100000001101010111100000011110000000010101100010000101110001111001011101101000011111000010111001111100001111111110000111100000010111011100110111100111111000011111100001011111111100111101001110100001000110100001110011010 \ No newline at end of file diff --git a/data/golf/machines/ko2kp.lam b/data/golf/machines/ko2kp.lam index b86e4133..0de54d53 100644 --- a/data/golf/machines/ko2kp.lam +++ b/data/golf/machines/ko2kp.lam @@ -1,4 +1,4 @@ --- showing KP(x) <= KO(x) + 541 +-- showing KP(x) <= KO(x) + 540 \io\p. let -- one fixpoint combinator shared by the three recursive functions @@ -10,7 +10,7 @@ -- replace `omega` used as the initial variable context by the closest -- variable; this is fine for closed terms as required by KP. - -- (IF_DIRTY = false gives 563 bits) + -- (IF_DIRTY = false gives 562 bits) IF_DIRTY = true; -- generic evaluator -- really just parser + translation to HOAS @@ -24,9 +24,9 @@ -- -- (the returned program takes a context defining its free variables) -- parser after int.lam (cons' cells, the variable's code as its lookup, - -- skipvar), ported by a9lim - uni = \abs\app. Y (\uni0. \cnt. - (\next. \xs. xs (\b0. b0 (\ys\rest. rest next) cnt) (xs xs xs)) + -- the stream selecting its own tail), ported by a9lim + uni = \abs\app. Y (\uni0. \cnt. \xs. + xs (\a. a) (\next. xs (\_. cnt) (xs xs next)) (\b1. uni0 (\v1. b1 (cnt (\ctx. abs (\v2. v1 (\zx\zy. zx v2 (zy ctx))))) (uni0 (\v2. cnt (\ctx. app (v1 ctx) (v2 ctx))))))); diff --git a/data/golf/machines/nf.blc b/data/golf/machines/nf.blc index ddb2da66..6c6ad95e 100644 --- a/data/golf/machines/nf.blc +++ b/data/golf/machines/nf.blc @@ -1 +1 @@ -0100010110000001000001011000010110000001101111101111001011010100001111000010111001111000000000011110000111111100000010111011100110111111100111110000111110000101000100010101110001000110100000000000010111011111101111001111010011101000010101110000001000001010111100000011111001111100101011111110011100000000110111111000000111001011111101101010000000011111100100000101100000101100101011111111011101111001010111111110110111101000000101110000110000010010111100000010110000010110011111010000001011000001101100110100000100001000110100001110011010 +0100010110000000010101100010000101110001111001011101101000011111000010111001111100000000001111000011111110000001011101110011011111110011111100001111110000101000100010101110001000110100000000000010111011111101111001111010011101000010101110000001000001010111100000011111001111100101011111110011100000000110111111000000111001011111101101010000000011111100100000101100000101100101011111111011101111001010111111110110111101000000101110000110000010010111100000010110000010110011111010000001011000001101100110100000100001000110100001110011010 \ No newline at end of file diff --git a/data/golf/machines/nf.lam b/data/golf/machines/nf.lam index 859cbf03..2698af44 100644 --- a/data/golf/machines/nf.lam +++ b/data/golf/machines/nf.lam @@ -28,9 +28,9 @@ let appT = \t. let A1 = \_. A t in caseT t id (\_. A1) A1; -- parser after int.lam (cons' cells, the variable's code as its lookup, - -- skipvar), ported by a9lim - parseval = Y (\parseval. \cont. - (\next. \xs. xs (\b0. b0 (\ys\rest. rest next) cont) (xs xs xs)) + -- the stream selecting its own tail), ported by a9lim + parseval = Y (\parseval. \cont. \xs. + xs (\a. a) (\next. xs (\_. cont) (xs xs next)) (\b1. parseval (\t1. b1 (cont (\ctx. L (\v. t1 (\zx\zy. zx v (zy ctx))))) (parseval (\t2. cont (\ctx. appT (t1 ctx) (t2 ctx))))))); diff --git a/data/golf/machines/pairup_Kp.blc b/data/golf/machines/pairup_Kp.blc index dc61eafd..7fa7e2c8 100644 --- a/data/golf/machines/pairup_Kp.blc +++ b/data/golf/machines/pairup_Kp.blc @@ -1 +1 @@ -0100000101110100000010101111101001010001010001101000010000000110000001100001000101111100111111110000001011111001011110110000000011110111100111111111100000010111111000011111100111101000000001011101111110111100001010100011010000000011000010110011110000110001001011111011110000111110011111111111111110100001011110010110000011011000000001101111011110000111111100000010110111111000010110111110011111011100110100000000111100101010101010101000110100100000000000001010101010100011010000100000001010111000000000011110000101111111110111110000101101101111111000000101010101111110110111000011001011111110110111100000001000000010000101100000011000001101100110100101111111000000101110111111001111110000000011011111110000010000000001101101100110000101010111111101111110111110000111111001000000000111100011111000000101110010111111111110000001100001100010111101110011111111111101110000001000000000101110001111111000000001111000000001111000000001101111111111111001010110111111000100001100010110001000011000101000001101000001000000001100001111100001111100000010110111100111101101110000000010110000101101111110111101100101000110100001000001000001011000010110000001101111101111001011010100001111000010111001111000000111100000010111011100110111100111110000111110000101111010011101001101000011010 +0100000101110100000010101111101001010001010001101000010000000110000001100001000101111100111111110000001011111001011110110000000011110111100111111111100000010111111000011111100111101000000001011101111110111100001010100011010000000011000010110011110000110001001011111011110000111110011111111111111110100001011110010110000011011000000001101111011110000111111100000010110111111000010110111110011111011100110100000000111100101010101010101000110100100000000000001010101010100011010000100000001010111000000000011110000101111111110111110000101101101111111000000101010101111110110111000011001011111110110111100000001000000010000101100000011000001101100110100101111111000000101110111111001111110000000011011111110000010000000001101101100110000101010111111101111110111110000111111001000000000111100011111000000101110010111111111110000001100001100010111101110011111111111101110000001000000000101110001111111000000001111000000001111000000001101111111111111001010110111111000100001100010110001000011000101000001101000001000000001100001111100001111100000010110111100111101101110000000010110000101101111110111101100101000110100001000000010101100010000101110001111001011101101000011111000010111001111100000011110000001011101110011011110011111100001111110000101111010011101001101000011010 \ No newline at end of file diff --git a/data/golf/machines/pairup_Kp.lam b/data/golf/machines/pairup_Kp.lam index 372ab85f..7af92a3d 100644 --- a/data/golf/machines/pairup_Kp.lam +++ b/data/golf/machines/pairup_Kp.lam @@ -9,13 +9,12 @@ let zero = \cont.cont id; -- binary LC interpreter -- parser after int.lam (cons' cells, the variable's code as its lookup, - -- skipvar), ported by a9lim + -- the stream selecting its own tail), ported by a9lim intL = (\x. x x) (\x. let intL = x x in - \cont. - let next = (\bit1.intL (\exp.bit1 + \cont. \list. list (\a. a) (\next. list (\_. cont) (list list next)) + (\bit1.intL (\exp.bit1 (cont (\args\arg.exp (\zx\zy. zx arg (zy args)))) - (intL (\exp2.cont (\args.exp args (exp2 args)))))) - in \list.list (\bit0.bit0 (\list1\rest. rest next) cont) (list list list)); + (intL (\exp2.cont (\args.exp args (exp2 args))))))); -- program list returns the program at the start of binary stream list -- its helpers are local to it, which makes it a closed term program = let diff --git a/docs/STATUS.md b/docs/STATUS.md index 4d0e639c..bef8dba1 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -465,14 +465,15 @@ with all features (three opt-in tests ignored) and 328 with default features. `classical/golf.md`: certified β-golf shrinks 44 of the 117 tromp/AIT programs by 463 bits in all (`data/golf/sweep.tsv`). The upstream branch, [tromp/AIT#13](https://github.com/tromp/AIT/pull/13), changes 40 programs by -1,143 bits, every one as a readable source: 36 of the β-golf gains, several +1,159 bits, every one as a readable source: 36 of the β-golf gains, several beyond the sweep (`tweet` 2230 → 2134, `loader` 1797 → 1781, -`pairup_Kp` 1402 → 1273), and hand redesigns. The IOCCC BLC8 machine goes from +`pairup_Kp` 1402 → 1270), and hand redesigns. The IOCCC BLC8 machine goes from 344 bits (43 bytes) to 304 strict (38 bytes) and 283 non-strict (36 bytes), `uni28` from 500 to 390 / 370, `uni2` to 332, `blc.lam` 195 → 186, and `uniK` -903 → 826 (599 with eager weakening). The parser ports give `int4` 175, -`ko2kp` 541 (so KP(x) ≤ KO(x) + 541), `nf` 538, and the pairup programs 756, -651 and 1273 (the last two on contract-valid inputs only). Artifacts are in +903 → 826 (599 with eager weakening). The parser ports, now with the 162's +reader, give `int4` 172, `ko2kp` 540 (so KP(x) ≤ KO(x) + 540), `nf` 535, and +the pairup programs 756, 651 and 1270 (the last two on contract-valid inputs +only); `int.lam` is 162 and `uni.lam` 184 strict, 172 non-strict. Artifacts are in `data/golf/machines/`. ### Running programs: blc and uni @@ -549,13 +550,11 @@ GHC 9.10.3; `uni.rs` with rustc), all three harnesses in 11 minutes: handwritten and 27 kernel-checked; the next steps are an application-sensitive charge for residual control (`remainder.md`), which no structural count supplies, and a formalization of residual tracing. - The 162's reader carries to int4 unchanged (175 → 172, battery `--int4` - 667/1/0, letopt-minimal; `reasoning_floor/origin162/int4_172.lam`). In - ko2kp, nf and pairup_Kp NEXT also references the outer `abs`/`app`, so - moving it under the stream binder pays two more index bits and the - saving shrinks to about one bit each; those need `blam golf check`. - Updating the fork's golf branch (and with it tromp/AIT#13) and the PR kit, - which still describes the 165, are a9's call. + The 162's reader is on the fork's golf branch (tromp/AIT#13): `int.lam` + 162, `uni.lam` 184 / 172, `int4` 172, `ko2kp` 540, `nf` 535, `pairup_Kp` + 1270, each verified against its previous version (`classical/golf.md`). + The PR's title and summary comment still say 165; the replacement text + is in `contrib/PR_KIT.md` for a9 to post. 10. **`blam uni` throughput:** within 4× of `uni.c` on byte streams. The next lever is allocation: a slab with index-based reference counts (or the open global-allocator decision) would remove most of malloc/free and the diff --git a/docs/classical/golf.md b/docs/classical/golf.md index 8b5fee0a..287c953d 100644 --- a/docs/classical/golf.md +++ b/docs/classical/golf.md @@ -24,7 +24,7 @@ records (`self-interpreter/`). This document covers the rest of tromp/AIT: weakening); - ports of the 2025-12 parser design into the programs that still embed the old one: `int4`, `ko2kp`, `nf` and the `pairup` programs, whose sizes are - constants in Tromp's AIT theorems (KP(x) ≤ KO(x) + 541). + constants in Tromp's AIT theorems (KP(x) ≤ KO(x) + 540). The machines were designed with Codex through independent consults. Who contributed which idea is marked where it appears. @@ -95,12 +95,12 @@ compiled bits. BLC8 machines also ship packed `.blc8`. | `uni2` (BLC2 machine) | 340 | **332** | **321** (from 324) | | `blc` (curried-bit interpreter) | 195 | **186** | | | `uniK` (Kiselyov machine) | 903 | **826**; **599** eager (`uniK_lazy`, `uniK`) | | -| `int4` (self-interpreter, 4-primitive code) | 189 | **175** | | -| `ko2kp` (KP ≤ KO + c) | 615 | **541** | | -| `nf` (normal-form printer) | 600 | **538** | | +| `int4` (self-interpreter, 4-primitive code) | 189 | **172** | | +| `ko2kp` (KP ≤ KO + c) | 615 | **540** | | +| `nf` (normal-form printer) | 600 | **535** | | | `pairupKP` (symmetry of information) | 778 | **756** | | | `pairupK_p` | 657 | 651 † | | -| `pairup_Kp` | 1402 | 1273 † | | +| `pairup_Kp` | 1402 | 1270 † | | † Verified on contract-valid inputs only. On invalid ones these differ from the originals; see below. @@ -271,8 +271,10 @@ unsolvable built from bindings already in scope can be cheaper than `fix fix` (−1). Elsewhere Codex's proved alternatives lose: `uni.lam`'s best, `intL intL intL`, is 192 against 187; strict `int4` 202 against 197; `uni28`'s `get get get` 396 against 390; `uniK`'s `fix fix` 607 against 599; -`ko2kp`'s clean `Y Y` 566 against 563. `pairup_Kp` has no strict bottom: it -accepts open programs. +`ko2kp`'s clean `Y Y` 566 against 563. These were measured with the 165's +reader; the 162's lowers both sides of each comparison equally (`uni.lam` +189 against 184, `ko2kp` clean 566 against 562). `pairup_Kp` has no strict +bottom: it accepts open programs. ## Porting the redesign into programs that embed the old parser @@ -288,21 +290,25 @@ They read plain bit streams, so the redesign drops in. ABS builds stream itself, does the lookup in any environment. The HOAS constructors (`abs`/`app` in `ko2kp`, `L`/`A` in `nf`) are untouched. -| program | original | port | with the 165's reader | source | -|---|---:|---:|---:|---:| -| `ko2kp` | 615 | 569 | 566 | **541** | -| `nf` | 600 | 562 | 559 | **538** | +| program | original | port | with the 165's reader | source | with the 162's reader | +|---|---:|---:|---:|---:|---:| +| `ko2kp` | 615 | 569 | 566 | 541 | **540** | +| `nf` | 600 | 562 | 559 | 538 | **535** | The 165's reader (`self-interpreter/interpreter.md`) drops in as well: the -whole-stream skip `xs xs xs` serves both dispatch arms, 3 bits each. The -sources then take certified β-moves of the ports: +whole-stream skip `xs xs xs` serves both dispatch arms, 3 bits each. So does +the 162's, in which the stream selects its own tail and the second-tag stage +becomes the reader's last operand: 3 bits in `nf`, but 1 in `ko2kp`, whose +second-tag stage also refers to `abs` and `app` and pays an index bit for +each under the stream binder. The sources take certified β-moves of the +ports: - `ko2kp`: the KP-side definitions (T's case analysis, `nfT`, `appT`, `boolT`, `consT`, `rest`) are scoped to the argument of `p` that uses them (−17); `withT = \b. b A appT` hands T's constructors to builders generic in both, as `uni` is (−5); one `Y` serves `uni`, `nfT` and `go` (−3). Its clean configuration (`IF_DIRTY = false`, with `omega = Y id`) goes from 598 to - 563. + 563, 562 with the 162's reader. - `nf`: `cons0`, `cons00` and `cons01` are bound inside `ser`, where their indices are small (−12); `appT` applies a HOAS value, β-reducing a `Lam` and building an `App` otherwise (−7); one `Y` serves `parseval` and `ser` (−2). @@ -320,10 +326,12 @@ variable's code reads `1^(2n-2) 0`, unary with every other bit a tag. With the rest of the 168 verbatim the result is 178 bits, against 189; with the 165's reader, 175, since `l l l` on the whole stream still stops right -after a variable. `battery.py --int4` checks the exact self-interpreter -contract on every closed term of 4..16 bits plus deep-index extras: 236 of -236 for the original, the 178 and the 175. As a negative control, `int.lam` under `--int4` fails -19 of the 40 programs of the 4..12-bit battery. +after a variable; with the 162's, 172, since `list list next` does too. +`battery.py --int4` checks the exact self-interpreter contract on every +closed term of 4..16 bits plus deep-index extras: 236 of 236 for the +original, the 178 and the 175; the 172 passes 667 of 667 through 18 bits. +As a negative control, `int.lam` under `--int4` fails 19 of the 40 programs +of the 4..12-bit battery. `golf check --io progs` compares normal forms on every closed program, followed by up to three data bits: @@ -333,7 +341,10 @@ followed by up to three data bits: the remainder by rerunning the program, which exhausts the budget often. - `nf` (through 16 bits): all 3,390 inputs identical. -These were run on the ports; the sources are β-convertible to them. +These were run on the ports; the sources are β-convertible to them. With +the 162's reader, against the 165-reader sources: `ko2kp` through 13 bits, +332 identical, 0 differ, 328 over budget on both, none on one side only; +`nf` through 16 bits, all 3,390 identical. Open programs fall outside both contracts, and the old and new base environments give them different garbage. @@ -349,7 +360,7 @@ prefix-capture layer and takes the whole `cons'`/skipvar interpreter. |---|---:|---:|---:|---:| | `pairupKP` | 778 | 775 | 774 | **756** | | `pairupK_p` | 657 | 655 | 653 | **651** | -| `pairup_Kp` | 1402 | 1372 | 1360, 1357 with the 165's reader | **1273** | +| `pairup_Kp` | 1402 | 1372 | 1360, 1357 with the 165's reader | 1273, **1270** with the 162's | The sources take certified β-moves of the ports: @@ -417,12 +428,12 @@ component sizes, except the two ties noted. | `fast_growing_and_conjectures/tweet.lam` | 2230 | **2168** | 62 | descend | beta | 2134 | | | `ait/uniK.lam` | 903 | **854** | 49 | descend | beta | 826; 599 with eager weakening | | | `characteristic_sequences/primes256.lam` | 286 | **252** | 34 | descend | beta | 252 | | -| `ait/pairup_Kp.lam` | 1402 | **1372** | 30 | descend | beta | 1273 (valid inputs) | | +| `ait/pairup_Kp.lam` | 1402 | **1372** | 30 | descend | beta | 1270 (valid inputs) | | | `ait/uni28.lam` | 500 | **474** | 26 | descend | beta | 390 / 370 | | | `fast_growing_and_conjectures/tree_ordinals.lam` | 752 | **728** | 24 | descend | beta | 726 | | | `lists/sort2.lam` | 435 | **415** | 20 | descend | beta | 415 | | | `ait/mpi.lam` | 473 | **454** | 19 | descend | beta | 454 | | -| `ait/nf.lam` | 600 | **581** | 19 | descend | beta | 538 | | +| `ait/nf.lam` | 600 | **581** | 19 | descend | beta | 535 | | | `ait/bf.lam` | 830 | **812** | 18 | descend | beta | 806 | | | `characteristic_sequences/squares.lam` | 325 | **308** | 17 | descend | beta | 301 | | | `numerals/binary_numerals.lam` | 433 | **416** | 17 | descend | beta | | kept out: the 416 inlines the library into fac | @@ -442,7 +453,7 @@ component sizes, except the two ties noted. | `ait/pairupKP.lam` | 778 | **775** | 3 | descend | beta | 756 | | | `ait/triage.lam` | 269 | **266** | 3 | descend | beta | 259 | | | `numerals/min.lam` | 52 | **49** | 3 | descend | beta | 49 | | -| `ait/ko2kp.lam` | 615 | **613** | 2 | descend | beta | 541 | | +| `ait/ko2kp.lam` | 615 | **613** | 2 | descend | beta | 540 | | | `ait/pairupK_p.lam` | 657 | **655** | 2 | letopt | beta | 651 (valid inputs) | | | `fast_growing_and_conjectures/erdos.lam` | 289 | **287** | 2 | descend | beta | 287 | | | `fast_growing_and_conjectures/laver.lam` | 203 | **201** | 2 | letopt | beta | | ties the stated 201 with slack 6 | @@ -473,13 +484,13 @@ Demos (excluded): - `rosetta/forloops.lam` (139 → 129): applies the artifact to sample data - `rosetta/variadicY.lam` (256 → 249): applies the artifact to sample data -No gain from β-golf: `BB/BB40.lam`, `BB/BB_Xi.lam`, `Sample.lam`, `ait/Aint.lam`, `ait/Y.lam`, `ait/allA.lam`, `ait/bcl.lam`, `ait/beavers.lam`, `ait/blc.lam` (source: 186), `ait/decoders.lam`, `ait/delimit2.lam`, `ait/int.lam` (source: 165), `ait/int4.lam` (source: 175), `ait/mlatu.lam`, `ait/quine.lam`, `ait/readlen.lam`, `ait/uni.lam` (source: 187 strict / 175 non-strict), `ait/vararg.lam`, `ait/wtf.lam`, `ait/zot.lam`, `characteristic_sequences/all.lam`, `characteristic_sequences/even.lam`, `characteristic_sequences/none.lam`, `characteristic_sequences/odd.lam`, `characteristic_sequences/primes.lam`, `characteristic_sequences/thue-morse.lam`, `fast_growing_and_conjectures/BBE0.lam`, `fast_growing_and_conjectures/BO.lam`, `fast_growing_and_conjectures/E0.lam`, `fast_growing_and_conjectures/ackermann.lam`, `fast_growing_and_conjectures/bms.lam`, `fast_growing_and_conjectures/collatz.lam`, `fast_growing_and_conjectures/gAckerman.lam`, `fast_growing_and_conjectures/goldbach.lam`, `fast_growing_and_conjectures/goodstein.lam`, `fast_growing_and_conjectures/graham.lam`, `fast_growing_and_conjectures/laver0.lam`, `fast_growing_and_conjectures/melo.lam`, `fast_growing_and_conjectures/oddperfect.lam`, `fast_growing_and_conjectures/perfect.lam`, `fast_growing_and_conjectures/w1CK.lam`, `fast_growing_and_conjectures/w218.lam`, `fast_growing_and_conjectures/wCubed.lam`, `lists/cat.lam`, `lists/fold.lam`, `lists/length.lam`, `lists/map.lam`, `lists/reverse.lam`, `misc/id.lam`, `misc/truth.lam`, `numerals/div.lam`, `numerals/divides.lam`, `numerals/eq.lam`, `numerals/fac.lam`, `numerals/fib.lam`, `numerals/gcd.lam`, `numerals/half.lam`, `numerals/leq.lam`, `numerals/lt.lam`, `numerals/mod.lam`, `numerals/tri.lam`, `rosetta/catstrings.lam`, `rosetta/mutrec.lam`, `rosetta/swap.lam`. +No gain from β-golf: `BB/BB40.lam`, `BB/BB_Xi.lam`, `Sample.lam`, `ait/Aint.lam`, `ait/Y.lam`, `ait/allA.lam`, `ait/bcl.lam`, `ait/beavers.lam`, `ait/blc.lam` (source: 186), `ait/decoders.lam`, `ait/delimit2.lam`, `ait/int.lam` (source: 162), `ait/int4.lam` (source: 172), `ait/mlatu.lam`, `ait/quine.lam`, `ait/readlen.lam`, `ait/uni.lam` (source: 184 strict / 172 non-strict), `ait/vararg.lam`, `ait/wtf.lam`, `ait/zot.lam`, `characteristic_sequences/all.lam`, `characteristic_sequences/even.lam`, `characteristic_sequences/none.lam`, `characteristic_sequences/odd.lam`, `characteristic_sequences/primes.lam`, `characteristic_sequences/thue-morse.lam`, `fast_growing_and_conjectures/BBE0.lam`, `fast_growing_and_conjectures/BO.lam`, `fast_growing_and_conjectures/E0.lam`, `fast_growing_and_conjectures/ackermann.lam`, `fast_growing_and_conjectures/bms.lam`, `fast_growing_and_conjectures/collatz.lam`, `fast_growing_and_conjectures/gAckerman.lam`, `fast_growing_and_conjectures/goldbach.lam`, `fast_growing_and_conjectures/goodstein.lam`, `fast_growing_and_conjectures/graham.lam`, `fast_growing_and_conjectures/laver0.lam`, `fast_growing_and_conjectures/melo.lam`, `fast_growing_and_conjectures/oddperfect.lam`, `fast_growing_and_conjectures/perfect.lam`, `fast_growing_and_conjectures/w1CK.lam`, `fast_growing_and_conjectures/w218.lam`, `fast_growing_and_conjectures/wCubed.lam`, `lists/cat.lam`, `lists/fold.lam`, `lists/length.lam`, `lists/map.lam`, `lists/reverse.lam`, `misc/id.lam`, `misc/truth.lam`, `numerals/div.lam`, `numerals/divides.lam`, `numerals/eq.lam`, `numerals/fac.lam`, `numerals/fib.lam`, `numerals/gcd.lam`, `numerals/half.lam`, `numerals/leq.lam`, `numerals/lt.lam`, `numerals/mod.lam`, `numerals/tri.lam`, `rosetta/catstrings.lam`, `rosetta/mutrec.lam`, `rosetta/swap.lam`. ## Upstream The sources go to Tromp as [tromp/AIT#13](https://github.com/tromp/AIT/pull/13), from the `golf` branch of the a9lim/AIT fork: one commit per program and change, each with its design note and verification, so any subset can be -taken. Against upstream the branch changes 40 programs and saves 1,143 bits +taken. Against upstream the branch changes 40 programs and saves 1,159 bits in all. `ref/AIT` here stays pinned to the fork's additive `master`; the `golf` branch modifies upstream files and never lands there. From 798e37c71a251b124a424c40156e556b70b6e0c3 Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 10:34:02 -0400 Subject: [PATCH 39/41] Polish the record after the 162 The README's docs table linked "the 165"; it now names the 162, and its Lean sentence reads as a claim about all three proved interpreters. The global floor's existence step and reference set use the 162 (verify.py checks int162's structural constraints alongside the others; floor37.json regenerated, the Lean clauses unchanged). The qBLC sub-174 candidate is now intL162 I at 168 bits. `blam selfint`'s help no longer describes its searches as "below the 168". STATUS and the PR kit record that a9 retitled tromp/AIT#13 and posted the 162's table, so the suggested-edits block goes. --- README.md | 6 +-- contrib/PR_KIT.md | 41 ++++--------------- data/self-interpreter/theory/floor37.json | 13 +++++- docs/STATUS.md | 9 ++-- .../self-interpreter/global-floor.md | 6 +-- .../self-interpreter/protocol-obstructions.md | 2 +- docs/quantum/bisimulation.md | 7 ++-- src/cli/main.rs | 2 +- src/cli/selfint/mod.rs | 4 +- .../self-interpreter/theory/floor37/verify.py | 1 + 10 files changed, 38 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index c1e6b717..8085989e 100644 --- a/README.md +++ b/README.md @@ -120,8 +120,8 @@ proven. 162 bits, six below Sean Palmer's 168. Its reader applies the input stream to the identity, so the first cell selects its own tail as the zero branch, and passes the parser's second-bit stage as an operand that the variable - branch erases. Lean proves it, the previous record's 165 and the 168 - self-interpreters for every closed program. Nothing smaller appears in its + branch erases. Lean proves it correct for every closed program, as it does + the previous record, the 165, and the 168. Nothing smaller appears in its let structure or its βη components. Every self-interpreter has at least 37 bits by a reviewed handwritten proof, and at least 27 kernel-checked in Lean ([global floor](docs/classical/self-interpreter/global-floor.md)). The same @@ -436,7 +436,7 @@ guarantees, and records of what the measurements and searches establish. | classical engine | [architecture](docs/classical/architecture.md), [running programs: notation, blc, uni](docs/classical/programs.md), [speed prior](docs/classical/speed.md) | | classical results | [bits of Ω](docs/classical/omega.md), [coding theorem](docs/classical/coding.md), [AIT golf](docs/classical/golf.md) | | certificates | [specification](docs/classical/certificates/specification.md), [frontier maps](docs/classical/certificates/frontier.md), [BB(33/34/35)](docs/classical/certificates/busy-beaver.md), [Lean](lean/README.md) | -| self-interpreter | [the 165](docs/classical/self-interpreter/interpreter.md), [global floor](docs/classical/self-interpreter/global-floor.md), [universal machine](docs/classical/self-interpreter/universal.md), [slot searches](docs/classical/self-interpreter/slots.md) | +| self-interpreter | [the 162](docs/classical/self-interpreter/interpreter.md), [global floor](docs/classical/self-interpreter/global-floor.md), [universal machine](docs/classical/self-interpreter/universal.md), [slot searches](docs/classical/self-interpreter/slots.md) | | qBLC | [architecture](docs/quantum/architecture.md), [frontier adjudication](docs/quantum/escalation.md), [Galois structure](docs/quantum/galois.md), [odd-sector search](docs/quantum/oddmin.md), [bisimulation](docs/quantum/bisimulation.md) | | qALC | [architecture](docs/quantum-algebraic/architecture.md), [token machine](docs/quantum-algebraic/token.md), [kernel register](docs/quantum-algebraic/kernel.md), [instance identity](docs/quantum-algebraic/instance-identity.md), [objects](docs/quantum-algebraic/objects.md), [speed prior](docs/quantum-algebraic/speed.md), [Rust pillar](docs/quantum-algebraic/rust-pillar.md), [reference and proof records](qalc/README.md) | diff --git a/contrib/PR_KIT.md b/contrib/PR_KIT.md index bb95aae1..28645628 100644 --- a/contrib/PR_KIT.md +++ b/contrib/PR_KIT.md @@ -106,40 +106,13 @@ instrumental, so they can be written out in full when the PRs go up. ## PR 2: `golf` (tromp/AIT#13, open) -a9 opened it with the title "165 bit self-interpreter" and a two-line body. -The commit messages carry each change's design note and verification, so -the body can stay short. a9 posted a summary comment with a size table on -2026-10-20; the draft it was edited from is kept below. - -**Suggested edits after the 162 (2026-10-21; a9 makes them):** - -- Title: `162 bit self-interpreter`. -- Body, second line, if Grok should be credited there too: - `Found with the help of Claude, Codex and Grok.` -- In the 2026-10-20 summary comment, six rows of the table change: - - | program | before | after | - |---|---:|---:| - | `int.lam` | 168 | 162 | - | `uni.lam` | 190; non-strict 178 | 184; non-strict 172 | - | `int4` | 189 | 172 | - | `ko2kp` | 615 | 540 | - | `nf` | 600 | 535 | - | `pairup_Kp` | 1402 | 1270 | -- A short new comment announcing the push (draft): - - > Pushed seven more commits: a new reader for the self-interpreter, - > 165 → 162 bits, carried into the five programs that share it (uni.lam - > 184 strict / 172 non-strict, int4 172, ko2kp 540, nf 535, pairup_Kp - > 1270). The reader is `list I V next`: `list I` makes the first cell its - > own selection, so after a 0 tag the zero branch is the tail itself, - > applied to `next`, which is now the reader's last operand instead of a - > let; after a 1, `V` reopens the stream, hands the tail to `cont`, and - > skips with `next` as the erased third operand of `list list`. Each - > commit has its check; the 162 also has a Lean proof that it is a - > self-interpreter for every closed program: - > https://github.com/a9lim/blam/blob/94c692c58cfe0f9d9c640051bff62f70d6ab9bce/lean/Blc/Selfint162.lean - > The branch now saves 1,159 bits across the same 40 programs. +a9 opened it with a two-line body and has since retitled it +"162 bit self-interpreter". The commit messages carry each change's design +note and verification, so the body can stay short. a9 posted a summary +comment with a size table on 2026-10-20, and a second one on 2026-10-21 with +the six rows the 162's reader changed (`int.lam` 162, `uni.lam` 184 / +non-strict 172, `int4` 172, `ko2kp` 540, `nf` 535, `pairup_Kp` 1270). The +draft the first was edited from is kept below. **Draft comment for #13 (as drafted):** diff --git a/data/self-interpreter/theory/floor37.json b/data/self-interpreter/theory/floor37.json index 30b9553b..61524bbc 100644 --- a/data/self-interpreter/theory/floor37.json +++ b/data/self-interpreter/theory/floor37.json @@ -763,6 +763,17 @@ } ], "reference_checks": [ + { + "name": "int162", + "bits": 162, + "lambdas": 16, + "leaves": 25, + "index_sum": 32, + "width": 4, + "nonlinear": 7, + "normal": false, + "incomparable_nonlinear": true + }, { "name": "int165", "bits": 165, @@ -847,5 +858,5 @@ "finite_clauses": 8 }, "lean_clauses": 152, - "seconds": 0.023 + "seconds": 0.024 } diff --git a/docs/STATUS.md b/docs/STATUS.md index bef8dba1..1f04e31c 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -552,9 +552,8 @@ GHC 9.10.3; `uni.rs` with rustc), all three harnesses in 11 minutes: no structural count supplies, and a formalization of residual tracing. The 162's reader is on the fork's golf branch (tromp/AIT#13): `int.lam` 162, `uni.lam` 184 / 172, `int4` 172, `ko2kp` 540, `nf` 535, `pairup_Kp` - 1270, each verified against its previous version (`classical/golf.md`). - The PR's title and summary comment still say 165; the replacement text - is in `contrib/PR_KIT.md` for a9 to post. + 1270, each verified against its previous version (`classical/golf.md`); + the PR's title and a summary comment carry the new table. 10. **`blam uni` throughput:** within 4× of `uni.c` on byte streams. The next lever is allocation: a slab with index-based reference counts (or the open global-allocator decision) would remove most of malloc/free and the @@ -635,7 +634,7 @@ agree at the complete effect-tree level through 24 bits (`blam q selfint 24`: mismatches; witness45 and the poisoned-seed canary pass), and Lean pins the wire identities and quote linearity and proves the pure-fragment obligations L1 and L2; the quantum obligations L3, L4 and B1–B5 are open -(`quantum/bisimulation.md`). The 165 would give a 171-bit `intL165 I`, not yet +(`quantum/bisimulation.md`). The 162 would give a 168-bit `intL162 I`, not yet checked against the qBLC contract. The ≤24 sweep takes 1.5 s wall and 18 CPU-seconds on the M5 Max. @@ -655,7 +654,7 @@ designated-output convention, derive explicit comparison constants with counterpart is measured, and `quantum::scalar::speed_units` is the shared rounding. 4. Complete the complement sweep at sizes 52 and 53. -5. Check the 171-bit `intL165 I` against the qBLC self-interpretation contract +5. Check the 168-bit `intL162 I` against the qBLC self-interpretation contract (`blam q selfint`). 6. Continue the odd-sector pruning program (α-normalize `BindId`, stronger ε/canonical-port quotienting, a simulation-preorder antichain, the diff --git a/docs/classical/self-interpreter/global-floor.md b/docs/classical/self-interpreter/global-floor.md index 965835a2..5a8f98eb 100644 --- a/docs/classical/self-interpreter/global-floor.md +++ b/docs/classical/self-interpreter/global-floor.md @@ -532,7 +532,7 @@ completing the vacuous-lambda case split. Every minimum interpreter of at most 36 bits would have one of the two inventories in section 2. Sections 3 and 4 exclude both. Since the known -165 supplies existence, well-ordering gives a minimum; therefore every +162 supplies existence, well-ordering gives a minimum; therefore every interpreter has at least **37 bits**. `verify.py` checks exactly 108 residual layouts (12+60+18+18), and never @@ -542,7 +542,7 @@ parametric invariants above; their fixed macro clauses are additionally checked in Python and Lean. The global syntax classification, width argument, and infinitary invariants remain handwritten. -The live 165, exact pinned 168, 170 inlined-NEXT variant, 204 normal, +The live 162 and 165, exact pinned 168, 170 inlined-NEXT variant, 204 normal, 584 two-nonlinear, 672 typed-normal, and 742 two-nonlinear-normal references satisfy the used structural constraints (`floor37.json`; `verify.py --battery` also reruns their batteries); no syntactic-redex or @@ -553,7 +553,7 @@ support a third nonlinear binder, or allow the off-chain nonlinear binder to capture a variable whose other occurrence lies in the width witness. The closed width-one operand argument above then stops applying. This proof establishes 37, not a claim that a few more leaf counts will bridge -the gap to 165. +the gap to 162. Source for the external theorem: Rick Statman, *Two Variables Are Not Enough*, ICTCS 2005, printed pp. 406-409, diff --git a/docs/classical/self-interpreter/protocol-obstructions.md b/docs/classical/self-interpreter/protocol-obstructions.md index 2e86dab9..86a2383e 100644 --- a/docs/classical/self-interpreter/protocol-obstructions.md +++ b/docs/classical/self-interpreter/protocol-obstructions.md @@ -1186,7 +1186,7 @@ lambda stream. stream (h h continuation) at every boundary where the old parser could be applied directly to the continuation. Sharing `h h` helps, but those adapters remain. This route changes the placement of recursion rather than removing its control cost, -and neither term improves the 165-bit record. +and neither term goes below the 165. The elementary cross-application identity explains why unary skipping is cheaper: diff --git a/docs/quantum/bisimulation.md b/docs/quantum/bisimulation.md index c9338f3b..2a76fd6b 100644 --- a/docs/quantum/bisimulation.md +++ b/docs/quantum/bisimulation.md @@ -321,9 +321,10 @@ qBLC lifting. ## 8. The parked sub-174 lane With the 168-bit `intL` opaque, sub-174 is impossible: any closed invocation -pays the six-bit `App + I`. The classical self-interpreter is 165 bits -(`../classical/self-interpreter/interpreter.md`), so `intL165 I` is a 171-bit -candidate; it has not been checked against the qBLC contract. Below that, a winner +pays the six-bit `App + I`. The classical self-interpreter is 162 bits +(`../classical/self-interpreter/interpreter.md`), so `intL162 I` is a 168-bit +candidate (and the 165's `intL165 I` a 171-bit one); neither has been checked +against the qBLC contract. Below that, a winner must reorganize the recursive knot and root entry jointly. The narrow lane, parked until the theorem contract is stable: freeze `cons'` and the three certified recursive branch meanings; one generic recursive entry + one diff --git a/src/cli/main.rs b/src/cli/main.rs index dfca1d3d..e9888105 100644 --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -68,7 +68,7 @@ INSTRUMENTS trace scan|single|dump|verify-loop32 reduction-shape classifier (lab feature) slots var|abs|app self-interpreter slot search (lab feature) - selfint ctx|hole|wiring searches below the 168 (lab feature) + selfint ctx|hole|wiring self-interpreter searches (lab feature) q galois idiom|complement the dyadicity campaign (lab feature) q oddmin [W] gated reference DP for the CNOT-free lane (lab feature) diff --git a/src/cli/selfint/mod.rs b/src/cli/selfint/mod.rs index 03863556..1ec7c9e9 100644 --- a/src/cli/selfint/mod.rs +++ b/src/cli/selfint/mod.rs @@ -1,4 +1,4 @@ -//! Searches below the 168-bit BLC self-interpreter (lab). +//! Searches around the BLC self-interpreter and universal machine (lab). //! //! `docs/classical/self-interpreter/interpreter.md` and `universal.md` //! record what these searches establish. These instruments are the searches that only make sense for @@ -13,7 +13,7 @@ mod wiring; use crate::args::{self, R}; const USAGE: &str = "\ -blam selfint — searches below the 168-bit self-interpreter (lab) +blam selfint — self-interpreter and universal-machine searches (lab) usage: blam selfint [flags] (`blam selfint --help`) diff --git a/tools/self-interpreter/theory/floor37/verify.py b/tools/self-interpreter/theory/floor37/verify.py index 73c03ed8..efb8690f 100644 --- a/tools/self-interpreter/theory/floor37/verify.py +++ b/tools/self-interpreter/theory/floor37/verify.py @@ -271,6 +271,7 @@ def write_lean(): def references(run_battery=False): import merges srcs={ + 'int162':ROOT/'data/self-interpreter/machines/int162.lam', 'int165':ROOT/'data/self-interpreter/machines/int165.lam', 'int204':ROOT/'data/self-interpreter/machines/int204_normal.lam', 'int584':ROOT/'data/self-interpreter/machines/int584_two_nonlinear.lam', From f635e4d9edbb6133003979a8b8187af2c2019258 Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 10:34:02 -0400 Subject: [PATCH 40/41] Release 3.0.1 No interface changes. The release republishes the README with the 162-bit self-interpreter, the 172/184 universal machines, the golf totals sent upstream as tromp/AIT#13, and the busy-beaver values credited to Tromp (OEIS A333479); the lab-gated `blam selfint wiring --strict` gains its seventh probe. Local bar: release tests with all, default and no default features, clippy, rustdoc, the census spot-check 4..32, and lake build Blc Certs BusyBeaver. --- Cargo.lock | 2 +- Cargo.toml | 2 +- contrib/PR_KIT.md | 6 +++--- docs/STATUS.md | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index abc228bc..c514ff8d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,7 +13,7 @@ dependencies = [ [[package]] name = "blam" -version = "3.0.0" +version = "3.0.1" dependencies = [ "im-rc", "rayon", diff --git a/Cargo.toml b/Cargo.toml index 0a50eb0d..bdeee423 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blam" -version = "3.0.0" +version = "3.0.1" edition = "2021" rust-version = "1.87" description = "Binary lambda calculus engine for algorithmic information theory: John Tromp's blc and uni, exhaustive term censuses, busy-beaver frontiers, exact Solomonoff/Kolmogorov measurements" diff --git a/contrib/PR_KIT.md b/contrib/PR_KIT.md index 28645628..99163ab6 100644 --- a/contrib/PR_KIT.md +++ b/contrib/PR_KIT.md @@ -16,9 +16,9 @@ instrumental, so they can be written out in full when the PRs go up. same day, and on 2026-10-21 the 162's reader in the same six programs (int.lam, uni.lam, int4, ko2kp, nf, pairup_Kp) plus a comment fix in ko2kp. The branch now changes 40 programs and saves 1,159 bits. -- blam 3.0.0 is released: point links at the `v3.0.0` tag where the content - predates it, and at a `dev` commit permalink for the 165's record, the Lean - self-interpreter proofs, and the golf record (`docs/classical/golf.md`). +- blam 3.0.1 is released: point links at the `v3.0.1` tag, which carries the + 162's record, the Lean self-interpreter proofs, and the golf record + (`docs/classical/golf.md`). - The fork's `master` is unchanged: upstream plus `uni.rs`. blam's `ref/AIT` pins it, and blam's CI checks that it only *adds* files over upstream. - `golf` modifies upstream files, so it must not land on the fork's master. diff --git a/docs/STATUS.md b/docs/STATUS.md index 1f04e31c..3e21bf0d 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -795,11 +795,12 @@ halt-rounding slack equals the number of inexact divisions (96 units at ## Repository and release -- The crate is 3.0.0: one `blam` binary over a `blc` substrate, the +- The crate is 3.0.1: one `blam` binary over a `blc` substrate, the classical, quantum, and qALC pillars, and lab-gated research instruments. 3.0 is a major release because `qalc`'s public types changed and a few internal helpers became crate-private; the GitHub release v3.0.0 lists - every break. + every break. 3.0.1 changes no interface: it republishes the README with + the 162-bit self-interpreter and the busy-beaver values credited to Tromp. - Checkpoints are `blamckpt v5`, and memo files use the shared tag-first codec; older cache files are invalid. Nothing in `data/` uses either. - CI runs on pushes to `main` and pull requests into it, not on `dev`. It From 9aa6f921c16ab7376ec945e4b817ad26e016920f Mon Sep 17 00:00:00 2001 From: a9lim Date: Wed, 21 Oct 2026 10:41:37 -0400 Subject: [PATCH 41/41] Prove in Lean that the universal machines are universal Tromp's two wirings are corollaries of a self-interpreter's contract: E dbl ( ++ N) ->* dbl (\z.M) N -> M N, and the strict (\a. a F (\b. b (a a))) dbl reduces in one step to E (\b. b Omega), whence (\z.M) Omega N -> M N. Blc/Universal.lean proves both once (uni_nonstrict_of_contract, uni_strict_of_contract) and instantiates them at the 162, 165 and 168: IsUniversal for the 172, 184, 175, 187 and Tromp's 178 and 190, each pinned to its wire (the first four to data/self-interpreter/machines/, the 190 to what blam blc blc makes of ref/AIT/ait/uni.lam, the 178 to intL dbl), and not_uniSizeBound_173. Axioms propext and Quot.sound; strictness on open programs stays a seven-probe check. lake build Blc Certs BusyBeaver: 89 jobs. --- README.md | 2 +- docs/STATUS.md | 6 +- docs/classical/self-interpreter/universal.md | 6 +- lean/Blc.lean | 1 + lean/Blc/Universal.lean | 186 +++++++++++++++++++ lean/README.md | 17 +- 6 files changed, 214 insertions(+), 4 deletions(-) create mode 100644 lean/Blc/Universal.lean diff --git a/README.md b/README.md index 8085989e..3706ba0e 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ proven. bits by a reviewed handwritten proof, and at least 27 kernel-checked in Lean ([global floor](docs/classical/self-interpreter/global-floor.md)). The same reader gives universal machines of 172 (non-strict) and 184 (strict) bits, - against Tromp's 178 and 190 + against Tromp's 178 and 190, and Lean proves all four universal ([universal](docs/classical/self-interpreter/universal.md)). - **The rest of tromp/AIT** ([golf](docs/classical/golf.md), sent upstream as [tromp/AIT#13](https://github.com/tromp/AIT/pull/13)): 40 programs shrink by diff --git a/docs/STATUS.md b/docs/STATUS.md index 3e21bf0d..180c7d03 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -445,7 +445,11 @@ with all features (three opt-in tests ignored) and 328 with default features. - **The universal machine** (`classical/self-interpreter/universal.md`): Tromp's wirings around the 162's body give 172 (non-strict) and 184 (strict; all seven strictness probes), around the 165's 175 and 187, and - around the 168's 178 and 190 (`machines/uni172.lam`, `uni184.lam`); letopt + around the 168's 178 and 190 (`machines/uni172.lam`, `uni184.lam`). Lean + proves all six universal for every closed program, each pinned to its wire + (`Blc/Universal.lean`: `isUniversal_uni172` … `uni190`, Tromp's 190 as his + compiler emits `uni.lam`, `not_uniSizeBound_173`); strictness stays a + seven-probe check. Letopt finds no smaller rendering of 172 or 184, and no wiring search has run around the 162's body yet. Wirings around the 165's body give no non-strict machine below 175 (14,856,126 contexts, 68,017 capped, diff --git a/docs/classical/self-interpreter/universal.md b/docs/classical/self-interpreter/universal.md index 0058afee..5ab30ed4 100644 --- a/docs/classical/self-interpreter/universal.md +++ b/docs/classical/self-interpreter/universal.md @@ -21,7 +21,11 @@ twice. Around the 162's body (140 bits, `interpreter.md`) they are **172** and pass the battery, the 184 all seven strictness probes, and `blam golf letopt` finds no smaller rendering of either); around the 165's body (143 bits) they are 175 and 187 (`uni175.lam`, `uni187.lam`), and around the 168's (146 bits) -Tromp's 178 and 190. *Strict* means, in BLC.tex's words, that "any attempt to +Tromp's 178 and 190. Each wiring is a corollary of its interpreter's +contract, `E dbl (⌜M⌝ ++ N) →β* dbl (λz. M) N →β M N` and, since the strict +wiring β-reduces to `E (λb. b Ω)`, `→β* (λb. b Ω) (λz. M) N →β* M N`; Lean +proves all six universal this way, each pinned to its wire +(`lean/Blc/Universal.lean`). *Strict* means, in BLC.tex's words, that "any attempt to apply free indices diverges", so the machine forces closed programs; the strict wiring gets this from an Ω base environment, which the 162's and the 165's readers leave untouched, since they change only how the code is read. diff --git a/lean/Blc.lean b/lean/Blc.lean index b2b9c080..33673ca1 100644 --- a/lean/Blc.lean +++ b/lean/Blc.lean @@ -17,6 +17,7 @@ import Blc.Selfint import Blc.SelfintProof import Blc.Selfint165 import Blc.Selfint162 +import Blc.Universal import Blc.SelfintLowerBound import Blc.SelfintNonlinearChain import Blc.SelfintNormal diff --git a/lean/Blc/Universal.lean b/lean/Blc/Universal.lean new file mode 100644 index 00000000..3fa4b037 --- /dev/null +++ b/lean/Blc/Universal.lean @@ -0,0 +1,186 @@ +/- +The universal machines. For every closed `M` and any `N`, + + U (⌜M⌝ ++ N) →β* M N, + +which is the figure algorithmic information theory reads its constants +from (`docs/classical/self-interpreter/universal.md`). Tromp's two wirings +(`ref/AIT/ait/uni.lam`) turn any self-interpreter `E = dbl F` into one: + + non-strict: E dbl →β* dbl (λz. M) N →β M N + strict: (λa. a F (λb. b (a a))) dbl →β E (λb. b Ω) + →β* (λz. M) Ω N →β M N + +so each is a corollary of its interpreter's contract +(`uni_nonstrict_of_contract`, `uni_strict_of_contract`). Instantiated at the +162, the 165 and Palmer's 168 they give the 172 / 184, 175 / 187 and Tromp's +178 / 190, each pinned to its wire: the first four to +`data/self-interpreter/machines/uni*.blc`, the 190 to what Tromp's compiler +makes of `ref/AIT/ait/uni.lam`, and the 178 to `uni_non_strict = intL dbl`. + +Strictness, that a machine has no normal form on an open program that uses +its free variable, is not proved here; `battery.py --strict` and `blam +selfint wiring --strict` check it on seven probes. + +No `sorry`; the axioms are `propext` and `Quot.sound`. +-/ + +import Blc.Selfint162 + +namespace Blc +open Term + +/-- `dbl = λx. x x`: the knot's self-application and the non-strict +continuation. -/ +def dblT : Term := .lam (.app (.var 0) (.var 0)) + +/-- `λb. b Ω`: the strict continuation, whose base environment is `Ω`. -/ +def omegaKT : Term := .lam (.app (.var 0) (.app dblT dblT)) + +/-- Tromp's strict wiring around a knot body `F`: +`(λa. a F (λb. b (a a))) dbl`. -/ +def uniStrict (F : Term) : Term := + .app (.lam (.app (.app (.var 0) F) (.lam (.app (.var 0) (.app (.var 1) (.var 1)))))) dblT + +/-- The universal-machine contract. -/ +def IsUniversal (U : Term) : Prop := + Closed U ∧ ∀ M, Closed M → ∀ N, Betas (.app U (streamOf (blcCode M) N)) (.app M N) + +/-- `UniSizeBound n`: every universal machine has at least `n` bits. -/ +def UniSizeBound (n : Nat) : Prop := + ∀ U, IsUniversal U → n ≤ (blcCode U).length + +/-- The self-interpreter contract, as `selfint_contract`, `selfint_contract165` +and `selfint_contract162` state it. -/ +def SelfintContract (E : Term) : Prop := + ∀ M, Closed M → ∀ C N, + Betas (.app (.app E C) (streamOf (blcCode M) N)) (.app (.app C (.lam M)) N) + +-- --------------------------------------------------------------------------- +-- §1. The two continuations finish the run. + +theorem dbl_finish (M : Term) (hM : Closed M) (N : Term) : + Betas (.app (.app dblT (.lam M)) N) (.app M N) := by + have e1 : contract (.app (.var 0) (.var 0)) (.lam M) = .app (.lam M) (.lam M) := by + simp [contract, substDec] + have e2 : contract M (.lam M) = M := substDec_closed 0 _ hM + have h1 := Beta.appL N (Beta.beta (.app (.var 0) (.var 0)) (.lam M)) + have h2 := Beta.appL N (Beta.beta M (.lam M)) + rw [e1] at h1 + rw [e2] at h2 + exact Betas.head h1 (Betas.head h2 (Betas.refl _)) + +theorem omegaK_finish (M : Term) (hM : Closed M) (N : Term) : + Betas (.app (.app omegaKT (.lam M)) N) (.app M N) := by + have e1 : contract (.app (.var 0) (.app dblT dblT)) (.lam M) = + .app (.lam M) (.app dblT dblT) := by + simp [contract, substDec, dblT] + have e2 : contract M (.app dblT dblT) = M := substDec_closed 0 _ hM + have h1 := Beta.appL N (Beta.beta (.app (.var 0) (.app dblT dblT)) (.lam M)) + have h2 := Beta.appL N (Beta.beta M (.app dblT dblT)) + rw [e1] at h1 + rw [e2] at h2 + exact Betas.head h1 (Betas.head h2 (Betas.refl _)) + +/-- The strict wiring's first step: `(λa. a F (λb. b (a a))) dbl →β +dbl F (λb. b Ω)`. -/ +theorem uniStrict_step (F : Term) (hF : Closed F) : + Beta (uniStrict F) (.app (.app dblT F) omegaKT) := by + have e : contract (.app (.app (.var 0) F) (.lam (.app (.var 0) (.app (.var 1) (.var 1))))) dblT = + .app (.app dblT F) omegaKT := by + simp [contract, substDec, substDec_closed 0 _ hF, omegaKT, dblT, shift] + have h := Beta.beta (.app (.app (.var 0) F) (.lam (.app (.var 0) (.app (.var 1) (.var 1))))) dblT + rw [e] at h + exact h + +-- --------------------------------------------------------------------------- +-- §2. Every self-interpreter gives both wirings. + +theorem uni_nonstrict_of_contract {E : Term} (hE : SelfintContract E) + (M : Term) (hM : Closed M) (N : Term) : + Betas (.app (.app E dblT) (streamOf (blcCode M) N)) (.app M N) := + betas_trans (hE M hM dblT N) (dbl_finish M hM N) + +theorem uni_strict_of_contract {F : Term} (hF : Closed F) + (hE : SelfintContract (.app dblT F)) (M : Term) (hM : Closed M) (N : Term) : + Betas (.app (uniStrict F) (streamOf (blcCode M) N)) (.app M N) := + betas_trans (betas_appL _ (Betas.head (uniStrict_step F hF) (Betas.refl _))) + (betas_trans (hE M hM omegaKT N) (omegaK_finish M hM N)) + +-- --------------------------------------------------------------------------- +-- §3. The machines, pinned to their wires. + +/-- 172 bits: `intL162 dbl`. -/ +def uni172 : Term := .app intL162 dblT +/-- 184 bits, strict: the strict wiring around the 162's knot body. -/ +def uni184 : Term := uniStrict knotW162 +/-- 175 bits: `intL165 dbl`. -/ +def uni175 : Term := .app intL165 dblT +/-- 187 bits, strict, around the 165's knot body. -/ +def uni187 : Term := uniStrict knotW165 +/-- Tromp's 178 bits, `uni_non_strict = intL dbl`. -/ +def uni178 : Term := .app intL dblT +/-- Tromp's 190 bits, `uni = intL (λz. z omega)`, as his compiler emits it. -/ +def uni190 : Term := uniStrict knotW + +def uni172Wire : List Bool := [false, true, false, true, false, false, false, true, true, false, true, false, false, false, false, true, false, false, false, false, false, false, false, true, false, true, false, true, true, false, false, false, true, false, false, false, false, true, false, true, true, true, false, false, false, true, true, true, true, false, false, true, false, true, true, true, false, true, true, false, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, false, true, true, true, false, false, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, false, true, false, true, true, true, false, true, true, true, false, false, true, true, false, true, true, true, true, false, false, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, true, false, false, false, false, true, false, true, true, true, true, false, true, false, false, true, true, true, false, true, false, false, true, true, false, true, false, false, false, false, true, true, false, true, false] + +def uni184Wire : List Bool := [false, true, false, false, false, true, false, true, true, false, false, false, false, true, false, false, false, false, false, false, false, true, false, true, false, true, true, false, false, false, true, false, false, false, false, true, false, true, true, true, false, false, false, true, true, true, true, false, false, true, false, true, true, true, false, true, true, false, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, false, true, true, true, false, false, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, false, true, false, true, true, true, false, true, true, true, false, false, true, true, false, true, true, true, true, false, false, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, true, false, false, false, false, true, false, true, true, true, true, false, true, false, false, true, true, true, false, true, false, false, true, true, false, true, false, false, false, false, true, true, false, false, true, true, true, false, true, true, false, false, false, false, true, true, false, true, false] + +def uni175Wire : List Bool := [false, true, false, true, false, false, false, true, true, false, true, false, false, false, false, true, false, false, false, false, false, true, false, false, false, false, false, true, false, true, true, false, false, false, false, true, false, true, true, false, false, false, false, false, false, true, true, false, true, true, true, true, true, false, true, true, true, true, false, false, true, false, true, true, false, true, false, true, false, false, false, false, true, true, true, true, false, false, false, false, true, false, true, true, true, false, false, true, true, true, true, false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, false, true, false, true, true, true, false, true, true, true, false, false, true, true, false, true, true, true, true, false, false, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, false, true, true, true, true, false, true, false, false, true, true, true, false, true, false, false, true, true, false, true, false, false, false, false, true, true, false, true, false] + +def uni187Wire : List Bool := [false, true, false, false, false, true, false, true, true, false, false, false, false, true, false, false, false, false, false, true, false, false, false, false, false, true, false, true, true, false, false, false, false, true, false, true, true, false, false, false, false, false, false, true, true, false, true, true, true, true, true, false, true, true, true, true, false, false, true, false, true, true, false, true, false, true, false, false, false, false, true, true, true, true, false, false, false, false, true, false, true, true, true, false, false, true, true, true, true, false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, false, true, false, true, true, true, false, true, true, true, false, false, true, true, false, true, true, true, true, false, false, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, false, true, true, true, true, false, true, false, false, true, true, true, false, true, false, false, true, true, false, true, false, false, false, false, true, true, false, false, true, true, true, false, true, true, false, false, false, false, true, true, false, true, false] + +def uni190Wire : List Bool := [false, true, false, false, false, true, false, true, true, false, false, false, false, true, false, false, false, false, false, true, false, false, false, false, false, true, true, false, false, false, false, false, false, true, false, true, true, true, false, false, true, true, false, true, true, true, true, false, false, true, false, true, true, true, true, true, true, false, true, false, false, true, false, true, true, false, true, false, true, false, false, false, false, true, true, true, true, false, false, false, false, true, false, true, true, true, false, false, true, true, true, true, false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, false, true, false, true, true, true, false, true, true, true, false, false, true, true, false, true, true, true, true, false, false, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, false, true, true, true, true, false, true, false, false, true, true, true, false, true, false, false, true, true, false, true, false, false, false, false, true, true, false, false, true, true, true, false, true, true, false, false, false, false, true, true, false, true, false] + +set_option maxRecDepth 8192 + +theorem wire_uni172 : blcCode uni172 = uni172Wire := by decide +theorem wire_uni184 : blcCode uni184 = uni184Wire := by decide +theorem wire_uni175 : blcCode uni175 = uni175Wire := by decide +theorem wire_uni187 : blcCode uni187 = uni187Wire := by decide +theorem wire_uni190 : blcCode uni190 = uni190Wire := by decide +theorem wire_uni178 : blcCode uni178 = + [false, true] ++ intLWire ++ [false, false, false, true, true, false, true, false] := by + decide + +theorem uni172_length : (blcCode uni172).length = 172 := by decide +theorem uni184_length : (blcCode uni184).length = 184 := by decide +theorem uni175_length : (blcCode uni175).length = 175 := by decide +theorem uni187_length : (blcCode uni187).length = 187 := by decide +theorem uni178_length : (blcCode uni178).length = 178 := by decide +theorem uni190_length : (blcCode uni190).length = 190 := by decide + +-- --------------------------------------------------------------------------- +-- §4. They are universal machines. + +theorem contract162 : SelfintContract intL162 := selfint_contract162 +theorem contract165 : SelfintContract intL165 := selfint_contract165 +theorem contract168 : SelfintContract intL := selfint_contract + +theorem isUniversal_uni172 : IsUniversal uni172 := + ⟨by decide, uni_nonstrict_of_contract contract162⟩ + +theorem isUniversal_uni184 : IsUniversal uni184 := + ⟨by decide, uni_strict_of_contract (by decide) contract162⟩ + +theorem isUniversal_uni175 : IsUniversal uni175 := + ⟨by decide, uni_nonstrict_of_contract contract165⟩ + +theorem isUniversal_uni187 : IsUniversal uni187 := + ⟨by decide, uni_strict_of_contract (by decide) (intL165_eq ▸ contract165)⟩ + +theorem isUniversal_uni178 : IsUniversal uni178 := + ⟨by decide, uni_nonstrict_of_contract contract168⟩ + +theorem isUniversal_uni190 : IsUniversal uni190 := + ⟨by decide, uni_strict_of_contract (by decide) (intL_eq ▸ contract168)⟩ + +/-- No bound above 172 holds for universal machines. -/ +theorem not_uniSizeBound_173 : ¬ UniSizeBound 173 := by + intro h + have := h uni172 isUniversal_uni172 + rw [uni172_length] at this + exact absurd this (by decide) + +end Blc diff --git a/lean/README.md b/lean/README.md index e26c9e1b..756ea5a9 100644 --- a/lean/README.md +++ b/lean/README.md @@ -28,6 +28,8 @@ theorem selfint_contract162 : Closed M → -- propext, Quot.sound theorem not_selfintSizeBound_163 : ¬ SelfintSizeBound 163 -- propext, Quot.sound +theorem isUniversal_uni172 : IsUniversal uni172 -- propext, Quot.sound +theorem not_uniSizeBound_173 : ¬ UniSizeBound 173 -- propext, Quot.sound theorem selfintSizeBound_27 : SelfintSizeBound 27 -- propext, Classical.choice, Quot.sound ``` @@ -37,7 +39,11 @@ normal form under arbitrary β-reduction. Palmer's 168-bit `intL` (pinned to its wire by `wire_intL`) is a self-interpreter: for every closed `M` and any terms `C`, `N`, `intL C (⌜M⌝ ++ N)` β-reduces to `C (λz. M) N`. So are the 165-bit `intL165` (`wire_intL165`) and the 162-bit `intL162` (`wire_intL162`), so no -self-interpreter size bound above 162 holds. The **general bridge** holds for +self-interpreter size bound above 162 holds. Each gives universal machines, +`U (⌜M⌝ ++ N) →β* M N` for every closed `M`, in both of Tromp's wirings: the +162 the 172 and the strict 184, the 165 the 175 and 187, and the 168 Tromp's +own 178 and 190 (`IsUniversal`, each pinned to its wire), so no universal +machine size bound above 172 holds. The **general bridge** holds for every term, so any head-divergence certificate concludes no-normal-form with no side conditions. The **class assemblies** turn certificate *data* into that conclusion mechanically, and the **rigid-head argument bridge** lifts a spine @@ -214,6 +220,15 @@ Self-interpretation: `selfint_contract162`, `isSelfInterpreter_intL162` and `not_selfintSizeBound_163` (the upper-bound half of optimality; the lower bound `SelfintSizeBound 162` is stated, open). +- `Blc/Universal.lean` — the universal machines as corollaries of the + interpreter contracts. `E dbl` and `(λa. a F (λb. b (a a))) dbl` with + `E = dbl F` reduce to `dbl (λz. M) N` and `(λb. b Ω) (λz. M) N`, both + `M N` (`uni_nonstrict_of_contract`, `uni_strict_of_contract`). Instantiated + at the 162, 165 and 168: `isUniversal_uni172`, `uni184`, `uni175`, + `uni187`, `uni178`, `uni190`, with `wire_uni*` pinning the first four to + `data/self-interpreter/machines/` and the 190 to Tromp's compiled + `uni.lam`, and `not_uniSizeBound_173`. Strictness on open programs is not + proved; the battery's seven probes check it. - `Blc/SelfintLowerBound.lean` — every term with at most one syntactically nonlinear binder weakly normalizes. Consequently every self-interpreter has at least two, and an explicit `λc s.B` has two inside `B`. A syntax