Independent scholarship · Open accessThe monthly digest

Editorially reviewed

Guarded Recursion for Meta-Learning Factories

We model finite factory construction by a homotopy-initial algebra and controller execution by guarded coalgebra. Lean verifies discrete truncation and resource bounds. In QEMU, 110 daughter factories booted from guest-emitted ELF images and matched the Lean reference over 188 valid boots.

Anonymous← All research

Guarded Recursion for Meta-Learning Factories

Abstract

We give a higher-categorical semantics for simulated factories that construct successors and pass on learned state. A homotopy-initial algebra describes finite construction records. A guarded coalgebra describes observations of execution. A truncation theorem relates the two. Lean checks discrete observation and accounting theorems. QEMU replay matched the reference over 188 valid boots and 110 guest-produced daughter executables. Eight malformed manifests were rejected.

Setting and construction semantics

Let $\mathcal X$ be an $\infty$-topos, possibly a presheaf $\infty$-topos or a slice over a task context. Fix finite arity bound $d$ and objects of event labels $A_k$ for $0\le k\le d$. The ordered polynomial is

$$F(X)=\coprod_{k=0}^{d} A_k\times X^k .$$

A label may retain equivalences of components or higher identifications. An arity-zero label denotes a terminal event. A recursive factory controller is a coalgebra $\gamma:S\to FS$ on states containing the task context, learner state and available resources.

Theorem 1. The initial chain $W_0=0$, $W_{n+1}=F W_n$ has a colimit $W$ with an equivalence $w:FW\simeq W$. The space of algebra maps from $(W,w)$ to any $F$-algebra is contractible.

Proof. Filtered colimits in an $\infty$-topos commute with finite products, so $F$ preserves the chain colimit. The successor shift is cofinal, giving $w$. For an algebra $a:FZ\to Z$, put $M_n=\operatorname{Map}(W_n,Z)$, write $r_n:M_{n+1}\to M_n$ for restriction, and set $t_n(x)=aF(x)$. The endomorphisms $T_0=\mathrm{id}$, $T_{n+1}=t_n r_n$ are compatible by naturality. The space of algebra maps is the homotopy equalizer of the identity and $\lim T_n$ on $\lim M_n$. For $u:B\to A$, $v:A\to B$, applying $u$ and $v$ induces inverse equivalences of the homotopy equalizers of $(\mathrm{id},vu)$ and $(\mathrm{id},uv)$. The point's specified path gives the homotopies for the composites. Apply this to $r_n,t_n$. All restrictions on the equalizers are equivalences and the zeroth equalizer is contractible. Limits commute with equalizers, completing the proof.

For a genuinely higher instance, take $A_0=K(G,m)$, $A_2=1$, and all other labels initial, with $G$ abelian and $m\ge2$. The summand for a tree with $l$ leaves is $K(G,m)^l$. A semantics that keeps only connected components loses its higher homotopy groups.

Guarded execution and its connection to construction

In $\operatorname{Fun}(\mathbb N^{op},\mathcal X)$, define $(\triangleright X)_0=1$ and $(\triangleright X)_{n+1}=X_n$. Let $B_0=1$ and $B_{n+1}=F B_n$, with restrictions $p_0={!}$ and $p_{n+1}=F(p_n)$.

Theorem 2. The tower $Y_n=B_{n+1}$ is the contractibly unique solution with a specified equivalence $Y\simeq F(\triangleright Y)$. A coalgebra $\gamma$ induces a coherent cone whose finite components satisfy

$$o_0={!},\qquad o_{n+1}=F(o_n)\gamma .$$

Proof. At level zero a solution is an object with a specified equivalence to $F1$, a contractible choice. Given a solution through level $n$, the next level is an object with a specified equivalence to $F(Y_n)$ and a restriction identified with the one prescribed by the preceding square. That space is also contractible. The inclusions of the spines of finite linear orders into their nerves supply the remaining coherent composites. The limit of the finite solution spaces is contractible. For the cone, compatibility follows from $p_0o_1\simeq o_0$ and $p_{n+1}o_{n+2}=F(p_no_{n+1})\gamma$. The construction on finite cones gives coherence. Equivalently, the unfolding is the fixed point of an endomorphism of the mapping-space tower that factors at each stage through the preceding stage. The restriction argument from Theorem 1 gives contractible uniqueness.

Add a distinct hole constructor and take $W^\sharp=\mu X.(1+F X)$. Let $j_0:1\to W^\sharp$ be the hole, and $j_{n+1}=\mathsf{node}\circ F(j_n)$. Let $T_k$ cut a record at depth $k$ by inserting holes. For $k\le n$,

$$T_k j_n\simeq j_k p_{n,k},\qquad T_k j_n o_n\simeq j_k o_k.$$

The first equation follows by induction using $p_{n+1,k+1}=F(p_{n,k})$, and the second uses the cone equations. The maps $j_n$ are monomorphisms by induction using disjoint coproducts and finite products. The observations are recovered as depth-bounded records. The ordered $F$ preserves inverse sequence limits. Over $A=\coprod_k A_k$ the functor splits into the components $A_k\times X^k\to A_k$, each of which preserves limits. The forgetful functor out of the slice creates this limit because an inverse sequence has contractible indexing nerve. The shifted tower limit therefore has a terminal coalgebra structure by the dual of Theorem 1.

Meta-learning and conservation

An episode consists of support data $D_s$ and query data $D_q$. For initialization $h$, inner adaptation is $U_h(D_s)$; the outer selector minimizes the sum of query losses $\sum_e \ell(U_h(D_s^e),D_q^e)$ over a finite hypothesis set. In the experiment $h$ is a bit. The inner rule uses a supplied support bit or falls back to $h$. The outer rule evaluates both initializations on four episodes and retains the inherited initialization on a tie. The daughter inherits the selected bit. A distinct deterministic validation list supplies the observed query error $q$.

At state $(g,b,h)$, a birth costs $c=3+q$. It produces $(g+1,b-c,\hat h)$ if $b\ge c$ and otherwise the controller stops. At the matched state $(g,b)=(1,3)$, inherited $1$ gives cost $3$ and produces a daughter. Reset to $0$ gives cost $5$ and no daughter.

More generally, a paid expansion replaces one balance $b$ by child balances $b_i$ satisfying $b=c+\sum_i b_i$, with $c\ge\delta>0$. The frontier balance plus the total debit is invariant because the replacement preserves that sum. From a root balance $b_0$, there are at most $\lfloor b_0/\delta\rfloor$ expansions and $1+d\lfloor b_0/\delta\rfloor$ created nodes. When every transition is a paid expansion or a terminal event, depth $\lfloor b_0/\delta\rfloor+1$ suffices to observe the whole run.

Checked specialization and QEMU evidence

Lean 4.19.0 checks the unique fold for finite unary records, the agreement between that fold and finite observations, prefix compatibility, uniqueness of the compatible family, optimality of the finite selector, accounting for every unary lineage, and stabilization at depth $\lfloor b/3\rfloor+1$. It also checks the cut identity and the resource bound for discrete branching systems. The higher-topos theorems are proved in the attached manuscript. The independent freestanding C guest is checked by replay against the compiled Lean reference.

Each lineage begins in a QEMU guest booted from a seed image and starting manifest. After a successful birth the guest emits a complete Multiboot ELF, embedding the assembled component flags, learned bit, remaining credits and successor generation. The harness checks its loadable bytes and starts a fresh VM directly from that image without an external state module. The host schedules each boot and supplies emulation. The validation covers simulated component assembly and executable reproduction.

CaseBootsBirthsQuery errors
Main lineage $(0,16,0)$650
Inherited $(1,3,1)$210
Reset $(1,3,0)$102
Credit limit $(0,120,0)$41400
All valid scenarios188110

The full test suite covers 78 valid initial states and rejects eight malformed manifests. All valid rounds matched the Lean reference. Fixed initializations $0$ and $1$ incurred respectively eight and four errors on the same six generations of the main lineage, compared with zero for learned initialization. Fixed policies can reach different generations in an actual run. This deterministic benchmark establishes the modeled dependence of feasibility on inheritance.

Run the bundle's integrity check and make verify to regenerate the evidence, and make paper to rebuild the two-column PDF. The bundle includes the checked sources, ELF images, raw serial observations, and captured expected summary. The manuscript, proof sources, and experiment were prepared with AI assistance.

References

Associated artifacts

Discussion

Open a careful, constructive conversation about this note.

Comments appear after editorial approval.