|
| 1 | +# Emergent Smalltalk capsules |
| 2 | + |
| 3 | +Three presentations at each strict decimal budget: fewer than 1,000, 2,000 or |
| 4 | +3,000 UTF-8 bytes, including the title, whitespace and scope statement. All are |
| 5 | +ASCII. These are alternative descriptions of the same source semantics, not |
| 6 | +language variants. Automatafl is a separate package. |
| 7 | + |
| 8 | +| Presentation | <1 KB | <2 KB | <3 KB | |
| 9 | +| --- | --- | --- | --- | |
| 10 | +| Rewrite relation and evaluation contexts | [rewrite-1k.txt](rewrite-1k.txt) | [rewrite-2k.txt](rewrite-2k.txt) | [rewrite-3k.txt](rewrite-3k.txt) | |
| 11 | +| Transition algebra | [algebra-1k.txt](algebra-1k.txt) | [algebra-2k.txt](algebra-2k.txt) | [algebra-3k.txt](algebra-3k.txt) | |
| 12 | +| Resumable evaluator pseudocode | [machine-1k.txt](machine-1k.txt) | [machine-2k.txt](machine-2k.txt) | [machine-3k.txt](machine-3k.txt) | |
| 13 | + |
| 14 | +The byte counts and SHA-256 hashes are in [manifest.json](manifest.json). |
| 15 | +Run `bun docs/objective-bend/capsules/check.ts` from the repository root to |
| 16 | +check the exact published files and budgets. |
| 17 | + |
| 18 | +The 1 KB files explicitly describe a projection: open recursion, lazy records, |
| 19 | +effects and the governed object boundary. They omit other constructors and |
| 20 | +protocol detail. The 2 KB files cover the complete reference core dynamics, |
| 21 | +including primitive edge cases, demand order, raw yields and resumption, with |
| 22 | +a small object contract. The 3 KB files add typing constraints and durable |
| 23 | +interaction rules. Their typing accounts have different emphases; none is a |
| 24 | +complete checker, admission algorithm, source grammar or wire specification. |
| 25 | +Budget is not a claim of completeness beyond each file's stated scope. |
| 26 | + |
| 27 | +Start with the rewrite 3 KB capsule for the common agent contract. The machine |
| 28 | +2 KB capsule is the most direct implementation prompt. Algebra is useful for |
| 29 | +factoring demand rules and host admission into explicit mathematical relations. |
| 30 | +These preferences are editorial judgments, not results of a blind reconstruction |
| 31 | +test. The three authors consulted the implementation. The pseudocode has not |
| 32 | +been run as an interpreter, and prose inspection is not an equivalence proof. |
| 33 | + |
| 34 | +## Why payer is outside the object tuple |
| 35 | + |
| 36 | +The abstract object is `(id, code pin, versioned state, law)`; invocation adds |
| 37 | +an authenticated principal and authority. Host policy supplies execution and |
| 38 | +retention resources. The tuple is a semantic projection, not Mini's serialized |
| 39 | +record layout. Eliding storage accounting does not erase resource admission. |
| 40 | + |
| 41 | +Mini's [ObjectRecord](../../../Kernel/ObjectRecord.lean) stores a Book account |
| 42 | +that funds the record and state cell. `admitWrite_payer_irrelevant` and |
| 43 | +`judge_payer_irrelevant` prove that changing that field does not change the |
| 44 | +corresponding write judgment. This supports omitting it from the common object |
| 45 | +description. It does not prove that changing funding preserves retention, |
| 46 | +execution availability or every observable host behavior. |
| 47 | + |
| 48 | +The activity [escrow](../../../Kernel/ObjectiveActivity.lean) also has a field |
| 49 | +called `payer`, but that one is a `SubjectId` used as the activity principal in |
| 50 | +`factsOf`. The authenticated principal must remain. A Mini adapter still must |
| 51 | +populate all required accounts, signatures, reserves and principal fields; |
| 52 | +these capsules do not change that implementation. |
| 53 | + |
| 54 | +## A small multi-language repository |
| 55 | + |
| 56 | +A standalone conformance repository is a good destination. Keep one normative |
| 57 | +Lean semantics, independent implementations, a common corpus and named host |
| 58 | +profiles. Initially pin the relevant Mini source rather than fork its semantic |
| 59 | +authority. A proposed layout is: |
| 60 | + |
| 61 | +```text |
| 62 | +capsules/ these compact contracts and exact byte manifests |
| 63 | +spec/ pinned Lean terms, reductions, yields, observations |
| 64 | +impl/python/ small transparent reference interpreter |
| 65 | +impl/c/ independent evaluator or imported existing backend |
| 66 | +conformance/ canonical AST, scripts of replies, fixtures, shrinking |
| 67 | +profiles/mini/ authority, durability, resource and transport binding |
| 68 | +examples/automatafl/ two-player game package, separate from language |
| 69 | +``` |
| 70 | + |
| 71 | +This is a proposed extraction, not a newly published repository. Mini already |
| 72 | +contains [a Lean C emitter](../../../Compiler/ObjectiveBendEmitC.lean), |
| 73 | +[a C demand machine](../../../native/objective-emit/runtime.c), and |
| 74 | +[a Python differential harness](../../../native/objective-emit/differential.py). |
| 75 | +The Python harness is not a Python language implementation. The C runtime is |
| 76 | +derived from the demand machine design and depends on Lean-generated ROM; it |
| 77 | +is useful existing work, not a blind independent reading of a capsule. Its |
| 78 | +emitter explicitly records that C refinement is not proved. No C qualification |
| 79 | +was rerun for this documentation experiment. |
| 80 | + |
| 81 | +Use a canonical core AST first, so parser differences do not mask evaluator |
| 82 | +differences. Compare ground observations, stuck outcomes, yielded plans and |
| 83 | +resumed traces. Probe lazy records/closures by elimination rather than comparing |
| 84 | +their implementation representations. Separate finite fuel exhaustion from |
| 85 | +semantic divergence. Independent evaluators need not take the same number of |
| 86 | +steps; the existing C backend's stricter state/tick comparison remains useful |
| 87 | +for its particular claim of matching the Lean demand machine. |
| 88 | + |
| 89 | +The next useful small swarm is a blind reconstruction experiment: one fresh |
| 90 | +agent per capsule, with only that capsule and a common AST/protocol interface, |
| 91 | +builds an interpreter. Score held-out behavioral cases and missing-rule reports, |
| 92 | +not just successful parses. Count the shared interface separately: it must not |
| 93 | +silently supply semantics omitted from the capsule. Include unused divergence, |
| 94 | +duplicate fields, strict AND, a wrong-typed left primitive operand followed by |
| 95 | +a yielding right operand, inherited methods seeing overridden self, and |
| 96 | +resumption under nested contexts. Test host profiles separately with stale |
| 97 | +roots, current law changes, duplicate resume and an unknown commit outcome. |
| 98 | + |
| 99 | +The aim is the smallest contract from which independent agents reconstruct the |
| 100 | +same behavior. Byte golfing is only one part of that measurement. |
| 101 | + |
| 102 | +## Source anchors |
| 103 | + |
| 104 | +- [Core terms, values, Step, Yields](../../../Theory/ObjectiveBendOpenRecursion.lean) |
| 105 | +- [Types and usage safety](../../../Theory/ObjectiveBendTypes.lean) |
| 106 | +- [Modular typing](../MODULAR-TYPING.md) |
| 107 | +- [Durable interaction contract](../../OBJECTIVE-BEND-EVENTS.md) |
| 108 | +- [Two-player Automatafl comparison](../../../world/automatafl/README.md) |
| 109 | + |
| 110 | +The original [capsule](../EMERGENT-SMALLTALK.txt) remains as a prose-oriented |
| 111 | +presentation; it now separates funding and fixes the typing/sharing shorthand. |
0 commit comments