01 — Stage C audit + Reader A vs Reader B
Morgen's direction: "Don't we just need to run those tests? We should likely code Reader A and B."
1.1 Stage C — just run the tests
Stage C is note 12 §8: audit the 75-entry corpus (docs/kernel-model/test/corpus.json, model.py, test_roundtrip.py, test_books.py at main 7761b9a).
For every one of the 75 corpus facts, produce a table with separate columns — this separation is the whole point, because the two headline numbers are two different metrics:
| Column | What it records | |||
|---|---|---|---|---|
| source | which corpus entry (id, file, line) | |||
| semantic AST | the fact as a typed AST under the seed language | |||
| full position | the 7-bit coordinate c = 64F + 32S + 16M + 8O + 2R + D | |||
| six stored bits | relation 2 \ | direction 1 \ | modality 1 \ | phase 2 |
| three derived bits | frame/world, sign/substance, self/other — with the derivation trace (derive_context(...) inputs: kind definition + role values + log frame) | |||
| derivation verdict | recovered / ambiguous / invalid — per entry, not in aggregate | |||
| round-trip | byte-for-byte decode(encode(entry)) == entry? | |||
| verb recovery | verb name recovered without labels? | |||
| roles | every key assigned a role (subject/object/kind/measure)? |
Known baseline to reproduce first: round trip 74/75 (exception: conformance case 04, non-canonical by design); verb names recovered 75/75; Books rebuilt from flow facts alone identical. If the rerun does not reproduce those three numbers, stop — the corpus or the model has drifted, and the audit is measuring the wrong thing.
The deciding question Stage C answers: is the context derivation total and unambiguous for the corpus, or does it fail? Outcomes, in order:
- Pass: every entry's three derived bits recover with a trace, no ambiguity. Then the 6-bit wire form may proceed to Stage D, and the claim "six stored bits recover the context" is proven for the corpus (not universally — note 17 #6: corpus success alone is not universal proof; the universal argument is still M6).
- Fail with a pattern: e.g. derivation fails only where the kind definition is missing, or only for
possiblefacts, or only for self/other. Then the fix is named (require kind definitions before derivation; add an explicit context bit for that axis; restrict the domain) — and the format retains explicit context bits until the fix is proven. - Fail without a pattern: the 6-bit form is not viable as stated; retain the full context in the reference AST (note 12: "Until this is proven on the corpus and edge cases, retain the full context in the reference AST and do not freeze the 6-bit wire form").
Also in Stage C: test the four-role mapping against each relation signature; add counterexamples; resolve the 74/75 vs 75/75 distinction in writing so it is never quoted conflated again; check the seal-code discrepancy (COMMIT 0x14 vs 0x15; seal 0x01 vs 0x02) against the corpus — a single byte difference here makes a second implementation fail.
Where it runs: in the Lab, as evidence — lab test <id> -- python3 <stage-c script> — so the run, its exit code, stdout/stderr and state hash are recorded in evidence/runs.jsonl, not in a chat message.
1.2 Reader A vs Reader B — code both, compare, do not silently exchange
Note 18 §6: two candidate readers. "Compare a finite relational reader with a more restrictive forest reader; do not silently exchange their meanings." Note 18's verdict to respect: "Keep A as the reference semantics until the wider STREAM operators establish that B's restrictions suffice."
Reader A — finite relational closure
- What it is: relations as sets of ground tuples; rules as positive typed implications; every variable bound by a premise; no fresh terms/numbers/nested values in rules; finite domain D gives at most
Σ_p |D|^arity(p)ground tuples; closure reaches a fixed point. In substance: Datalog safety/stratification (note 15 §5). - What it can do that B cannot (yet): general recursive inference over relations; arbitrary positive rules; the full note-15 seed language.
- What it costs: the trusted machinery is larger — parser, matching/substitution, finite closure, complete-scope guards, exact arithmetic, staging, admission, atomic append (note 15 §12's irreducible list).
Reader B — finite derived expressions and forest traversal
- What it is: the transcript's observations reproduced by bounded forest traversal; consume/produce as one shared delta
B_next = (B_current ∖ C) ∪ A; occurrence identity as the one-use capability token; birth references from occurrence addresses. No general recursive engine (for this forest transcript). - What it can do: reproduce the note 16b L:1–L:16 transcript's observations with fewer fields — remove the one-use counter, separate grant identity, independent entity allocator, primitive principal, materialized tables.
- What it costs: less trusted machinery, but "cannot necessarily accept same definitions" — a semantic translation for a restricted domain, not byte compatibility. It reproduces observations, not the same definitions.
The comparison plan (both readers, same transcript, same criteria)
Run both readers against the same inputs and score them on note 18 §9's comparison criteria:
| Criterion | How to measure |
|---|---|
| Total trusted implementation | Lines of code + the premise inventory: every supplied capability listed, as in experiments/mark-boundary/premises.json |
| Definition size | Bytes of the seed + definitions needed to run the L:1–L:16 transcript |
| Evaluation bounds | Worst-case steps / time for the transcript; what happens at the limit (EvaluationLimit, never false) |
| Expressiveness | Which of the note-15 eight forms each reader can run; which transcript events each can reproduce |
| Explanation quality | Can each reader explain a refusal (which guard, which missing grant, which spent occurrence)? |
| Books | Can each produce the paired-delta transfer (x−q)+(y+q) = x+y with exact arithmetic and range limits? |
| Failure behaviour | Refused pre-activation use leaves domain state unchanged? Spent grant refuses? Second GENESIS refused? |
Decision rule, stated in advance: A stays the reference semantics unless B reproduces all of the transcript's observations and the wider STREAM operators (the eight forms, the Books, the refusal rules) establish that B's restrictions suffice. If B wins on size but loses on expressiveness, that is a recorded trade-off, not a silent exchange.
What "code both" means in practice
- Language: Python, standard library only, in the Lab working folder — same discipline as
experiments/mark-boundary/src/checker.py. No Rust yet (do-not list: do not rebuild the Rust kernel until Stages A–C pass). - First target: the note 16b L:1–L:16 transcript, rendered in exact bytes (M2). Second target: the Stage C corpus, read through each reader.
- Evidence: every run recorded via
lab test; every new capability extends the premise inventory ("Extend the premise inventory whenever a new capability is introduced. Do not add a domain assertion to make a desired derivation pass."). - What it does not do: it does not settle the seed text, the type encodings, or migration. Those are separate decisions (files 03, 06, 07).