The first formal-links milestone shipped clause-5 + 8 links across the
existing file layout. Browsing surfaced that file-only granularity is
only as precise as the file boundaries — three files mixed two or
three navigation targets under one address, so the 8 links could not
multiply without ambiguity. This commit fixes the substrate, then
applies the sweep the original milestone deferred.
Splits (each extracts an already-self-contained section into its own
file so links land on the topic, not the parent doc's TOC):
contracts/typeclasses.md
→ +contracts/prelude-classes.md (Eq/Ord/Show ships, polymorphic `print`)
→ +contracts/method-dispatch.md (5-step dispatch rule, candidate index)
contracts/memory-model.md
→ +contracts/language-constraints.md (the 4 binding constraints
making RC sound without a
cycle collector)
models/authoring-surface.md
→ +models/prose-projection.md (Form-B / `ail prose` / merge-prose)
Each new file enters design/INDEX.md as its own row (three contracts
share show_no_instance_e2e.rs / uniqueness.rs as ratifying tests;
prose-projection is a model). Two pre-existing links rebind to the
new topic-files (memory-model.md → method-dispatch.md;
float-semantics.md → prelude-classes.md).
Link sweep: 8 → 88 formal Markdown links over 23 files. Every file
in design/contracts/ + design/models/ now has at least one outgoing
link; the tree is fully connected. Links are file-relative
`[label](path)` per the established convention, fenced code blocks
are skipped (a `](` inside ```jsonc``` is literal text), the durable
tier (design/ + crates/ + runtime/) is enforced by clause-5.
Tests:
- design_index_pin.rs (5/5 clauses): clean-cut, INDEX resolution,
ratifying-test resolution, no decision-record prose in contracts/,
body links durable + resolving.
- docs_honesty_pin.rs (5/5): one assertion rebinds from typeclasses.md
to prelude-classes.md (where the gated sentence now lives);
design_corpus widens to include the 4 new files so the Wunschdenken
/ doc-archaeology sweeps continue to cover everything that used to
live in the parents.
No spec/plan/journal for this batch — interactive collaboration after
the milestone closed; the user gated the splits explicitly before the
sweep.
4.2 KiB
Form (B) — prose projection whitepaper
Form (B) — human prose projection
AILang ships a
second textual projection of the AST: ailang-prose, a one-way
projection from Module → human-readable text. It is not an
authoring surface; it is the "display" projection that Decision 6's
architectural pin (see authoring surface)
explicitly anticipated:
"Future projections are explicitly anticipated: a visual / graphical front-end is a plausible second projection for human review and inspection (display being the one case where non-AI eyes matter). The architecture leaves room: any producer of well-formed
ailang-core::ast::Modulevalues is a valid front-end."
Form (B) targets the specific failure mode where a human reviewer needs to read an AILang module quickly. Form (A) was designed to fit a 30-production EBNF spec and to be parsed zero-shot by foreign LLMs; that prioritisation makes it dense and visually noisy for human readers. Form (B) inverts the trade-offs:
- Rust-flavoured surface. Braces and
=>for match arms, Rust-aligned 4-level operator precedence, infix arithmetic (a + b, not+(a, b)), unary!fornot. - Lossy by design. Projection elides machinery the LLM can
re-derive:
(con T)wrappers ((con Int)→Int), the(fn-type (params ...) (ret ...))wrap,(term-ctor T C ...)collapses toC(...), redundant parens. Only the AST machinery whose information is recoverable from typecheck context. - Lossless on load-bearing detail. Mode annotations
(
own T,borrow T), effects (with IO), explicitclone,reuse-as, doc strings, type annotations on signatures and lambdas, thetailflag — all preserved verbatim.
Critically, form (B) has no parser. Form (A) is round-trippable
by construction (see roundtrip invariant);
form (B) deliberately is not. Re-integrating prose edits requires an
external LLM mediator, not a compiler pass — the prompt template
ail merge-prose composes the six-step cycle.
Form (B) does not weaken any Decision 6 invariant:
- The JSON-AST remains the only hashable artefact. Prose is not hashed, not content-addressed, not load-bearing for any cross-module reference.
- Form (A) remains the canonical authoring surface. Foreign LLMs still author against form (A); humans review and edit through form (B).
- The 30-production grammar of form (A) is unchanged.
ailang-checkandailang-codegenremain projection-agnostic;ailang-proseis a downstream consumer ofailang-core::ast, parallel toailang-surfacebut in the rendering direction only.
The CLI gains ail prose <m.ail.json> (the deterministic
projection) and ail merge-prose <m.ail.json> <edited.prose.txt>
(the mediator-prompt composer); both are listed under
pipeline.
Form-A spec embedding
An earlier merge-prose
prompt instructed the LLM to emit JSON-AST and offered a 12-line
schema-essentials reminder; that combination did not give a
foreign LLM enough to produce valid output. The current prompt revises this:
- The LLM emits Form-A (the canonical authoring surface), not
JSON. JSON-AST stays the only hashable artefact, but it is not
a writing surface. The user runs
ail parse foo.new.ailbeforeail checkto produce the canonical JSON. crates/ailang-core/specs/form_a.mdis the complete LLM-targeted Form-A specification — grammar, every term / pattern / type / def keyword, schema invariants, pitfall catalogue, four few-shot modules drawn fromexamples/*.ail. It is exported asailang_core::FORM_A_SPECand embedded verbatim in everymerge-proseprompt.crates/ailang-core/tests/spec_drift.rswalks every variant ofTerm,Pattern,Type,Def,Literalvia exhaustivematchand asserts an anchor for each appears in the spec. The exhaustive match is the load-bearing piece: adding a new variant without updating the match fails compilation in this test, before its assertions even run. Hand-written content, mechanical drift detection.
The cycle's lowest-common-denominator path is the static prompt
(ail merge-prose | client | ail parse | ail check), which works
with any client.