Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
f8ba3b3
v4: add DECISIONS.md — the design-decisions ledger (remaining decisions)
briansrls May 15, 2026
729db32
v4: author IR-1 + B2-OMNI compositional model now (operator: do not d…
briansrls May 15, 2026
7621f48
v4: add Verilog/SPICE/English as parallel B2-OMNI falsification probes
briansrls May 15, 2026
04592f1
v4: encode B1 + the U2/C3/B3/C4 per-header pass — design surface closed
briansrls May 15, 2026
831e14e
v4: #3150 followup — 4 BLOCKING (B1 canonicality, B3, IR-1, Shape A/B)
briansrls May 15, 2026
22cc262
v4: #3150 must-fix — re-enumerate the closed file tree (invariant #1)
briansrls May 15, 2026
74e0bf5
v4: #3150 REQUEST_CHANGES — 4 BLOCKING (audit-all-mentions siblings)
briansrls May 15, 2026
11f104b
v4: C5-fidelity + L-2 — round-trip fidelity is model-relative; model …
briansrls May 15, 2026
8e85bf2
v4: add LLVM IR / machine code / CUDA(PTX) — down-the-stack B2-OMNI p…
briansrls May 15, 2026
e320e43
v4: tighten lens/parallelism.dag — fact vs realize; effect+algebra de…
briansrls May 15, 2026
7f1afde
v4: parallelism USER-FACING contract — a lens you read, not a "parall…
briansrls May 15, 2026
4b4d1ef
v4: QRY-1 — name "language queries" (= user-defined dimensions; was u…
briansrls May 15, 2026
fb8fdac
v4: RETRACT QRY-1 query-as-user-lens — provenance is not a distinction
briansrls May 15, 2026
2b76f0f
v4 PARSE-1: bodiless-fn not needed pre-self-parse; forward req on v4 …
briansrls May 15, 2026
2fbcc73
v4 #3150: resolve 4 BLOCKING — Shape A/B blur + closed-ledger forks
briansrls May 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
243 changes: 243 additions & 0 deletions src/v4/DECISIONS.md

Large diffs are not rendered by default.

30 changes: 27 additions & 3 deletions src/v4/STRUCTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ v2 proved 1-residual hand-Rust is achievable but had modeling gaps. v3 had riche
```
src/v4/
STRUCTURE.md # this file
CULTURE.md # the working agreement + reading map (read first)
BRIEF_TEMPLATE.md # the worker brief shape (immutable across tasks)
TASKS.md # 15 XL tasks defining "v4 done"
TASKS.md # the XL task plan (count drift-proof; see T-15)
DECISIONS.md # design-decisions ledger (RATIFIED + record)

std/ # substrate primitives (8 files)
node.dag # 6 type connectives + 5 L1 behaviors (substrate root)
Expand All @@ -25,13 +27,14 @@ src/v4/
verification.dag # TestClaim schema (imported from v3)
report.dag # advisory carrier (NOT fail-closed Diagnostic); used by synthesis lens

extdeps/ # external system contracts (15 files)
extdeps/ # external system contracts (17 files)
languages/ # language models (direction-agnostic — emit AND ingest)
rust.dag
python.dag
go.dag
cpp.dag # C++ (subsumes C subset); ISO/IEC 14882
typescript.dag # TypeScript + ECMAScript
verilog.dag # Verilog HDL (T-4.9 — B2-OMNI falsification probe; IN-B concurrency)
frameworks/ # framework substrates (UI / server / data)
react.dag # React: Component/Hook/Effect (frontload per operator 2026-05-15)
formats/ # data format models (direction-agnostic)
Expand All @@ -41,6 +44,7 @@ src/v4/
toml.dag
json_schema.dag
openapi.dag
spice.dag # SPICE netlist (T-4.10 — B2-OMNI probe; Shape B, no control flow)
process.dag # OS process model (POSIX/SUS)
file_system.dag # OS file system model (POSIX file/directory operations)
coordination.dag # multi-program: Endpoint/DeploymentUnit/sync/async/stream/pubsub
Expand Down Expand Up @@ -87,10 +91,18 @@ src/v4/

test/
claim/ # TestClaim data — no hand-Rust tests
impossible_bug/ # the R1+ impossible-bug class demos
diagnostic_correction/
algebra_laws/
manual/ # hand-authored anti-regression anchors (Phase 1.5)
boundary/ # boundary-honesty probes
english_ingest_fail_closed.dag # T-4.11 — fail-closed ingest, no fabrication
fixture/ # canonical input programs
```

**Total: 57 .dag files + 3 docs + 5 .gitkeep = 65 files at scaffold time.**
**Total: 60 .dag files + 5 docs + 5 .gitkeep = 70 files.** (Per invariant
#1 the enumeration above — not the count — is authoritative; the count is
a checksum, updated on every operator-ratified file addition.)

## Anchor convention

Expand Down Expand Up @@ -260,6 +272,18 @@ These are non-negotiable across all v4 work:
judgment. Not "the substrate refuses.") This surfacing structure is in
force from scaffold time; the tasks fill behavior *under* it.

8. **On-disk emitted artifacts are checked projections, not authority
(C4, operator-ratified 2026-05-15).** Some emitted artifacts must live
on disk because an external tool reads them from the repo (GitHub
reads `.github/workflows/ci.yml`; the bootstrap trampoline). These are
NOT a violation of "no generated code on disk" — that rule means *no
editable generated **authority***, not *no generated bytes*. A
committed emitted artifact is a **`committed == emit(source)` checked
projection**, guarded by the SAME machine as invariant 7 / A3: if the
committed file diverges from `emit(.dag source)`, CI is red and the
divergence is conspicuous and STOP-routed. The `.dag` is the
authority; the on-disk file is a checked shadow, never hand-edited.

## Bootstrap chain

The chain IS a file: `workflow/bootstrap.dag` (orchestration as data; v2
Expand Down
36 changes: 33 additions & 3 deletions src/v4/TASKS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# v4 — XL Task Plan

28 XL tasks define "v4 done." Each task is a bounded modeling unit; each produces a typed pure function in declared files; each is honestly hard to game because the work IS the decisions.
The XL tasks below define "v4 done" (the count is intentionally NOT stated — it drifts as scope is ratified; the close gate is "every task in this plan," never a hardcoded number — see T-15). Each task is a bounded modeling unit; each produces a typed pure function in declared files; each is honestly hard to game because the work IS the decisions.

**Sizing discipline** (per operator directive 2026-05-15): all tasks are XL by default. Relative sizing (S / M / L / XL within the XL bracket) is used only when conveying scope-risk explicitly. **No timelines, no day estimates** — discuss only technical decisions.

Expand All @@ -16,6 +16,9 @@ Phase 1 (parallel — substrate foundation):
T-4.6 extdeps/formats/* (6 files: json/yaml/csv/toml/json_schema/openapi)
T-4.7 extdeps/frameworks/react.dag [needs T-4 (typescript)]
T-4.8 extdeps/coordination.dag [needs T-4, T-4.7]
T-4.9 extdeps/languages/verilog.dag [needs T-1, T-2; B2-OMNI falsification probe — concurrency vs the 5 behaviors]
T-4.10 extdeps/formats/spice.dag [needs T-1; B2-OMNI falsification probe — LanguageModel generality (no control flow)]
T-4.11 test/claim/boundary/english_ingest_fail_closed.dag [needs T-1; boundary-honesty probe — fail-closed ingest, no fabrication]
T-5 workflow/* (5 files) [needs T-1; FIRST IN EXECUTION]

Phase 1.5 (test + bootstrap substrate — early, before compiler stages):
Expand Down Expand Up @@ -130,10 +133,14 @@ Phase 4 (serial — close the loop):
**File**: 5 files in `src/v4/extdeps/languages/` (operator-ratified 2026-05-15: cpp + typescript added; cpp subsumes C subset; Go retained)
**Why bundled**: identical structural shape per language; the SHAPE is the work. Each file declares the language MODEL (grammar + types + semantics) — direction-agnostic; emit AND ingest are operations against the same model.

**Authoring contract (operator-ratified 2026-05-15):**
- **Model the SPECIFICATION, not libraries (L-2).** Model the versioned upstream spec (Rust Reference, ECMAScript/TS Handbook, IEEE 1364, …) — the anchor IS that spec. Do NOT model std/crates/packages: a library is just a program in the modeled language = `Node`. Modeling libraries is infinite, non-general, the wrong layer.
- **Declare every surface feature's disposition (C5-fidelity).** For each feature: `Modeled` (∈ F, Node-bearing, round-trips both ways — e.g. Python indentation IS block structure) | `Declared-normalized` (deliberately not in F; `emit∘ingest` canonicalizes — Go/C++ insignificant whitespace; a *declared*, reviewable loss, never silent) | `Fail-closed` (encountered but neither → Diagnostic, no-engine). F = the spec's own meaning-vs-lexical distinction, not worker judgment. Round-trip fidelity = declared model completeness.

**Modeling decisions**:
- Per-language primitive inhabitance (i32 -> OrderedRing, std::vector<T> -> List<T>, etc.)
- Per-language realization cost shape
- Grammar encoding (declarative production rules vs procedural recognizer)
- Grammar encoding: declarative production data — the **bidirectional relation** (concrete syntax ⟷ Node), read as ingest (partial, many→one, fail-closed off F) and emit (the chosen canonical section); NOT a procedural recognizer. The ingest reading MUST be unambiguous, or ambiguity ⇒ Diagnostic (never "parser picks one" = fabrication). Syntax needing semantic feedback to parse (C++ most-vexing-parse, `<` template-vs-less-than) is a STOP/escalation, not silently absorbed.
- Type system: nominal (Rust, Java) vs structural (TypeScript, Go), or both (C++)

**Reference**:
Expand Down Expand Up @@ -405,6 +412,29 @@ Once T-15 lands and stays green, all four failure modes are impossible-by-constr

---

### T-4.9 / T-4.10 / T-4.11 — architecture stress probes (operator-ratified 2026-05-15)

Three **parallel** tasks (need only T-1 + the B2-OMNI `LanguageModel` contract; independent of each other and of T-4). Their value is that they are **maximally diverse on purpose** — each is a *falsification probe* for the just-ratified B2-OMNI O(N+M) claim. If adding one is genuinely O(1) (one declarative model, instantly cross-composing through the Node pivot), B2-OMNI is empirically validated. If any forces a core/pipeline change, B2-OMNI is leaking — surfaced now, before it is load-bearing. Long-held v2 intent, de-deferred per the frontload-the-hard-cases discipline.

#### T-4.9: `extdeps/languages/verilog.dag`
- **Stress axis**: hardware **concurrency** vs the 5 L1 behaviors. This is the **IN-B validation probe** — if Verilog (`always @(posedge clk)`, continuous assignment) cannot be modeled as effect-typed `Bind` composition without a 6th `Concurrent` behavior, that is a **C1 stop-signal escalation**, and catching it early is the entire point.
- **Clear win**: one `.dag` FSM → simulable Verilog + a Rust reference model, same Node, zero translator.
- **Scope**: L (substrate-validating; concurrency model is the risk).

#### T-4.10: `extdeps/formats/spice.dag`
- **Stress axis**: is the format/`LanguageModel` abstraction *actually* general, or secretly programming-language-shaped? A SPICE netlist has **no control flow** — components + a connection graph.
- **Clear win**: one `.dag` circuit declaration → a SPICE netlist that simulates (omni-emission reaches analog hardware).
- **Placement (operator-ratified fork)**: `extdeps/formats/` — a netlist is a data format, not a programming language (sibling of csv/json), Shape B.
- **Scope**: M-L.

#### T-4.11: `test/claim/boundary/english_ingest_fail_closed.dag`
- **Framing (operator-ratified fork)**: English is **NOT a language model** (no formal grammar). It is a **boundary-honesty probe**, not `extdeps/languages/english.dag`.
- **Stress axis**: the C5 lossless-core boundary at its extreme, and the no-engine thesis made visible.
- **Clear win**: (a) Shape B emit — `.dag` → English docs (≈ T-16's existing Markdown artifact, no new substrate); (b) the honest win — `ingest(English prose)` → a precise Diagnostic, **never a fabricated parse**. The architecture refusing to lie *is* the demonstrable result.
- **Scope**: M (the substrate it needs already exists; the claim is the work).

---

### T-16: Full-stack omni-emission demo

**Output**: ONE `.dag` program → multi-language multi-endpoint application
Expand Down Expand Up @@ -595,7 +625,7 @@ All 5 artifacts share ONE Node tree (per gate #28 omni_layers_share_one_node_tre

## Summary

28 XL tasks. Every task is a bounded, modeling-load-bearing pure function. Gaming surface is structurally bounded because adding files / splitting files / reaching outside declared substrate all require operator escalation. Per zero-deferrals: "I'll just do this for now" is forbidden — STOP and escalate.
Every task in this plan is a bounded, modeling-load-bearing pure function (the count is intentionally unstated — it drifts as scope is ratified; see T-15's drift-proof close gate). Gaming surface is structurally bounded because adding files / splitting files / reaching outside declared substrate all require operator escalation. Per zero-deferrals: "I'll just do this for now" is forbidden — STOP and escalate.

If a task hits an unmodelable case or escalations pile up, that's a substrate-design signal — STOP, re-model, do not paper over.

Expand Down
60 changes: 52 additions & 8 deletions src/v4/compiler/00_compile.dag
Original file line number Diff line number Diff line change
@@ -1,18 +1,62 @@
// src/v4/compiler/00_compile.dag
//
// Scope: pipeline orchestrator — wires tokenize → parse → normalize → resolve → infer → emit
// Anchor: https://en.wikipedia.org/wiki/Compiler (general phase architecture)
// into a single compile() entry point. Called by bin/main.dag and by
// every end-to-end TestClaim.
// Scope: pipeline orchestrator — the OMNI pivot architecture.
// Anchor: https://en.wikipedia.org/wiki/Compiler +
// THESIS:215-221 omni-emission (Shape A: O(1)/target, O(N+M) not O(N×M))
//
// B2-OMNI (operator-ratified 2026-05-15) — parse is NOT special; it is
// ONE instance of ingestion. The pipeline is three parts: two
// PARAMETERIZED BOUNDARIES and a language-agnostic core:
//
// ingest : (Source, LanguageModel) -> Result<Node, Diagnostic>
// The ingest boundary. tokenize (T-6) + parse (T-7) are the GENERIC
// walker over LanguageModel's declarative grammar (B2) — NOT
// .dag-specific. Self-parse is just `ingest(src, dag_model)`; Rust is
// `ingest(src, rust_model)`. `.dag` is language #1, never hardcoded.
//
// core : Node -> Result<InferredTree, Diagnostic>
// Language-agnostic: normalize (C3 — dissolve the 4 sugar forms)
// ∘ resolve (bind opaque Symbols, K-1) ∘ infer (U1 Find → IR-1).
//
// emit : (InferredTree, TargetModel) -> Result<Source, Diagnostic>
// The emit boundary, parameterized by target (U1 Realize phase).
// eval : (InferredTree, Inputs) -> Result<Value, Diagnostic>
// The primary execution path (THESIS:225); sibling of emit.
//
// compile = emit ∘ core ∘ ingest run = eval ∘ core ∘ ingest
//
// O(N+M), structurally: N bidirectional language models + M target
// models. Adding model #k is O(1) — it instantly ingests to all M and
// is a target for all N. N×M capabilities from N+M models because Node
// is the universal pivot. `ingest(Rust) ∘ emit(Python)` translates
// Rust→Python with NO Rust→Python translator ever written — the
// visceral cash of the O(N+M) promise. Per C5, ingest = emit⁻¹ on each
// model's lossless core; outside it, a fail-closed Diagnostic (never a
// lossy guess — feedback_no_engine).
//
// Owns:
// - compile: (Source, TargetSpec) -> Result<TargetSource, Diagnostic>
// (the top-level entry; fail-fast on any stage's Diagnostic)
// - ingest: (Source, LanguageModel) -> Result<Node, Diagnostic>
// - emit: (InferredTree, TargetModel) -> Result<Source, Diagnostic>
// - compile = emit ∘ core ∘ ingest ; run = eval ∘ core ∘ ingest
// (top-level entries; fail-closed on any stage's Diagnostic)
//
// Shape A vs Shape B (correction 3248488229 — the boundary must NOT be
// blurred, THESIS):
// - `ingest`/`emit` here are the **Shape A** compiler boundary; their
// LanguageModel/TargetModel parameter is `extdeps/languages/*.dag`
// ONLY (programming-language render/ingest targets).
// - `extdeps/formats/*.dag` (csv/json/yaml/spice/…) are **Shape B**:
// emitted/consumed by user `.dag` programs walking typed values —
// NOT a compiler ingest/emit parameter. The compiler does not render
// to a Shape B format; a `.dag` program does. Conflating them
// reintroduces the N×M trap at the boundary.
//
// Consumes:
// - compiler/01_tokenize.dag → 05_emit.dag (every stage)
// - compiler/01_tokenize.dag → 05_emit.dag + 05_eval.dag (core + boundaries)
// - std/diagnostic.dag for error propagation
// - extdeps/languages/*.dag for TargetSpec
// - extdeps/languages/*.dag — the Shape A bidirectional LanguageModel /
// TargetModel parameter (one model, two directions). (Shape B
// `extdeps/formats/*` is user-program emission, not consumed here.)
//
// Status: scaffold — fill per TASKS.md T-10 (paired with emit implementation;
// orchestrator is the consumer of every prior stage)
Expand Down
11 changes: 9 additions & 2 deletions src/v4/compiler/01_tokenize.dag
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
// Scope: pipeline stage 1 — Source string to TokenStream. Pure function.
// Anchor: https://en.wikipedia.org/wiki/Lexical_analysis
//
// B2-OMNI (operator-ratified 2026-05-15): tokenize is the first half of
// the GENERIC ingest walker (with 02_parse), driven by a `LanguageModel`'s
// declarative lexical rules — NOT .dag-specific. `.dag` is language #1.
// A .dag-only character class hardcoded here reintroduces the N×M trap =
// STOP. See 00_compile.dag B2-OMNI for the pivot.
//
// Owns:
// - TokenStream type (output)
// - tokenize: FreeMonoid<Char> -> Result<TokenStream, Diagnostic>
// - character-class predicates
// - tokenize: (FreeMonoid<Char>, LexRules) -> Result<TokenStream, Diagnostic>
// (LexRules is declarative data from the LanguageModel, not code here)
// - character-class predicates (driven by LexRules)
//
// Consumes:
// - std/primitive.dag: Char, String
Expand Down
11 changes: 10 additions & 1 deletion src/v4/compiler/02_parse.dag
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@
// Scope: pipeline stage 2 — TokenStream to ParseTree. Pure function, fail-closed.
// Anchor: https://en.wikipedia.org/wiki/Parsing
//
// B2-OMNI (operator-ratified 2026-05-15): parse is NOT a .dag parser. It
// is the GENERIC walker over a `LanguageModel`'s declarative grammar
// (B2). Parsing .dag is `parse(tokens, dag_model.grammar)` — `.dag` is
// language #1, never hardcoded/special-cased. The same generic walker
// ingests Rust/JSON/… via their models. This is the load-bearing enabler

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKING: JSON is a Shape B format, so making it an example of the generic LanguageModel parser re-blurs the compiler ingest boundary that THESIS Shape A/Shape B keeps separate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2fbcc73. Correct — JSON is Shape B. Removed it as a generic-walker example; the header now cites only Shape A languages (Rust/Python/…) and explicitly encodes that Shape B formats (JSON/SPICE) do NOT pass through the compiler-language parser — they ingest via the formats data-model path. The Shape A/B boundary is now stated in-file so it can't silently regress.

— sent from deep-wolf-155

// of the O(N+M) pivot (see 00_compile.dag B2-OMNI). A `.dag`-specific
// production hardcoded here = the N×M trap creeping back = STOP.
//
// Owns:
// - ParseTree type
// - parse: TokenStream -> Result<ParseTree, Diagnostic>
// - parse: (TokenStream, Grammar) -> Result<ParseTree, Diagnostic>
// (Grammar is declarative data from the LanguageModel, not code here)
// - grammar productions as Node trees
//
// Consumes:
Expand Down
11 changes: 10 additions & 1 deletion src/v4/compiler/03_normalize.dag
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@
// Scope: pipeline stage 3a — ParseTree to NormalizedTree. Surface sugar dissolution.
// Anchor: https://en.wikipedia.org/wiki/Abstract_syntax_tree
//
// C3 (operator-ratified 2026-05-15): normalize dissolves EXACTLY the 4
// bounded surface-sugar forms THESIS:198-203 names — `service`, `fn`,
// `type`, `operation` — into Node trees. It is NOT identity and NOT
// open-ended. There is no 5th sugar form; a new one is a substrate
// extension = STOP, not an inline add. (This closes the "what does
// normalize do in a no-sugar language" tension — there IS bounded sugar,
// exactly these 4; cascade-closure of A1.)
//
// Owns:
// - NormalizedTree type
// - normalize: ParseTree -> Result<NormalizedTree, Diagnostic>
// - service/fn/type sugar -> Node tree (per MODELING.md composition layer)
// - dissolves the 4 sugar forms { service, fn, type, operation } -> Node
// tree (per MODELING.md composition layer); exactly 4, closed
//
// Consumes:
// - std/node.dag, std/diagnostic.dag
Expand Down
Loading
Loading