# Reader → Hamiltonian Compiler — Design Spike **Status**: COMPLETE — design ready for review; all bindings verified against the live tree, algebra claims verified in-tree. Implementation (P1–P5) starts after the §8 rulings. **Date**: 2026-07-18 **Base**: `forgejo/main @ 6ff73aa7` (intelligence-loop arc merged; ADR-0246/0247/0248 Accepted) **Branch**: `feat/reader-hamiltonian-compiler` **Provenance**: Next-arc candidate #1 from `docs/handoff/ADR-0246-Acceptance-Evidence.md`; the generalized-lift instrument recorded GSM8K/NL non-ingestibility as the composition frontier — this spike designs the mechanism that crosses it. --- ## 1. Problem statement The corridor can solve what it can ingest, and it can ingest almost nothing. Today's compilable domains are (a) propositional entailment over ≤5 atoms and (b) quadratic wells around a known target versor. Real problems — GSM8K arithmetic, multi-step deduction — have no path onto the substrate. The measurement harness (Phase 4 instrument) is built and waiting; the compiler is the missing feeder. This is the recorded composition wall from the GSM8K learning history finally getting its mechanism. **Done-when (spike)**: a ratifiable design that (1) compiles real reader output into corridor Hamiltonians deterministically, (2) provably encodes *relations, not answers* (anti-hollow invariant, §4.1), (3) reuses the merged Ring-1/2/3 machinery for composition, and (4) names its governing ADR obligations line-by-line. Implementation phases follow only after the design is reviewed. ## 2. Design thesis: composition = certified turn sequences The wall is COMPOSITION (ADR-0191/0192/0193 lesson: single-layer widening is metric-inert). The freshly merged arc supplies exactly the composition machinery: per-turn RelaxationCertificates, egress routing, the Ring-2 residual protocol's replay-verified path ledger, Ring-3 handoff, and the S3 tether. Therefore: > **The compiler does not compile a problem into one big Hamiltonian. It compiles a problem > into a *turn program* — an ordered DAG of small relation-Hamiltonians, each solvable in one > lifecycle turn, chained through the Ring-2 path ledger.** - Each turn's H is ≤ the substrate's native 32-dim space (the ≤5-atom limit *is* 2⁵ = 32 — the truth-table basis saturates the Cl(4,1) blade basis; this is a feature to design around, not an accident). - Composition depth lives in the *certified chain*, not in matrix size. Multi-step problems become multi-turn programs whose end-to-end integrity is the path ledger's job — the same ledger that already discriminates `port:identity:d_stab>epsilon_turn`. - This unifies the two flagship domains under one design: arithmetic chains (each step = one relation well) and >5-atom deduction (ROBDD-partitioned ≤5-atom slices per turn). ## 3. Substrate-native quantity encoding (the standing hand) Numbers must live on the field before arithmetic relations can be field constraints. The CGA-native choice — no bespoke machinery — is the conformal embedding of the real line: - **Quantity**: `q ↦ P(q) = e_o + q·e₁ + ½q²·e_∞` (null point on the line's horosphere). - **Addition by a known constant**: translator versor `T_a = 1 − ½ a e₁e_∞`; `T_a P(b) T̃_a = P(a + b)` — exact, versor-native. - **Scaling by a known constant**: dilator versor `D_s`; `D_s P(b) D̃_s = P(s·b)` — exact. - **Subtraction / division**: inverse versors of the above. - **Relation as constraint**: "x = a·y + b" compiles to a quadratic well whose minimum is the versor-transported target — i.e. the *existing* quadratic-well machinery centered on `(T_b D_a) ψ_y (T_b D_a)~`, never on a precomputed number. - **Weight honesty**: versor transport of null points is exact up to conformal weight (dilators rescale the point's overall factor), and the corridor requires unit-norm states (`compile_quadratic_well` refuses `target_not_unit` at 1e-9). The compiler therefore normalizes transported targets, and quantity *decode is projective* — `q` is recovered from coefficient ratios (e₁-coefficient over e_o-coefficient), which are scale-invariant, so normalization loses nothing. Scope honesty (Tier 1): products of two *unknowns* are not versor operations. Tier-1 scope is **affine DAGs** — each step multiplies/divides by problem-text constants and adds/subtracts known or previously-certified quantities. This covers the dominant GSM8K step shape; the non-affine remainder is recorded, not silently capped (§6 risks). **Verified in-tree (2026-07-18)**: all four algebra claims checked numerically against `algebra/cl41.py`'s own multiplication table (signature `(+,+,+,+,−)`, basis e1..e5; `n_∞ = e4+e5`, `n_o = ½(e5−e4)`), 200 random cases, q ∈ [−50, 50]: nullity `|P(q)²| < 3e-10`; translator exactness `|T_a P(b) T̃_a − P(a+b)| < 2e-10` (f64 rounding only — the identity is algebraically exact, translators preserve weight); dilator `D = exp(+α/2·e4e5)` scales `s = e^{−α}` (sign convention pinned here) with conformal weight rescale confirmed (w ≈ 2.01 ≠ 1 at α=0.7 — normalization required); projective decode `q = e1c/(e5c − e4c)` scale-invariant to < 1e-9. ## 4. Design invariants (pins before code) ### 4.1 Relation-not-answer (anti-hollow) The compiler must never evaluate the arithmetic or logic it encodes. If the compiler computes `a+b` to center a well, the corridor confirms rather than solves — a hollow instrument. Enforcement: (i) purity pin — no arithmetic on problem quantities in the compiler module beyond versor construction; (ii) property test — compiled artifacts for a relation are invariant to which variable is designated unknown; (iii) ablation test — corrupting the relaxation changes the answer while compiler output is bit-identical. ### 4.2 Determinism + content addressing Compiled Hamiltonians are frozen, content-addressed per ADR-0245 §2.3/§2.4 (full SHA-256, canonical JSON, explicit `5) / clause-budget; closes the prose → `comprehend` → `to_deductive_logic` → CNF → corridor path. - **P4 — Turn-program compiler + executor** (evals quarantine): `MathProblemGraph` → ordered turn program (one relation well per step, previously-certified quantities as transported targets); executor chains lifecycle turns through the Ring-2 residual protocol (per-turn certificates, replay-verified path ledger); tether readings per §S3. - **P5 — Instrument integration**: arithmetic-chain domain added to the generalized-lift instrument; **real GSM8K holdout slice, never the 150 templated cases**; baseline = the symbolic evaluator over the same `MathProblemGraph`; honest-NULL protocol; Tier-1 affine coverage of the slice measured and RECORDED. - **P6 (next arc, not this one)** — >5-atom deduction via ROBDD-partitioned turn programs. Each phase: own PR, smoke-gated, TDD-first. New machinery ⇒ **ADR-0249** (Proposed; re-verify number at landing), acceptance evidence assembled as in the intelligence-loop arc; no self-Accept. ## 8. Rulings (RESOLVED 2026-07-18) All four APPROVED by Shay: 1. **Tier-1 = affine-only.** Unknown×unknown deferred; keep the versor story exact. 2. **>5-atom deduction = next arc**, via ROBDD-partitioned turn programs. NOTE the honest reason: this is a *sequencing* choice (one capability per arc), **not** a claim that >5-atom deduction is impossible or needs probabilistic approximation — composition handles it deterministically and exactly. The 32-blade ceiling only forbids doing it *natively in one Hamiltonian*; the certified turn chain crosses it losslessly. 3. **One ADR (0249)** for quantity kernel + relation compiler + CNF converter + turn programs. 4. **Field wedge continues independently** (0D+W); this arc generalizes the same versor mechanism into the corridor; compiler imports neither wedge arm (INV-27 intact); any merge is a later explicit ADR.