From 438d35f368491f66a640ad5fdcaed35b52fb9ed5 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Tue, 12 May 2026 22:08:43 +0000 Subject: [PATCH 01/36] =?UTF-8?q?docs(briefs):=20S6=20brief=20fix-forward?= =?UTF-8?q?=20=E2=80=94=20authority=20chain=20corrected=20per=20codex=20BL?= =?UTF-8?q?OCKING=20review=20on=20PR=20#2782=20sha=20b28cf884?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Earlier brief mis-cited high-level T-WAD substrate-shape framing; codex caught that the actual implementation authority for affected-set selection is: - PR #2713 (upstream affected-set lens substrate; merged) per docs/design-affected-set-lens.md §2 - docs/design-t-wad-slice-7-binary-shim-affected-set-selection-canvas.md in main (§1 BinaryShim consumption / §3 fail-closed / §4 selection algorithm / §5 path-regex removal invariant) - PR #2766 harness contract + Layer 2 path-regex inventory ratchet §0 + §1 rewritten to encode the correct authority chain, canvas §4 algorithm verbatim, and canvas §5 path-regex removal invariant. STOP conditions tightened to the actual fail-closed surfaces (PR #2713 serialization form, path-regex inventory drift). Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ave1-s6-slice7-affected-set-impl-worker.md | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md b/docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md index 5ce6900989f..1649e54576c 100644 --- a/docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md +++ b/docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md @@ -10,43 +10,42 @@ **Do not start authoring until prerequisite clears**: -1. **PR #2766 (cool-crab-565 / Slice 7 affected-set canvas) Director-ratified** — the canvas establishes the affected-set selection contract (input: `CIWorkflowDag` + diff; output: subset of gate-nodes to execute). Worker reads ratified canvas as substrate authority before authoring implementation. - -If PR #2766 hasn't ratified at spawn time, hold; ping warm-wolf-698 for status. Brief may need revision per ratified contract details. +1. **PR #2766 (Slice 7 pre-impl prequeue: harness contract + Layer 2 path-regex inventory ratchet) merged** — the post-merge canvas establishes the implementation contract. Merge = post-Director-ratification. ## §1. Scope -Implement the affected-set selection logic referenced by Slice 7 canvas (PR #2766). Closes gate #103 `ci_uses_affected_set_selection`. +Implement the **BinaryShim affected-set selection** per the ratified Slice 7 canvas (`docs/design-t-wad-slice-7-binary-shim-affected-set-selection-canvas.md` in main, post-PR-#2766). Closes gate #103 `ci_uses_affected_set_selection`. + +**Authority chain** (corrected per codex BLOCKING review on PR #2782 sha b28cf884 — earlier draft of this brief mis-cited high-level T-WAD substrate-shape framing): +- **Upstream lens authority**: **PR #2713** — affected-set lens substrate (already merged per scope docs); `docs/design-affected-set-lens.md` §2 defines `affected_set(Dag_before, Dag_after, dim)` per-dimension + aggregate +- **Slice 7 canvas authority**: `docs/design-t-wad-slice-7-binary-shim-affected-set-selection-canvas.md` (in main) — §1 BinaryShim consumption contract, §3 fail-closed policy, §4 selection-derivation algorithm, §5 path-regex removal invariant +- **Implementation harness**: PR #2766's harness contract + Layer 2 path-regex inventory ratchet (in main) -### Phase A — Read the ratified canvas +### Phase A — Read the canvas + lens authorities -`docs/design-ci-workflow-substrate-shape-2026-05-12.md` (Slice 7 canvas, post-#2766 merge) is the substrate authority. Inventory: -- Input domain: `CIWorkflowDag` + diff-against-base shape -- Output: gate-id subset / matrix specification -- Verifier ratchet contract (per PM dispatch msg_a63f5e7e: "Brief should reference upstream gate-state for verifier ratchet") +Inventory canvas §1: BinaryShim runner consumes PR #2713's affected-set lens output (NOT path globs). At PR time, runner builds `Dag_before` (merge-base) + `Dag_after` (PR head) using same compiler revision + feature flags per `CIWorkflowDag` + pinned toolchain facts. Lens output: `Set` (or NodeRef-keyed record with dimension + provenance — treat **authoritative serialized form from PR #2713** as single source of truth). -### Phase B — Implement the selection function +### Phase B — Implement the selection function per canvas §4 -Author the selection logic in the appropriate gunbc/ci namespace module. The function shape is likely: -``` -func select_affected_gates(workflow_dag: CIWorkflowDag, diff: ) -> List -``` -(exact signature per canvas ratification). +Algorithm verbatim from canvas §4: +1. Compute `A = ⋃_dim affected_set(Dag_before, Dag_after, dim)` (aggregate affected nodes) +2. For each `TestClaim` or test-shaped obligation `t ∈ B`: derive selected vs skip-safe status from `TestClaim` declarations + gate records + `CIWorkflowDag` metadata +3. Map `NodeRef` sets to **executable CI actions** (cargo filters, job labels, gate commands) using metadata anchored in `CIWorkflowDag`, `TestClaim` declarations, and gate records — **NOT** by parsing GitHub `paths`/`paths-ignore` in YAML Implementation MUST: -- Honor single-authority derivation: every selection decision derives from `CIWorkflowDag` + diff input +- Honor single-authority derivation from `Dag_before` + `Dag_after` + PR #2713 lens output + `TestClaim` / gate metadata - Be testable structurally (per TESTING.md band-A) -- Handle edge cases per canvas (empty diff, diff-touches-everything, isolated-gate) +- Handle canvas §3 fail-closed cases: `Dag_before`/`Dag_after` unbuildable → superset + diagnostic; `TestClaim` lacks dimension declarations → superset (cannot prove skip-safe) -### Phase C — Verifier ratchet integration +### Phase C — Path-regex removal invariant (canvas §5) -Wire the affected-set output into the verifier ratchet per upstream gate-state contract. The ratchet shape is whatever PR #2766 canvas ratifies; brief cannot pre-author this without that ratification. +After this PR lands, **no** workflow `if:` condition may encode run-vs-skip on `git diff` path patterns, `paths-filter` equivalents, or hand-maintained regex allowlists. That logic lives **only** in the BinaryShim runner using PR #2713 output. Layer 2 path-regex inventory ratchet (in main per PR #2766) tracks removal. ## §2. STOP conditions -1. **PR #2766 canvas not ratified** — already noted in §0. Hold. -2. **Single-authority violation in selection logic** — if any selection rule requires reading state outside `CIWorkflowDag` + diff (e.g., environment vars, external service calls, hand-written config), **STOP** — P2/P3 violation by inventing inputs. -3. **Verifier ratchet contract ambiguity** — if the ratchet contract isn't unambiguously specified in the ratified canvas, **STOP** and surface — don't infer. +1. **PR #2713 lens output shape uncertainty** — if the authoritative serialized form (`Set` vs richer NodeRef-keyed record per canvas §1.2) isn't unambiguous at landing time, **STOP** and surface — the canvas explicitly names PR #2713 as the single source of truth; do not re-derive. +2. **Single-authority violation in selection logic** — if any selection rule requires reading state outside `Dag_before` / `Dag_after` / PR #2713 lens output / `TestClaim` / gate records / `CIWorkflowDag` (e.g., env vars, external service calls, hand-written config, path globs), **STOP** — P2/P3 violation; the canvas §5 invariant explicitly bars path-regex shortcuts. +3. **Layer 2 path-regex inventory drift** — if canvas §5 invariant cannot be enforced without leaving residual `if:` path-regex conditions in main, **STOP** and surface — the inventory ratchet (in main per PR #2766) is the structural enforcement; can't dissolve incrementally. ## §3. Verification From 0f42558d518e4232c5aa442b9b2d9e305b58d27a Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Tue, 12 May 2026 22:11:05 +0000 Subject: [PATCH 02/36] =?UTF-8?q?docs(briefs):=20S6=20brief=20=E2=80=94=20?= =?UTF-8?q?surface=202-layer=20decomposition=20per=20canvas=20=C2=A76-?= =?UTF-8?q?=C2=A77=20staging=20(substrate=20prerequisite=20+=20BinaryShim?= =?UTF-8?q?=20consumer/runner)=20=E2=80=94=20swift-wren-365=20msg=5F29f681?= =?UTF-8?q?09?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Earlier draft compressed both layers into one PR. swift-wren-365 surfaced (correctly) that PR #2798 in-flight is Layer 1 substrate (closure+topo over CIWorkflowDag + CiWorkflowDiff) — Layer 2 (BinaryShim consumer of PR #2713 lens output + TestClaim D(t)/Δ(t) mapping + canvas §5 path-regex removal) is a follow-on PR depending on Slice 5 BinaryShim hook per canvas §6-§7. §1 reframed as two-layer decomposition with explicit scope boundaries. Phase A-C explicitly scoped to Layer 2. Layer 1 in-flight under PR #2798 not in this brief's scope. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ave1-s6-slice7-affected-set-impl-worker.md | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md b/docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md index 1649e54576c..e77e34837a9 100644 --- a/docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md +++ b/docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md @@ -12,15 +12,33 @@ 1. **PR #2766 (Slice 7 pre-impl prequeue: harness contract + Layer 2 path-regex inventory ratchet) merged** — the post-merge canvas establishes the implementation contract. Merge = post-Director-ratification. -## §1. Scope +## §1. Scope — two-layer decomposition -Implement the **BinaryShim affected-set selection** per the ratified Slice 7 canvas (`docs/design-t-wad-slice-7-binary-shim-affected-set-selection-canvas.md` in main, post-PR-#2766). Closes gate #103 `ci_uses_affected_set_selection`. +Gate #103 `ci_uses_affected_set_selection` lands in **TWO sequenced PRs** per canvas §6-§7 staging (this layering surfaced by swift-wren-365 msg_29f68109 2026-05-12T22:09Z; earlier brief draft erroneously compressed both layers): + +### Layer 1 — Substrate prerequisite (PR #2798 in-flight by swift-wren-365) + +Pure closure + topo over `CIWorkflowDag` + `CiWorkflowDiff`: +- Gate-id touch set computation +- TouchAll upstream of selection +- NO NodeRef × dimension `affected_set(Dag_before, Dag_after)` consumption (that's Layer 2) +- NO TestClaim D(t)/Δ(t) mapping (that's Layer 2) +- NO `.github/workflows/ci.yml` edits (that's Layer 2) +- Substrate-only scope: gunbc_ci graph machinery that Layer 2's planner consumes + +Layer 1 lands first as standalone substrate; Layer 2 consumes the Layer 1 surface. + +### Layer 2 — BinaryShim consumer/runner (follow-on PR; depends on Slice 5 BinaryShim hook) + +Implement the **BinaryShim affected-set selection** per the ratified Slice 7 canvas (`docs/design-t-wad-slice-7-binary-shim-affected-set-selection-canvas.md` in main). Closes gate #103. **Authority chain** (corrected per codex BLOCKING review on PR #2782 sha b28cf884 — earlier draft of this brief mis-cited high-level T-WAD substrate-shape framing): - **Upstream lens authority**: **PR #2713** — affected-set lens substrate (already merged per scope docs); `docs/design-affected-set-lens.md` §2 defines `affected_set(Dag_before, Dag_after, dim)` per-dimension + aggregate - **Slice 7 canvas authority**: `docs/design-t-wad-slice-7-binary-shim-affected-set-selection-canvas.md` (in main) — §1 BinaryShim consumption contract, §3 fail-closed policy, §4 selection-derivation algorithm, §5 path-regex removal invariant - **Implementation harness**: PR #2766's harness contract + Layer 2 path-regex inventory ratchet (in main) +**Below applies to Layer 2 (BinaryShim consumer/runner PR). Layer 1 (gunbc_ci substrate, PR #2798) is in-flight under swift-wren-365 with narrower scope; don't graft Layer 2 onto it.** + ### Phase A — Read the canvas + lens authorities Inventory canvas §1: BinaryShim runner consumes PR #2713's affected-set lens output (NOT path globs). At PR time, runner builds `Dag_before` (merge-base) + `Dag_after` (PR head) using same compiler revision + feature flags per `CIWorkflowDag` + pinned toolchain facts. Lens output: `Set` (or NodeRef-keyed record with dimension + provenance — treat **authoritative serialized form from PR #2713** as single source of truth). From c0326991a1f60e5dd05b62d14cce1e95845a5617 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Tue, 12 May 2026 22:13:01 +0000 Subject: [PATCH 03/36] =?UTF-8?q?docs(briefs):=20S6=20brief=20=C2=A74=20PR?= =?UTF-8?q?-body=20framing=20+=20=C2=A76=20reference=20list=20harmonized?= =?UTF-8?q?=20with=20=C2=A71=20canvas-vs-PR-#2766-harness=20split=20?= =?UTF-8?q?=E2=80=94=20cursor=20APPROVE=2010477=20exploratory=20note?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit §4 PR body framing now distinguishes three authority types: canvas (BinaryShim consumption + selection algorithm + path-regex removal) + upstream lens (PR #2713 / design-affected-set-lens.md) + harness/ratchet (PR #2766). §6 reference list expanded similarly. Removes the residual 'PR #2766 substrate authority' phrasing that conflicted with §1's three-source split. Co-Authored-By: Claude Opus 4.7 (1M context) --- docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md b/docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md index e77e34837a9..f832a70e54f 100644 --- a/docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md +++ b/docs/briefs/r3-wave1-s6-slice7-affected-set-impl-worker.md @@ -74,7 +74,7 @@ After this PR lands, **no** workflow `if:` condition may encode run-vs-skip on ` ## §4. PR body framing - Cite gate #103 closure -- Cite PR #2766 ratified canvas as substrate authority +- Cite **canvas authority**: `docs/design-t-wad-slice-7-binary-shim-affected-set-selection-canvas.md` (Slice 7 BinaryShim consumption / fail-closed / selection algorithm / path-regex removal) + **upstream lens authority**: PR #2713 / `docs/design-affected-set-lens.md` §2 + **harness/ratchet authority**: PR #2766 (Layer 2 path-regex inventory ratchet enforcing canvas §5) - Cite verifier ratchet contract (specific paragraph in canvas) - Inline 2-3 worked examples of selection behavior @@ -86,6 +86,8 @@ After this PR lands, **no** workflow `if:` condition may encode run-vs-skip on ` ## §6. Reference -- PR #2766 (cool-crab-565 Slice 7 canvas) — substrate authority +- `docs/design-t-wad-slice-7-binary-shim-affected-set-selection-canvas.md` (in main) — Slice 7 BinaryShim canvas authority (§1 consumption / §3 fail-closed / §4 selection algorithm / §5 path-regex removal) +- PR #2713 (already merged) + `docs/design-affected-set-lens.md` §2 — upstream affected-set lens substrate authority +- PR #2766 (cool-crab-565, merged) — Slice 7 implementation harness contract + Layer 2 path-regex inventory ratchet (enforces canvas §5) - `docs/r3-remaining-work-dependency-graph.md:125` — gate-row metadata - TESTING.md band-A — structural test discipline From 466b4876b02b377647b9af04752c90b9b6fa4635 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 02:24:55 +0000 Subject: [PATCH 04/36] docs(r3): gate #62 file-ingestion substrate-shape canvas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Surfaces the substrate-shape question for §1.8 row #62 substrate_gap_file_ingestion_closed before brief authoring. bright-otter-731 was auto-spawned on this gate without an authored brief and surfaced a clean audit (no include_str! at HEAD in dsl/; PR #2819 read_utf8_file candidate shape held in draft). §4.3 line 505 frames closure as workflow_substrate extension to file-attachment (Candidate B), but PR #2819 implements compile-time UTF-8 read (Candidate A) — parallel-authority risk. This canvas frames the candidate shapes (A/B/C/d) for Director-or- Substrate-Mgr-tier ratification before brief authoring proceeds. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...substrate-gate-62-file-ingestion-canvas.md | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 docs/briefs/r3-substrate-gate-62-file-ingestion-canvas.md diff --git a/docs/briefs/r3-substrate-gate-62-file-ingestion-canvas.md b/docs/briefs/r3-substrate-gate-62-file-ingestion-canvas.md new file mode 100644 index 00000000000..1913ace8522 --- /dev/null +++ b/docs/briefs/r3-substrate-gate-62-file-ingestion-canvas.md @@ -0,0 +1,124 @@ +--- +status: Mgr canvas (substrate-shape question for Director-or-Mgr ratification; surfaced per feedback_substrate_shape_belongs_in_mgr_canvas) +authority parent: R3 Substrate Manager (warm-wolf-698) +authoring date: 2026-05-13 +gate: §1.8 ledger row #62 `substrate_gap_file_ingestion_closed` +roadmap row: T-Workflow-As-Data Class 3 (file-ingestion) +authority docs: + - docs/r3-program-plan.md §1.8 row #62 (line 290) — DECLARED + - docs/r3-program-plan.md §2.4 (line 411) — Class 3 sequenced post-T-Lens-Behavioral-Parity (#73 now closed via PR #2797) + - docs/r3-program-plan.md §4.3 (lines 499-506) — Class 3 closure framing + - bright-otter-731 audit receipt msg_e85224dc — `rg include_str! dsl` → no matches at HEAD +--- + +# Gate #62 `substrate_gap_file_ingestion_closed` — substrate-shape canvas + +## §0. Status + +DECLARED at `docs/r3-program-plan.md:290` (NEW 2026-05-06). T-Lens-Behavioral-Parity precondition cleared 2026-05-13 via PR #2797 (keen-crab-424), unblocking Class 3 dispatch. No worker brief authored before this canvas; bright-otter-731 was auto-spawned and surfaced the substrate-shape question via clean audit. This canvas frames the substrate-shape question for ratification before brief authoring. + +## §1. Source authority (verbatim) + +### §1.8 row #62 criterion (line 290) + +> `.dag` program ingests external file w/o `include_str!` + +### §4.3 Class 3 closure framing (line 505) + +> **Closes via**: T-Workflow-As-Data file-ingestion substrate (`workflow_substrate_carriers_landed` extended to file-attachment). + +### Sequencing (line 411) + +> **Class 3 (file-ingestion)**: closes with T-Workflow-As-Data file-ingestion grammar (post-T-Lens-Behavioral-Parity). + +## §2. State at HEAD (bright-otter-731 audit) + +- `rg include_str! dsl/` → **no matches** (no Rust macro side-channel in dsl/ tree). The literal-text reading of the row criterion ("w/o `include_str!`") is trivially passing if the criterion is absence-shaped. +- `docs/briefs/r3-substrate-t-workflow-as-data-slice-1-worker.md` cites #62 in closure predicate (carrier slice) but is not gate-#62-scoped. +- PR #2819 candidate-shape lands `read_utf8_file` declared in `dsl/std/render.dag` + id-keyed expansion in `lower.rs` + Compiles fixture/tests + INVARIANTS §P5 SG-0 row. This is **compile-time UTF-8 read** plumbing. + +## §3. Substrate-shape question — two candidate shapes + +### Candidate A — compile-time UTF-8 read (PR #2819 direction) + +Shape: +- `extern func read_utf8_file(path: String): String` (or similar arity) declared in `dsl/std/` +- Lower.rs expansion at compile time reads file bytes, embeds as data +- Closes the "no include_str!" criterion by giving the DSL a first-class file-read it can compile to inline data + +Pros: +- Concrete, lands quickly, plumbing receipt already drafted +- INVARIANTS §P5 SG-0 row addition is substrate-progress evidence + +Cons: +- **Doesn't match §4.3 framing** — §4.3 says "extend `workflow_substrate_carriers_landed` (#53) to file-attachment", which is a **workflow-substrate** extension, not a compile-time compiler intrinsic +- Risk of parallel-authority debt: if the workflow-substrate shape also lands later, gate #62 has two answers +- Compile-time read is a P5-style intrinsic; row's lane is T-Workflow-As-Data (substrate-modeled, runtime/workflow-shaped) + +### Candidate B — workflow-modeled file-attachment substrate + +Shape: +- Extend `std.workflow` carriers (gate #53 `workflow_substrate_carriers_landed`, partial at PR #2160) with a `FileAttachment` (or similar-shaped) carrier +- DSL programs declare file dependencies as **workflow-substrate values**, not via compile-time reads +- Closes #62 by giving file-ingestion a **workflow-substrate** modeled form + +Pros: +- Matches §4.3 framing verbatim ("extend `workflow_substrate_carriers_landed` to file-attachment") +- Sits in the same lane (T-WAD) as the existing carriers (WorkflowSecret, CronExpression) +- Avoids compile-time intrinsic posture — file-ingestion is **modeled** in the workflow, not handled as a compiler side-channel + +Cons: +- Larger scope (carrier authoring + lower-stage + consumer evidence) +- T-WAD lane just closed its Wave-1 substrate work (#2747/#2762/#2774/#2798/#2808); reopening for one carrier +- May need a use-case existence proof (concrete `.dag` program ingesting a file) to anchor the carrier shape + +### Candidate C — strict-mirror of an existing read-path + +Examine if there's an existing read-path precedent in the codebase that gate #62 should mirror (e.g., timing observation set ingestion, build-time asset read). If so, gate-62 closure = adopt that precedent. STOP-and-grep before authoring either A or B. + +## §4. Question for ratification + +**Which candidate shape closes gate #62?** + +- (a) Candidate A — compile-time UTF-8 read via `read_utf8_file` extern (PR #2819 direction) +- (b) Candidate B — workflow-substrate `FileAttachment` carrier extending #53 (§4.3 verbatim framing) +- (c) Candidate C — strict-mirror of existing read-path (specify which precedent) +- (d) Both A + B in distinct slices (A as compile-time bootstrap intrinsic, B as runtime workflow-attachment substrate) — gate #62 closes on B; A is independent compiler-side scope + +## §5. Practice 4 (coproduct dissolution) discipline + +No new sum-type proposed in this canvas. Candidate A introduces an extern func declaration (no new coproduct). Candidate B extends an existing carrier set (additive to #53). Candidate C mirrors precedent. + +## §6. Cost-of-change accounting + +Per `INVARIANTS.md` "Cost of Change": + +| Candidate | Files edited to add a new file-ingest site | +|---|---| +| A (compile-time read) | 1 (the `.dag` site calls `read_utf8_file(path)`) | +| B (workflow-attachment) | 1 (the `.dag` site declares a `FileAttachment` value) | +| C (mirror precedent) | depends on precedent shape | + +Both A + B satisfy the cost-of-change-1 target. The discriminator is **§4.3 framing fidelity** + **lane-fit** (Workflow-As-Data vs compiler intrinsic), not cost-of-change. + +## §7. Ratification ask + +Director or Substrate-Mgr-tier ratification on §4 question (a/b/c/d). On ratification, brief authoring proceeds: +- If (a): brief frames PR #2819's `read_utf8_file` as gate-62 closure shape; ratify the extern signature + lower expansion +- If (b): brief frames `FileAttachment` carrier extending #53; specify type + data + consumer; carrier-shape question delegated to Director per §3.2-style canvas precedent +- If (c): brief points to the precedent + authorizes strict-mirror landing +- If (d): both briefs author independently; #62 closure pinned to B + +PR #2819 currently held in draft per bright-otter-731 disposition path (a) at msg_e5cde2eb. No merge until ratification. + +## §8. Reference + +- bright-otter-731 audit receipt: msg_e85224dc-7c7e-495d-911f-8bace75a7bcd (preserved as diagnostic-trail per `feedback_redirect_noop_prs` + `feedback_alert_dont_workaround_for_diagnostic_capture`) +- PR #2819 (held in draft) — Candidate A interim plumbing +- `docs/briefs/r3-substrate-t-workflow-as-data-slice-1-worker.md` — cites #62 in closure predicate but is not gate-62-scoped +- §4.3 lines 499-506 — Class 3 closure framing + +--- + +**Authored by**: warm-wolf-698 (R3 Substrate Mgr) +**Date**: 2026-05-13 From 4a96d33f9a9d751b454afc919ffbd21b7b9fc64d Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 02:29:37 +0000 Subject: [PATCH 05/36] docs(r3): gate #62 FileAttachment carrier-internals sub-canvas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Director ratified Candidate (b) on PR #2820 — workflow-substrate FileAttachment carrier extending #53 — per PM msg_52c4a707. This sub-canvas surfaces carrier internals (type def + fields + workflow coupling + Practice 4 + lazy-vs-eager) for next-tier ratification per recursive feedback_substrate_shape_belongs_in_mgr_canvas. Three candidate shapes (B-1 minimal / B-2 path-keyed / B-3 anchor+entry pair) anchored against gate #55 WorkflowObservationAnchor precedent at src/v3/std/timing_lens.dag:98 (already CONSUMER_LANDED). Director anti-patterns encoded for worker review enforcement. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...e-62-file-attachment-carrier-sub-canvas.md | 212 ++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 docs/briefs/r3-substrate-gate-62-file-attachment-carrier-sub-canvas.md diff --git a/docs/briefs/r3-substrate-gate-62-file-attachment-carrier-sub-canvas.md b/docs/briefs/r3-substrate-gate-62-file-attachment-carrier-sub-canvas.md new file mode 100644 index 00000000000..3fc1bd409c0 --- /dev/null +++ b/docs/briefs/r3-substrate-gate-62-file-attachment-carrier-sub-canvas.md @@ -0,0 +1,212 @@ +--- +status: Mgr sub-canvas (carrier-internals substrate-shape question; surfaced per recursive feedback_substrate_shape_belongs_in_mgr_canvas after PR #2820 Candidate (b) ratification 2026-05-13) +authority parent: R3 Substrate Manager (warm-wolf-698) +authoring date: 2026-05-13 +gate: §1.8 ledger row #62 `substrate_gap_file_ingestion_closed` +parent canvas: PR #2820 / `docs/briefs/r3-substrate-gate-62-file-ingestion-canvas.md` — Candidate (b) RATIFIED +sibling-carrier precedent: gate #55 `WorkflowObservationAnchor` (src/v3/std/timing_lens.dag:98) + gate #53 WorkflowSecret (PR #2160 / dsl/extdeps/github/actions.dag:114) +--- + +# Gate #62 — FileAttachment carrier-shape sub-canvas + +## §0. Status + +Macro shape ratified: workflow-substrate FileAttachment carrier extending #53 per parent canvas PR #2820 + Director disposition relayed via PM msg_52c4a707. This sub-canvas surfaces **carrier internals** for Director-or-Mgr-tier ratification before worker brief authoring proceeds. + +PR #2819 (Candidate A) stands closed/held per ratification; audit-trail (msg_e85224dc) preserved as diagnostic input. + +## §1. Authority + anti-patterns (verbatim per Director disposition) + +### Authority chain at HEAD + +1. §4.3 line 505: "Closes via: T-Workflow-As-Data file-ingestion substrate (`workflow_substrate_carriers_landed` extended to file-attachment)" +2. §1.8 row #53 sibling-carrier precedent (WorkflowSecret + CronExpression β-ratified via PR #2160) +3. §1.8 row #55 (`shared_external_attachment_pattern_documented`) **already CONSUMER_LANDED** — `WorkflowObservationAnchor` + `TimingObservationEntry` typed in `src/v3/std/timing_lens.dag:98-116`; pattern + 6 invariants documented in `docs/design-timing-lens.md` §2; branded provenance nominals in `dsl/std/types.dag`; bootstrap ratchet `timing_lens_substrate_carrier_test.rs`. **Load-bearing**: this is the precedent FileAttachment must align with. + +### Director-enumerated anti-patterns (downstream worker review must enforce) + +1. **No compile-time `read_utf8_file`-equivalent extern-func substrate additions** — Candidate A drift, rejected +2. **FileAttachment must align with #53 + #55 sibling-carrier pattern** — no novel shape +3. **No bridge variants** — legacy `include_str!` paths preserved alongside FileAttachment violates §P5 atomic-migration + +## §2. Sibling-carrier pattern (#55 precedent, verbatim) + +```dag +type WorkflowObservationAnchor { + subject_node: NodeId + artifact_digest: ContentHash + producer_id: WorkflowProducerId // branded nominal + observer_id: WorkflowObserverId // branded nominal + prover_id: WorkflowProverId // branded nominal + attached_at_ns: Nanoseconds + workflow_run_id: WorkflowRunId // branded nominal +} +``` + +Shape rules visible in this precedent: +- **Workflow-context coupling** via `subject_node: NodeId` + `workflow_run_id: WorkflowRunId` +- **Artifact identity** via `artifact_digest: ContentHash` (not bare path; content-addressed) +- **Branded provenance** for distinct provenance roles (three role-IDs, not three `String`s) +- **Typed time** (`Nanoseconds`, not `Int`) +- **Boundary Discipline**: anchor + payload separated in `TimingObservationEntry` (one product fact, no join drift) + +This is the pattern FileAttachment must mirror. + +## §3. Carrier-shape question — three candidate shapes + +### Candidate B-1 — content-addressed minimal (strictest #55 mirror) + +```dag +type FileAttachment { + subject_node: NodeId + content_digest: ContentHash + workflow_run_id: WorkflowRunId + attached_at_ns: Nanoseconds +} +``` + +Rationale: ContentHash IS the file (content-addressed); path is derivable from a separate lookup (workflow-substrate stores blobs by digest). Maximally aligned with #55's content-addressed posture. + +Pros: +- Strictest mirror of #55; no novel fields +- Path/encoding/mime become **derivable** from digest + workflow blob store, not stored on the carrier +- Cost-of-change-1 satisfied (one digest reference per ingest site) + +Cons: +- Requires a workflow blob-store substrate to resolve digest→bytes; that substrate may not exist at HEAD +- Doesn't give consumers a self-contained file handle + +### Candidate B-2 — path-keyed with provenance (richer) + +```dag +type FileAttachment { + subject_node: NodeId + path: WorkflowAssetPath // NEW branded nominal (cross-provider authority?) + content_digest: ContentHash // for change-detection / pinning + encoding: AttachmentEncoding // UTF-8 | Binary | ... + workflow_run_id: WorkflowRunId + attached_at_ns: Nanoseconds +} +``` + +Rationale: path AND digest carried; encoding declared up-front so consumers don't decode-by-guess. + +Pros: +- Self-contained: any consumer can resolve to bytes without external blob store +- Encoding-declared avoids consumer-side parse-shape drift +- Brand-typed path (`WorkflowAssetPath`, new nominal) keeps boundary discipline + +Cons: +- Introduces `AttachmentEncoding` sum-type (Practice 4 application — see §5) +- Introduces `WorkflowAssetPath` nominal (cross-provider authority grep required per `feedback_self_hosting_md_authority_audit_before_naming`) +- Slightly larger surface than #55 baseline; question whether encoding-declaration is load-bearing + +### Candidate B-3 — anchor+entry-pair (closest structural mirror of #55+`TimingObservationEntry`) + +```dag +type FileAttachmentAnchor { + subject_node: NodeId + workflow_run_id: WorkflowRunId + attached_at_ns: Nanoseconds +} + +type FileAttachment { + anchor: FileAttachmentAnchor + path: WorkflowAssetPath + content_digest: ContentHash + encoding: AttachmentEncoding +} +``` + +Rationale: structurally mirrors `WorkflowObservationAnchor` + `TimingObservationEntry` split — anchor (provenance/identity) and payload (file fact) are distinct product facts, joined explicitly. + +Pros: +- **Structurally isomorphic to #55** — exact pattern-match for the locked sibling-carrier shape +- Boundary Discipline: anchor vs payload separation +- Future-proof: if a non-file attachment (e.g. inline-string attachment) needs the same anchor pattern, the anchor type composes + +Cons: +- Two types vs one; slightly more authoring overhead per ingest site +- Per-ingest-site cost-of-change is still 1 (build one `FileAttachment { anchor: …, … }` value) + +## §4. Lazy-vs-eager evaluation + +Orthogonal axis to carrier shape. Three sub-options: + +- (i) **Eager**: `FileAttachment` value is constructed with `content_digest` pre-computed; bytes are workflow-substrate-resolved by digest at consumer-time +- (ii) **Lazy**: `content_digest` is a deferred-thunk evaluated on first read +- (iii) **Eager with cache**: eager construction, consumer-side memoized + +Recommendation: **(i) eager**, consistent with #55 `TimingObservationEntry` (no lazy thunks in sibling carriers). Lazy semantics not justified by current consumer evidence. + +## §5. Practice 4 (coproduct dissolution) check — `AttachmentEncoding` + +Candidates B-2 and B-3 introduce `AttachmentEncoding` sum-type. Per `feedback_canvas_finding_taxonomy`: + +- 🟢 **GREEN if** encoding distinctions drive type-level behavior differences at consumer sites (e.g., UTF-8 consumers vs Binary consumers have different APIs); named-dissolution-trigger applies if encoding can be inferred from `path` extension or `content_digest` magic-bytes +- 🟡 **YELLOW if** encoding is a tag without behavioral payload — likely vacuous, should be derivable +- 🔴 **RED** would only apply if encoding partitions consumers in a way that's already modeled elsewhere (e.g., `dsl/std/encoding.dag` already has carriers) + +**Existing precedent check** (per `feedback_self_hosting_md_authority_audit_before_naming`): `dsl/std/encoding.dag` exists; the canvas worker brief MUST grep that file before naming `AttachmentEncoding` — if the encoding partition is already modeled there, FileAttachment field references the existing nominal rather than introducing a new sum-type. + +## §6. Workflow-context coupling — how does a Workflow node reference an attached file? + +Three sub-questions: + +- (a) **Carrier-side**: `FileAttachment.subject_node: NodeId` (per #55 mirror) — the node it's attached to is on the attachment record +- (b) **Workflow-side**: does `Workflow` / `Job` / `Step` carry a `List`? Or is the attachment table indexed externally? +- (c) **Consumer-evidence**: which ingest call sites need this (forward-looking; gate is "model for future use", not retire-existing per Director audit) + +PR #2820 §2 cites `rg include_str! dsl/` → no matches at HEAD — gate is forward-looking. So consumer-evidence brief is **forward-looking** (existence-proof use cases) not **migration-shaped** (no legacy sites to migrate). + +## §7. Consumer evidence — forward-looking existence proof + +Director's anti-pattern #3 ("no bridge variants") + Class-1 5-criteria-pass for §1.8 row #62 imply: at least 1 concrete `.dag` program that ingests an external file via FileAttachment must land as existence-proof. + +Sub-canvas defers to worker brief: enumerate ≥1 candidate use case (e.g., timing observation set ingest as workflow attachment; cf. timing_lens.dag's existing `TimingObservationSet` shape but where the observation data itself comes from a file). + +## §8. Open questions for ratification + +1. **Carrier shape**: B-1 (content-addressed minimal) / B-2 (path-keyed with provenance) / B-3 (anchor+entry-pair mirror of #55)? +2. **`AttachmentEncoding` field present** (B-2/B-3) **or absent** (B-1) — derivable-from-path or from-digest, OR carried explicitly? +3. **`WorkflowAssetPath` branded nominal**: introduce new nominal or strict-mirror an existing `dsl/std/types.dag` brand? (Worker brief grep required.) +4. **Workflow-side coupling**: does `Job` / `Step` carry `attachments: List`, or external indexing? +5. **Eager-vs-lazy**: confirm (i) eager per #55 precedent. +6. **Practice 4 disposition for `AttachmentEncoding`** if introduced: 🟢/🟡/🔴 per §5. + +## §9. Cost-of-change accounting + +| Candidate | Files edited to add a new file-ingest site | +|---|---| +| B-1 (content-addressed minimal) | 1 (one `FileAttachment` value referencing digest) | +| B-2 (path-keyed) | 1 (one `FileAttachment` value with path+digest) | +| B-3 (anchor-entry pair) | 1 (one `FileAttachment { anchor: …, … }` value) | + +All three satisfy cost-of-change-1. Discriminator is **#55 structural-mirror fidelity** + **encoding-declaration load-bearing-ness**, not cost. + +## §10. Ratification ask + +Director or Substrate-Mgr-tier ratification on §8 questions 1-6. On ratification, worker brief authors: +- Type definition + sibling-carrier alignment receipt +- Brand-nominal grep audits (encoding + path) +- Practice 4 disposition for any new sum-types +- Workflow-side coupling site +- Existence-proof use case +- Bootstrap ratchet test (mirror of `timing_lens_substrate_carrier_test.rs`) + +## §11. Reference + +- Parent canvas: PR #2820 / `docs/briefs/r3-substrate-gate-62-file-ingestion-canvas.md` +- Director disposition: PM msg_52c4a707 +- #55 precedent type: `src/v3/std/timing_lens.dag:98-116` +- #55 design doc: `docs/design-timing-lens.md` §2 (6 invariants) +- #55 bootstrap ratchet: `timing_lens_substrate_carrier_test.rs` +- #53 sibling: `dsl/extdeps/github/actions.dag:114` (WorkflowSecret) +- §4.3 framing: `docs/r3-program-plan.md:499-506` +- bright-otter-731 audit: msg_e85224dc-7c7e-495d-911f-8bace75a7bcd + +--- + +**Authored by**: warm-wolf-698 (R3 Substrate Mgr) +**Date**: 2026-05-13 +**Source authority**: PR #2820 Director-ratified macro shape + #55 sibling-carrier precedent From 5a2c3d8e824d5eb13cbbff2e1ea69da732376362 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 02:35:39 +0000 Subject: [PATCH 06/36] docs(r3): gate #62 FileAttachment worker brief (Refined-B-1 ratified) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Director ratified Refined-B-1 carrier shape with full §8 Q1-Q6 dispositions + 7 anti-patterns per PM msg_bc8c23f6 (relaying Director msg_61e302c6). Worker brief authored with: - Exact 5-field carrier (subject_node + content_digest + producer_id + workflow_run_id + attached_at_ns) — strict 5-of-7-subset of #55 WorkflowObservationAnchor - Q1-Q6 dispositions encoded verbatim for reviewer enforcement - 7 anti-patterns receipt-of-compliance requirement - Phase A (carrier) / Phase B (ratchet test) / Phase C (existence-proof use case) / Phase D (ledger update) staging - 5 STOP conditions including consumer-evidence-blob-store gap - Workflow blob-store substrate flagged as Wave-2 sub-canvas-2 trigger (forward-looking, NOT blocking this brief) Brief is DISPATCH-READY. PR #2819 stays held as Candidate A drift (anti-pattern #1). Co-Authored-By: Claude Opus 4.7 (1M context) --- ...-gate-62-file-attachment-carrier-worker.md | 172 ++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 docs/briefs/r3-substrate-gate-62-file-attachment-carrier-worker.md diff --git a/docs/briefs/r3-substrate-gate-62-file-attachment-carrier-worker.md b/docs/briefs/r3-substrate-gate-62-file-attachment-carrier-worker.md new file mode 100644 index 00000000000..2d15004a284 --- /dev/null +++ b/docs/briefs/r3-substrate-gate-62-file-attachment-carrier-worker.md @@ -0,0 +1,172 @@ +--- +status: dispatchable (worker brief; ratified shape per recursive Mgr-canvas chain + Director disposition relayed via PM msg_bc8c23f6 2026-05-13) +authority parent: R3 Substrate Manager (warm-wolf-698) +authoring date: 2026-05-13 +gate: §1.8 ledger row #62 `substrate_gap_file_ingestion_closed` +parent canvases: + - PR #2820 / `docs/briefs/r3-substrate-gate-62-file-ingestion-canvas.md` — macro shape (Candidate b RATIFIED 2026-05-13) + - PR #2820 / `docs/briefs/r3-substrate-gate-62-file-attachment-carrier-sub-canvas.md` — carrier internals (Refined-B-1 RATIFIED 2026-05-13) +ratification anchor: PM msg_bc8c23f6 relaying Director msg_61e302c6 — full §8 Q1-Q6 dispositions + 7 anti-patterns + Director-grep-verified-at-HEAD audit +ledger refinement: PR #2821 commit 3fcd374e0 (DECLARED-with-ratified-shape-and-carrier-internals-ratified) +--- + +# Gate #62 — FileAttachment substrate-carrier worker brief + +## §0. Status — DISPATCH-READY + +All carrier-shape questions ratified. Worker authors carrier + ratchet + existence-proof use case. No further canvas required. + +PR #2819 (Candidate A drift, compile-time `read_utf8_file`) is **CLOSED/HELD** as ratified anti-pattern; audit-trail preserved. + +## §1. Ratified carrier (exact shape — Director verbatim) + +```dag +type FileAttachment { + subject_node: NodeId + content_digest: ContentHash + producer_id: WorkflowProducerId + workflow_run_id: WorkflowRunId + attached_at_ns: Nanoseconds +} +``` + +**5 fields, in this order, with these names**. Strict 5-of-7 subset of `WorkflowObservationAnchor` at `src/v3/std/timing_lens.dag:98-106` (dropping `observer_id` + `prover_id` as timing-specific roles). + +**Placement**: `src/v3/std/` — same crate as `timing_lens.dag` sibling. Worker grep-verifies adjacency at authoring time. + +## §2. Director-verified authority chain at HEAD (verbatim) + +1. **#55 anchor 7 fields** at `src/v3/std/timing_lens.dag:98-106` (subject_node, artifact_digest, producer_id, observer_id, prover_id, attached_at_ns, workflow_run_id) +2. **All 5 needed branded nominals** at `dsl/std/types.dag:324-331`: + - `ContentHash` :324 + - `WorkflowProducerId` :328 + - `WorkflowObserverId` :329 (unused by FileAttachment) + - `WorkflowProverId` :330 (unused by FileAttachment) + - `WorkflowRunId` :331 + - All follow `NonEmptyStr where brand("…")` pattern +3. **`dsl/std/encoding.dag`** exists with full `Encoding` lattice (`type Encoding` :23; 6-variant `ASCII | UTF8 | Latin1 | Text | Binary | Unknown` BoundedLattice) +4. **No `FileAttachment` / `AttachmentEncoding` / `WorkflowAssetPath` at HEAD** — names available + +## §3. §8 Q1-Q6 dispositions (Director verbatim — load-bearing for PR framing) + +| Q | Disposition | +|---|---| +| Q1 carrier shape | **Refined-B-1** — 5-field 5-of-7-subset-of-#55. B-2 path+digest REJECTED as parallel-rep; B-3 anchor+entry-pair REJECTED as over-engineered (no payload to split) | +| Q2 encoding field | **ABSENT default**. If consumer needs encoding, use `Encoding` from `dsl/std/encoding.dag`. **Never introduce `AttachmentEncoding`.** | +| Q3 `WorkflowAssetPath` | **DO NOT introduce**. No path field on carrier; digest is the identifier. | +| Q4 workflow-side coupling | **Defer to consumer evidence.** Per #55: `TimingObservationSet = List` is OWN carrier, NOT embedded on Job/Step. Do NOT preemptively add `List` to Job/Step. | +| Q5 eager-vs-lazy | **EAGER** per #55 sibling. | +| Q6 `AttachmentEncoding` Practice-4 | 🔴 **RED** — DISSOLVE to existing `Encoding`. Practice-4 RED-zone (partitions consumers in way already modeled). | + +## §4. 7 anti-patterns (downstream worker review MUST enforce) + +1. Compile-time `read_utf8_file`-equivalent extern-func additions (Candidate A drift, rejected) +2. FileAttachment landed without #55/#53 sibling-carrier alignment +3. Bridge variants alongside FileAttachment (§P5 atomic-migration violation) +4. Any `AttachmentEncoding` or equivalent encoding sum-type duplicating `dsl/std/encoding.dag` +5. `path` field on FileAttachment (parallel-rep vs canonical digest) +6. `List` on Job/Step preemptively (consumer-evidence-required) +7. Carrier-pattern deviation from Refined-B-1 5-field structure (no novel field-name renames; `producer_id` stays `producer_id`, etc.) + +PR body MUST cite this list verbatim and assert receipt-of-compliance per anti-pattern. + +## §5. Scope + +### Phase A — Carrier landing + +1. Add `type FileAttachment { … }` to **`src/v3/std/`** in a new or existing file (worker decides per grep + sibling-carrier adjacency; `timing_lens.dag` is the structural neighbor) +2. Cite §1 verbatim in a header comment block referencing gate #62 + sub-canvas (PR #2820) + Director disposition (PM msg_bc8c23f6) +3. Re-validate all 5 branded nominals exist at `dsl/std/types.dag:324-331` at authoring time + +### Phase B — Bootstrap ratchet test + +Mirror `timing_lens_substrate_carrier_test.rs` shape — single test asserting: +- `FileAttachment` type declared with 5 fields (exact names + types per §1) +- All 5 field types resolve via cross-module reference (not parallel declarations) +- Test placement: `src/v3/compiler/tests/integration/cementing/file_attachment_substrate_carrier_test.rs` (or sibling location per existing pattern) + +### Phase C — Existence-proof use case (forward-looking) + +Per §1.8 row #62 criterion (".dag program ingests external file w/o `include_str!`"), one concrete `.dag` program must construct a `FileAttachment` value as existence proof. Worker enumerates the candidate use case: + +- Suggested: timing-observation-set ingest (cf. existing `TimingObservationSet` in `timing_lens.dag`) where observation data originates from an external file +- Alternative: any `.dag` workflow that needs to attach an asset by digest + +Worker proposes the use case in PR body; can be a minimal demo module (cf. `t_ci_workflow_as_data_demo.dag` shape). + +### Phase D — §1.8 row #62 ledger update + +After Phase A+B+C land and pass, update `docs/r3-program-plan.md` §1.8 row #62 (line 290) from **DECLARED-with-ratified-shape-and-carrier-internals-ratified** (per PR #2821) to **CONSUMER_LANDED** with cite to this PR. + +## §6. STOP conditions + +1. **Branded-nominal grep mismatch** at HEAD — if `dsl/std/types.dag:324-331` no longer contains the 5 nominals exactly as Director-verified (e.g., rename, removal), **STOP** and surface — substrate state has drifted. +2. **Sibling-carrier #55 drift** — if `WorkflowObservationAnchor` shape at `src/v3/std/timing_lens.dag:98-106` no longer matches the 7-field structure (e.g., renamed, reshaped), **STOP** — the 5-of-7-subset rationale needs re-anchoring. +3. **Carrier-name collision** — if `FileAttachment` / `AttachmentEncoding` / `WorkflowAssetPath` appear at HEAD via parallel landing, **STOP** — surface to Mgr (warm-wolf-698) for de-duplication. +4. **Consumer-evidence use case unbuildable** — if no candidate `.dag` site can construct a `FileAttachment` value at digest-resolution-time (e.g., no `ContentHash` source in `.dag` surface), **STOP** — sub-canvas-2 (blob-store substrate) is prerequisite, not optional. Surface to Mgr. +5. **Practice-4 RED violation surfaces** — if Phase A authoring tempts an `AttachmentEncoding` sum-type or path field, **STOP** — anti-patterns #4 + #5 fire; revise to use existing `Encoding` + drop path. + +## §7. Verification + +- `cargo test --workspace` green +- Hermetic test `file_attachment_substrate_carrier_test.rs` asserts: + - Field count = 5 + - Field names + types match §1 exactly + - Cross-module reference resolution for all 5 nominals +- Demo module (Phase C) compiles + constructs a `FileAttachment` value +- PR body cites: + - Gate #62 closure (Phase D ledger update) + - Director disposition (PM msg_bc8c23f6) verbatim Q1-Q6 + - 7 anti-patterns receipt-of-compliance + - Sibling-carrier #55 5-of-7-subset alignment receipt + - Branded-nominal grep audit at HEAD + +## §8. Out of scope + +- Workflow blob-store substrate (`content_digest → bytes` resolution) — **separate canvas; Wave-2 sub-canvas-2 trigger per Director "not blocking this ratification"**. If consumer evidence (Phase C) requires blob resolution unavailable at HEAD, surface STOP-4 instead of inventing inline. +- `List` on `Job` / `Step` (anti-pattern #6) — consumer-evidence-required, not preemptive +- Migration of any (hypothetical) legacy `include_str!` paths — Director-verified no `include_str!` in `dsl/` at HEAD; gate is forward-looking +- Encoding-tag introduction — anti-pattern #4 + +## §9. PR body framing template + +``` +Closes gate #62 substrate_gap_file_ingestion_closed. + +Carrier landed exactly per Refined-B-1 ratification (PR #2820 sub-canvas; +Director disposition relayed via PM msg_bc8c23f6 2026-05-13): + +[paste §1 type definition verbatim] + +5-of-7-subset of #55 WorkflowObservationAnchor (src/v3/std/timing_lens.dag:98) +— drops observer_id + prover_id (timing-specific roles). + +Q1-Q6 dispositions enforced (verbatim per Director): +[paste §3 table] + +7 anti-patterns receipt-of-compliance: +[enumerate each + cite that the implementation does not violate it] + +Existence proof: [Phase C demo module path] constructs a FileAttachment +value via digest-resolution at [site]. + +§1.8 row #62 updated: DECLARED-... → CONSUMER_LANDED. +``` + +## §10. Reference + +- Parent canvases: PR #2820 (top-level + sub-canvas as two commits on same branch) +- Director disposition relay: PM msg_bc8c23f6 (relaying Director msg_61e302c6) +- Ledger refinement: PR #2821 commit 3fcd374e0 +- Sibling-carrier #55: `src/v3/std/timing_lens.dag:98-106` +- Sibling-carrier #55 ratchet: `src/v3/compiler/tests/integration/cementing/timing_lens_substrate_carrier_test.rs` +- Branded nominals: `dsl/std/types.dag:324-331` +- Encoding lattice (do-not-duplicate authority): `dsl/std/encoding.dag:23` +- §4.3 framing: `docs/r3-program-plan.md:499-506` +- bright-otter-731 audit-trail: msg_e85224dc + +--- + +**Authored by**: warm-wolf-698 (R3 Substrate Mgr) +**Date**: 2026-05-13 +**Sub-canvas-2 trigger** (forward-looking, NOT blocking): workflow blob-store substrate canvas authoring to Wave-2 queue. From 8c1b71df70a4c91a48c8df5981d80c3b14ca2b8f Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 04:03:34 +0000 Subject: [PATCH 07/36] docs(r3): gate #105 SymbolicCost Tier 1 carrier-extension canvas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Director ratified Path A Tier 1 on 2026-05-13 (PM msg_4fd650b7 relaying msg_ad5e934d) with 5 sub-canvas questions Q1-Q5 routed to Mgr. This canvas surfaces dispositions on each for next-tier ratification before worker brief authoring. Mgr recommendations: - Q1 Rational ordering: c (layered OrderedField + lazy migration) - Q2 Linear-vs-Polynomial: Y (collapse to PolynomialCost(degree=1) per §P5; net 10 variants not 11) - Q3 algebra rules: tabulated 10 new interaction rules; PolyLog reserved for log^k only (n log n stays composite); Factorial² = UnknownCost (Tier-2 R4-deferral receipt) - Q4 STOP SIGNAL: re-resets at 11th variant (or 12th if Tier-2) - Q5 carrier-shape canvas: this document - §8 Tier-2 mechanism: defer to R4 (InverseAckermann doesn't fit IteratedAlgebra; no uniform compositional surface) 5 Director anti-patterns encoded + 2 Mgr-derived for worker review. Gates on §1.8 row #105 PR #2824 landing + Director ratification of §12 questions before worker dispatch. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ate-gate-105-symbolic-cost-tier1-canvas.md | 279 ++++++++++++++++++ 1 file changed, 279 insertions(+) create mode 100644 docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md new file mode 100644 index 00000000000..f1f33e65124 --- /dev/null +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -0,0 +1,279 @@ +--- +status: Mgr canvas (substrate-shape question for Director ratification; surfaced per feedback_substrate_shape_belongs_in_mgr_canvas after PM msg_4fd650b7 formal canvas-trigger relay of Director ratification msg_ad5e934d 2026-05-13) +authority parent: R3 Substrate Manager (warm-wolf-698) +authoring date: 2026-05-13 +gate: §1.8 ledger row #105 `symbolic_cost_textbook_coverage_landed` (added via PM PR #2824) +ratification anchor: PM msg_4fd650b7 relaying Director msg_ad5e934d — Path A Tier 1 RATIFIED + 5 sub-canvas questions Q1-Q5 routed +operator framing: "current list looks very slim ... we need to land this all in R3 please" (2026-05-13) +authority docs: + - `src/v3/std/algebra.dag:190-197` — current 7-variant `SymbolicCost` + - `src/v3/std/algebra.dag:60-72` — `STOP SIGNAL: wanting an eighth variant` (will reset) + - `docs/design-symbolic-cost-algebra.md` — current algebra + - `dsl/std/algebra.dag:268-286` — existing `OrderedRing` witness pattern + - `dsl/std/algebra.dag:287` — existing `Field` (no order) + - `dsl/std/rational.dag:26` — `type Rational = Field>` (no order witness) + - `feedback_groundedness_gates_lenses` (Tier 2 structural-extension caveat) +--- + +# Gate #105 — SymbolicCost Tier 1 carrier-extension canvas + +## §0. Status + +Director ratified Path A Tier 1 on 2026-05-13 (PM msg_4fd650b7 relaying msg_ad5e934d). Net 7 → 11 SymbolicCost variants; one promoted (PolynomialCost.degree to Rational). This canvas surfaces 5 sub-questions for Director ratification before worker brief authoring. + +PR #2824 (PM) carries §1.8 row #105 authority anchor; landing pending. Worker brief authoring **gates on this canvas being Director-ratified AND PR #2824 landing**. + +## §1. Ratified Tier 1 variant list (verbatim per Director msg_ad5e934d) + +1. **PROMOTE**: `PolynomialCost { var: SizeVariable, degree: Rational }` (subsumes √n = n^(1/2), ∛n = n^(1/3), n^(2/3), and non-integer poly n^2.373 + n^2.807, plus existing integer poly) +2. **ADD**: `PolyLogCost { var: SizeVariable, exponent: Int }` for log² n, log^k n +3. **ADD**: `ExponentialCost { base: Int, var: SizeVariable }` for 2^n, c^n with c ≥ 2 +4. **ADD**: `FactorialCost { var: SizeVariable }` for n! + +Net `src/v3/std/algebra.dag:190-197` final variant count: **11** (was 7). + +Tier 2 R4-DEFERRED per Director with named-consumer-trigger requirement: +- LogLogCost (vEB trees) +- InverseAckermannCost (α(n) union-find) +- IteratedLogCost (log* n) +- HyperExponentialCost (n^n super-exp) + +**Structural-extension caveat** (Director-named): if this canvas surfaces a compositional mechanism for Tier 2 satisfying `feedback_groundedness_gates_lenses` + composing with Sum/Product algebra + carries consumer-evidence justification, accept that mechanism IN-R3 instead of named variants. Canvas §6 addresses. + +## §2. State at HEAD (grep-verified 2026-05-13) + +- `src/v3/std/algebra.dag:190-197`: current 7 variants (ConstantCost, LinearCost, PolynomialCost with `degree: DegreeAtLeastTwo`, ProductCost, SumCost, LogCost, UnknownCost) +- `src/v3/std/algebra.dag:60-72`: STOP SIGNAL "wanting an eighth variant" +- `dsl/std/algebra.dag:268-286`: `OrderedRing` witness with `compare/lt/le/gt/ge` already defined +- `dsl/std/algebra.dag:287-...`: `Field` defined WITHOUT order operations +- `dsl/std/rational.dag:26`: `type Rational = Field>` — supports add+mul+inverse, NOT order. Confirmed: NO `OrderedField` witness exists at HEAD. +- `dsl/std/computation.dag:8`: "algebra.dag says 'Int inhabits OrderedRing'" — Int is ordered, but Rational is not + +## §3. Q1 — Rational dominance lattice (substrate-shape question) + +Polynomial dominance requires **total order on Rational** to compare degrees (1/2 < 1 < 2/3 < 1 < 2 < 2.373). `Rational = Field<...>` carries no order witness. + +### Candidate Q1-a — Extend Rational with OrderedField witness + +Add `type OrderedField { ... }` in `dsl/std/algebra.dag` analogous to `OrderedRing` (lines 268-286), with `add/sub/zero/negate/mul/div/one + compare/eq/lt/le/gt/ge + reciprocal/divide`. Refit Rational: +```dag +type Rational = OrderedField> +``` + +Pros: +- Strict-mirror of `OrderedRing` precedent (`feedback_strict_mirror_vs_novel_substrate_fact` applies — no novel substrate fact; ratifies directly) +- Rational gains order as a first-class field witness; benefits all consumers (not just cost-lens) +- Clean Practice-4 placement: order is structurally part of the field's algebra, not bolted on + +Cons: +- Touches a foundational algebra carrier; cross-program impact requires checking all `Field<>` consumers +- Adds 7 functions to the witness record (compare/eq/lt/le/gt/ge + ne) + +### Candidate Q1-b — Carry parallel Int-tuple representation for comparison + +Add per-PolynomialCost-degree-comparison helpers that decompose `Rational = p/q` into `(p, q)` Int-tuples and compare via cross-multiplication (`a/b ≶ c/d ⟺ ad ≶ bc` since q > 0). + +Pros: +- Localizes to cost-lens; no foundational algebra touched +- Useful even if a future OrderedField lands (correctness check) + +Cons: +- **Parallel-rep risk**: comparison logic lives in cost-lens body, not on the Rational carrier — two-source-of-truth posture if Rational consumers elsewhere later need order +- Anti-pattern #4 (Director-enumerated): "Dominance lattice fudging via string-tagged Rational (use real ordered-witness)" — partial application risk + +### Candidate Q1-c — Substrate Mgr discretion (third approach) + +**Proposed Q1-c**: Layered approach — land `OrderedField` witness alongside `Rational` re-declaration, BUT scope the OrderedField introduction strictly to enable rational ordering at the algebraic-witness layer; do NOT preemptively migrate existing `Field` consumers. Migration occurs only if a consumer surfaces a need. This is Q1-a's substrate landing + lazy consumer migration. + +Pros: +- Lands the structural fix without cross-program migration burden +- Strict-mirror precedent (OrderedRing → OrderedField analogous addition) +- Future consumers can adopt incrementally; no breaking change + +Cons: +- Two `Field`-shaped witnesses exist (Field + OrderedField) — potential confusion until full migration + +**Mgr recommendation**: Q1-c. Combines Q1-a structural correctness with bounded blast-radius. + +## §4. Q2 — Linear-vs-Polynomial split reconciliation + +Current shape: `LinearCost(SizeVariable)` is a distinct variant; `PolynomialCost { degree: DegreeAtLeastTwo }` excludes degree=1. After PolynomialCost.degree → Rational, the structural separation question: + +### Candidate Q2-X — Keep Linear separate + +```dag +| LinearCost(SizeVariable) +| PolynomialCost { var: SizeVariable, degree: Rational where degree ≠ 1 } +``` + +Pros: +- Preserves all existing LinearCost-consumer paths (no migration) +- Linear is a meaningful named case; reviewers can grep for it + +Cons: +- `degree ≠ 1` refinement is awkward; structural separation no longer matches algebraic reality (n = n^1 is exactly poly degree=1) +- Algebra rules need a branch for Linear vs PolynomialCost in sum/product (e.g., `LinearCost · LinearCost = PolynomialCost(degree=2)` introduces a cross-variant rule) + +### Candidate Q2-Y — Collapse Linear into Polynomial(degree=1) + +```dag +| PolynomialCost { var: SizeVariable, degree: Rational where degree > 0 } +``` +(LinearCost removed; `LinearCost(v)` ≡ `PolynomialCost { var: v, degree: 1 }`) + +Pros: +- Single uniform variant for all positive-degree polynomial bounds +- Sum/product algebra closes uniformly: `PolyCost(d1) · PolyCost(d2) = PolyCost(d1+d2)` no Linear special case +- 11 → 10 net (Linear absorbed); aligns with §P5 Progress Is Dissolution + +Cons: +- **Migration**: all LinearCost-consumer paths must rewrite to PolynomialCost(degree=1) +- Reviewers lose the named "Linear" landmark in cost analysis output (cosmetic) + +**Mgr recommendation**: Q2-Y. The `degree ≠ 1` refinement (Q2-X) is exactly the kind of structural fudge §P5 progress-is-dissolution discipline rejects. LinearCost as a separate variant in a Rational-degree world is a pre-Rational vestige. Migration scope is bounded (cost-lens consumers) and per `feedback_load_bearing_ratchet_preservation` the dissolution-receipt is the standard pattern. + +Net Tier 1 final variant count under Q2-Y: **10**, not 11. Reviewer-ratchet adjusts accordingly. + +## §5. Q3 — Sum/Product algebra interaction rules + +Existing rules (from `docs/design-symbolic-cost-algebra.md` + algebra.dag fold operators): +- `PolyCost(d1) + PolyCost(d2) = PolyCost(max(d1, d2))` (sum takes dominant) +- `PolyCost(d1) · PolyCost(d2) = PolyCost(d1 + d2)` (product adds degrees) +- `LogCost(v) + ConstantCost(c) = LogCost(v)` (log dominates constant) + +**New rules required** (per Director Q3): + +| Operation | Result | Justification | +|---|---|---| +| `PolyCost(d) · LogCost(v)` | `PolyLogCost { var: v, exponent: 1 }`? OR composite ProductCost? | Canvas question (see §5.1) | +| `PolyLogCost(v, k1) · PolyLogCost(v, k2)` | `PolyLogCost(v, k1+k2)` | log^a · log^b = log^(a+b) | +| `PolyCost(d) + ExpCost(c, v)` | `ExpCost(c, v)` | exp dominates poly | +| `PolyCost(d) · ExpCost(c, v)` | `ExpCost(c, v)` | exp absorbs poly multiplicatively too | +| `ExpCost(c1, v) · ExpCost(c2, v)` | `ExpCost(c1·c2, v)` | c1^v · c2^v = (c1·c2)^v | +| `ExpCost(c1, v) + ExpCost(c2, v)` (c1 < c2) | `ExpCost(c2, v)` | dominant base | +| `FactorialCost(v) + anything` | `FactorialCost(v)` | factorial dominates | +| `FactorialCost(v) · PolyCost(d)` | `FactorialCost(v)` | factorial dominates | +| `FactorialCost(v) · ExpCost(c, v)` | `FactorialCost(v)` | factorial dominates exp | +| `FactorialCost(v) · FactorialCost(v)` | `FactorialCost(v)`? OR `UnknownCost("v! · v! exceeds Tier 1")` | Canvas question (see §5.2) | + +### §5.1 — PolyCost · LogCost normalization + +Two candidate shapes: +- (a) `PolyCost(d) · LogCost(v) = PolyLogCost { var: v, exponent: 1 }` if d=0, but d=0 means ConstantCost not PolyCost; if d=1 then it's `v · log(v)` which is canonically n log n +- (b) Keep as composite `ProductCost([PolyCost, LogCost])`; PolyLogCost only constructed from explicit log² n etc. + +Mgr recommendation: (b). PolyLogCost is for log^k n only (single variable, integer-exponent log). The n log n shape is `ProductCost([LinearCost(n), LogCost(n)])` — already representable, and the algebra fold via ordered-dominance correctly identifies it. Avoiding (a) prevents semantic-collision between "poly times log" and "polylog". + +### §5.2 — FactorialCost · FactorialCost + +Two candidate shapes: +- (a) `FactorialCost(v) · FactorialCost(v) = FactorialCost(v)` (factorial absorbs) +- (b) `UnknownCost("(v!)² exceeds Tier 1 — pending R4 named-variant canvas")` per Tier-2-deferral receipt + +Mgr recommendation: (b). `(n!)²` is genuinely outside Tier 1; it's super-factorial / hyperfactorial territory. Per Director anti-pattern #5: "UnknownCost used for textbook-Tier-1-coverable bounds post-promotion (STOP-SIGNAL violation)" — (n!)² is NOT Tier-1-coverable, so UnknownCost("...pending R4...") is the correct disposition. + +### §5.3 — Normalization (rational-degree polynomial) + +- `PolyCost(d1) · PolyCost(d2) = PolyCost(d1 + d2)` — uses Q1-c OrderedField.add +- `PolyCost(1/2) · PolyCost(1/2) = PolyCost(1)` — and per Q2-Y, this is PolyCost(degree=1), the absorbed Linear +- `PolyCost(d1) + PolyCost(d2) = PolyCost(max(d1, d2))` — uses Q1-c OrderedField.compare + +## §6. Q4 — STOP-SIGNAL update + +Current `src/v3/std/algebra.dag:69-72`: +> STOP SIGNAL: wanting an eighth variant. Pause and escalate rather than extending; the thesis claim is that seven covers the asymptotic surface, and any new variant should carry its own dissolution receipt. + +**Post-extension proposed text** (Mgr recommendation): +> STOP SIGNAL: wanting an 11th variant (or 12th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 10 variants covering ConstantCost / PolynomialCost(Rational ≥ 0) / PolyLogCost / LogCost / ProductCost / SumCost / ExponentialCost / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. + +Variant count: **10** post-Q2-Y (recommended), or **11** if Q2-X is ratified. + +## §7. Q5 — Carrier-shape canvas before worker dispatch — THIS DOC + +This canvas IS the Q5 carrier-shape canvas. On Director ratification of Q1-Q4 + this canvas, worker dispatch proceeds with brief authored per ratified shape. + +## §8. Tier-2 structural-extension caveat (Director-named) + +Director: "if your canvas surfaces a compositional mechanism for Tier 2 that satisfies `feedback_groundedness_gates_lenses` + composes with Sum/Product algebra + carries consumer-evidence justification, accept that mechanism IN-R3 instead of named variants for Tier 2." + +### Candidate compositional mechanism — `IteratedAlgebra` + +Hypothesis: most Tier-2 bounds are **iterates** of Tier-1 functions: +- LogLogCost = `IteratedAlgebra` (log applied twice) +- IteratedLogCost = `IteratedAlgebra` with iteration-count = log*(n) +- InverseAckermannCost = inverse of `Ackermann` iterate — doesn't fit cleanly +- HyperExpCost = `IteratedAlgebra` + +Sum/Product composition under iterate: complex — LogLog · LogLog = LogLog², which is itself a polylog of a logarithm. Composition discipline rapidly degrades. + +**Mgr finding**: a uniform compositional mechanism for ALL Tier-2 cases is **not surfaced by this canvas**. InverseAckermann in particular doesn't fit the iterate pattern. Recommendation: **defer Tier 2 to R4 per Director default**; do NOT accept IteratedAlgebra in this canvas as a structural-extension shortcut. The consumer-evidence triggers (vEB trees, union-find, log*-bounded data structures) can drive named-variant canvases in R4. + +## §9. Practice 4 (coproduct dissolution) classification + +For each Tier-1 addition under §1: + +| Addition | Practice 4 classification | +|---|---| +| PROMOTE PolynomialCost.degree to Rational | 🟢 GREEN — refines structural payload; no new sum-type arm; dissolution-trigger if Rational lands order | +| ADD PolyLogCost | 🟢 GREEN — new variant for distinct asymptotic class (log^k n); consumer evidence: polylog-time algorithms (Strassen, FFT preliminaries) | +| ADD ExponentialCost | 🟢 GREEN — distinct asymptotic class; consumer evidence: brute-force search, exponential-time hypotheses | +| ADD FactorialCost | 🟢 GREEN — distinct asymptotic class; consumer evidence: permutation enumeration, brute-force matching | +| REMOVE LinearCost (under Q2-Y) | 🟢 P5 dissolution — absorbed into PolynomialCost(degree=1); structural fact unchanged | + +No 🔴 RED introductions. Anti-pattern #2 (Director-enumerated): "Path B revival (RootCost as separate variant — Practice-4 RED)" — explicitly NOT done; roots are PolynomialCost(degree=1/2 etc.). + +## §10. Anti-patterns (5 Director-enumerated + 2 derived) + +### Director-enumerated + +1. Any Tier 2 variant named without consumer-evidence (premature variants) — §8 disposition: not introducing +2. Any Path B revival (RootCost as separate variant — Practice-4 RED) — §9: explicitly not done +3. Linear-Polynomial split decision authored without canvas (substrate-shape question goes through Mgr) — this canvas IS the §4 Q2 disposition +4. Dominance lattice fudging via string-tagged Rational (use real ordered-witness) — §3 Q1-c addresses +5. UnknownCost used for textbook-Tier-1-coverable bounds post-promotion (STOP-SIGNAL violation) — §6 STOP-SIGNAL text encodes + +### Mgr-derived (encoded for worker review) + +6. `OrderedField` witness landed without strict-mirror of `OrderedRing` (Q1-c structural-mirror discipline) +7. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) + +## §11. Cost-of-change accounting + +Per `INVARIANTS.md` "Cost of Change": + +| State | Files to edit to add one new asymptotic-bound consumer | +|---|---| +| Pre-canvas (today) | ≥3 (variant if Tier-2-coverable; algebra rules; consumer site) | +| Post-canvas (10-variant Q2-Y) | 1 (consumer constructs the appropriate Tier-1 variant directly) | + +For exotic (Tier-2) bounds: still requires UnknownCost("reason") at consumer site — that's the R4-deferral receipt. + +## §12. Open questions for ratification + +Director ratification on: + +- **Q1**: a / b / c (Mgr-rec: c — layered OrderedField introduction + lazy consumer migration) +- **Q2**: X (keep Linear separate) / Y (collapse to PolynomialCost(degree=1)) (Mgr-rec: Y per §P5) +- **Q3**: §5 algebra interaction rule table; §5.1 PolyLog-vs-Product disposition (Mgr-rec: b composite); §5.2 FactorialCost squared (Mgr-rec: b UnknownCost) +- **Q4**: §6 STOP-SIGNAL text (10 or 11 variants depending on Q2) +- **Q5**: This canvas (ratification-of-canvas is itself the Q5 disposition) +- **§8 Tier-2 mechanism**: defer to R4 (Mgr-rec) or accept IteratedAlgebra mechanism (rejected by §8 analysis) + +## §13. Reference + +- §1.8 row #105 (PM PR #2824 pending) — authority anchor +- `src/v3/std/algebra.dag:190-197` — current 7-variant SymbolicCost +- `src/v3/std/algebra.dag:60-72` — current STOP SIGNAL +- `dsl/std/algebra.dag:268-286` — OrderedRing precedent +- `dsl/std/algebra.dag:287` — Field (no order) +- `dsl/std/rational.dag:26` — Rational = Field> +- `docs/design-symbolic-cost-algebra.md` — current algebra +- Director ratification: PM msg_4fd650b7 / Director msg_ad5e934d +- `feedback_groundedness_gates_lenses` — Tier-2 structural-extension caveat +- `feedback_strict_mirror_vs_novel_substrate_fact` — Q1-c applies +- `feedback_load_bearing_ratchet_preservation` — Q2-Y migration discipline + +--- + +**Authored by**: warm-wolf-698 (R3 Substrate Mgr) +**Date**: 2026-05-13 From 62e0ec55f90fd1f3121b554e2ded88135985b268 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 04:08:21 +0000 Subject: [PATCH 08/36] docs(r3): gate #105 SymbolicCost Tier 1 worker brief (canvas ratified) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Director ratified canvas PR #2828 Q1-Q5 + §8 Tier-2 disposition per PM msg_a055c38b relaying msg_d86a5987. Worker brief encodes ratified shape as single coordinated PR with 7 sub-phases: - Phase A: OrderedField witness landing + Rational re-declaration - Phase B: STOP SIGNAL rewrite (cap at 11) - Phase C: SymbolicCost carrier reshape (Q2-Y collapse Linear) - Phase D: algebra interaction rules (13-rule table; §5.1 composite for poly·log; §5.2 (n!)² → UnknownCost verbatim) - Phase E: bootstrap ratchet test - Phase F: cost-lens consumer migration (LinearCost → PolyCost(d=1)) - Phase G: §1.8 row #105 ledger update 7 anti-patterns + 5 reviewer ratchets + 6 STOP conditions encoded. DISPATCH GATES on PR #2824 (row anchor) AND PR #2828 (canvas) both merged; brief is ready when cascade clears. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ate-gate-105-symbolic-cost-tier1-worker.md | 274 ++++++++++++++++++ 1 file changed, 274 insertions(+) create mode 100644 docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md new file mode 100644 index 00000000000..f74d00a6b40 --- /dev/null +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -0,0 +1,274 @@ +--- +status: dispatchable-on-cascade (worker brief; ratified shape per canvas PR #2828 Director-ratified 2026-05-13 via PM msg_a055c38b relaying msg_d86a5987; dispatch gates on PR #2824 row #105 anchor + PR #2828 canvas landing — both AND) +authority parent: R3 Substrate Manager (warm-wolf-698) +authoring date: 2026-05-13 +gate: §1.8 ledger row #105 `symbolic_cost_textbook_coverage_landed` +parent canvas: PR #2828 / `docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md` — Q1-Q5 + §8 Tier-2 RATIFIED +ratification anchor: PM msg_a055c38b relaying Director msg_d86a5987 +row anchor: PM PR #2824 +--- + +# Gate #105 — SymbolicCost Tier 1 carrier-extension worker brief + +## §0. Status — DISPATCH-READY (cascade-gated) + +Director ratified all Q1-Q5 + §8 Tier-2 dispositions per PM msg_a055c38b. Worker dispatch gates on: +1. **PR #2824 merge** — §1.8 row #105 authority anchor lands +2. **PR #2828 merge** — canvas authored shape lands (both PRs may merge in parallel) + +This brief encodes the ratified Tier-1 4-addition + 1-collapse + 1-promotion structure as a single coordinated PR. **No sub-phase merges independently** (mirrors F-β.2 atomic-PR receipt; gate-row STOP discipline). + +## §1. Ratified scope summary + +Net 7 → **10** SymbolicCost variants: +- **PROMOTE**: `PolynomialCost.degree: DegreeAtLeastTwo` → `PolynomialCost.degree: Rational where degree > 0` (subsumes √n, ∛n, n^(2/3), non-Int 2.373, AND the absorbed Linear case at degree=1) +- **REMOVE**: `LinearCost(SizeVariable)` — atomic migration to `PolynomialCost { var: v, degree: 1 }` (Q2-Y) +- **ADD**: `PolyLogCost { var: SizeVariable, exponent: Int }` for log^k n +- **ADD**: `ExponentialCost { base: Int, var: SizeVariable }` for c^n with c ≥ 2 +- **ADD**: `FactorialCost { var: SizeVariable }` for n! + +Sibling substrate (Q1-c — separate but co-landing in same PR): +- **ADD**: `OrderedField` witness in `dsl/std/algebra.dag` (strict-mirror of `OrderedRing` at :268-286) +- **PROMOTE**: `Rational = OrderedField>` at `dsl/std/rational.dag:26` + +## §2. Authority chain (verbatim) + +- `src/v3/std/algebra.dag:60-72` — current STOP SIGNAL (will be rewritten per §4) +- `src/v3/std/algebra.dag:190-197` — current 7-variant `SymbolicCost` +- `dsl/std/algebra.dag:268-286` — `OrderedRing` precedent (`compare/lt/le/gt/ge` witness pattern) +- `dsl/std/algebra.dag:287-...` — current `Field` (no order) +- `dsl/std/rational.dag:26` — `type Rational = Field>` +- `docs/design-symbolic-cost-algebra.md` — current algebra +- Canvas: PR #2828 / `docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md` §§3-9 +- Ratification: PM msg_a055c38b relaying Director msg_d86a5987 + +## §3. Phase A — OrderedField witness landing (Q1-c) + +**Sub-phase A.1 — Declare `OrderedField`** in `dsl/std/algebra.dag` adjacent to existing `Field`. Strict-mirror of `OrderedRing` (:268-286) — same 7 order operators added on top of Field: + +```dag +type OrderedField { + add: fn(T, T) -> T + sub: fn(T, T) -> T + zero: T + negate: fn(T) -> T + mul: fn(T, T) -> T + div: fn(T, T) -> Result + one: T + reciprocal: fn(T) -> T + divide: fn(T, T) -> T + compare: fn(T, T) -> Ordering + eq: fn(T, T) -> Bool + ne: fn(T, T) -> Bool + lt: fn(T, T) -> Bool + le: fn(T, T) -> Bool + gt: fn(T, T) -> Bool + ge: fn(T, T) -> Bool +} +``` + +**Sub-phase A.2 — Re-declare `Rational`** at `dsl/std/rational.dag:26`: + +```dag +type Rational = OrderedField> +``` + +**Sub-phase A.3 — Lazy consumer migration** (anti-pattern #6): do NOT migrate existing `Field` consumers preemptively. Field + OrderedField coexist as the Ring/OrderedRing parallel. Only the cost-lens (this PR) needs OrderedField operations on Rational. + +**Sub-phase A.4 — Witness realization**: the `OrderedField>` realization can use Int cross-multiplication for compare (`a/b ≶ c/d ⟺ ad ≶ bc` when b·d > 0). Hand-author the data witness alongside the type. + +## §4. Phase B — STOP SIGNAL rewrite (Q4) + +Replace `src/v3/std/algebra.dag:60-72` block with (Director-ratified verbatim per canvas §6): + +``` +// STOP SIGNAL: wanting an 11th variant (or 12th if Tier-2 +// IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and +// escalate. Tier-1 textbook coverage (gate #105 carrier-extension +// 2026-05-13, PR #) lands 10 variants covering ConstantCost / +// PolynomialCost(Rational > 0) / PolyLogCost / LogCost / ProductCost / +// SumCost / ExponentialCost / FactorialCost / UnknownCost — sufficient +// for the asymptotic surface that R3-load-bearing lenses reason about. +// Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is +// R4-DEFERRED per Director ratification msg_d86a5987; new variants in +// R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") +// remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a +// Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern +// #5 per gate #105. +``` + +Cite gate #105 + PR #2828 + msg_d86a5987 in the comment block. + +## §5. Phase C — SymbolicCost carrier reshape (Q2-Y + variant additions) + +Replace `src/v3/std/algebra.dag:190-197` variant set with: + +```dag +type SymbolicCost inhabits Semiring + = ConstantCost(Int) + | PolynomialCost { var: SizeVariable, degree: Rational } // Q2-Y: absorbs LinearCost via degree=1; degree > 0 invariant + | PolyLogCost { var: SizeVariable, exponent: Int } // NEW: log^k n only (k integer) + | ProductCost(NonSingletonList) + | SumCost(NonSingletonList) + | LogCost(SizeVariable) + | ExponentialCost { base: Int, var: SizeVariable } // NEW: c^n with c ≥ 2 + | FactorialCost { var: SizeVariable } // NEW: n! + | UnknownCost(String) +``` + +10 variants. **LinearCost is REMOVED** (anti-pattern #7: no bridge variants; atomic migration). + +Refinement constraints (state-space-vs-behavioral-invariant discipline per `feedback_state_space_vs_behavioral_invariants`): +- `PolynomialCost.degree > 0` is an algebra invariant; degree=0 collapses to ConstantCost (existing behavior preserved) +- `PolyLogCost.exponent ≥ 1` (exponent=0 collapses to ConstantCost; exponent=1 collapses to LogCost via canonicalization) +- `ExponentialCost.base ≥ 2` (base=0 / base=1 collapse to ConstantCost) + +These refinements live in the algebra fold normalizer, NOT as type-level `where` clauses (avoids Q2-X-style structural fudge). + +## §6. Phase D — Algebra interaction rules (Q3) + +Update sum + product fold logic to implement the Director-ratified rule table (canvas §5): + +| Operation | Result | +|---|---| +| `PolyCost(d1) + PolyCost(d2)` | `PolyCost(max(d1, d2))` (uses `OrderedField.compare`) | +| `PolyCost(d1) · PolyCost(d2)` | `PolyCost(d1 + d2)` (uses `OrderedField.add`) | +| `PolyCost(d) · LogCost(v)` | `ProductCost([PolyCost(d), LogCost(v)])` (§5.1: composite, NOT PolyLogCost) | +| `PolyLogCost(v, k1) · PolyLogCost(v, k2)` | `PolyLogCost(v, k1+k2)` | +| `PolyLogCost(v, k1) + PolyLogCost(v, k2)` | `PolyLogCost(v, max(k1, k2))` | +| `PolyCost(d) + ExpCost(c, v)` | `ExpCost(c, v)` (exp dominates poly) | +| `PolyCost(d) · ExpCost(c, v)` | `ExpCost(c, v)` (exp absorbs poly) | +| `ExpCost(c1, v) + ExpCost(c2, v)`, c1 ≤ c2 | `ExpCost(c2, v)` (dominant base) | +| `ExpCost(c1, v) · ExpCost(c2, v)` | `ExpCost(c1·c2, v)` (multiplicative composition) | +| `FactorialCost(v) + anything` | `FactorialCost(v)` (factorial dominates) | +| `FactorialCost(v) · PolyCost(d)` | `FactorialCost(v)` (factorial absorbs poly) | +| `FactorialCost(v) · ExpCost(c, v)` | `FactorialCost(v)` (factorial dominates exp) | +| `FactorialCost(v) · FactorialCost(v)` | `UnknownCost("(v!)² exceeds Tier 1 — pending R4 named-variant canvas")` (§5.2 verbatim) | + +Normalization invariants in fold (canvas §5.3): +- `PolyCost(1/2) · PolyCost(1/2)` normalizes to `PolyCost(1)` via `OrderedField.add` +- Sum/product dominance applies `OrderedField.compare` for all max-style reductions +- The collapsed Linear (`PolyCost(d=1)`) participates uniformly in sum/product + +## §7. Phase E — Bootstrap ratchet test + +Mirror `src/v3/compiler/tests/integration/cementing/` shape (cf. `complexity_lens_behavioral_completion.rs`): + +`src/v3/compiler/tests/integration/cementing/symbolic_cost_tier1_carrier_test.rs` asserting: +- 10 variant count (assert against `cost.dag` or `algebra.dag` source); REMOVED LinearCost +- All 10 variant names + field shapes structurally present +- `OrderedField` declared in `dsl/std/algebra.dag` with 16 record fields (Field 9 + Order 7) +- `Rational = OrderedField>` at `dsl/std/rational.dag:26` +- Algebra rule sample tests (≥6 of §6 rules): assert fold output for representative inputs (e.g., `PolyCost(1/2) · PolyCost(1/2)` produces `PolyCost(1)`; `ExpCost(2,n) · PolyCost(d)` produces `ExpCost(2,n)`; `FactorialCost(n)²` produces `UnknownCost` with the exact §5.2 reason-string) +- STOP-SIGNAL text at `:60-72` contains new "11th variant" wording + +## §8. Phase F — Consumer migration (atomic) + +Migrate cost-lens consumers from `LinearCost(v)` → `PolynomialCost { var: v, degree: 1 }` in the **same PR**. No bridge variant; no `LinearCost`-fallback path (anti-pattern #7). + +Inventory required (worker greps at HEAD before authoring): +- `git grep -nE "\\bLinearCost\\b" src/v3/ dsl/` — all consumer sites +- For each site, replace with `PolynomialCost { var: , degree: rational_from_int(1) }` (or canvas-ratified helper name) +- The fold algebra under §6 ensures correctness: `PolyCost(1) + PolyCost(1) = PolyCost(1)`; `PolyCost(1) · PolyCost(1) = PolyCost(2)` etc. + +## §9. Phase G — §1.8 row #105 ledger update + +After Phase A-F land + tests green, update `docs/r3-program-plan.md` §1.8 row #105 from DECLARED (or CANVAS_RATIFIED if PM ledger-maintenance landed first) → **CONSUMER_LANDED** with cite to this PR + canvas PR #2828 + Director msg_d86a5987. + +## §10. STOP conditions + +1. **`OrderedRing` shape drift** at HEAD — if `dsl/std/algebra.dag:268-286` no longer carries the exact 14-field signature this brief mirrors, **STOP** and surface — strict-mirror authority broken. +2. **Existing `LinearCost`-consumer surface differs from canvas assumption** — if grep reveals consumer paths that can't migrate to `PolynomialCost(degree=1)` losslessly (e.g., type-level dispatches on LinearCost variant-tag), **STOP** — anti-pattern #7 atomic-migration discipline requires lossless migration. +3. **`Rational` carrier not at `dsl/std/rational.dag:26`** — if Rational has moved / changed shape since 2026-05-13 grep, **STOP** — Q1-c re-declaration target is wrong. +4. **Variant-name collision** at HEAD — if any of `PolyLogCost` / `ExponentialCost` / `FactorialCost` / `OrderedField` appear from parallel landing, **STOP** for de-duplication. +5. **Algebra rule §5.2 violation tempted** — if Phase D authoring tempts a named (n!)² variant or non-Unknown disposition, **STOP** — anti-pattern #5 fires; the rule disposition is Director-ratified. +6. **PR #2824 not merged at dispatch** OR **PR #2828 not merged at dispatch** — both gates AND; if either is unmerged, **STOP** and surface to Mgr; worker dispatch is blocked. + +## §11. 7 anti-patterns (5 Director-enumerated + 2 Mgr-derived per canvas §10) + +PR body MUST cite each verbatim + assert receipt-of-compliance: + +1. Any Tier 2 variant named without consumer-evidence (premature variants) +2. Any Path B revival (RootCost as separate variant — Practice-4 RED) +3. Linear-Polynomial split decision authored without canvas (substrate-shape question goes through Mgr) +4. Dominance lattice fudging via string-tagged Rational (use real ordered-witness) — §3 Q1-c addresses +5. UnknownCost used for textbook-Tier-1-coverable bounds post-promotion (STOP-SIGNAL violation) +6. `OrderedField` witness landed without strict-mirror of `OrderedRing` (Q1-c structural-mirror discipline) +7. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) + +## §12. 5 reviewer ratchets (Director-enumerated for PR review) + +1. **Q1-c integrity**: OrderedField MUST strict-mirror OrderedRing record shape (compare/lt/le/gt/ge minimum) +2. **Q2-Y integrity**: NO LinearCost preservation paths alongside PolyCost(degree=1); atomic migration receipt required +3. **Q3 algebra rules**: §5.1 + §5.2 dispositions are load-bearing; reviewers flag deviation +4. **Q4 STOP-SIGNAL text**: must land at `src/v3/std/algebra.dag:69-72` with new variant cap at 11 (10 ratified + 1 trigger) +5. **All 7 anti-patterns enforceable** at PR review + +## §13. Verification + +- `cargo test --workspace` green +- New hermetic ratchet `symbolic_cost_tier1_carrier_test.rs` (§7) asserts all 4 verification axes (variant set / OrderedField / Rational / algebra rules sample / STOP-SIGNAL text) +- Pre-existing cost-lens behavioral tests still green (Phase F migration must preserve semantic equivalence: `LinearCost(v)` and `PolynomialCost { var: v, degree: 1 }` must produce identical lens output for all consumers) +- PR body cites: + - Gate #105 closure (Phase G ledger update) + - Canvas PR #2828 + Director disposition (PM msg_a055c38b) verbatim Q1-Q5 + §8 + - 7 anti-patterns receipt-of-compliance (§11) + - 5 reviewer ratchets (§12) — explicit assertion-of-compliance per item + +## §14. Out of scope + +- **Tier 2 variants** (LogLog / InverseAckermann / IteratedLog / HyperExp) — R4-deferred per Director §8. Worker must NOT add these. +- **`Field` consumer migration** beyond cost-lens — Q1-c lazy migration; Field stays in place +- **InverseAckermann / IteratedAlgebra mechanism** — canvas §8 finding accepted; not introduced +- **Cost-lens behavioral changes** — this is a carrier-extension PR, not a semantics change; lens output must be backwards-compatible modulo Linear→Poly(d=1) lossless rewrite +- **`docs/design-symbolic-cost-algebra.md` rewrite** — out of scope; tracked separately as doc-drift sweep + +## §15. PR body framing template + +``` +Closes gate #105 symbolic_cost_textbook_coverage_landed. + +Carrier extended per Director-ratified Path A Tier 1 (canvas PR #2828; +ratification PM msg_a055c38b relaying msg_d86a5987 2026-05-13). + +Net 7 → 10 SymbolicCost variants (Q2-Y collapse Linear into +PolynomialCost(degree=1)): +[paste §5 variant set verbatim] + +Companion substrate (Q1-c): +- OrderedField witness in dsl/std/algebra.dag (strict-mirror of OrderedRing) +- Rational = OrderedField> + +STOP-SIGNAL re-reset to 11 (10 ratified + 1 trigger) at algebra.dag:60-72. + +Algebra rules §5/§6 implemented verbatim per canvas; (n!)² → UnknownCost +("(v!)² exceeds Tier 1 — pending R4 named-variant canvas"). + +7 anti-patterns receipt-of-compliance: +[enumerate each + cite that the implementation does not violate it] + +5 reviewer ratchets compliance: +[enumerate each + cite assertion] + +§1.8 row #105 updated: CANVAS_RATIFIED → CONSUMER_LANDED. +``` + +## §16. Reference + +- Canvas: PR #2828 / `docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md` +- Director ratification relay: PM msg_a055c38b (relaying Director msg_d86a5987) +- Row anchor: PM PR #2824 +- Sibling-witness precedent: `dsl/std/algebra.dag:268-286` (OrderedRing) +- Current SymbolicCost: `src/v3/std/algebra.dag:190-197` +- Current STOP-SIGNAL: `src/v3/std/algebra.dag:60-72` +- Rational: `dsl/std/rational.dag:26` +- `feedback_strict_mirror_vs_novel_substrate_fact` — Q1-c discipline +- `feedback_state_space_vs_behavioral_invariants` — Q2-Y refinement-vs-fold discipline +- `feedback_naming_is_aliasing` — §5.1 PolyLog-vs-Product semantic-collision avoidance +- `feedback_no_short_term_solutions` — Q2-Y absorption-over-coexistence + +--- + +**Authored by**: warm-wolf-698 (R3 Substrate Mgr) +**Date**: 2026-05-13 +**Dispatch gate**: PR #2824 AND PR #2828 both merged. From 3d21cb7afb185029d821c146db93be197abfe5db Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 04:24:25 +0000 Subject: [PATCH 09/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20enc?= =?UTF-8?q?ode=20invariants=20in=20type=20carriers=20(codex=20BLOCKING=20f?= =?UTF-8?q?ix)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit codex BLOCKING #10726 on PR #2828 (Practice 2 + Practice 6 violations): 1. Worker brief moved invariants (degree>0, exponent≥1, base≥2) into fold normalizer instead of carrier — admits illegal states 2. Canvas §187 said 'Rational ≥ 0' while worker said 'degree > 0' — split authority on the invariant Both findings valid. Fix: Canvas §6 STOP-SIGNAL text: - Replaced 'PolynomialCost(Rational ≥ 0)' with 'PolynomialCost { degree: PositiveRational }' + adds PolyLogCost { exponent: PositiveInt } + ExponentialCost { base: IntAtLeastTwo } verbatim - Adds new "Type-level refinement carriers" subsection citing DegreeAtLeastTwo precedent (algebra.dag:171-173) Worker brief §5: - New §5.0 introduces PositiveRational, PositiveInt, IntAtLeastTwo as Peano-style inductive carriers (strict-mirror of DegreeAtLeastTwo) - §5.1 SymbolicCost now uses these refinement types for fields: PolynomialCost.degree: PositiveRational PolyLogCost.exponent: PositiveInt ExponentialCost.base: IntAtLeastTwo - Removed the "refinements live in fold normalizer" paragraph Illegal states (degree≤0, exponent≤0, base≤1) now structurally unrepresentable per Practice 2 + Practice 6. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ate-gate-105-symbolic-cost-tier1-canvas.md | 10 +++- ...ate-gate-105-symbolic-cost-tier1-worker.md | 49 +++++++++++++++---- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index f1f33e65124..24d07a8de7a 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -184,7 +184,15 @@ Current `src/v3/std/algebra.dag:69-72`: > STOP SIGNAL: wanting an eighth variant. Pause and escalate rather than extending; the thesis claim is that seven covers the asymptotic surface, and any new variant should carry its own dissolution receipt. **Post-extension proposed text** (Mgr recommendation): -> STOP SIGNAL: wanting an 11th variant (or 12th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 10 variants covering ConstantCost / PolynomialCost(Rational ≥ 0) / PolyLogCost / LogCost / ProductCost / SumCost / ExponentialCost / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. +> STOP SIGNAL: wanting an 11th variant (or 12th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 10 variants covering ConstantCost / PolynomialCost { degree: PositiveRational } / PolyLogCost { exponent: PositiveInt } / LogCost / ProductCost / SumCost / ExponentialCost { base: IntAtLeastTwo } / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. + +**Type-level refinement carriers** (per codex BLOCKING on PR #2828 — `docs/modeling-discipline.md` Practice 2 + Practice 6: invariants encoded in type system, NOT fold normalizer): + +- `PositiveRational` — strict-positive Rational; constructor accepts only `> 0` values. Follows `DegreeAtLeastTwo` precedent at `src/v3/std/algebra.dag:171-173` (inductive carrier where illegal cases are structurally unrepresentable). +- `PositiveInt` — strict-positive Int; same Peano-style precedent. +- `IntAtLeastTwo` — Int ≥ 2; strict-mirror of `DegreeAtLeastTwo` shape. + +These types make `degree ≤ 0`, `exponent ≤ 0`, `base ≤ 1` **structurally unrepresentable** at the carrier level — no normalizer-time enforcement required. Aligns with `feedback_state_space_vs_behavioral_invariants`. Variant count: **10** post-Q2-Y (recommended), or **11** if Q2-X is ratified. diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index f74d00a6b40..77519ddaba4 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -101,29 +101,58 @@ Cite gate #105 + PR #2828 + msg_d86a5987 in the comment block. ## §5. Phase C — SymbolicCost carrier reshape (Q2-Y + variant additions) -Replace `src/v3/std/algebra.dag:190-197` variant set with: +### §5.0 — Type-level refinement carriers (per codex BLOCKING on PR #2828) + +Before reshaping SymbolicCost, introduce three refinement carriers that make illegal field values **structurally unrepresentable** (Practice 2 + Practice 6; `docs/modeling-discipline.md`). Strict-mirror of `DegreeAtLeastTwo` precedent at `src/v3/std/algebra.dag:171-173`: + +```dag +// Mirror of DegreeAtLeastTwo (lines 171-173): Peano-style inductive +// carrier where illegal cases are structurally unrepresentable, not +// normalizer-cleaned-up. +type IntAtLeastTwo + = IntTwo + | IntSuccessor { previous: IntAtLeastTwo } + +type PositiveInt + = One + | PositiveSuccessor { previous: PositiveInt } + +// PositiveRational: strict-positive Rational. Constructor accepts only +// numerator > 0 + denominator > 0 (excluding 0 and negative). Realization +// follows OrderedField from Phase A. +type PositiveRational { + numerator: PositiveInt + denominator: PositiveInt +} +``` + +These types make `degree ≤ 0`, `exponent ≤ 0`, `base ≤ 1` structurally impossible to construct — no fold-time enforcement required. + +### §5.1 — Replace SymbolicCost variant set + +Replace `src/v3/std/algebra.dag:190-197` with: ```dag type SymbolicCost inhabits Semiring = ConstantCost(Int) - | PolynomialCost { var: SizeVariable, degree: Rational } // Q2-Y: absorbs LinearCost via degree=1; degree > 0 invariant - | PolyLogCost { var: SizeVariable, exponent: Int } // NEW: log^k n only (k integer) + | PolynomialCost { var: SizeVariable, degree: PositiveRational } // Q2-Y: absorbs LinearCost via degree=1; degree > 0 by carrier + | PolyLogCost { var: SizeVariable, exponent: PositiveInt } // NEW: log^k n; exponent ≥ 1 by carrier | ProductCost(NonSingletonList) | SumCost(NonSingletonList) | LogCost(SizeVariable) - | ExponentialCost { base: Int, var: SizeVariable } // NEW: c^n with c ≥ 2 - | FactorialCost { var: SizeVariable } // NEW: n! + | ExponentialCost { base: IntAtLeastTwo, var: SizeVariable } // NEW: c^n with c ≥ 2 by carrier + | FactorialCost { var: SizeVariable } // NEW: n! | UnknownCost(String) ``` 10 variants. **LinearCost is REMOVED** (anti-pattern #7: no bridge variants; atomic migration). -Refinement constraints (state-space-vs-behavioral-invariant discipline per `feedback_state_space_vs_behavioral_invariants`): -- `PolynomialCost.degree > 0` is an algebra invariant; degree=0 collapses to ConstantCost (existing behavior preserved) -- `PolyLogCost.exponent ≥ 1` (exponent=0 collapses to ConstantCost; exponent=1 collapses to LogCost via canonicalization) -- `ExponentialCost.base ≥ 2` (base=0 / base=1 collapse to ConstantCost) +**Invariants encoded at carrier level** (Practice 2/6 — NOT fold normalizer): +- `PolynomialCost.degree: PositiveRational` — `degree ≤ 0` is structurally impossible +- `PolyLogCost.exponent: PositiveInt` — `exponent ≤ 0` is structurally impossible +- `ExponentialCost.base: IntAtLeastTwo` — `base ≤ 1` is structurally impossible -These refinements live in the algebra fold normalizer, NOT as type-level `where` clauses (avoids Q2-X-style structural fudge). +Reviewers MUST flag any attempt to use raw `Rational` / `Int` for these fields. ## §6. Phase D — Algebra interaction rules (Q3) From 4ee7b12541e3bd024fbf68e454a4195a4c5cd004 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 04:31:47 +0000 Subject: [PATCH 10/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20fix?= =?UTF-8?q?=20variant=20arithmetic=2010=20=E2=86=92=209=20per=20operator?= =?UTF-8?q?=20BLOCKING?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Operator BLOCKING on PR #2828 canvas:135 caught real arithmetic error: Q2-Y removes LinearCost (-1) and adds 3 NEW variants (PolyLogCost + ExponentialCost + FactorialCost), so net is 7 - 1 + 3 = 9, not 10. PolynomialCost is PROMOTED (degree type changed Rational), NOT added as a new variant — that was the counting mistake. Confirmed variant set per canvas §6 + worker §5.1: 1. ConstantCost 2. PolynomialCost { degree: PositiveRational } 3. PolyLogCost { exponent: PositiveInt } 4. LogCost 5. ProductCost 6. SumCost 7. ExponentialCost { base: IntAtLeastTwo } 8. FactorialCost 9. UnknownCost Total: 9 variants. Confirmed. All references updated: - "10 variants" → "9 variants" - "11th variant" → "10th variant" (STOP-SIGNAL trigger threshold) - "Net 7 → 10/11" → "Net 7 → 9" - "variant cap at 11" → "variant cap at 10" - "10 ratified + 1 trigger" → "9 ratified + 1 trigger" - "STOP-SIGNAL re-reset to 11" → "STOP-SIGNAL re-reset to 10" Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ubstrate-gate-105-symbolic-cost-tier1-canvas.md | 12 ++++++------ ...ubstrate-gate-105-symbolic-cost-tier1-worker.md | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 24d07a8de7a..2e1439f3c7e 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -19,7 +19,7 @@ authority docs: ## §0. Status -Director ratified Path A Tier 1 on 2026-05-13 (PM msg_4fd650b7 relaying msg_ad5e934d). Net 7 → 11 SymbolicCost variants; one promoted (PolynomialCost.degree to Rational). This canvas surfaces 5 sub-questions for Director ratification before worker brief authoring. +Director ratified Path A Tier 1 on 2026-05-13 (PM msg_4fd650b7 relaying msg_ad5e934d). Net 7 → 9 SymbolicCost variants; one promoted (PolynomialCost.degree to Rational). This canvas surfaces 5 sub-questions for Director ratification before worker brief authoring. PR #2824 (PM) carries §1.8 row #105 authority anchor; landing pending. Worker brief authoring **gates on this canvas being Director-ratified AND PR #2824 landing**. @@ -30,7 +30,7 @@ PR #2824 (PM) carries §1.8 row #105 authority anchor; landing pending. Worker b 3. **ADD**: `ExponentialCost { base: Int, var: SizeVariable }` for 2^n, c^n with c ≥ 2 4. **ADD**: `FactorialCost { var: SizeVariable }` for n! -Net `src/v3/std/algebra.dag:190-197` final variant count: **11** (was 7). +Net `src/v3/std/algebra.dag:190-197` final variant count: **9** (was 7). Tier 2 R4-DEFERRED per Director with named-consumer-trigger requirement: - LogLogCost (vEB trees) @@ -132,7 +132,7 @@ Cons: **Mgr recommendation**: Q2-Y. The `degree ≠ 1` refinement (Q2-X) is exactly the kind of structural fudge §P5 progress-is-dissolution discipline rejects. LinearCost as a separate variant in a Rational-degree world is a pre-Rational vestige. Migration scope is bounded (cost-lens consumers) and per `feedback_load_bearing_ratchet_preservation` the dissolution-receipt is the standard pattern. -Net Tier 1 final variant count under Q2-Y: **10**, not 11. Reviewer-ratchet adjusts accordingly. +Net Tier 1 final variant count under Q2-Y: **9**, not 10 (PolynomialCost.degree promotion is not a new variant). Reviewer-ratchet adjusts accordingly. ## §5. Q3 — Sum/Product algebra interaction rules @@ -184,7 +184,7 @@ Current `src/v3/std/algebra.dag:69-72`: > STOP SIGNAL: wanting an eighth variant. Pause and escalate rather than extending; the thesis claim is that seven covers the asymptotic surface, and any new variant should carry its own dissolution receipt. **Post-extension proposed text** (Mgr recommendation): -> STOP SIGNAL: wanting an 11th variant (or 12th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 10 variants covering ConstantCost / PolynomialCost { degree: PositiveRational } / PolyLogCost { exponent: PositiveInt } / LogCost / ProductCost / SumCost / ExponentialCost { base: IntAtLeastTwo } / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. +> STOP SIGNAL: wanting a 10th variant (or 11th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 9 variants covering ConstantCost / PolynomialCost { degree: PositiveRational } / PolyLogCost { exponent: PositiveInt } / LogCost / ProductCost / SumCost / ExponentialCost { base: IntAtLeastTwo } / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. **Type-level refinement carriers** (per codex BLOCKING on PR #2828 — `docs/modeling-discipline.md` Practice 2 + Practice 6: invariants encoded in type system, NOT fold normalizer): @@ -252,7 +252,7 @@ Per `INVARIANTS.md` "Cost of Change": | State | Files to edit to add one new asymptotic-bound consumer | |---|---| | Pre-canvas (today) | ≥3 (variant if Tier-2-coverable; algebra rules; consumer site) | -| Post-canvas (10-variant Q2-Y) | 1 (consumer constructs the appropriate Tier-1 variant directly) | +| Post-canvas (9-variant Q2-Y) | 1 (consumer constructs the appropriate Tier-1 variant directly) | For exotic (Tier-2) bounds: still requires UnknownCost("reason") at consumer site — that's the R4-deferral receipt. @@ -263,7 +263,7 @@ Director ratification on: - **Q1**: a / b / c (Mgr-rec: c — layered OrderedField introduction + lazy consumer migration) - **Q2**: X (keep Linear separate) / Y (collapse to PolynomialCost(degree=1)) (Mgr-rec: Y per §P5) - **Q3**: §5 algebra interaction rule table; §5.1 PolyLog-vs-Product disposition (Mgr-rec: b composite); §5.2 FactorialCost squared (Mgr-rec: b UnknownCost) -- **Q4**: §6 STOP-SIGNAL text (10 or 11 variants depending on Q2) +- **Q4**: §6 STOP-SIGNAL text (9 or 10 variants depending on Q2) - **Q5**: This canvas (ratification-of-canvas is itself the Q5 disposition) - **§8 Tier-2 mechanism**: defer to R4 (Mgr-rec) or accept IteratedAlgebra mechanism (rejected by §8 analysis) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 77519ddaba4..868ee5535a2 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -82,10 +82,10 @@ type Rational = OrderedField> Replace `src/v3/std/algebra.dag:60-72` block with (Director-ratified verbatim per canvas §6): ``` -// STOP SIGNAL: wanting an 11th variant (or 12th if Tier-2 +// STOP SIGNAL: wanting a 10th variant (or 11th if Tier-2 // IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and // escalate. Tier-1 textbook coverage (gate #105 carrier-extension -// 2026-05-13, PR #) lands 10 variants covering ConstantCost / +// 2026-05-13, PR #) lands 9 variants covering ConstantCost / // PolynomialCost(Rational > 0) / PolyLogCost / LogCost / ProductCost / // SumCost / ExponentialCost / FactorialCost / UnknownCost — sufficient // for the asymptotic surface that R3-load-bearing lenses reason about. @@ -145,7 +145,7 @@ type SymbolicCost inhabits Semiring | UnknownCost(String) ``` -10 variants. **LinearCost is REMOVED** (anti-pattern #7: no bridge variants; atomic migration). +9 variants. **LinearCost is REMOVED** (anti-pattern #7: no bridge variants; atomic migration). **Invariants encoded at carrier level** (Practice 2/6 — NOT fold normalizer): - `PolynomialCost.degree: PositiveRational` — `degree ≤ 0` is structurally impossible @@ -189,7 +189,7 @@ Mirror `src/v3/compiler/tests/integration/cementing/` shape (cf. `complexity_len - `OrderedField` declared in `dsl/std/algebra.dag` with 16 record fields (Field 9 + Order 7) - `Rational = OrderedField>` at `dsl/std/rational.dag:26` - Algebra rule sample tests (≥6 of §6 rules): assert fold output for representative inputs (e.g., `PolyCost(1/2) · PolyCost(1/2)` produces `PolyCost(1)`; `ExpCost(2,n) · PolyCost(d)` produces `ExpCost(2,n)`; `FactorialCost(n)²` produces `UnknownCost` with the exact §5.2 reason-string) -- STOP-SIGNAL text at `:60-72` contains new "11th variant" wording +- STOP-SIGNAL text at `:60-72` contains new "10th variant" wording ## §8. Phase F — Consumer migration (atomic) @@ -230,7 +230,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 1. **Q1-c integrity**: OrderedField MUST strict-mirror OrderedRing record shape (compare/lt/le/gt/ge minimum) 2. **Q2-Y integrity**: NO LinearCost preservation paths alongside PolyCost(degree=1); atomic migration receipt required 3. **Q3 algebra rules**: §5.1 + §5.2 dispositions are load-bearing; reviewers flag deviation -4. **Q4 STOP-SIGNAL text**: must land at `src/v3/std/algebra.dag:69-72` with new variant cap at 11 (10 ratified + 1 trigger) +4. **Q4 STOP-SIGNAL text**: must land at `src/v3/std/algebra.dag:69-72` with new variant cap at 10 (9 ratified + 1 trigger) 5. **All 7 anti-patterns enforceable** at PR review ## §13. Verification @@ -260,7 +260,7 @@ Closes gate #105 symbolic_cost_textbook_coverage_landed. Carrier extended per Director-ratified Path A Tier 1 (canvas PR #2828; ratification PM msg_a055c38b relaying msg_d86a5987 2026-05-13). -Net 7 → 10 SymbolicCost variants (Q2-Y collapse Linear into +Net 7 → 9 SymbolicCost variants (Q2-Y collapse Linear into PolynomialCost(degree=1)): [paste §5 variant set verbatim] @@ -268,7 +268,7 @@ Companion substrate (Q1-c): - OrderedField witness in dsl/std/algebra.dag (strict-mirror of OrderedRing) - Rational = OrderedField> -STOP-SIGNAL re-reset to 11 (10 ratified + 1 trigger) at algebra.dag:60-72. +STOP-SIGNAL re-reset to 10 (9 ratified + 1 trigger) at algebra.dag:60-72. Algebra rules §5/§6 implemented verbatim per canvas; (n!)² → UnknownCost ("(v!)² exceeds Tier 1 — pending R4 named-variant canvas"). From 21b831cd88e0b226b9a42181c785654b3ade1701 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 04:35:00 +0000 Subject: [PATCH 11/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20Q1?= =?UTF-8?q?=20premise=20correction=20per=20operator=20BLOCKING=20canvas:48?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Operator BLOCKING #2 on PR #2828 canvas:48 caught real authority error: Field at dsl/std/algebra.dag:294 ALREADY has compare: fn(T,T)->Ordering. The canvas claim "Rational supports add+mul+inverse, NOT order" was wrong — Field carries the foundational order primitive. Introducing OrderedField would create parallel order authority. This invalidates the original Q1-c ratification premise (PM msg_a055c38b). Q1 disposition needs RE-RATIFICATION: Revised candidate set (canvas §3 REVISED): - Q1-α (Mgr-rec): use existing Field.compare via Rational; lt/le/gt/ge as cost-lens-local free functions. Zero new substrate. - Q1-β: extend Field in-place with 6 derived predicate fields. Larger blast radius; mirrors OrderedRing predicate set on Field directly. - Q1-γ: OrderedField as Field-superset via type-level inheritance. Requires DSL grammar prerequisite (worker grep-verifies). Worker brief Phase A regenerated under Q1-α assumption (smallest scope): - NO OrderedField type introduction - NO Rational re-declaration - Cost-lens-local rational_lt/le/gt/ge/max helpers derived from rational.compare (existing Field operation) Anti-pattern #6 reworded: "Parallel order authority — adding any new OrderedField or equivalent witness when Field.compare already exists at algebra.dag:294 (Q1 premise-corrected anti-pattern)". Canvas + worker brief both note re-ratification required; if Director prefers Q1-β or Q1-γ, Phase A regenerates. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ate-gate-105-symbolic-cost-tier1-canvas.md | 68 ++++++++----- ...ate-gate-105-symbolic-cost-tier1-worker.md | 98 ++++++++++--------- 2 files changed, 95 insertions(+), 71 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 2e1439f3c7e..a06d6023efe 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -45,55 +45,69 @@ Tier 2 R4-DEFERRED per Director with named-consumer-trigger requirement: - `src/v3/std/algebra.dag:190-197`: current 7 variants (ConstantCost, LinearCost, PolynomialCost with `degree: DegreeAtLeastTwo`, ProductCost, SumCost, LogCost, UnknownCost) - `src/v3/std/algebra.dag:60-72`: STOP SIGNAL "wanting an eighth variant" - `dsl/std/algebra.dag:268-286`: `OrderedRing` witness with `compare/lt/le/gt/ge` already defined -- `dsl/std/algebra.dag:287-...`: `Field` defined WITHOUT order operations -- `dsl/std/rational.dag:26`: `type Rational = Field>` — supports add+mul+inverse, NOT order. Confirmed: NO `OrderedField` witness exists at HEAD. +- `dsl/std/algebra.dag:287-295`: `Field` — **CORRECTION per operator BLOCKING 2026-05-13 (canvas:48)**: Field ALREADY has `compare: fn(T, T) -> Ordering` (line 294). The earlier "defined WITHOUT order operations" claim was wrong. Field is missing the derived order predicates (lt/le/gt/ge/eq/ne) that `OrderedRing` carries (lines 268-286), but the foundational `compare` operator IS already on Field. +- `dsl/std/rational.dag:26`: `type Rational = Field>`. Per above correction: Rational already carries `compare` via Field — order primitive is present. What's missing is the convenience-predicate set (lt/le/gt/ge/eq/ne). This invalidates the original Q1 premise; see §3 revised candidate set below. - `dsl/std/computation.dag:8`: "algebra.dag says 'Int inhabits OrderedRing'" — Int is ordered, but Rational is not -## §3. Q1 — Rational dominance lattice (substrate-shape question) +## §3. Q1 — Rational dominance lattice (substrate-shape question; REVISED per operator BLOCKING canvas:48) -Polynomial dominance requires **total order on Rational** to compare degrees (1/2 < 1 < 2/3 < 1 < 2 < 2.373). `Rational = Field<...>` carries no order witness. +**Premise correction**: Earlier canvas authoring claimed Rational "carries no order witness." This was wrong — `Field` at `dsl/std/algebra.dag:294` already has `compare: fn(T, T) -> Ordering`. Rational therefore already carries the foundational order primitive. What's missing is the **derived order predicates** (lt/le/gt/ge/eq/ne) that `OrderedRing` carries on top of `compare`. -### Candidate Q1-a — Extend Rational with OrderedField witness +The original Q1-a/Q1-b/Q1-c framing — and the prior Director-ratified Q1-c disposition — was based on the stale premise. Introducing `OrderedField` now would create **parallel order authority** with the existing `Field.compare` field. Anti-pattern. -Add `type OrderedField { ... }` in `dsl/std/algebra.dag` analogous to `OrderedRing` (lines 268-286), with `add/sub/zero/negate/mul/div/one + compare/eq/lt/le/gt/ge + reciprocal/divide`. Refit Rational: -```dag -type Rational = OrderedField> -``` +### REVISED Candidate Q1-α — Use `Field.compare` directly + derive helpers as free functions + +Scope: +- Cost-lens fold uses `Rational.compare` directly via existing `Field>.compare` +- Where lt/le/gt/ge convenience predicates are needed in cost-lens body, define them as free functions on `Rational` in cost-lens module (e.g., `rational_lt(a, b) = compare(a, b) == Less`) +- **No `OrderedField` introduction**; no `Rational` re-declaration; no modifications to `dsl/std/algebra.dag` or `dsl/std/rational.dag` Pros: -- Strict-mirror of `OrderedRing` precedent (`feedback_strict_mirror_vs_novel_substrate_fact` applies — no novel substrate fact; ratifies directly) -- Rational gains order as a first-class field witness; benefits all consumers (not just cost-lens) -- Clean Practice-4 placement: order is structurally part of the field's algebra, not bolted on +- Zero new substrate; uses existing `Field.compare` +- Cost-lens-local convenience helpers; no foundational algebra touched +- No parallel order authority Cons: -- Touches a foundational algebra carrier; cross-program impact requires checking all `Field<>` consumers -- Adds 7 functions to the witness record (compare/eq/lt/le/gt/ge + ne) +- lt/le/gt/ge live as free functions, not on the carrier (mild Cost-of-Change-2 for future predicate sites if free functions need refactor) -### Candidate Q1-b — Carry parallel Int-tuple representation for comparison +### REVISED Candidate Q1-β — Extend `Field` with derived order predicates (in-place) -Add per-PolynomialCost-degree-comparison helpers that decompose `Rational = p/q` into `(p, q)` Int-tuples and compare via cross-multiplication (`a/b ≶ c/d ⟺ ad ≶ bc` since q > 0). +Scope: +- Add `lt: fn(T, T) -> Bool`, `le`, `gt`, `ge`, `eq`, `ne` to `Field` at `dsl/std/algebra.dag:287` — mirroring the OrderedRing record's predicate set +- No new type; `Field` becomes the single authority for ordered-field operations +- Refit Rational stays at `Field>` Pros: -- Localizes to cost-lens; no foundational algebra touched -- Useful even if a future OrderedField lands (correctness check) +- Strict in-place extension of foundational carrier; no parallel-rep +- Single authority — `Field.compare` is foundational; derived predicates compose on it +- Cost-lens fold uses `Rational.lt`, `Rational.le`, etc. directly (Cost-of-Change-1 for future predicate sites) Cons: -- **Parallel-rep risk**: comparison logic lives in cost-lens body, not on the Rational carrier — two-source-of-truth posture if Rational consumers elsewhere later need order -- Anti-pattern #4 (Director-enumerated): "Dominance lattice fudging via string-tagged Rational (use real ordered-witness)" — partial application risk +- Touches foundational `Field` shape; affects all `Field` consumers (witness record gets 6 new fields) +- Migration: existing `Field` witness realizations must populate the new predicate fields -### Candidate Q1-c — Substrate Mgr discretion (third approach) +### REVISED Candidate Q1-γ — `OrderedField` strict-superset (former Q1-c REVISED with explicit reconciliation) -**Proposed Q1-c**: Layered approach — land `OrderedField` witness alongside `Rational` re-declaration, BUT scope the OrderedField introduction strictly to enable rational ordering at the algebraic-witness layer; do NOT preemptively migrate existing `Field` consumers. Migration occurs only if a consumer surfaces a need. This is Q1-a's substrate landing + lazy consumer migration. +Scope: +- Add `type OrderedField` extending Field with the missing 6 predicates, EXPLICITLY reconciled: `Field.compare` is the foundational primitive; OrderedField inherits compare from its Field-shaped sub-record and adds derived predicates +- This requires DSL support for sub-record inheritance / type-level inclusion — check at HEAD whether the grammar supports this Pros: -- Lands the structural fix without cross-program migration burden -- Strict-mirror precedent (OrderedRing → OrderedField analogous addition) -- Future consumers can adopt incrementally; no breaking change +- Cleanest Practice-4 layering; OrderedField is structurally Field-plus-predicates +- Field consumers unchanged; OrderedField consumers gain full predicate set Cons: -- Two `Field`-shaped witnesses exist (Field + OrderedField) — potential confusion until full migration +- DSL inheritance grammar may not exist at HEAD (worker brief must grep-verify before authoring) +- Two carriers (Field + OrderedField); the prior parallel-authority concern returns unless inheritance is structural, not parallel + +**Revised Mgr recommendation**: **Q1-α** (use `Field.compare` + cost-lens-local free functions). Reasoning: +- Zero new substrate; zero foundational-algebra-touch +- `feedback_strict_mirror_vs_novel_substrate_fact` does NOT apply here — there's no need for a new witness shape since Field already carries the foundational primitive +- `feedback_no_short_term_solutions` is also irrelevant — this is the canonical use-existing-substrate pattern, not a workaround +- Q1-β is acceptable if Director prefers carrier-uniform predicate set, but the migration scope is broader +- Q1-γ requires DSL-grammar prerequisite check; defer unless Q1-α is rejected -**Mgr recommendation**: Q1-c. Combines Q1-a structural correctness with bounded blast-radius. +**Re-ratification required**: Director's prior Q1-c ratification (PM msg_a055c38b relaying msg_d86a5987) was based on the stale premise. With premise corrected, Q1 needs re-disposition. Most likely lands on Q1-α (smallest scope, premise-corrected) but Director may prefer Q1-β for carrier uniformity. ## §4. Q2 — Linear-vs-Polynomial split reconciliation diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 868ee5535a2..4bfd8e21822 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -20,62 +20,72 @@ This brief encodes the ratified Tier-1 4-addition + 1-collapse + 1-promotion str ## §1. Ratified scope summary -Net 7 → **10** SymbolicCost variants: +Net 7 → **9** SymbolicCost variants: - **PROMOTE**: `PolynomialCost.degree: DegreeAtLeastTwo` → `PolynomialCost.degree: Rational where degree > 0` (subsumes √n, ∛n, n^(2/3), non-Int 2.373, AND the absorbed Linear case at degree=1) - **REMOVE**: `LinearCost(SizeVariable)` — atomic migration to `PolynomialCost { var: v, degree: 1 }` (Q2-Y) - **ADD**: `PolyLogCost { var: SizeVariable, exponent: Int }` for log^k n - **ADD**: `ExponentialCost { base: Int, var: SizeVariable }` for c^n with c ≥ 2 - **ADD**: `FactorialCost { var: SizeVariable }` for n! -Sibling substrate (Q1-c — separate but co-landing in same PR): -- **ADD**: `OrderedField` witness in `dsl/std/algebra.dag` (strict-mirror of `OrderedRing` at :268-286) -- **PROMOTE**: `Rational = OrderedField>` at `dsl/std/rational.dag:26` +Sibling substrate (Q1 — Rational ordering; **DISPOSITION REVISED per operator BLOCKING canvas:48 2026-05-13**): + +**Original Q1-c (OrderedField introduction) IS REJECTED**: `Field` at `dsl/std/algebra.dag:294` already carries `compare: fn(T, T) -> Ordering`. Introducing `OrderedField` would create parallel order authority. + +**Revised disposition pending Director re-ratification** (see canvas §3 REVISED). Worker brief Phase A scope below assumes **Q1-α** (use `Field.compare` directly + define lt/le/gt/ge as cost-lens-local free functions). If Director re-ratifies as Q1-β or Q1-γ, this section regenerates accordingly. + +Under Q1-α: +- **NO `OrderedField` introduction** +- **NO `Rational` re-declaration** at `dsl/std/rational.dag:26` +- Cost-lens fold uses `Rational.compare` via existing `Field.compare` +- Cost-lens-local free functions: `rational_lt(a, b) = compare(a, b) == Less` (and `_le`, `_gt`, `_ge`, `_eq`, `_ne` as needed by §6 algebra rules) ## §2. Authority chain (verbatim) - `src/v3/std/algebra.dag:60-72` — current STOP SIGNAL (will be rewritten per §4) - `src/v3/std/algebra.dag:190-197` — current 7-variant `SymbolicCost` - `dsl/std/algebra.dag:268-286` — `OrderedRing` precedent (`compare/lt/le/gt/ge` witness pattern) -- `dsl/std/algebra.dag:287-...` — current `Field` (no order) +- `dsl/std/algebra.dag:287-295` — current `Field` (carries `compare: fn(T, T) -> Ordering` at :294; missing derived predicates lt/le/gt/ge/eq/ne — see §3 Q1-α premise correction) - `dsl/std/rational.dag:26` — `type Rational = Field>` - `docs/design-symbolic-cost-algebra.md` — current algebra - Canvas: PR #2828 / `docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md` §§3-9 - Ratification: PM msg_a055c38b relaying Director msg_d86a5987 -## §3. Phase A — OrderedField witness landing (Q1-c) +## §3. Phase A — Rational ordering helpers (Q1-α; **PENDING Director re-ratification**) -**Sub-phase A.1 — Declare `OrderedField`** in `dsl/std/algebra.dag` adjacent to existing `Field`. Strict-mirror of `OrderedRing` (:268-286) — same 7 order operators added on top of Field: +**Premise correction**: `Field` at `dsl/std/algebra.dag:294` ALREADY has `compare: fn(T, T) -> Ordering`. The original Phase A introducing `OrderedField` was based on stale premise (rejected per operator BLOCKING canvas:48). -```dag -type OrderedField { - add: fn(T, T) -> T - sub: fn(T, T) -> T - zero: T - negate: fn(T) -> T - mul: fn(T, T) -> T - div: fn(T, T) -> Result - one: T - reciprocal: fn(T) -> T - divide: fn(T, T) -> T - compare: fn(T, T) -> Ordering - eq: fn(T, T) -> Bool - ne: fn(T, T) -> Bool - lt: fn(T, T) -> Bool - le: fn(T, T) -> Bool - gt: fn(T, T) -> Bool - ge: fn(T, T) -> Bool -} -``` +**Under Q1-α (pending re-ratification)**: -**Sub-phase A.2 — Re-declare `Rational`** at `dsl/std/rational.dag:26`: +- **NO `OrderedField` introduction** — Field carries `compare` already +- **NO `Rational` re-declaration** at `dsl/std/rational.dag:26` — stays as `Field>` +- **Cost-lens-local convenience helpers**: define lt/le/gt/ge as free functions on Rational in cost-lens module, derived from existing `Rational.compare`: ```dag -type Rational = OrderedField> +// In src/v3/lenses/cost.dag (or equivalent cost-lens module). +// Convenience predicates derived from Rational.compare. Single source of +// truth remains Field.compare at dsl/std/algebra.dag:294. + +fn rational_lt(a: Rational, b: Rational) -> Bool = + rational.compare(a, b) == Less + +fn rational_le(a: Rational, b: Rational) -> Bool = + rational.compare(a, b) == Less || rational.compare(a, b) == Equal + +fn rational_gt(a: Rational, b: Rational) -> Bool = + rational.compare(a, b) == Greater + +fn rational_max(a: Rational, b: Rational) -> Rational = + match rational.compare(a, b) { + Greater => a + _ => b + } ``` -**Sub-phase A.3 — Lazy consumer migration** (anti-pattern #6): do NOT migrate existing `Field` consumers preemptively. Field + OrderedField coexist as the Ring/OrderedRing parallel. Only the cost-lens (this PR) needs OrderedField operations on Rational. +**Witness realization**: Rational's Field-witness realization (`compare` for `FieldOfFractions`) uses Int cross-multiplication: `a/b ≶ c/d ⟺ ad ≶ bc` when b·d > 0. If this realization is NOT yet wired at HEAD, Phase A may need to land the data witness; worker grep-verifies before authoring. + +**If Director re-ratifies as Q1-β** (extend Field with lt/le/gt/ge in-place): Phase A becomes a `dsl/std/algebra.dag:287` extension instead — adds 6 predicate fields to `Field` and refits all Field-realizations. Larger blast radius. -**Sub-phase A.4 — Witness realization**: the `OrderedField>` realization can use Int cross-multiplication for compare (`a/b ≶ c/d ⟺ ad ≶ bc` when b·d > 0). Hand-author the data witness alongside the type. +**If Director re-ratifies as Q1-γ** (OrderedField as Field-superset with inheritance): worker grep-verifies DSL grammar supports type-level inheritance before authoring; if not supported, falls back to Q1-α. ## §4. Phase B — STOP SIGNAL rewrite (Q4) @@ -119,7 +129,7 @@ type PositiveInt // PositiveRational: strict-positive Rational. Constructor accepts only // numerator > 0 + denominator > 0 (excluding 0 and negative). Realization -// follows OrderedField from Phase A. +// follows Rational compare via existing Field>.compare (no OrderedField introduction; Q1-α). type PositiveRational { numerator: PositiveInt denominator: PositiveInt @@ -160,8 +170,8 @@ Update sum + product fold logic to implement the Director-ratified rule table (c | Operation | Result | |---|---| -| `PolyCost(d1) + PolyCost(d2)` | `PolyCost(max(d1, d2))` (uses `OrderedField.compare`) | -| `PolyCost(d1) · PolyCost(d2)` | `PolyCost(d1 + d2)` (uses `OrderedField.add`) | +| `PolyCost(d1) + PolyCost(d2)` | `PolyCost(max(d1, d2))` (uses `Rational.compare` (Q1-α free function `rational_max`)) | +| `PolyCost(d1) · PolyCost(d2)` | `PolyCost(d1 + d2)` (uses `Rational.add` (Field)) | | `PolyCost(d) · LogCost(v)` | `ProductCost([PolyCost(d), LogCost(v)])` (§5.1: composite, NOT PolyLogCost) | | `PolyLogCost(v, k1) · PolyLogCost(v, k2)` | `PolyLogCost(v, k1+k2)` | | `PolyLogCost(v, k1) + PolyLogCost(v, k2)` | `PolyLogCost(v, max(k1, k2))` | @@ -175,8 +185,8 @@ Update sum + product fold logic to implement the Director-ratified rule table (c | `FactorialCost(v) · FactorialCost(v)` | `UnknownCost("(v!)² exceeds Tier 1 — pending R4 named-variant canvas")` (§5.2 verbatim) | Normalization invariants in fold (canvas §5.3): -- `PolyCost(1/2) · PolyCost(1/2)` normalizes to `PolyCost(1)` via `OrderedField.add` -- Sum/product dominance applies `OrderedField.compare` for all max-style reductions +- `PolyCost(1/2) · PolyCost(1/2)` normalizes to `PolyCost(1)` via `Rational.add` (Field) +- Sum/product dominance applies `Rational.compare` (Field) for all max-style reductions - The collapsed Linear (`PolyCost(d=1)`) participates uniformly in sum/product ## §7. Phase E — Bootstrap ratchet test @@ -186,8 +196,8 @@ Mirror `src/v3/compiler/tests/integration/cementing/` shape (cf. `complexity_len `src/v3/compiler/tests/integration/cementing/symbolic_cost_tier1_carrier_test.rs` asserting: - 10 variant count (assert against `cost.dag` or `algebra.dag` source); REMOVED LinearCost - All 10 variant names + field shapes structurally present -- `OrderedField` declared in `dsl/std/algebra.dag` with 16 record fields (Field 9 + Order 7) -- `Rational = OrderedField>` at `dsl/std/rational.dag:26` +- Phase A Q1-α deliverables present: rational_lt/le/gt/ge/eq/ne free functions in cost-lens module; NO OrderedField type declared +- `Rational = Field>` UNCHANGED at `dsl/std/rational.dag:26` (Q1-α) - Algebra rule sample tests (≥6 of §6 rules): assert fold output for representative inputs (e.g., `PolyCost(1/2) · PolyCost(1/2)` produces `PolyCost(1)`; `ExpCost(2,n) · PolyCost(d)` produces `ExpCost(2,n)`; `FactorialCost(n)²` produces `UnknownCost` with the exact §5.2 reason-string) - STOP-SIGNAL text at `:60-72` contains new "10th variant" wording @@ -209,7 +219,7 @@ After Phase A-F land + tests green, update `docs/r3-program-plan.md` §1.8 row # 1. **`OrderedRing` shape drift** at HEAD — if `dsl/std/algebra.dag:268-286` no longer carries the exact 14-field signature this brief mirrors, **STOP** and surface — strict-mirror authority broken. 2. **Existing `LinearCost`-consumer surface differs from canvas assumption** — if grep reveals consumer paths that can't migrate to `PolynomialCost(degree=1)` losslessly (e.g., type-level dispatches on LinearCost variant-tag), **STOP** — anti-pattern #7 atomic-migration discipline requires lossless migration. 3. **`Rational` carrier not at `dsl/std/rational.dag:26`** — if Rational has moved / changed shape since 2026-05-13 grep, **STOP** — Q1-c re-declaration target is wrong. -4. **Variant-name collision** at HEAD — if any of `PolyLogCost` / `ExponentialCost` / `FactorialCost` / `OrderedField` appear from parallel landing, **STOP** for de-duplication. +4. **Variant-name collision** at HEAD — if any of `PolyLogCost` / `ExponentialCost` / `FactorialCost` / `PositiveRational` / `IntAtLeastTwo` / `PositiveInt` appear from parallel landing, **STOP** for de-duplication. 5. **Algebra rule §5.2 violation tempted** — if Phase D authoring tempts a named (n!)² variant or non-Unknown disposition, **STOP** — anti-pattern #5 fires; the rule disposition is Director-ratified. 6. **PR #2824 not merged at dispatch** OR **PR #2828 not merged at dispatch** — both gates AND; if either is unmerged, **STOP** and surface to Mgr; worker dispatch is blocked. @@ -222,12 +232,12 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 3. Linear-Polynomial split decision authored without canvas (substrate-shape question goes through Mgr) 4. Dominance lattice fudging via string-tagged Rational (use real ordered-witness) — §3 Q1-c addresses 5. UnknownCost used for textbook-Tier-1-coverable bounds post-promotion (STOP-SIGNAL violation) -6. `OrderedField` witness landed without strict-mirror of `OrderedRing` (Q1-c structural-mirror discipline) +6. Parallel order authority — adding any new `OrderedField` or equivalent witness when `Field.compare` already exists at algebra.dag:294 (Q1 premise-corrected anti-pattern) 7. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) ## §12. 5 reviewer ratchets (Director-enumerated for PR review) -1. **Q1-c integrity**: OrderedField MUST strict-mirror OrderedRing record shape (compare/lt/le/gt/ge minimum) +1. **Q1-α integrity**: NO new OrderedField type; Rational ordering uses existing Field.compare via cost-lens-local free functions 2. **Q2-Y integrity**: NO LinearCost preservation paths alongside PolyCost(degree=1); atomic migration receipt required 3. **Q3 algebra rules**: §5.1 + §5.2 dispositions are load-bearing; reviewers flag deviation 4. **Q4 STOP-SIGNAL text**: must land at `src/v3/std/algebra.dag:69-72` with new variant cap at 10 (9 ratified + 1 trigger) @@ -236,7 +246,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: ## §13. Verification - `cargo test --workspace` green -- New hermetic ratchet `symbolic_cost_tier1_carrier_test.rs` (§7) asserts all 4 verification axes (variant set / OrderedField / Rational / algebra rules sample / STOP-SIGNAL text) +- New hermetic ratchet `symbolic_cost_tier1_carrier_test.rs` (§7) asserts all 4 verification axes (variant set / refinement carriers (PositiveRational/PositiveInt/IntAtLeastTwo) / algebra rules sample / STOP-SIGNAL text) - Pre-existing cost-lens behavioral tests still green (Phase F migration must preserve semantic equivalence: `LinearCost(v)` and `PolynomialCost { var: v, degree: 1 }` must produce identical lens output for all consumers) - PR body cites: - Gate #105 closure (Phase G ledger update) @@ -265,8 +275,8 @@ PolynomialCost(degree=1)): [paste §5 variant set verbatim] Companion substrate (Q1-c): -- OrderedField witness in dsl/std/algebra.dag (strict-mirror of OrderedRing) -- Rational = OrderedField> +- Cost-lens-local Rational ordering helpers (Q1-α; NO new OrderedField) +- Rational stays as Field> (UNCHANGED) STOP-SIGNAL re-reset to 10 (9 ratified + 1 trigger) at algebra.dag:60-72. From f5056682ff9f01a95cfee182b791e8bddede70e8 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 04:36:41 +0000 Subject: [PATCH 12/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20fix?= =?UTF-8?q?=20unsound=20multiplicative=20absorption=20rules=20per=20operat?= =?UTF-8?q?or=20BLOCKING=20worker:140?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Operator BLOCKING caught real asymptotic-analysis error: multiplicative absorption rules like `PolyCost(d) · ExpCost(c, v) = ExpCost(c, v)` are UNSOUND. n^d · c^n / c^n = n^d is unbounded as n → ∞, so n^d · c^n is NOT O(c^n) strictly. Same problem with FactorialCost · PolyCost and FactorialCost · ExpCost. Fix: multiplicative absorption rules removed; replaced with composite ProductCost retention: - PolyCost(d) · ExpCost(c, v) → ProductCost([PolyCost(d), ExpCost(c, v)]) - FactorialCost(v) · PolyCost(d) → ProductCost([FactorialCost, PolyCost(d)]) - FactorialCost(v) · ExpCost(c, v) → ProductCost([FactorialCost, ExpCost]) ADDITIVE dominance rules unchanged (those ARE sound — n^d + c^n = O(c^n) because dominant term wins; only multiplicative absorption is unsound). Both canvas §5 + worker brief §6 rule tables updated. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../r3-substrate-gate-105-symbolic-cost-tier1-canvas.md | 6 +++--- .../r3-substrate-gate-105-symbolic-cost-tier1-worker.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index a06d6023efe..7c58669d253 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -162,12 +162,12 @@ Existing rules (from `docs/design-symbolic-cost-algebra.md` + algebra.dag fold o | `PolyCost(d) · LogCost(v)` | `PolyLogCost { var: v, exponent: 1 }`? OR composite ProductCost? | Canvas question (see §5.1) | | `PolyLogCost(v, k1) · PolyLogCost(v, k2)` | `PolyLogCost(v, k1+k2)` | log^a · log^b = log^(a+b) | | `PolyCost(d) + ExpCost(c, v)` | `ExpCost(c, v)` | exp dominates poly | -| `PolyCost(d) · ExpCost(c, v)` | `ExpCost(c, v)` | exp absorbs poly multiplicatively too | +| `PolyCost(d) · ExpCost(c, v)` | `ProductCost([PolyCost(d), ExpCost(c, v)])` | composite, NOT absorbed — n^d · c^n is NOT O(c^n) (operator BLOCKING worker:140); additive absorption above is sound, multiplicative is NOT | | `ExpCost(c1, v) · ExpCost(c2, v)` | `ExpCost(c1·c2, v)` | c1^v · c2^v = (c1·c2)^v | | `ExpCost(c1, v) + ExpCost(c2, v)` (c1 < c2) | `ExpCost(c2, v)` | dominant base | | `FactorialCost(v) + anything` | `FactorialCost(v)` | factorial dominates | -| `FactorialCost(v) · PolyCost(d)` | `FactorialCost(v)` | factorial dominates | -| `FactorialCost(v) · ExpCost(c, v)` | `FactorialCost(v)` | factorial dominates exp | +| `FactorialCost(v) · PolyCost(d)` | `ProductCost([FactorialCost(v), PolyCost(d)])` | composite, NOT absorbed (n! · n^d not O(n!)) | +| `FactorialCost(v) · ExpCost(c, v)` | `ProductCost([FactorialCost(v), ExpCost(c, v)])` | composite, NOT absorbed (n! · c^n not O(n!)) | | `FactorialCost(v) · FactorialCost(v)` | `FactorialCost(v)`? OR `UnknownCost("v! · v! exceeds Tier 1")` | Canvas question (see §5.2) | ### §5.1 — PolyCost · LogCost normalization diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 4bfd8e21822..9e7c81819ae 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -176,12 +176,12 @@ Update sum + product fold logic to implement the Director-ratified rule table (c | `PolyLogCost(v, k1) · PolyLogCost(v, k2)` | `PolyLogCost(v, k1+k2)` | | `PolyLogCost(v, k1) + PolyLogCost(v, k2)` | `PolyLogCost(v, max(k1, k2))` | | `PolyCost(d) + ExpCost(c, v)` | `ExpCost(c, v)` (exp dominates poly) | -| `PolyCost(d) · ExpCost(c, v)` | `ExpCost(c, v)` (exp absorbs poly) | +| `PolyCost(d) · ExpCost(c, v)` | `ProductCost([PolyCost(d), ExpCost(c, v)])` — composite, NOT absorbed (n^d · c^n is NOT O(c^n) strictly; `n^d · c^n / c^n = n^d` is unbounded; multiplicative absorption is unsound per operator BLOCKING worker:140) | | `ExpCost(c1, v) + ExpCost(c2, v)`, c1 ≤ c2 | `ExpCost(c2, v)` (dominant base) | | `ExpCost(c1, v) · ExpCost(c2, v)` | `ExpCost(c1·c2, v)` (multiplicative composition) | | `FactorialCost(v) + anything` | `FactorialCost(v)` (factorial dominates) | -| `FactorialCost(v) · PolyCost(d)` | `FactorialCost(v)` (factorial absorbs poly) | -| `FactorialCost(v) · ExpCost(c, v)` | `FactorialCost(v)` (factorial dominates exp) | +| `FactorialCost(v) · PolyCost(d)` | `ProductCost([FactorialCost(v), PolyCost(d)])` — composite, NOT absorbed (same unsoundness; n! · n^d / n! = n^d unbounded) | +| `FactorialCost(v) · ExpCost(c, v)` | `ProductCost([FactorialCost(v), ExpCost(c, v)])` — composite, NOT absorbed (n! · c^n / n! = c^n unbounded) | | `FactorialCost(v) · FactorialCost(v)` | `UnknownCost("(v!)² exceeds Tier 1 — pending R4 named-variant canvas")` (§5.2 verbatim) | Normalization invariants in fold (canvas §5.3): From 014544f4a8cad08edf17d9dc34dcf72f4f1cc1bc Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 04:39:50 +0000 Subject: [PATCH 13/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20Q1-?= =?UTF-8?q?=CE=B1=20Director-RATIFIED;=20add=206th=20anti-pattern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Director re-ratified Q1 to Q1-α per msg_676ad4e7 (supersedes msg_d86a5987 Q1-c), retraction explicit. Updates: Canvas + worker brief §3: - "PENDING re-ratification" framing removed - Q1-c rejection cites INVARIANTS P1 + row #24 + Q-MachineConstraint-Carrier - Q1-β + Q1-γ rejections documented (Director rationale verbatim) Anti-patterns: - NEW Director-ratified #6: "Introducing parallel ordered-algebraic-structure carriers (Ordered) when underlying carrier already provides compare: fn(T,T) -> Ordering" - NEW Mgr-derived #7: "Multiplicative absorption rules where one variant absorbs another asymptotically" (operator BLOCKING worker:140 retained as permanent anti-pattern receipt) Canvas: 6 Director + 2 Mgr-derived = 8 total Worker brief: 8 anti-patterns total (matches canvas) PR body framing template + reviewer ratchet count updated 7 → 8 Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ate-gate-105-symbolic-cost-tier1-canvas.md | 17 ++++++---- ...ate-gate-105-symbolic-cost-tier1-worker.md | 33 +++++++++---------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 7c58669d253..4b56cc450ef 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -49,7 +49,7 @@ Tier 2 R4-DEFERRED per Director with named-consumer-trigger requirement: - `dsl/std/rational.dag:26`: `type Rational = Field>`. Per above correction: Rational already carries `compare` via Field — order primitive is present. What's missing is the convenience-predicate set (lt/le/gt/ge/eq/ne). This invalidates the original Q1 premise; see §3 revised candidate set below. - `dsl/std/computation.dag:8`: "algebra.dag says 'Int inhabits OrderedRing'" — Int is ordered, but Rational is not -## §3. Q1 — Rational dominance lattice (substrate-shape question; REVISED per operator BLOCKING canvas:48) +## §3. Q1 — Rational dominance lattice (Director RATIFIED Q1-α per msg_676ad4e7 2026-05-13; supersedes msg_d86a5987 Q1-c) **Premise correction**: Earlier canvas authoring claimed Rational "carries no order witness." This was wrong — `Field` at `dsl/std/algebra.dag:294` already has `compare: fn(T, T) -> Ordering`. Rational therefore already carries the foundational order primitive. What's missing is the **derived order predicates** (lt/le/gt/ge/eq/ne) that `OrderedRing` carries on top of `compare`. @@ -107,7 +107,11 @@ Cons: - Q1-β is acceptable if Director prefers carrier-uniform predicate set, but the migration scope is broader - Q1-γ requires DSL-grammar prerequisite check; defer unless Q1-α is rejected -**Re-ratification required**: Director's prior Q1-c ratification (PM msg_a055c38b relaying msg_d86a5987) was based on the stale premise. With premise corrected, Q1 needs re-disposition. Most likely lands on Q1-α (smallest scope, premise-corrected) but Director may prefer Q1-β for carrier uniformity. +**Director ratified Q1-α** (msg_676ad4e7 2026-05-13, explicit retraction of msg_d86a5987 Q1-c). Director acknowledged discipline-miss (failure to grep `dsl/std/algebra.dag` for existing Field carrier shape before ratifying); will fold incident as Case 3 in `feedback_grep_substrate_before_naming_ratification`. + +Q1-β REJECTED: doubles Field carrier surface (7→13) for predicates derivable from Ordering pattern-match. + +Q1-γ REJECTED: DSL grammar inheritance/superset typing R4-scope at earliest. ## §4. Q2 — Linear-vs-Polynomial split reconciliation @@ -244,20 +248,21 @@ For each Tier-1 addition under §1: No 🔴 RED introductions. Anti-pattern #2 (Director-enumerated): "Path B revival (RootCost as separate variant — Practice-4 RED)" — explicitly NOT done; roots are PolynomialCost(degree=1/2 etc.). -## §10. Anti-patterns (5 Director-enumerated + 2 derived) +## §10. Anti-patterns (6 Director-enumerated + 2 derived) ### Director-enumerated 1. Any Tier 2 variant named without consumer-evidence (premature variants) — §8 disposition: not introducing 2. Any Path B revival (RootCost as separate variant — Practice-4 RED) — §9: explicitly not done 3. Linear-Polynomial split decision authored without canvas (substrate-shape question goes through Mgr) — this canvas IS the §4 Q2 disposition -4. Dominance lattice fudging via string-tagged Rational (use real ordered-witness) — §3 Q1-c addresses +4. Dominance lattice fudging via string-tagged Rational (use real ordered-witness) — §3 Q1-α addresses via existing Field.compare 5. UnknownCost used for textbook-Tier-1-coverable bounds post-promotion (STOP-SIGNAL violation) — §6 STOP-SIGNAL text encodes +6. **NEW (Director-ratified msg_676ad4e7)**: Introducing parallel ordered-algebraic-structure carriers (`Ordered`) when the underlying carrier already provides `compare: fn(T, T) -> Ordering`. Lens-local predicate derivation from Ordering pattern-match is the canonical path. — §3 Q1-α addresses ### Mgr-derived (encoded for worker review) -6. `OrderedField` witness landed without strict-mirror of `OrderedRing` (Q1-c structural-mirror discipline) -7. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) +7. Multiplicative absorption rules where one variant absorbs another (`X · Y = X`) when X is asymptotically larger than Y additively — asymptotic absorption is sound for SUM but NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products must be `ProductCost` composite. §5 algebra rules table addresses (operator BLOCKING worker:140). +8. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) ## §11. Cost-of-change accounting diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 9e7c81819ae..3f55921376c 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -27,13 +27,11 @@ Net 7 → **9** SymbolicCost variants: - **ADD**: `ExponentialCost { base: Int, var: SizeVariable }` for c^n with c ≥ 2 - **ADD**: `FactorialCost { var: SizeVariable }` for n! -Sibling substrate (Q1 — Rational ordering; **DISPOSITION REVISED per operator BLOCKING canvas:48 2026-05-13**): +Sibling substrate (Q1 — Rational ordering; **Director RATIFIED Q1-α per msg_676ad4e7 2026-05-13**, retracting prior Q1-c msg_d86a5987): -**Original Q1-c (OrderedField introduction) IS REJECTED**: `Field` at `dsl/std/algebra.dag:294` already carries `compare: fn(T, T) -> Ordering`. Introducing `OrderedField` would create parallel order authority. +**Original Q1-c (OrderedField introduction) REJECTED**: `Field` at `dsl/std/algebra.dag:294` already carries `compare: fn(T, T) -> Ordering` (precedent: `OrderedRing.compare` at `:276`). Introducing `OrderedField` would have duplicated Field.compare authority, violating INVARIANTS P1 + row #24 + Q-MachineConstraint-Carrier "no dual representations". -**Revised disposition pending Director re-ratification** (see canvas §3 REVISED). Worker brief Phase A scope below assumes **Q1-α** (use `Field.compare` directly + define lt/le/gt/ge as cost-lens-local free functions). If Director re-ratifies as Q1-β or Q1-γ, this section regenerates accordingly. - -Under Q1-α: +**Director-ratified Q1-α**: - **NO `OrderedField` introduction** - **NO `Rational` re-declaration** at `dsl/std/rational.dag:26` - Cost-lens fold uses `Rational.compare` via existing `Field.compare` @@ -50,11 +48,11 @@ Under Q1-α: - Canvas: PR #2828 / `docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md` §§3-9 - Ratification: PM msg_a055c38b relaying Director msg_d86a5987 -## §3. Phase A — Rational ordering helpers (Q1-α; **PENDING Director re-ratification**) +## §3. Phase A — Rational ordering helpers (Q1-α; Director RATIFIED msg_676ad4e7) -**Premise correction**: `Field` at `dsl/std/algebra.dag:294` ALREADY has `compare: fn(T, T) -> Ordering`. The original Phase A introducing `OrderedField` was based on stale premise (rejected per operator BLOCKING canvas:48). +**Premise correction landed**: `Field` at `dsl/std/algebra.dag:294` carries `compare: fn(T, T) -> Ordering`. Original Phase A introducing `OrderedField` was based on stale premise (operator BLOCKING canvas:48); Director retracted msg_d86a5987 Q1-c via msg_676ad4e7. -**Under Q1-α (pending re-ratification)**: +**Under Q1-α (ratified)**: - **NO `OrderedField` introduction** — Field carries `compare` already - **NO `Rational` re-declaration** at `dsl/std/rational.dag:26` — stays as `Field>` @@ -83,9 +81,9 @@ fn rational_max(a: Rational, b: Rational) -> Rational = **Witness realization**: Rational's Field-witness realization (`compare` for `FieldOfFractions`) uses Int cross-multiplication: `a/b ≶ c/d ⟺ ad ≶ bc` when b·d > 0. If this realization is NOT yet wired at HEAD, Phase A may need to land the data witness; worker grep-verifies before authoring. -**If Director re-ratifies as Q1-β** (extend Field with lt/le/gt/ge in-place): Phase A becomes a `dsl/std/algebra.dag:287` extension instead — adds 6 predicate fields to `Field` and refits all Field-realizations. Larger blast radius. +Q1-β (extend Field with predicate fields) REJECTED by Director — doubles Field carrier surface (7→13) for predicates derivable from Ordering pattern-match; violates cost-of-change minimization. -**If Director re-ratifies as Q1-γ** (OrderedField as Field-superset with inheritance): worker grep-verifies DSL grammar supports type-level inheritance before authoring; if not supported, falls back to Q1-α. +Q1-γ (OrderedField as Field-superset via inheritance) REJECTED by Director — DSL grammar inheritance/superset typing R4-scope at earliest; forward-incompatible with R3 timeline. ## §4. Phase B — STOP SIGNAL rewrite (Q4) @@ -223,17 +221,18 @@ After Phase A-F land + tests green, update `docs/r3-program-plan.md` §1.8 row # 5. **Algebra rule §5.2 violation tempted** — if Phase D authoring tempts a named (n!)² variant or non-Unknown disposition, **STOP** — anti-pattern #5 fires; the rule disposition is Director-ratified. 6. **PR #2824 not merged at dispatch** OR **PR #2828 not merged at dispatch** — both gates AND; if either is unmerged, **STOP** and surface to Mgr; worker dispatch is blocked. -## §11. 7 anti-patterns (5 Director-enumerated + 2 Mgr-derived per canvas §10) +## §11. 8 anti-patterns (6 Director-enumerated + 2 Mgr-derived per canvas §10) PR body MUST cite each verbatim + assert receipt-of-compliance: 1. Any Tier 2 variant named without consumer-evidence (premature variants) 2. Any Path B revival (RootCost as separate variant — Practice-4 RED) 3. Linear-Polynomial split decision authored without canvas (substrate-shape question goes through Mgr) -4. Dominance lattice fudging via string-tagged Rational (use real ordered-witness) — §3 Q1-c addresses +4. Dominance lattice fudging via string-tagged Rational (use real ordered-witness) — §3 Q1-α addresses via existing Field.compare 5. UnknownCost used for textbook-Tier-1-coverable bounds post-promotion (STOP-SIGNAL violation) -6. Parallel order authority — adding any new `OrderedField` or equivalent witness when `Field.compare` already exists at algebra.dag:294 (Q1 premise-corrected anti-pattern) -7. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) +6. **Director-ratified msg_676ad4e7**: Introducing parallel ordered-algebraic-structure carriers (`Ordered`) when the underlying carrier already provides `compare: fn(T, T) -> Ordering` — lens-local predicate derivation from Ordering pattern-match is the canonical path +7. Multiplicative absorption rules (`X · Y = X`) where one variant absorbs another asymptotically — sound for SUM, NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products MUST be ProductCost composite (per operator BLOCKING worker:140) +8. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) ## §12. 5 reviewer ratchets (Director-enumerated for PR review) @@ -241,7 +240,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 2. **Q2-Y integrity**: NO LinearCost preservation paths alongside PolyCost(degree=1); atomic migration receipt required 3. **Q3 algebra rules**: §5.1 + §5.2 dispositions are load-bearing; reviewers flag deviation 4. **Q4 STOP-SIGNAL text**: must land at `src/v3/std/algebra.dag:69-72` with new variant cap at 10 (9 ratified + 1 trigger) -5. **All 7 anti-patterns enforceable** at PR review +5. **All 8 anti-patterns enforceable** at PR review ## §13. Verification @@ -251,7 +250,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: - PR body cites: - Gate #105 closure (Phase G ledger update) - Canvas PR #2828 + Director disposition (PM msg_a055c38b) verbatim Q1-Q5 + §8 - - 7 anti-patterns receipt-of-compliance (§11) + - 8 anti-patterns receipt-of-compliance (§11) - 5 reviewer ratchets (§12) — explicit assertion-of-compliance per item ## §14. Out of scope @@ -283,7 +282,7 @@ STOP-SIGNAL re-reset to 10 (9 ratified + 1 trigger) at algebra.dag:60-72. Algebra rules §5/§6 implemented verbatim per canvas; (n!)² → UnknownCost ("(v!)² exceeds Tier 1 — pending R4 named-variant canvas"). -7 anti-patterns receipt-of-compliance: +8 anti-patterns receipt-of-compliance: [enumerate each + cite that the implementation does not violate it] 5 reviewer ratchets compliance: From d93e2eaffe7cceac74c1916817b2c1d0e15bb425 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 05:04:03 +0000 Subject: [PATCH 14/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20ref?= =?UTF-8?q?inement=20types=20for=20PolyLogExponent=20+=20ExponentialBase?= =?UTF-8?q?=20per=20operator=20BLOCKING=20PR=20#2824:333?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Operator BLOCKING #4 on PR #2824 (relayed via PM msg_92bc8538): - PolyLogCost { exponent: Int } admits exponent=0 (ConstantCost dup), exponent=1 (LogCost dup), negative; cannot represent log^7.5 (AKS Tier-1 case) - ExponentialCost { base: Int } admits base=0/1 (degenerate/ConstantCost) - Same Practice 2/6 illegal-states-unrepresentable class as prior codex BLOCKING (commit 3d21cb7afb) Fix: - NEW refinement carrier ExponentialBase (Int ≥ 2; renames IntAtLeastTwo to PM-ledger naming per row #105 commit 8049ccde4) - NEW refinement carrier PolyLogExponent (Rational > 1; admits 7.5/AKS) - PolyLogCost.exponent: PositiveInt → PolyLogExponent - ExponentialCost.base: IntAtLeastTwo → ExponentialBase - PositiveRational unchanged (PolynomialCost.degree already correctly bounded > 0 by this carrier) 7th Director-pending anti-pattern added: "Tier-1 variant constructed with raw Int/Rational bypassing refinement type" (matches PM's row #105 ledger 7th anti-pattern per PR #2824:8049ccde4). Updated counts: - Canvas §10: 6→7 Director + 2 Mgr-derived - Worker brief §11: 8→9 anti-patterns total Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ate-gate-105-symbolic-cost-tier1-canvas.md | 16 +++-- ...ate-gate-105-symbolic-cost-tier1-worker.md | 65 +++++++++++++------ 2 files changed, 53 insertions(+), 28 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 4b56cc450ef..175d833483f 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -26,8 +26,8 @@ PR #2824 (PM) carries §1.8 row #105 authority anchor; landing pending. Worker b ## §1. Ratified Tier 1 variant list (verbatim per Director msg_ad5e934d) 1. **PROMOTE**: `PolynomialCost { var: SizeVariable, degree: Rational }` (subsumes √n = n^(1/2), ∛n = n^(1/3), n^(2/3), and non-integer poly n^2.373 + n^2.807, plus existing integer poly) -2. **ADD**: `PolyLogCost { var: SizeVariable, exponent: Int }` for log² n, log^k n -3. **ADD**: `ExponentialCost { base: Int, var: SizeVariable }` for 2^n, c^n with c ≥ 2 +2. **ADD**: `PolyLogCost { var: SizeVariable, exponent: PolyLogExponent }` for log² n, log^k n (PolyLogExponent = Rational > 1 refinement; supports log^7.5 n / AKS Tier-1 case per operator BLOCKING PR #2824:333) +3. **ADD**: `ExponentialCost { base: ExponentialBase, var: SizeVariable }` for 2^n, c^n with c ≥ 2 (ExponentialBase = Int ≥ 2 refinement) 4. **ADD**: `FactorialCost { var: SizeVariable }` for n! Net `src/v3/std/algebra.dag:190-197` final variant count: **9** (was 7). @@ -202,13 +202,14 @@ Current `src/v3/std/algebra.dag:69-72`: > STOP SIGNAL: wanting an eighth variant. Pause and escalate rather than extending; the thesis claim is that seven covers the asymptotic surface, and any new variant should carry its own dissolution receipt. **Post-extension proposed text** (Mgr recommendation): -> STOP SIGNAL: wanting a 10th variant (or 11th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 9 variants covering ConstantCost / PolynomialCost { degree: PositiveRational } / PolyLogCost { exponent: PositiveInt } / LogCost / ProductCost / SumCost / ExponentialCost { base: IntAtLeastTwo } / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. +> STOP SIGNAL: wanting a 10th variant (or 11th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 9 variants covering ConstantCost / PolynomialCost { degree: PositiveRational } / PolyLogCost { exponent: PolyLogExponent } / LogCost / ProductCost / SumCost / ExponentialCost { base: ExponentialBase } / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. **Type-level refinement carriers** (per codex BLOCKING on PR #2828 — `docs/modeling-discipline.md` Practice 2 + Practice 6: invariants encoded in type system, NOT fold normalizer): - `PositiveRational` — strict-positive Rational; constructor accepts only `> 0` values. Follows `DegreeAtLeastTwo` precedent at `src/v3/std/algebra.dag:171-173` (inductive carrier where illegal cases are structurally unrepresentable). -- `PositiveInt` — strict-positive Int; same Peano-style precedent. -- `IntAtLeastTwo` — Int ≥ 2; strict-mirror of `DegreeAtLeastTwo` shape. +- `PositiveInt` — strict-positive Int; same Peano-style precedent. Used by `PositiveRational`. +- `ExponentialBase` — Int ≥ 2; strict-mirror of `DegreeAtLeastTwo` shape. Used by `ExponentialCost.base`. +- `PolyLogExponent` — Rational > 1; required to support log^7.5 n (AKS Tier-1 case) per operator BLOCKING PR #2824:333; excludes exponent=0 (collapse to ConstantCost) + exponent=1 (collapse to LogCost). Used by `PolyLogCost.exponent`. These types make `degree ≤ 0`, `exponent ≤ 0`, `base ≤ 1` **structurally unrepresentable** at the carrier level — no normalizer-time enforcement required. Aligns with `feedback_state_space_vs_behavioral_invariants`. @@ -248,7 +249,7 @@ For each Tier-1 addition under §1: No 🔴 RED introductions. Anti-pattern #2 (Director-enumerated): "Path B revival (RootCost as separate variant — Practice-4 RED)" — explicitly NOT done; roots are PolynomialCost(degree=1/2 etc.). -## §10. Anti-patterns (6 Director-enumerated + 2 derived) +## §10. Anti-patterns (7 Director-enumerated/pending + 2 Mgr-derived) ### Director-enumerated @@ -257,7 +258,8 @@ No 🔴 RED introductions. Anti-pattern #2 (Director-enumerated): "Path B reviva 3. Linear-Polynomial split decision authored without canvas (substrate-shape question goes through Mgr) — this canvas IS the §4 Q2 disposition 4. Dominance lattice fudging via string-tagged Rational (use real ordered-witness) — §3 Q1-α addresses via existing Field.compare 5. UnknownCost used for textbook-Tier-1-coverable bounds post-promotion (STOP-SIGNAL violation) — §6 STOP-SIGNAL text encodes -6. **NEW (Director-ratified msg_676ad4e7)**: Introducing parallel ordered-algebraic-structure carriers (`Ordered`) when the underlying carrier already provides `compare: fn(T, T) -> Ordering`. Lens-local predicate derivation from Ordering pattern-match is the canonical path. — §3 Q1-α addresses +6. **Director-ratified msg_676ad4e7**: Introducing parallel ordered-algebraic-structure carriers (`Ordered`) when the underlying carrier already provides `compare: fn(T, T) -> Ordering`. Lens-local predicate derivation from Ordering pattern-match is the canonical path. — §3 Q1-α addresses +7. **NEW (pending Director ratification per operator BLOCKING PR #2824:333)**: Tier-1 variant constructed with raw Int/Rational exponent/base that admits illegal collapse values (exponent=0/1 for PolyLogCost; base=0/1 for ExponentialCost; degree≤0 for PolynomialCost) bypassing the refinement type. PolyLogExponent/ExponentialBase/PositiveRational are required at the type level (Practice 2/6; illegal-states-unrepresentable). ### Mgr-derived (encoded for worker review) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 3f55921376c..ed45a098b22 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -23,8 +23,8 @@ This brief encodes the ratified Tier-1 4-addition + 1-collapse + 1-promotion str Net 7 → **9** SymbolicCost variants: - **PROMOTE**: `PolynomialCost.degree: DegreeAtLeastTwo` → `PolynomialCost.degree: Rational where degree > 0` (subsumes √n, ∛n, n^(2/3), non-Int 2.373, AND the absorbed Linear case at degree=1) - **REMOVE**: `LinearCost(SizeVariable)` — atomic migration to `PolynomialCost { var: v, degree: 1 }` (Q2-Y) -- **ADD**: `PolyLogCost { var: SizeVariable, exponent: Int }` for log^k n -- **ADD**: `ExponentialCost { base: Int, var: SizeVariable }` for c^n with c ≥ 2 +- **ADD**: `PolyLogCost { var: SizeVariable, exponent: PolyLogExponent }` for log^k n (PolyLogExponent = Rational > 1 refinement; supports log^7.5 n cited Tier-1 AKS case) +- **ADD**: `ExponentialCost { base: ExponentialBase, var: SizeVariable }` for c^n with c ≥ 2 (ExponentialBase = Int ≥ 2 refinement) - **ADD**: `FactorialCost { var: SizeVariable }` for n! Sibling substrate (Q1 — Rational ordering; **Director RATIFIED Q1-α per msg_676ad4e7 2026-05-13**, retracting prior Q1-c msg_d86a5987): @@ -94,8 +94,10 @@ Replace `src/v3/std/algebra.dag:60-72` block with (Director-ratified verbatim pe // IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and // escalate. Tier-1 textbook coverage (gate #105 carrier-extension // 2026-05-13, PR #) lands 9 variants covering ConstantCost / -// PolynomialCost(Rational > 0) / PolyLogCost / LogCost / ProductCost / -// SumCost / ExponentialCost / FactorialCost / UnknownCost — sufficient +// PolynomialCost { degree: PositiveRational } / PolyLogCost { exponent: +// PolyLogExponent (Rational > 1) } / LogCost / ProductCost / SumCost / +// ExponentialCost { base: ExponentialBase (Int ≥ 2) } / FactorialCost / +// UnknownCost — sufficient // for the asymptotic surface that R3-load-bearing lenses reason about. // Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is // R4-DEFERRED per Director ratification msg_d86a5987; new variants in @@ -117,21 +119,41 @@ Before reshaping SymbolicCost, introduce three refinement carriers that make ill // Mirror of DegreeAtLeastTwo (lines 171-173): Peano-style inductive // carrier where illegal cases are structurally unrepresentable, not // normalizer-cleaned-up. -type IntAtLeastTwo - = IntTwo - | IntSuccessor { previous: IntAtLeastTwo } - +// ExponentialBase: Int ≥ 2 (admits 2, 3, 4, ...; rejects 0, 1, negative). +// Strict-mirror of DegreeAtLeastTwo precedent. +type ExponentialBase + = ExponentialBaseTwo + | ExponentialBaseSuccessor { previous: ExponentialBase } + +// PositiveInt: strict-positive Int (admits 1, 2, ...; rejects 0, negative). +// Used by PositiveRational realization. type PositiveInt = One | PositiveSuccessor { previous: PositiveInt } -// PositiveRational: strict-positive Rational. Constructor accepts only -// numerator > 0 + denominator > 0 (excluding 0 and negative). Realization -// follows Rational compare via existing Field>.compare (no OrderedField introduction; Q1-α). +// PositiveRational: strict-positive Rational (numerator/denominator both +// PositiveInt). Used as PolynomialCost.degree (any positive degree valid, +// including degree=1 absorbing former LinearCost). type PositiveRational { numerator: PositiveInt denominator: PositiveInt } + +// PolyLogExponent: Rational > 1 (admits 2, 7.5, 3/2, ...; rejects ≤ 1). +// Rejects exponent=1 to avoid semantic collision with LogCost. +// Rejects exponent=0 to avoid collapse to ConstantCost. +// Rational rather than Int because Tier-1 cites textbook log^7.5 n (AKS). +// Implementation: PositiveRational with structural invariant numerator > +// denominator. Worker authors as inductive carrier or refinement-typed +// PositiveRational subset per DSL grammar support. +type PolyLogExponent { + // numerator > denominator > 0 (strictly greater than 1) + numerator: PositiveInt + denominator: PositiveInt + // Invariant: numerator > denominator. Worker grep-verifies DSL refinement + // grammar; if not available, expresses as separate inductive carrier + // mirroring ExponentialBase shape (RationalGreaterThanOne). +} ``` These types make `degree ≤ 0`, `exponent ≤ 0`, `base ≤ 1` structurally impossible to construct — no fold-time enforcement required. @@ -144,11 +166,11 @@ Replace `src/v3/std/algebra.dag:190-197` with: type SymbolicCost inhabits Semiring = ConstantCost(Int) | PolynomialCost { var: SizeVariable, degree: PositiveRational } // Q2-Y: absorbs LinearCost via degree=1; degree > 0 by carrier - | PolyLogCost { var: SizeVariable, exponent: PositiveInt } // NEW: log^k n; exponent ≥ 1 by carrier + | PolyLogCost { var: SizeVariable, exponent: PolyLogExponent } // NEW: log^k n; exponent > 1 by carrier (admits 2, 3/2, 7.5; rejects 0/1 collapses) | ProductCost(NonSingletonList) | SumCost(NonSingletonList) | LogCost(SizeVariable) - | ExponentialCost { base: IntAtLeastTwo, var: SizeVariable } // NEW: c^n with c ≥ 2 by carrier + | ExponentialCost { base: ExponentialBase, var: SizeVariable } // NEW: c^n with c ≥ 2 by carrier | FactorialCost { var: SizeVariable } // NEW: n! | UnknownCost(String) ``` @@ -157,8 +179,8 @@ type SymbolicCost inhabits Semiring **Invariants encoded at carrier level** (Practice 2/6 — NOT fold normalizer): - `PolynomialCost.degree: PositiveRational` — `degree ≤ 0` is structurally impossible -- `PolyLogCost.exponent: PositiveInt` — `exponent ≤ 0` is structurally impossible -- `ExponentialCost.base: IntAtLeastTwo` — `base ≤ 1` is structurally impossible +- `PolyLogCost.exponent: PolyLogExponent` — `exponent ≤ 1` is structurally impossible (excludes 0=ConstantCost-collapse + 1=LogCost-collapse semantic dups); supports rational exponents like log^7.5 n (AKS primality cited Tier-1 case) +- `ExponentialCost.base: ExponentialBase` — `base ≤ 1` is structurally impossible (excludes 0=degenerate + 1=ConstantCost-collapse) Reviewers MUST flag any attempt to use raw `Rational` / `Int` for these fields. @@ -221,7 +243,7 @@ After Phase A-F land + tests green, update `docs/r3-program-plan.md` §1.8 row # 5. **Algebra rule §5.2 violation tempted** — if Phase D authoring tempts a named (n!)² variant or non-Unknown disposition, **STOP** — anti-pattern #5 fires; the rule disposition is Director-ratified. 6. **PR #2824 not merged at dispatch** OR **PR #2828 not merged at dispatch** — both gates AND; if either is unmerged, **STOP** and surface to Mgr; worker dispatch is blocked. -## §11. 8 anti-patterns (6 Director-enumerated + 2 Mgr-derived per canvas §10) +## §11. 9 anti-patterns (7 Director-enumerated/pending + 2 Mgr-derived per canvas §10) PR body MUST cite each verbatim + assert receipt-of-compliance: @@ -231,8 +253,9 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 4. Dominance lattice fudging via string-tagged Rational (use real ordered-witness) — §3 Q1-α addresses via existing Field.compare 5. UnknownCost used for textbook-Tier-1-coverable bounds post-promotion (STOP-SIGNAL violation) 6. **Director-ratified msg_676ad4e7**: Introducing parallel ordered-algebraic-structure carriers (`Ordered`) when the underlying carrier already provides `compare: fn(T, T) -> Ordering` — lens-local predicate derivation from Ordering pattern-match is the canonical path -7. Multiplicative absorption rules (`X · Y = X`) where one variant absorbs another asymptotically — sound for SUM, NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products MUST be ProductCost composite (per operator BLOCKING worker:140) -8. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) +7. **Pending Director ratification per operator BLOCKING PR #2824:333**: Tier-1 variant constructed with raw Int/Rational exponent/base admitting illegal collapse values (exponent=0/1 for PolyLogCost; base=0/1 for ExponentialCost; degree≤0 for PolynomialCost) bypassing refinement type — PolyLogExponent/ExponentialBase/PositiveRational required at carrier level (Practice 2/6) +8. Multiplicative absorption rules (`X · Y = X`) where one variant absorbs another asymptotically — sound for SUM, NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products MUST be ProductCost composite (per operator BLOCKING worker:140) +9. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) ## §12. 5 reviewer ratchets (Director-enumerated for PR review) @@ -240,7 +263,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 2. **Q2-Y integrity**: NO LinearCost preservation paths alongside PolyCost(degree=1); atomic migration receipt required 3. **Q3 algebra rules**: §5.1 + §5.2 dispositions are load-bearing; reviewers flag deviation 4. **Q4 STOP-SIGNAL text**: must land at `src/v3/std/algebra.dag:69-72` with new variant cap at 10 (9 ratified + 1 trigger) -5. **All 8 anti-patterns enforceable** at PR review +5. **All 9 anti-patterns enforceable** at PR review ## §13. Verification @@ -250,7 +273,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: - PR body cites: - Gate #105 closure (Phase G ledger update) - Canvas PR #2828 + Director disposition (PM msg_a055c38b) verbatim Q1-Q5 + §8 - - 8 anti-patterns receipt-of-compliance (§11) + - 9 anti-patterns receipt-of-compliance (§11) - 5 reviewer ratchets (§12) — explicit assertion-of-compliance per item ## §14. Out of scope @@ -282,7 +305,7 @@ STOP-SIGNAL re-reset to 10 (9 ratified + 1 trigger) at algebra.dag:60-72. Algebra rules §5/§6 implemented verbatim per canvas; (n!)² → UnknownCost ("(v!)² exceeds Tier 1 — pending R4 named-variant canvas"). -8 anti-patterns receipt-of-compliance: +9 anti-patterns receipt-of-compliance: [enumerate each + cite that the implementation does not violate it] 5 reviewer ratchets compliance: From bb1d9d030e4aeeb59450c491819b44eb56f398ab Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 05:08:30 +0000 Subject: [PATCH 15/36] =?UTF-8?q?docs(r3):=20gate=20#105=20worker=20brief?= =?UTF-8?q?=20=E2=80=94=20pre-wire=20P5=20receipt=20requirement=20per=20cl?= =?UTF-8?q?aude=20APPROVE=2010773?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit claude review 10773 exploratory observation (non-blocking): when worker authors symbolic_cost_tier1_carrier_test.rs, INVARIANTS P5 requires explicit single checkable receipt (deletion / SG-0 census shrink / named-lane deferral) in PR body. Pre-wire so worker doesn't re-derive. Added §13 verification bullet: canonical receipt is Phase F cost-lens consumer migration (deletes LinearCost variant + collapses fallback dispatch paths) — that net hand-Rust deletion is the P5 receipt for the new test file. Also corrected refinement carrier name list (was: PositiveRational/ PositiveInt/IntAtLeastTwo; now: PositiveRational/PositiveInt/ ExponentialBase/PolyLogExponent matching the post-d93e2eaffe naming). Co-Authored-By: Claude Opus 4.7 (1M context) --- .../briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index ed45a098b22..8215643853a 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -268,7 +268,8 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: ## §13. Verification - `cargo test --workspace` green -- New hermetic ratchet `symbolic_cost_tier1_carrier_test.rs` (§7) asserts all 4 verification axes (variant set / refinement carriers (PositiveRational/PositiveInt/IntAtLeastTwo) / algebra rules sample / STOP-SIGNAL text) +- New hermetic ratchet `symbolic_cost_tier1_carrier_test.rs` (§7) asserts all 4 verification axes (variant set / refinement carriers (PositiveRational/PositiveInt/ExponentialBase/PolyLogExponent) / algebra rules sample / STOP-SIGNAL text) +- **INVARIANTS P5 receipt for the new hand-Rust test file** (per claude APPROVE review 10773 exploratory observation): authoring `symbolic_cost_tier1_carrier_test.rs` adds new hand-Rust under `src/v3/compiler/tests/`. Per P5 "Pure Bootstrap" discipline, this PR's body MUST cite ONE of: (a) a concrete hand-Rust deletion of equivalent or greater LOC elsewhere; (b) SG-0 census shrink receipt; (c) named-lane deferral with explicit dissolution-trigger naming. Pre-wired here so worker doesn't re-derive; the canonical receipt is the cost-lens consumer migration Phase F (which deletes LinearCost variant + collapses fallback dispatch paths — that net hand-Rust deletion is the P5 receipt for the new test file). - Pre-existing cost-lens behavioral tests still green (Phase F migration must preserve semantic equivalence: `LinearCost(v)` and `PolynomialCost { var: v, degree: 1 }` must produce identical lens output for all consumers) - PR body cites: - Gate #105 closure (Phase G ledger update) From c787f754a85029399a4192d4984f232e7d554d6b Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 05:24:25 +0000 Subject: [PATCH 16/36] =?UTF-8?q?docs(r3):=20gate=20#105=20worker=20brief?= =?UTF-8?q?=20=E2=80=94=20address=20codex=20BLOCKING=20014544f4=20findings?= =?UTF-8?q?=202/3/4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit codex review 014544f4 surfaced 4 BLOCKING findings (sha pre-d93e2eaffe). Findings 1 + partial-2 covered by intervening d93e2eaffe (refinement types). Residual findings 2/3/4 addressed in this commit: Finding 2 — refinement-mixed-with-product on PolyLogExponent: - Previous shape was `{ numerator, denominator }` with textual "numerator > denominator" invariant — exact refinement-mixed-with-product pattern codex forbids - New inductive shape: PolyLogExponentSuccessor | PolyLogExponentFractional with FractionalPart in (0, 1] structurally; whole ≥ 1 + fraction > 0 yields value > 1 by carrier shape - HARD STOP added: do NOT author as record-with-comment-invariant - Worker grep-verifies DSL refinement support; if not available, ratify inductive shape pre-authoring Finding 3 — cross-variable dominance gap: - §6 algebra rules table prefaced with explicit "Variable-scoping precondition" — rules assume same-variable operands; different-variable operations preserve as SumCost/ProductCost composite, not folded by dominance - Cross-variable dominance explicitly named undefined within Tier-1 substrate (Tier-2 / polynomial-multivariate scope post-R3) Finding 4 — P5 receipt category specificity: - §13 verification bullet now requires "exactly ONE P5 receipt category with concrete path + LOC count" (not narrative) - 3 categories enumerated: (a) hand-Rust deletion + LOC; (b) SG-0 census shrink + delta; (c) T-PB-B ROADMAP row + dissolution-trigger - Phase F LinearCost removal noted as LIKELY (a) source but worker MUST measure actual numbers, not assume narrative-equivalence Finding 1 (refinement-over-existing-Rational vs fresh records) surfaces a refinement-mechanism canvas question; routed to PM/Director (no fix in this commit; the residual product-shape for PositiveRational is preserved pending Director disposition on substrate-refinement-mechanism). Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ate-gate-105-symbolic-cost-tier1-worker.md | 67 ++++++++++++++----- 1 file changed, 50 insertions(+), 17 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 8215643853a..4954a47332b 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -139,21 +139,45 @@ type PositiveRational { denominator: PositiveInt } -// PolyLogExponent: Rational > 1 (admits 2, 7.5, 3/2, ...; rejects ≤ 1). -// Rejects exponent=1 to avoid semantic collision with LogCost. -// Rejects exponent=0 to avoid collapse to ConstantCost. -// Rational rather than Int because Tier-1 cites textbook log^7.5 n (AKS). -// Implementation: PositiveRational with structural invariant numerator > -// denominator. Worker authors as inductive carrier or refinement-typed -// PositiveRational subset per DSL grammar support. -type PolyLogExponent { - // numerator > denominator > 0 (strictly greater than 1) - numerator: PositiveInt - denominator: PositiveInt - // Invariant: numerator > denominator. Worker grep-verifies DSL refinement - // grammar; if not available, expresses as separate inductive carrier - // mirroring ExponentialBase shape (RationalGreaterThanOne). -} +// PolyLogExponent: Rational > 1. Admits 2, 7.5, 3/2; rejects ≤ 1. +// Per codex BLOCKING 014544f4 finding #2: invalid exponents must be +// structurally uninhabited, NOT expressed as a product-of-PositiveInts +// with an extra "numerator > denominator" invariant (refinement-mixed-with- +// product). The canonical inductive shape mirrors ExponentialBase: +// +// type PolyLogExponent +// = PolyLogExponentSuccessor { previous: PolyLogExponent } +// | PolyLogExponentBase { fractional_part: FractionalPart } +// +// where FractionalPart is itself a structurally-constrained rational in +// (0, 1] — admitting log^1.5, log^2, log^2.5, etc. — and PolyLogExponent +// values START at the "≥ 1" base case with FractionalPart > 0 required +// (to exclude exponent=1 collapse to LogCost). +// +// **Implementation note**: this requires either (i) DSL refinement-type +// grammar supporting "Rational > 1" as a type-level predicate, OR (ii) +// the inductive carrier above with FractionalPart > 0 invariant baked +// into FractionalPart's own constructors. Worker grep-verifies DSL +// refinement support at authoring time: +// - If (i) available: type PolyLogExponent = Rational where r > 1 +// - If (ii) only: ratify the inductive shape before authoring; this +// surfaces back to Mgr/Director per §10 STOP-condition new entry. +// +// **HARD STOP**: do NOT author PolyLogExponent as `{ numerator, denominator +// }` with a textual "numerator > denominator" comment — that's the exact +// refinement-mixed-with-product pattern codex 014544f4 BLOCKING #2 forbids. +type PolyLogExponent + = PolyLogExponentSuccessor { previous: PolyLogExponent } // ≥ 2 case + | PolyLogExponentFractional { whole: PositiveInt, fraction: FractionalPart } + // whole ≥ 1 + fraction in (0, 1] → result > 1; whole = 1 + fraction + // close to 0 approaches exponent = 1 but never reaches it; fraction > 0 + // strictly enforced by FractionalPart's own constructors + +// FractionalPart: rational in (0, 1]. Inductive: 1/n for n ≥ 1. +// (Sketch — worker authors final shape per DSL refinement support.) +type FractionalPart + = FractionalOne // 1/1 = 1 + | FractionalRecip { denominator: PositiveInt } // 1/d for d ≥ 1 → value in (0, 1] ``` These types make `degree ≤ 0`, `exponent ≤ 0`, `base ≤ 1` structurally impossible to construct — no fold-time enforcement required. @@ -186,7 +210,11 @@ Reviewers MUST flag any attempt to use raw `Rational` / `Int` for these fields. ## §6. Phase D — Algebra interaction rules (Q3) -Update sum + product fold logic to implement the Director-ratified rule table (canvas §5): +Update sum + product fold logic to implement the Director-ratified rule table (canvas §5). + +**Variable-scoping precondition** (per codex BLOCKING 014544f4 finding #3): the rules below assume **same-variable operands**. Different-variable operations (e.g., `PolyCost(n, d1) + PolyCost(m, d2)` where n ≠ m) are NOT folded by dominance — they preserve as `SumCost` / `ProductCost` composite. Algebra dominance is variable-local; cross-variable dominance is undefined within Tier-1 substrate (requires Tier-2 or polynomial-multivariate ratification post-R3). + +Same-variable rules (operands share `SizeVariable`): | Operation | Result | |---|---| @@ -269,7 +297,12 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: - `cargo test --workspace` green - New hermetic ratchet `symbolic_cost_tier1_carrier_test.rs` (§7) asserts all 4 verification axes (variant set / refinement carriers (PositiveRational/PositiveInt/ExponentialBase/PolyLogExponent) / algebra rules sample / STOP-SIGNAL text) -- **INVARIANTS P5 receipt for the new hand-Rust test file** (per claude APPROVE review 10773 exploratory observation): authoring `symbolic_cost_tier1_carrier_test.rs` adds new hand-Rust under `src/v3/compiler/tests/`. Per P5 "Pure Bootstrap" discipline, this PR's body MUST cite ONE of: (a) a concrete hand-Rust deletion of equivalent or greater LOC elsewhere; (b) SG-0 census shrink receipt; (c) named-lane deferral with explicit dissolution-trigger naming. Pre-wired here so worker doesn't re-derive; the canonical receipt is the cost-lens consumer migration Phase F (which deletes LinearCost variant + collapses fallback dispatch paths — that net hand-Rust deletion is the P5 receipt for the new test file). +- **INVARIANTS P5 receipt for the new hand-Rust test file** (per claude APPROVE 10773 + codex BLOCKING 014544f4 finding #4): authoring `symbolic_cost_tier1_carrier_test.rs` adds new hand-Rust under `src/v3/compiler/tests/`. Per P5 "Pure Bootstrap" discipline, this PR's body MUST cite **exactly ONE P5 receipt category** with concrete path + LOC count: + - (a) **hand-Rust deletion of equivalent or greater LOC**: cite specific deleted file/lines + LOC count + - (b) **SG-0 census shrink receipt**: cite specific SG-0 cell + shrink delta + - (c) **named-lane T-PB-B ROADMAP row deferral**: cite the ROADMAP row by ID + explicit dissolution-trigger condition + + **Worker MUST pick exactly one and document with concrete numbers, NOT narrative.** Phase F (LinearCost variant removal + fallback dispatch collapse) is the LIKELY (a) source — but worker measures actual LOC at authoring time. If Phase F deletion LOC < new test file LOC, worker MUST pick (b) or (c). Codex 014544f4 BLOCKING explicitly: "feature migration as debt receipt" is NOT a clean P5 receipt — concrete numbers required. - Pre-existing cost-lens behavioral tests still green (Phase F migration must preserve semantic equivalence: `LinearCost(v)` and `PolynomialCost { var: v, degree: 1 }` must produce identical lens output for all consumers) - PR body cites: - Gate #105 closure (Phase G ledger update) From adb841713c7ec2f5ef382d031099495a032c3856 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 05:26:07 +0000 Subject: [PATCH 17/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20fix?= =?UTF-8?q?=20FactorialCost=20dominance=20over-reach=20per=20operator=20BL?= =?UTF-8?q?OCKING=20worker:158?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Operator BLOCKING: 'FactorialCost(v) + anything = FactorialCost(v)' rule would erase UnknownCost (conservative-top) and incomparable SizeVariable dimensions, violating P2/P3. Fix: expand FactorialCost addition rule from single 'anything' catch-all to per-variant explicit enumeration: - FactorialCost + same-variable cost (Factorial/Exp/Poly/PolyLog/Log/ Constant) → FactorialCost (absorption valid) - FactorialCost + UnknownCost → SumCost composite (UnknownCost is conservative-top per algebra.dag; NEVER absorbed) - FactorialCost + FactorialCost different-variable → SumCost composite (cross-variable undefined per §6 precondition) Same-variable precondition from prior commit (c787f754a8 finding #3 fix) now explicitly applied per-rule for the FactorialCost row. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../r3-substrate-gate-105-symbolic-cost-tier1-worker.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 4954a47332b..a42f58ca81b 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -227,7 +227,14 @@ Same-variable rules (operands share `SizeVariable`): | `PolyCost(d) · ExpCost(c, v)` | `ProductCost([PolyCost(d), ExpCost(c, v)])` — composite, NOT absorbed (n^d · c^n is NOT O(c^n) strictly; `n^d · c^n / c^n = n^d` is unbounded; multiplicative absorption is unsound per operator BLOCKING worker:140) | | `ExpCost(c1, v) + ExpCost(c2, v)`, c1 ≤ c2 | `ExpCost(c2, v)` (dominant base) | | `ExpCost(c1, v) · ExpCost(c2, v)` | `ExpCost(c1·c2, v)` (multiplicative composition) | -| `FactorialCost(v) + anything` | `FactorialCost(v)` (factorial dominates) | +| `FactorialCost(v) + FactorialCost(v)` | `FactorialCost(v)` (same-variable absorption) | +| `FactorialCost(v) + ExpCost(c, v)` | `FactorialCost(v)` (factorial dominates exp, same-variable) | +| `FactorialCost(v) + PolyCost(d, v)` | `FactorialCost(v)` (factorial dominates poly, same-variable) | +| `FactorialCost(v) + PolyLogCost(v, k)` | `FactorialCost(v)` (factorial dominates polylog, same-variable) | +| `FactorialCost(v) + LogCost(v)` | `FactorialCost(v)` (factorial dominates log, same-variable) | +| `FactorialCost(v) + ConstantCost(c)` | `FactorialCost(v)` (factorial dominates constant) | +| `FactorialCost(v) + UnknownCost(r)` | `SumCost([FactorialCost(v), UnknownCost(r)])` — composite; UnknownCost is conservative-top per `src/v3/std/algebra.dag` documentation; NEVER absorbed (operator BLOCKING worker:158) | +| `FactorialCost(v) + FactorialCost(w)` (v ≠ w) | `SumCost([FactorialCost(v), FactorialCost(w)])` — composite; cross-variable dominance undefined per §6 precondition | | `FactorialCost(v) · PolyCost(d)` | `ProductCost([FactorialCost(v), PolyCost(d)])` — composite, NOT absorbed (same unsoundness; n! · n^d / n! = n^d unbounded) | | `FactorialCost(v) · ExpCost(c, v)` | `ProductCost([FactorialCost(v), ExpCost(c, v)])` — composite, NOT absorbed (n! · c^n / n! = c^n unbounded) | | `FactorialCost(v) · FactorialCost(v)` | `UnknownCost("(v!)² exceeds Tier 1 — pending R4 named-variant canvas")` (§5.2 verbatim) | From 344339aabb53976fc929e5be500c637090e7f0af Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 05:29:42 +0000 Subject: [PATCH 18/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20ref?= =?UTF-8?q?inement=20mechanism=20IS=20ratified;=20reshape=20carriers=20per?= =?UTF-8?q?=20PM=20msg=5Fa52ed981?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PM-grep correction (msg_a52ed981): substrate refinement-mechanism `type X = Y where predicate` is ALREADY RATIFIED at HEAD per gunbc#828 issuecomment-4390333451 Path 3 + Director Option 2. Mgr missed grep- verifying this when authoring path (i)/(ii) framing — same discipline class as feedback_grep_substrate_before_naming_ratification. Precedent: dsl/std/integer.dag:181 (`PositiveInt = Nat where gt_zero`). KNOWN_PREDICATES registry at lower.rs:798-862: range / non_empty / brand / gt_zero / unicode_scalar Reshape (worker brief §5.0 + canvas §6): - PositiveRational = Rational where gt_zero (REQUIRES gt_zero allowed_carriers extension to include Rational — Phase A atomic) - ExponentialBase = Int where range(min: 2) (IMMEDIATELY available; range predicate has Int in allowed_carriers) - PolyLogExponent = Rational where gt_one (REQUIRES NEW gt_one predicate; allowed_carriers Rational + Int; mirrors gt_zero shape; Phase A atomic) - PositiveInt reuses existing dsl/std/integer.dag:181 declaration ZERO new authority introduced. P1 single-authority + Practice 4 + Q- MachineConstraint-Carrier "no dual representations" all satisfied via refinement over canonical Rational/Int carriers. NEW Mgr-derived anti-pattern #8 added: parallel rational-number carriers when refinement-mechanism is available (PM-grep-corrected per msg_a52ed981 + codex 014544f4 finding #1). Phase A KNOWN_PREDICATES extensions: 1. gt_zero allowed_carriers + Rational 2. New gt_one predicate (Rational + Int; Bare arg) Both atomic with carrier landing per §P5. HARD STOP added: do NOT author fresh records/inductive sums when refinement is available. Anti-pattern counts: canvas §10 → 7 Director + 3 Mgr-derived = 10; worker brief §11 → 10 anti-patterns total. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ate-gate-105-symbolic-cost-tier1-canvas.md | 15 +-- ...ate-gate-105-symbolic-cost-tier1-worker.md | 108 +++++++----------- 2 files changed, 47 insertions(+), 76 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 175d833483f..a37bab7d0c6 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -204,14 +204,14 @@ Current `src/v3/std/algebra.dag:69-72`: **Post-extension proposed text** (Mgr recommendation): > STOP SIGNAL: wanting a 10th variant (or 11th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 9 variants covering ConstantCost / PolynomialCost { degree: PositiveRational } / PolyLogCost { exponent: PolyLogExponent } / LogCost / ProductCost / SumCost / ExponentialCost { base: ExponentialBase } / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. -**Type-level refinement carriers** (per codex BLOCKING on PR #2828 — `docs/modeling-discipline.md` Practice 2 + Practice 6: invariants encoded in type system, NOT fold normalizer): +**Type-level refinement carriers (CORRECTED per PM msg_a52ed981)** — refinement-mechanism `type X = Y where predicate` is ALREADY RATIFIED at HEAD per gunbc#828 issuecomment-4390333451 Path 3 + Director Option 2 (gunbc#828 issuecomment-4390199218). Precedent: `dsl/std/integer.dag:181` (`PositiveInt = Nat where gt_zero`). KNOWN_PREDICATES registry at `src/v3/compiler/src/lower.rs:798-862`: `range / non_empty / brand / gt_zero / unicode_scalar`. NO fresh-records / inductive-sum carriers — refinement over canonical carrier is the canonical path: -- `PositiveRational` — strict-positive Rational; constructor accepts only `> 0` values. Follows `DegreeAtLeastTwo` precedent at `src/v3/std/algebra.dag:171-173` (inductive carrier where illegal cases are structurally unrepresentable). -- `PositiveInt` — strict-positive Int; same Peano-style precedent. Used by `PositiveRational`. -- `ExponentialBase` — Int ≥ 2; strict-mirror of `DegreeAtLeastTwo` shape. Used by `ExponentialCost.base`. -- `PolyLogExponent` — Rational > 1; required to support log^7.5 n (AKS Tier-1 case) per operator BLOCKING PR #2824:333; excludes exponent=0 (collapse to ConstantCost) + exponent=1 (collapse to LogCost). Used by `PolyLogCost.exponent`. +- `PositiveRational = Rational where gt_zero` — REQUIRES `gt_zero` allowed_carriers extension to include `Rational` (atomic with carrier landing per Phase A) +- `ExponentialBase = Int where range(min: 2)` — IMMEDIATELY available via `range` predicate (allowed_carriers includes Int) +- `PolyLogExponent = Rational where gt_one` — REQUIRES NEW `gt_one` predicate (allowed_carriers: Rational + Int; mirrors `gt_zero` shape; atomic with carrier landing per Phase A) +- `PositiveInt = Nat where gt_zero` — ALREADY EXISTS at `dsl/std/integer.dag:181`; worker reuses -These types make `degree ≤ 0`, `exponent ≤ 0`, `base ≤ 1` **structurally unrepresentable** at the carrier level — no normalizer-time enforcement required. Aligns with `feedback_state_space_vs_behavioral_invariants`. +These refinements make `degree ≤ 0` / `exponent ≤ 1` / `base ≤ 1` **structurally unrepresentable** at the carrier level via the ratified refinement mechanism — Practice 2 + Practice 6 satisfied; INVARIANTS P1 (single authority) preserved (no parallel rational/int authority). Variant count: **10** post-Q2-Y (recommended), or **11** if Q2-X is ratified. @@ -249,7 +249,7 @@ For each Tier-1 addition under §1: No 🔴 RED introductions. Anti-pattern #2 (Director-enumerated): "Path B revival (RootCost as separate variant — Practice-4 RED)" — explicitly NOT done; roots are PolynomialCost(degree=1/2 etc.). -## §10. Anti-patterns (7 Director-enumerated/pending + 2 Mgr-derived) +## §10. Anti-patterns (7 Director-enumerated/pending + 3 Mgr-derived) ### Director-enumerated @@ -264,6 +264,7 @@ No 🔴 RED introductions. Anti-pattern #2 (Director-enumerated): "Path B reviva ### Mgr-derived (encoded for worker review) 7. Multiplicative absorption rules where one variant absorbs another (`X · Y = X`) when X is asymptotically larger than Y additively — asymptotic absorption is sound for SUM but NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products must be `ProductCost` composite. §5 algebra rules table addresses (operator BLOCKING worker:140). +8. **PM-grep-corrected per msg_a52ed981 + codex 014544f4 finding #1**: Parallel rational-number carriers (fresh records like `{ num: PositiveInt; denom: PositiveInt }`, inductive sums, or any carrier shape OTHER than refinement) when the canonical refinement-mechanism (`type X = Y where predicate`) is RATIFIED at HEAD per gunbc#828 issuecomment-4390333451 Path 3 + Director Option 2. Refinement over canonical `Rational = Field>` is the canonical path; precedent `PositiveInt = Nat where gt_zero` at `dsl/std/integer.dag:181`. Anti-pattern fires on ANY fresh-carrier shape when refinement is available. 8. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) ## §11. Cost-of-change accounting diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index a42f58ca81b..33f32a22632 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -113,74 +113,43 @@ Cite gate #105 + PR #2828 + msg_d86a5987 in the comment block. ### §5.0 — Type-level refinement carriers (per codex BLOCKING on PR #2828) -Before reshaping SymbolicCost, introduce three refinement carriers that make illegal field values **structurally unrepresentable** (Practice 2 + Practice 6; `docs/modeling-discipline.md`). Strict-mirror of `DegreeAtLeastTwo` precedent at `src/v3/std/algebra.dag:171-173`: +**Refinement-mechanism path (CORRECT per PM msg_a52ed981)**: the substrate refinement-mechanism `type X = Y where predicate` is **already ratified** at HEAD per gunbc#828 issuecomment-4390333451 (Path 3) + Director Option 2 ratification at gunbc#828 issuecomment-4390199218. Precedent: `dsl/std/integer.dag:181` — `type PositiveInt = Nat where gt_zero`. The `KNOWN_PREDICATES` registry at `src/v3/compiler/src/lower.rs:798-862` carries: `range` / `non_empty` / `brand` / `gt_zero` / `unicode_scalar`. + +This **invalidates** the prior product-shape carriers (codex BLOCKING 014544f4 finding #1 + operator BLOCKING worker:104). Canonical shape uses refinement over existing carriers: ```dag -// Mirror of DegreeAtLeastTwo (lines 171-173): Peano-style inductive -// carrier where illegal cases are structurally unrepresentable, not -// normalizer-cleaned-up. -// ExponentialBase: Int ≥ 2 (admits 2, 3, 4, ...; rejects 0, 1, negative). -// Strict-mirror of DegreeAtLeastTwo precedent. -type ExponentialBase - = ExponentialBaseTwo - | ExponentialBaseSuccessor { previous: ExponentialBase } - -// PositiveInt: strict-positive Int (admits 1, 2, ...; rejects 0, negative). -// Used by PositiveRational realization. -type PositiveInt - = One - | PositiveSuccessor { previous: PositiveInt } - -// PositiveRational: strict-positive Rational (numerator/denominator both -// PositiveInt). Used as PolynomialCost.degree (any positive degree valid, -// including degree=1 absorbing former LinearCost). -type PositiveRational { - numerator: PositiveInt - denominator: PositiveInt -} - -// PolyLogExponent: Rational > 1. Admits 2, 7.5, 3/2; rejects ≤ 1. -// Per codex BLOCKING 014544f4 finding #2: invalid exponents must be -// structurally uninhabited, NOT expressed as a product-of-PositiveInts -// with an extra "numerator > denominator" invariant (refinement-mixed-with- -// product). The canonical inductive shape mirrors ExponentialBase: -// -// type PolyLogExponent -// = PolyLogExponentSuccessor { previous: PolyLogExponent } -// | PolyLogExponentBase { fractional_part: FractionalPart } -// -// where FractionalPart is itself a structurally-constrained rational in -// (0, 1] — admitting log^1.5, log^2, log^2.5, etc. — and PolyLogExponent -// values START at the "≥ 1" base case with FractionalPart > 0 required -// (to exclude exponent=1 collapse to LogCost). -// -// **Implementation note**: this requires either (i) DSL refinement-type -// grammar supporting "Rational > 1" as a type-level predicate, OR (ii) -// the inductive carrier above with FractionalPart > 0 invariant baked -// into FractionalPart's own constructors. Worker grep-verifies DSL -// refinement support at authoring time: -// - If (i) available: type PolyLogExponent = Rational where r > 1 -// - If (ii) only: ratify the inductive shape before authoring; this -// surfaces back to Mgr/Director per §10 STOP-condition new entry. -// -// **HARD STOP**: do NOT author PolyLogExponent as `{ numerator, denominator -// }` with a textual "numerator > denominator" comment — that's the exact -// refinement-mixed-with-product pattern codex 014544f4 BLOCKING #2 forbids. -type PolyLogExponent - = PolyLogExponentSuccessor { previous: PolyLogExponent } // ≥ 2 case - | PolyLogExponentFractional { whole: PositiveInt, fraction: FractionalPart } - // whole ≥ 1 + fraction in (0, 1] → result > 1; whole = 1 + fraction - // close to 0 approaches exponent = 1 but never reaches it; fraction > 0 - // strictly enforced by FractionalPart's own constructors - -// FractionalPart: rational in (0, 1]. Inductive: 1/n for n ≥ 1. -// (Sketch — worker authors final shape per DSL refinement support.) -type FractionalPart - = FractionalOne // 1/1 = 1 - | FractionalRecip { denominator: PositiveInt } // 1/d for d ≥ 1 → value in (0, 1] +// ExponentialBase: Int ≥ 2. range(min: 2) — `range` predicate at +// lower.rs:817 with allowed_carriers Int + Nat. +type ExponentialBase = Int where range(min: 2) + +// PositiveRational: Rational > 0. REQUIRES KNOWN_PREDICATES extension: +// add `Rational` to gt_zero's allowed_carriers (currently Nat + Int). +// Worker authors atomic with carrier landing per Phase A. +type PositiveRational = Rational where gt_zero + +// PolyLogExponent: Rational > 1. REQUIRES KNOWN_PREDICATES extension: +// add NEW `gt_one` predicate (allowed_carriers: Rational + Int) to +// the registry. Mirrors `gt_zero` shape. Worker authors atomic with +// carrier landing per Phase A. +type PolyLogExponent = Rational where gt_one ``` -These types make `degree ≤ 0`, `exponent ≤ 0`, `base ≤ 1` structurally impossible to construct — no fold-time enforcement required. +**Phase A KNOWN_PREDICATES extensions** (Mgr-tier scope; required for refinement-mechanism authority): +1. Extend `gt_zero`'s `allowed_carriers` to include `Rational` (was `Nat + Int`) +2. Add new `gt_one` predicate (allowed_carriers: `Rational + Int`; arg_shape: `Bare`) +3. Both extensions land in same PR as carrier-shape changes — atomic per §P5 + +**ZERO new authority introduced**: PositiveRational + PolyLogExponent are refinements of canonical Rational; ExponentialBase is refinement of canonical Int. Practice 4 / P1 / Q-MachineConstraint-Carrier hard constraint "no dual representations" all satisfied. + +**Authority chain for refinement mechanism**: +- gunbc#828 issuecomment-4390333451 (Path 3 RATIFIED) +- gunbc#828 issuecomment-4390199218 (Director Option 2) +- `dsl/std/integer.dag:171-181` precedent (`PositiveInt = Nat where gt_zero`) +- `src/v3/compiler/src/lower.rs:798-862` KNOWN_PREDICATES registry + +These types make `degree ≤ 0`, `exponent ≤ 1`, `base ≤ 1` structurally impossible to construct via the ratified refinement mechanism — no fold-time enforcement required, no new authority. + +**HARD STOP**: do NOT author PositiveRational / PolyLogExponent / ExponentialBase as fresh records / inductive sums when refinement over canonical carrier is available. That pattern is codex BLOCKING 014544f4 finding #1 + operator BLOCKING worker:104 anti-pattern (now §10 #8 below). ### §5.1 — Replace SymbolicCost variant set @@ -274,11 +243,11 @@ After Phase A-F land + tests green, update `docs/r3-program-plan.md` §1.8 row # 1. **`OrderedRing` shape drift** at HEAD — if `dsl/std/algebra.dag:268-286` no longer carries the exact 14-field signature this brief mirrors, **STOP** and surface — strict-mirror authority broken. 2. **Existing `LinearCost`-consumer surface differs from canvas assumption** — if grep reveals consumer paths that can't migrate to `PolynomialCost(degree=1)` losslessly (e.g., type-level dispatches on LinearCost variant-tag), **STOP** — anti-pattern #7 atomic-migration discipline requires lossless migration. 3. **`Rational` carrier not at `dsl/std/rational.dag:26`** — if Rational has moved / changed shape since 2026-05-13 grep, **STOP** — Q1-c re-declaration target is wrong. -4. **Variant-name collision** at HEAD — if any of `PolyLogCost` / `ExponentialCost` / `FactorialCost` / `PositiveRational` / `IntAtLeastTwo` / `PositiveInt` appear from parallel landing, **STOP** for de-duplication. +4. **Variant-name collision** at HEAD — if any of `PolyLogCost` / `ExponentialCost` / `FactorialCost` / `PositiveRational` / `ExponentialBase` / `PolyLogExponent` appear from parallel landing, **STOP** for de-duplication. (`PositiveInt` already exists at `dsl/std/integer.dag:181` — reuse.) 5. **Algebra rule §5.2 violation tempted** — if Phase D authoring tempts a named (n!)² variant or non-Unknown disposition, **STOP** — anti-pattern #5 fires; the rule disposition is Director-ratified. 6. **PR #2824 not merged at dispatch** OR **PR #2828 not merged at dispatch** — both gates AND; if either is unmerged, **STOP** and surface to Mgr; worker dispatch is blocked. -## §11. 9 anti-patterns (7 Director-enumerated/pending + 2 Mgr-derived per canvas §10) +## §11. 10 anti-patterns (7 Director-enumerated/pending + 3 Mgr-derived per canvas §10) PR body MUST cite each verbatim + assert receipt-of-compliance: @@ -289,6 +258,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 5. UnknownCost used for textbook-Tier-1-coverable bounds post-promotion (STOP-SIGNAL violation) 6. **Director-ratified msg_676ad4e7**: Introducing parallel ordered-algebraic-structure carriers (`Ordered`) when the underlying carrier already provides `compare: fn(T, T) -> Ordering` — lens-local predicate derivation from Ordering pattern-match is the canonical path 7. **Pending Director ratification per operator BLOCKING PR #2824:333**: Tier-1 variant constructed with raw Int/Rational exponent/base admitting illegal collapse values (exponent=0/1 for PolyLogCost; base=0/1 for ExponentialCost; degree≤0 for PolynomialCost) bypassing refinement type — PolyLogExponent/ExponentialBase/PositiveRational required at carrier level (Practice 2/6) +8. **PM-grep-corrected per msg_a52ed981 + codex 014544f4 finding #1**: Parallel rational-number carriers (`PositiveRational { num: PositiveInt; denom: PositiveInt }`, inductive `PolyLogExponentSuccessor | PolyLogExponentFractional`, or any fresh record/sum shape) when refinement over canonical `Rational = Field>` carrier is available via ratified `type X = Y where predicate` mechanism (gunbc#828 issuecomment-4390333451 Path 3 RATIFIED; precedent `PositiveInt = Nat where gt_zero` at `dsl/std/integer.dag:181`). Anti-pattern fires on ANY fresh-carrier shape when refinement is available. 8. Multiplicative absorption rules (`X · Y = X`) where one variant absorbs another asymptotically — sound for SUM, NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products MUST be ProductCost composite (per operator BLOCKING worker:140) 9. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) @@ -298,7 +268,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 2. **Q2-Y integrity**: NO LinearCost preservation paths alongside PolyCost(degree=1); atomic migration receipt required 3. **Q3 algebra rules**: §5.1 + §5.2 dispositions are load-bearing; reviewers flag deviation 4. **Q4 STOP-SIGNAL text**: must land at `src/v3/std/algebra.dag:69-72` with new variant cap at 10 (9 ratified + 1 trigger) -5. **All 9 anti-patterns enforceable** at PR review +5. **All 10 anti-patterns enforceable** at PR review ## §13. Verification @@ -314,7 +284,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: - PR body cites: - Gate #105 closure (Phase G ledger update) - Canvas PR #2828 + Director disposition (PM msg_a055c38b) verbatim Q1-Q5 + §8 - - 9 anti-patterns receipt-of-compliance (§11) + - 10 anti-patterns receipt-of-compliance (§11) - 5 reviewer ratchets (§12) — explicit assertion-of-compliance per item ## §14. Out of scope @@ -346,7 +316,7 @@ STOP-SIGNAL re-reset to 10 (9 ratified + 1 trigger) at algebra.dag:60-72. Algebra rules §5/§6 implemented verbatim per canvas; (n!)² → UnknownCost ("(v!)² exceeds Tier 1 — pending R4 named-variant canvas"). -9 anti-patterns receipt-of-compliance: +10 anti-patterns receipt-of-compliance: [enumerate each + cite that the implementation does not violate it] 5 reviewer ratchets compliance: From 48328e45c871c8838c25a627a160a5092a1e75a0 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 05:36:23 +0000 Subject: [PATCH 19/36] =?UTF-8?q?docs(r3):=20gate=20#105=20canvas/worker?= =?UTF-8?q?=20=E2=80=94=20cursor=2010801=20stale-cite=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cursor review 10801 (PR #2828) — 6 stale-ratification cites cleaned to the Q1-α / 9-variant ratified state: Canvas (PR #2828): - L13-14 front matter: Field/Rational "no order" → carries compare (Director ratified Q1-α via existing Field.compare; line ref :287→:294) - §6 L216 variant count: "10 post-Q2-Y" → "9 post-Q2-Y" (matches §5 L153 and Q2-Y disposition; PolynomialCost.degree promotion is not a new variant) - §6 algebra bullets: Q1-c OrderedField.add/compare → Field.add/compare on Rational + rational_max lens-local helper (Q1-α) - §12 Q1 Mgr-rec: stale "c — OrderedField" replaced with full ratified Q1-α/Q2-Y/Q3/Q4/Q5/§8 disposition block as audit trail - §13 reference list: Field "no order" + Q1-c cite → Q1-α via compare Worker brief: - §7 phase E receipt: "10 variant count" / "All 10 variant names" → 9 - §10 STOP #3: "Q1-c re-declaration target" → "Q1-α refinement target" - §14 out-of-scope: "Q1-c lazy migration" → Q1-α (Field unchanged) - §15 PR body template: "Companion substrate (Q1-c)" → (Q1-α) - §11 anti-patterns: duplicate #8 numbering fixed → renumber to 1-10 - §16 reference: feedback_strict_mirror Q1-c → Q1-α discipline INVARIANTS P2 single-authority restored across both briefs. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ate-gate-105-symbolic-cost-tier1-canvas.md | 30 +++++++++---------- ...ate-gate-105-symbolic-cost-tier1-worker.md | 18 +++++------ 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index a37bab7d0c6..1424a716e9b 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -10,8 +10,8 @@ authority docs: - `src/v3/std/algebra.dag:60-72` — `STOP SIGNAL: wanting an eighth variant` (will reset) - `docs/design-symbolic-cost-algebra.md` — current algebra - `dsl/std/algebra.dag:268-286` — existing `OrderedRing` witness pattern - - `dsl/std/algebra.dag:287` — existing `Field` (no order) - - `dsl/std/rational.dag:26` — `type Rational = Field>` (no order witness) + - `dsl/std/algebra.dag:294` — `Field` carries `compare: fn(T, T) -> Ordering` (foundational order primitive; derived predicates lt/le/gt/ge live lens-local under Q1-α) + - `dsl/std/rational.dag:26` — `type Rational = Field>` (inherits `Field.compare` via Field-shape) - `feedback_groundedness_gates_lenses` (Tier 2 structural-extension caveat) --- @@ -192,9 +192,9 @@ Mgr recommendation: (b). `(n!)²` is genuinely outside Tier 1; it's super-factor ### §5.3 — Normalization (rational-degree polynomial) -- `PolyCost(d1) · PolyCost(d2) = PolyCost(d1 + d2)` — uses Q1-c OrderedField.add +- `PolyCost(d1) · PolyCost(d2) = PolyCost(d1 + d2)` — uses `Field.add` on Rational (Q1-α; Rational inherits Field's Ring-shape add) - `PolyCost(1/2) · PolyCost(1/2) = PolyCost(1)` — and per Q2-Y, this is PolyCost(degree=1), the absorbed Linear -- `PolyCost(d1) + PolyCost(d2) = PolyCost(max(d1, d2))` — uses Q1-c OrderedField.compare +- `PolyCost(d1) + PolyCost(d2) = PolyCost(max(d1, d2))` — uses `Field.compare` on Rational via cost-lens-local `rational_max` helper (Q1-α; NO OrderedField) ## §6. Q4 — STOP-SIGNAL update @@ -213,7 +213,7 @@ Current `src/v3/std/algebra.dag:69-72`: These refinements make `degree ≤ 0` / `exponent ≤ 1` / `base ≤ 1` **structurally unrepresentable** at the carrier level via the ratified refinement mechanism — Practice 2 + Practice 6 satisfied; INVARIANTS P1 (single authority) preserved (no parallel rational/int authority). -Variant count: **10** post-Q2-Y (recommended), or **11** if Q2-X is ratified. +Variant count: **9** post-Q2-Y (Director-ratified; PolynomialCost.degree promotion is not a new variant), or **10** if Q2-X is ratified. ## §7. Q5 — Carrier-shape canvas before worker dispatch — THIS DOC @@ -278,16 +278,14 @@ Per `INVARIANTS.md` "Cost of Change": For exotic (Tier-2) bounds: still requires UnknownCost("reason") at consumer site — that's the R4-deferral receipt. -## §12. Open questions for ratification +## §12. Ratified dispositions (audit trail; all Q1-Q5 Director-ratified) -Director ratification on: - -- **Q1**: a / b / c (Mgr-rec: c — layered OrderedField introduction + lazy consumer migration) -- **Q2**: X (keep Linear separate) / Y (collapse to PolynomialCost(degree=1)) (Mgr-rec: Y per §P5) -- **Q3**: §5 algebra interaction rule table; §5.1 PolyLog-vs-Product disposition (Mgr-rec: b composite); §5.2 FactorialCost squared (Mgr-rec: b UnknownCost) -- **Q4**: §6 STOP-SIGNAL text (9 or 10 variants depending on Q2) -- **Q5**: This canvas (ratification-of-canvas is itself the Q5 disposition) -- **§8 Tier-2 mechanism**: defer to R4 (Mgr-rec) or accept IteratedAlgebra mechanism (rejected by §8 analysis) +- **Q1**: **RATIFIED Q1-α** (msg_676ad4e7, supersedes msg_d86a5987 Q1-c) — use existing `Field.compare`; NO `OrderedField` introduction; cost-lens-local rational_lt/le/gt/ge/eq/ne free functions +- **Q2**: **RATIFIED Q2-Y** (collapse LinearCost into PolynomialCost(degree=1)) +- **Q3**: **RATIFIED** §5 10-rule algebra interaction table; §5.1 b composite; §5.2 b UnknownCost (for (n!)²) +- **Q4**: **RATIFIED** §6 STOP-SIGNAL text re-reset at 10th variant (9 ratified + 1 trigger) +- **Q5**: **RATIFIED** this canvas (carrier-shape canvas before worker dispatch) +- **§8 Tier-2 mechanism**: **RATIFIED defer to R4**; IteratedAlgebra rejected per §8 analysis ## §13. Reference @@ -295,12 +293,12 @@ Director ratification on: - `src/v3/std/algebra.dag:190-197` — current 7-variant SymbolicCost - `src/v3/std/algebra.dag:60-72` — current STOP SIGNAL - `dsl/std/algebra.dag:268-286` — OrderedRing precedent -- `dsl/std/algebra.dag:287` — Field (no order) +- `dsl/std/algebra.dag:294` — Field carries `compare: fn(T, T) -> Ordering` - `dsl/std/rational.dag:26` — Rational = Field> - `docs/design-symbolic-cost-algebra.md` — current algebra - Director ratification: PM msg_4fd650b7 / Director msg_ad5e934d - `feedback_groundedness_gates_lenses` — Tier-2 structural-extension caveat -- `feedback_strict_mirror_vs_novel_substrate_fact` — Q1-c applies +- `feedback_strict_mirror_vs_novel_substrate_fact` — Q1-α applies (strict-mirror via existing Field.compare) - `feedback_load_bearing_ratchet_preservation` — Q2-Y migration discipline --- diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 33f32a22632..7da2953738e 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -218,8 +218,8 @@ Normalization invariants in fold (canvas §5.3): Mirror `src/v3/compiler/tests/integration/cementing/` shape (cf. `complexity_lens_behavioral_completion.rs`): `src/v3/compiler/tests/integration/cementing/symbolic_cost_tier1_carrier_test.rs` asserting: -- 10 variant count (assert against `cost.dag` or `algebra.dag` source); REMOVED LinearCost -- All 10 variant names + field shapes structurally present +- 9 variant count (assert against `cost.dag` or `algebra.dag` source); REMOVED LinearCost (PolynomialCost.degree promotion to Rational is not a new variant) +- All 9 variant names + field shapes structurally present - Phase A Q1-α deliverables present: rational_lt/le/gt/ge/eq/ne free functions in cost-lens module; NO OrderedField type declared - `Rational = Field>` UNCHANGED at `dsl/std/rational.dag:26` (Q1-α) - Algebra rule sample tests (≥6 of §6 rules): assert fold output for representative inputs (e.g., `PolyCost(1/2) · PolyCost(1/2)` produces `PolyCost(1)`; `ExpCost(2,n) · PolyCost(d)` produces `ExpCost(2,n)`; `FactorialCost(n)²` produces `UnknownCost` with the exact §5.2 reason-string) @@ -242,7 +242,7 @@ After Phase A-F land + tests green, update `docs/r3-program-plan.md` §1.8 row # 1. **`OrderedRing` shape drift** at HEAD — if `dsl/std/algebra.dag:268-286` no longer carries the exact 14-field signature this brief mirrors, **STOP** and surface — strict-mirror authority broken. 2. **Existing `LinearCost`-consumer surface differs from canvas assumption** — if grep reveals consumer paths that can't migrate to `PolynomialCost(degree=1)` losslessly (e.g., type-level dispatches on LinearCost variant-tag), **STOP** — anti-pattern #7 atomic-migration discipline requires lossless migration. -3. **`Rational` carrier not at `dsl/std/rational.dag:26`** — if Rational has moved / changed shape since 2026-05-13 grep, **STOP** — Q1-c re-declaration target is wrong. +3. **`Rational` carrier not at `dsl/std/rational.dag:26`** — if Rational has moved / changed shape since 2026-05-13 grep, **STOP** — Q1-α refinement target is wrong. 4. **Variant-name collision** at HEAD — if any of `PolyLogCost` / `ExponentialCost` / `FactorialCost` / `PositiveRational` / `ExponentialBase` / `PolyLogExponent` appear from parallel landing, **STOP** for de-duplication. (`PositiveInt` already exists at `dsl/std/integer.dag:181` — reuse.) 5. **Algebra rule §5.2 violation tempted** — if Phase D authoring tempts a named (n!)² variant or non-Unknown disposition, **STOP** — anti-pattern #5 fires; the rule disposition is Director-ratified. 6. **PR #2824 not merged at dispatch** OR **PR #2828 not merged at dispatch** — both gates AND; if either is unmerged, **STOP** and surface to Mgr; worker dispatch is blocked. @@ -259,8 +259,8 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 6. **Director-ratified msg_676ad4e7**: Introducing parallel ordered-algebraic-structure carriers (`Ordered`) when the underlying carrier already provides `compare: fn(T, T) -> Ordering` — lens-local predicate derivation from Ordering pattern-match is the canonical path 7. **Pending Director ratification per operator BLOCKING PR #2824:333**: Tier-1 variant constructed with raw Int/Rational exponent/base admitting illegal collapse values (exponent=0/1 for PolyLogCost; base=0/1 for ExponentialCost; degree≤0 for PolynomialCost) bypassing refinement type — PolyLogExponent/ExponentialBase/PositiveRational required at carrier level (Practice 2/6) 8. **PM-grep-corrected per msg_a52ed981 + codex 014544f4 finding #1**: Parallel rational-number carriers (`PositiveRational { num: PositiveInt; denom: PositiveInt }`, inductive `PolyLogExponentSuccessor | PolyLogExponentFractional`, or any fresh record/sum shape) when refinement over canonical `Rational = Field>` carrier is available via ratified `type X = Y where predicate` mechanism (gunbc#828 issuecomment-4390333451 Path 3 RATIFIED; precedent `PositiveInt = Nat where gt_zero` at `dsl/std/integer.dag:181`). Anti-pattern fires on ANY fresh-carrier shape when refinement is available. -8. Multiplicative absorption rules (`X · Y = X`) where one variant absorbs another asymptotically — sound for SUM, NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products MUST be ProductCost composite (per operator BLOCKING worker:140) -9. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) +9. Multiplicative absorption rules (`X · Y = X`) where one variant absorbs another asymptotically — sound for SUM, NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products MUST be ProductCost composite (per operator BLOCKING worker:140) +10. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) ## §12. 5 reviewer ratchets (Director-enumerated for PR review) @@ -290,7 +290,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: ## §14. Out of scope - **Tier 2 variants** (LogLog / InverseAckermann / IteratedLog / HyperExp) — R4-deferred per Director §8. Worker must NOT add these. -- **`Field` consumer migration** beyond cost-lens — Q1-c lazy migration; Field stays in place +- **`Field` consumer migration** beyond cost-lens — Q1-α; Field stays in place unchanged (compare already present) - **InverseAckermann / IteratedAlgebra mechanism** — canvas §8 finding accepted; not introduced - **Cost-lens behavioral changes** — this is a carrier-extension PR, not a semantics change; lens output must be backwards-compatible modulo Linear→Poly(d=1) lossless rewrite - **`docs/design-symbolic-cost-algebra.md` rewrite** — out of scope; tracked separately as doc-drift sweep @@ -307,8 +307,8 @@ Net 7 → 9 SymbolicCost variants (Q2-Y collapse Linear into PolynomialCost(degree=1)): [paste §5 variant set verbatim] -Companion substrate (Q1-c): -- Cost-lens-local Rational ordering helpers (Q1-α; NO new OrderedField) +Companion substrate (Q1-α): +- Cost-lens-local Rational ordering helpers (NO new OrderedField; derived from existing Field.compare) - Rational stays as Field> (UNCHANGED) STOP-SIGNAL re-reset to 10 (9 ratified + 1 trigger) at algebra.dag:60-72. @@ -334,7 +334,7 @@ Algebra rules §5/§6 implemented verbatim per canvas; (n!)² → UnknownCost - Current SymbolicCost: `src/v3/std/algebra.dag:190-197` - Current STOP-SIGNAL: `src/v3/std/algebra.dag:60-72` - Rational: `dsl/std/rational.dag:26` -- `feedback_strict_mirror_vs_novel_substrate_fact` — Q1-c discipline +- `feedback_strict_mirror_vs_novel_substrate_fact` — Q1-α discipline (strict-mirror of existing Field.compare; novel only at lens-local helper layer) - `feedback_state_space_vs_behavioral_invariants` — Q2-Y refinement-vs-fold discipline - `feedback_naming_is_aliasing` — §5.1 PolyLog-vs-Product semantic-collision avoidance - `feedback_no_short_term_solutions` — Q2-Y absorption-over-coexistence From 3bba9260e7530e0275606d27213df4feb7b68fd7 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 05:43:56 +0000 Subject: [PATCH 20/36] =?UTF-8?q?docs(r3):=20gate=20#105=20canvas=20?= =?UTF-8?q?=E2=80=94=20fix=20=C2=A710=20Mgr-derived=20duplicate=20#8=20num?= =?UTF-8?q?bering?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per claude/claude-opus-4-7 review 10819 cosmetic note: Mgr-derived anti-patterns had 7,8,8 → renumber to 8,9,10 (continuing from Director-enumerated 1-7). Matches the §11 worker brief enumeration. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../r3-substrate-gate-105-symbolic-cost-tier1-canvas.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 1424a716e9b..48cff0ec0d2 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -263,9 +263,9 @@ No 🔴 RED introductions. Anti-pattern #2 (Director-enumerated): "Path B reviva ### Mgr-derived (encoded for worker review) -7. Multiplicative absorption rules where one variant absorbs another (`X · Y = X`) when X is asymptotically larger than Y additively — asymptotic absorption is sound for SUM but NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products must be `ProductCost` composite. §5 algebra rules table addresses (operator BLOCKING worker:140). -8. **PM-grep-corrected per msg_a52ed981 + codex 014544f4 finding #1**: Parallel rational-number carriers (fresh records like `{ num: PositiveInt; denom: PositiveInt }`, inductive sums, or any carrier shape OTHER than refinement) when the canonical refinement-mechanism (`type X = Y where predicate`) is RATIFIED at HEAD per gunbc#828 issuecomment-4390333451 Path 3 + Director Option 2. Refinement over canonical `Rational = Field>` is the canonical path; precedent `PositiveInt = Nat where gt_zero` at `dsl/std/integer.dag:181`. Anti-pattern fires on ANY fresh-carrier shape when refinement is available. -8. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) +8. Multiplicative absorption rules where one variant absorbs another (`X · Y = X`) when X is asymptotically larger than Y additively — asymptotic absorption is sound for SUM but NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products must be `ProductCost` composite. §5 algebra rules table addresses (operator BLOCKING worker:140). +9. **PM-grep-corrected per msg_a52ed981 + codex 014544f4 finding #1**: Parallel rational-number carriers (fresh records like `{ num: PositiveInt; denom: PositiveInt }`, inductive sums, or any carrier shape OTHER than refinement) when the canonical refinement-mechanism (`type X = Y where predicate`) is RATIFIED at HEAD per gunbc#828 issuecomment-4390333451 Path 3 + Director Option 2. Refinement over canonical `Rational = Field>` is the canonical path; precedent `PositiveInt = Nat where gt_zero` at `dsl/std/integer.dag:181`. Anti-pattern fires on ANY fresh-carrier shape when refinement is available. +10. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) ## §11. Cost-of-change accounting From c196edc6a1803d8a2367dbe1fe548763250588e5 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 06:03:18 +0000 Subject: [PATCH 21/36] =?UTF-8?q?docs(r3):=20gate=20#105=20worker=20?= =?UTF-8?q?=E2=80=94=20fix=20Phase=20E=20sample-test=20multiplicative=20ab?= =?UTF-8?q?sorption?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex REQUEST_CHANGES review 10837: worker brief §7 line 225 sample test asserted ExpCost(2,n) · PolyCost(d) collapses to ExpCost(2,n), which contradicts §6 algebra + anti-pattern #9 (multiplicative cross-class absorption is unsound; only ProductCost composite is correct). Fix-forward: corrected sample to assert ProductCost composite under multiplication; added the additive-sound sibling test (ExpCost + PolyCost DOES absorb to ExpCost) so both directions of the SUM-sound vs PRODUCT-unsound asymmetry are receipt-tested. Co-Authored-By: Claude Opus 4.7 (1M context) --- docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 7da2953738e..94a300403b7 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -222,7 +222,7 @@ Mirror `src/v3/compiler/tests/integration/cementing/` shape (cf. `complexity_len - All 9 variant names + field shapes structurally present - Phase A Q1-α deliverables present: rational_lt/le/gt/ge/eq/ne free functions in cost-lens module; NO OrderedField type declared - `Rational = Field>` UNCHANGED at `dsl/std/rational.dag:26` (Q1-α) -- Algebra rule sample tests (≥6 of §6 rules): assert fold output for representative inputs (e.g., `PolyCost(1/2) · PolyCost(1/2)` produces `PolyCost(1)`; `ExpCost(2,n) · PolyCost(d)` produces `ExpCost(2,n)`; `FactorialCost(n)²` produces `UnknownCost` with the exact §5.2 reason-string) +- Algebra rule sample tests (≥6 of §6 rules): assert fold output for representative inputs (e.g., `PolyCost(1/2) · PolyCost(1/2)` produces `PolyCost(1)`; `ExpCost(2,n) · PolyCost(d)` produces `ProductCost([ExpCost(2,n), PolyCost(d)])` — multiplicative cross-class is NOT absorbed per §6 + anti-pattern #9 (asymptotic absorption is sound for SUM but unsound for PRODUCT); `ExpCost(2,n) + PolyCost(d)` produces `ExpCost(2,n)` — additive cross-class absorption is sound; `FactorialCost(n)²` produces `UnknownCost` with the exact §5.2 reason-string) - STOP-SIGNAL text at `:60-72` contains new "10th variant" wording ## §8. Phase F — Consumer migration (atomic) From 5f512c14c492e4dceef84dfa985a1d1c2abc21e7 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 06:19:21 +0000 Subject: [PATCH 22/36] =?UTF-8?q?docs(r3):=20gate=20#105=20canvas=20?= =?UTF-8?q?=E2=80=94=20codex=2010852=20two=20contradictions=20in=20dispatc?= =?UTF-8?q?h=20artifact?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex REQUEST_CHANGES review 10852 — both findings load-bearing: 1. §5 L172 FactorialCost rule: "FactorialCost(v) + anything = FactorialCost(v)" contradicted worker brief's per-variant rules (preserve composites for UnknownCost + cross-variable FactorialCost(w)). Expanded canvas table to match worker: - Same-variable Tier-1-below: absorb to FactorialCost(v) - Cross-variable FactorialCost(w): SumCost composite - + UnknownCost: SumCost composite (conservative-top, never absorbed) - + SumCost/ProductCost composites: distribute and re-fold per §6 Mirrors operator BLOCKING #5 fix to worker brief (commit adb841713c). 2. §5.1 L183 n log n shape: "ProductCost([LinearCost(n), LogCost(n)])" reintroduced the LinearCost variant dissolved by ratified Q2-Y. Corrected to "ProductCost([PolynomialCost { var: n, degree: 1 }, LogCost(n)])" — post-Q2-Y collapse via PolynomialCost(degree=1). INVARIANTS P2 single-authority restored across canvas + worker for both fold rules. Anti-pattern §11 #10 (LinearCost-consumer paths preserved) no longer self-violated by the canvas guidance. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../r3-substrate-gate-105-symbolic-cost-tier1-canvas.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 48cff0ec0d2..252985efe81 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -169,7 +169,10 @@ Existing rules (from `docs/design-symbolic-cost-algebra.md` + algebra.dag fold o | `PolyCost(d) · ExpCost(c, v)` | `ProductCost([PolyCost(d), ExpCost(c, v)])` | composite, NOT absorbed — n^d · c^n is NOT O(c^n) (operator BLOCKING worker:140); additive absorption above is sound, multiplicative is NOT | | `ExpCost(c1, v) · ExpCost(c2, v)` | `ExpCost(c1·c2, v)` | c1^v · c2^v = (c1·c2)^v | | `ExpCost(c1, v) + ExpCost(c2, v)` (c1 < c2) | `ExpCost(c2, v)` | dominant base | -| `FactorialCost(v) + anything` | `FactorialCost(v)` | factorial dominates | +| `FactorialCost(v) + ConstantCost / PolyCost(_,v) / LogCost(v) / PolyLogCost(v,_) / ExpCost(_,v)` | `FactorialCost(v)` | factorial dominates same-variable Tier-1 below | +| `FactorialCost(v) + FactorialCost(w)` (v ≠ w) | `SumCost([FactorialCost(v), FactorialCost(w)])` | cross-variable preserved as composite (no inter-variable dominance) | +| `FactorialCost(v) + UnknownCost(reason)` | `SumCost([FactorialCost(v), UnknownCost(reason)])` | UnknownCost is conservative-top; never absorbed | +| `FactorialCost(v) + SumCost([…]) / ProductCost([…])` | distribute then re-fold per §6 | composite-fold delegates to algebra rules | | `FactorialCost(v) · PolyCost(d)` | `ProductCost([FactorialCost(v), PolyCost(d)])` | composite, NOT absorbed (n! · n^d not O(n!)) | | `FactorialCost(v) · ExpCost(c, v)` | `ProductCost([FactorialCost(v), ExpCost(c, v)])` | composite, NOT absorbed (n! · c^n not O(n!)) | | `FactorialCost(v) · FactorialCost(v)` | `FactorialCost(v)`? OR `UnknownCost("v! · v! exceeds Tier 1")` | Canvas question (see §5.2) | @@ -180,7 +183,7 @@ Two candidate shapes: - (a) `PolyCost(d) · LogCost(v) = PolyLogCost { var: v, exponent: 1 }` if d=0, but d=0 means ConstantCost not PolyCost; if d=1 then it's `v · log(v)` which is canonically n log n - (b) Keep as composite `ProductCost([PolyCost, LogCost])`; PolyLogCost only constructed from explicit log² n etc. -Mgr recommendation: (b). PolyLogCost is for log^k n only (single variable, integer-exponent log). The n log n shape is `ProductCost([LinearCost(n), LogCost(n)])` — already representable, and the algebra fold via ordered-dominance correctly identifies it. Avoiding (a) prevents semantic-collision between "poly times log" and "polylog". +Mgr recommendation: (b). PolyLogCost is for log^k n only (single variable, rational-exponent log per Q1-α + PolyLogExponent refinement). The n log n shape is `ProductCost([PolynomialCost { var: n, degree: 1 }, LogCost(n)])` — representable via PolynomialCost(degree=1) post-Q2-Y collapse (LinearCost dissolved); the algebra fold via ordered-dominance correctly identifies it. Avoiding (a) prevents semantic-collision between "poly times log" and "polylog". ### §5.2 — FactorialCost · FactorialCost From 33452b7ee6731b36715e1345839dcad1c2ac4d4e Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 06:36:52 +0000 Subject: [PATCH 23/36] =?UTF-8?q?docs(r3):=20gate=20#105=20worker=20?= =?UTF-8?q?=E2=80=94=20reconcile=20authority=20chain=20(codex=2048328e45)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex BLOCKING review sha 48328e45: worker brief frontmatter / authority chain / §9 ledger update / §15 PR body template cited the pre-Q1-α ratification msg_d86a5987 alone, without msg_676ad4e7 (Q1-α supersession) reconciliation. The substantive carrier + algebra fixes were clean but the authority chain leaked the superseded shape. Fix-forward: every load-bearing authority cite (frontmatter, §0 status, §2 inputs ratification line, §4 cite-in-comment-block, §9 row-#105 ledger update text, §13 PR body cite list, §15 PR template, §16 reference) now cites the **composite ratification**: PM msg_a055c38b relaying Director msg_d86a5987 (Q2-Q5 + §8 base) RECONCILED BY Director msg_676ad4e7 (Q1-α supersedes prior Q1-c) Worker dispatches on this composite — not the pre-Q1-α msg_d86a5987 alone. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...rate-gate-105-symbolic-cost-tier1-worker.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 94a300403b7..ab0db79261a 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -1,10 +1,10 @@ --- -status: dispatchable-on-cascade (worker brief; ratified shape per canvas PR #2828 Director-ratified 2026-05-13 via PM msg_a055c38b relaying msg_d86a5987; dispatch gates on PR #2824 row #105 anchor + PR #2828 canvas landing — both AND) +status: dispatchable-on-cascade (worker brief; ratified shape per canvas PR #2828 Director-ratified 2026-05-13 via composite ratification — PM msg_a055c38b relaying Director msg_d86a5987 (Q2-Q5 + §8 base ratification) AS RECONCILED BY Director msg_676ad4e7 (Q1-α supersession of prior Q1-c); dispatch gates on PR #2824 row #105 anchor + PR #2828 canvas landing — both AND) authority parent: R3 Substrate Manager (warm-wolf-698) authoring date: 2026-05-13 gate: §1.8 ledger row #105 `symbolic_cost_textbook_coverage_landed` parent canvas: PR #2828 / `docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md` — Q1-Q5 + §8 Tier-2 RATIFIED -ratification anchor: PM msg_a055c38b relaying Director msg_d86a5987 +ratification anchor: composite — PM msg_a055c38b relaying Director msg_d86a5987 (Q2-Q5 + §8) AS RECONCILED BY Director msg_676ad4e7 (Q1-α supersedes prior Q1-c) row anchor: PM PR #2824 --- @@ -12,7 +12,7 @@ row anchor: PM PR #2824 ## §0. Status — DISPATCH-READY (cascade-gated) -Director ratified all Q1-Q5 + §8 Tier-2 dispositions per PM msg_a055c38b. Worker dispatch gates on: +Director ratified all Q1-Q5 + §8 Tier-2 dispositions per **composite ratification**: PM msg_a055c38b relaying Director msg_d86a5987 (Q2-Q5 + §8 base) AS RECONCILED BY Director msg_676ad4e7 (Q1-α supersedes prior Q1-c). Worker dispatch gates on: 1. **PR #2824 merge** — §1.8 row #105 authority anchor lands 2. **PR #2828 merge** — canvas authored shape lands (both PRs may merge in parallel) @@ -46,7 +46,7 @@ Sibling substrate (Q1 — Rational ordering; **Director RATIFIED Q1-α per msg_6 - `dsl/std/rational.dag:26` — `type Rational = Field>` - `docs/design-symbolic-cost-algebra.md` — current algebra - Canvas: PR #2828 / `docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md` §§3-9 -- Ratification: PM msg_a055c38b relaying Director msg_d86a5987 +- Ratification (composite): PM msg_a055c38b relaying Director msg_d86a5987 (Q2-Q5 + §8) RECONCILED BY Director msg_676ad4e7 (Q1-α supersedes prior Q1-c) ## §3. Phase A — Rational ordering helpers (Q1-α; Director RATIFIED msg_676ad4e7) @@ -107,7 +107,7 @@ Replace `src/v3/std/algebra.dag:60-72` block with (Director-ratified verbatim pe // #5 per gate #105. ``` -Cite gate #105 + PR #2828 + msg_d86a5987 in the comment block. +Cite gate #105 + PR #2828 + composite ratification (msg_d86a5987 base RECONCILED BY msg_676ad4e7 Q1-α supersession) in the comment block. ## §5. Phase C — SymbolicCost carrier reshape (Q2-Y + variant additions) @@ -236,7 +236,7 @@ Inventory required (worker greps at HEAD before authoring): ## §9. Phase G — §1.8 row #105 ledger update -After Phase A-F land + tests green, update `docs/r3-program-plan.md` §1.8 row #105 from DECLARED (or CANVAS_RATIFIED if PM ledger-maintenance landed first) → **CONSUMER_LANDED** with cite to this PR + canvas PR #2828 + Director msg_d86a5987. +After Phase A-F land + tests green, update `docs/r3-program-plan.md` §1.8 row #105 from DECLARED (or CANVAS_RATIFIED if PM ledger-maintenance landed first) → **CONSUMER_LANDED** with cite to this PR + canvas PR #2828 + composite ratification (Director msg_d86a5987 base + msg_676ad4e7 Q1-α supersession). ## §10. STOP conditions @@ -283,7 +283,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: - Pre-existing cost-lens behavioral tests still green (Phase F migration must preserve semantic equivalence: `LinearCost(v)` and `PolynomialCost { var: v, degree: 1 }` must produce identical lens output for all consumers) - PR body cites: - Gate #105 closure (Phase G ledger update) - - Canvas PR #2828 + Director disposition (PM msg_a055c38b) verbatim Q1-Q5 + §8 + - Canvas PR #2828 + composite Director ratification verbatim Q1-Q5 + §8 (PM msg_a055c38b relaying msg_d86a5987 Q2-Q5/§8 base RECONCILED BY msg_676ad4e7 Q1-α supersession of prior Q1-c) - 10 anti-patterns receipt-of-compliance (§11) - 5 reviewer ratchets (§12) — explicit assertion-of-compliance per item @@ -301,7 +301,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: Closes gate #105 symbolic_cost_textbook_coverage_landed. Carrier extended per Director-ratified Path A Tier 1 (canvas PR #2828; -ratification PM msg_a055c38b relaying msg_d86a5987 2026-05-13). +ratification composite: PM msg_a055c38b relaying Director msg_d86a5987 (Q2-Q5 + §8 base) RECONCILED BY Director msg_676ad4e7 (Q1-α supersedes prior Q1-c) 2026-05-13. Net 7 → 9 SymbolicCost variants (Q2-Y collapse Linear into PolynomialCost(degree=1)): @@ -328,7 +328,7 @@ Algebra rules §5/§6 implemented verbatim per canvas; (n!)² → UnknownCost ## §16. Reference - Canvas: PR #2828 / `docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md` -- Director ratification relay: PM msg_a055c38b (relaying Director msg_d86a5987) +- Director ratification (composite): PM msg_a055c38b relaying Director msg_d86a5987 (Q2-Q5 + §8 base) RECONCILED BY Director msg_676ad4e7 (Q1-α supersedes prior Q1-c) - Row anchor: PM PR #2824 - Sibling-witness precedent: `dsl/std/algebra.dag:268-286` (OrderedRing) - Current SymbolicCost: `src/v3/std/algebra.dag:190-197` From 243fd6379b1bdaea3550eebc7430347d5eed7f13 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 06:42:49 +0000 Subject: [PATCH 24/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20Dir?= =?UTF-8?q?ector=20scope-extension=20msg=5F2c1bfb0e=20(signed=20Rational)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Director RATIFIED scope-extension on PR #2828 (msg_2c1bfb0e via PM msg_e5ed6db8 2026-05-13) per operator directive: PolynomialCost.degree admits signed Rational (arbitrary roots + inverse/decay coverage), no where-refinement. Q6 dominance ordering + Q7 SymbolicCost preserves full expression both ratified; new anti-pattern #11 forbidding parallel InverseCost/ReciprocalCost variants. Canvas (PR #2828) updates: - §1 PROMOTE: PolynomialCost.degree = signed Rational (no refinement); subsumes negative degrees for asymptotic-decay - §4 Q2-Y candidate: drop "where degree > 0"; plain Rational - §6 refinement-carriers: PositiveRational DROPPED (struck-through with Director cite); ExponentialBase + PolyLogExponent unchanged - NEW §6.1 Q6 asymptotic-dominance ordering verbatim Director conjecture (reverse-sign-convention via Field.compare; Q1-α authority) - NEW §6.2 Q7 SymbolicCost preserves full expression; Big-O is derived operation (dominant_term / asymptotic_class) - §10 anti-pattern #11: no parallel InverseCost/ReciprocalCost when carrier-extension dissolves question - §12 ratifications Q6 + Q7 added; Practice 4 GREEN per Director pre-emption Worker brief updates: - §1 PROMOTE: signed Rational, no refinement - §5.0 PositiveRational refinement DROPPED with struck-through comment - §5.1 PolynomialCost.degree: Rational (Q6 signed) - NEW §6.0 Q7 canonical-form preservation: SymbolicCost preserves all terms; canonicalize ≠ dominant_term; mixed-sign canonicalization test - NEW §6.1 Q6 dominance rule encoded via Field.compare reverse-sign - §6.2 same-variable algebra fold rules header - §11 anti-pattern #11 mirrored - §16 Director msg_2c1bfb0e reference added Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ate-gate-105-symbolic-cost-tier1-canvas.md | 40 +++++++++++++--- ...ate-gate-105-symbolic-cost-tier1-worker.md | 48 +++++++++++++++++-- 2 files changed, 77 insertions(+), 11 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 252985efe81..cf308edb833 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -25,7 +25,7 @@ PR #2824 (PM) carries §1.8 row #105 authority anchor; landing pending. Worker b ## §1. Ratified Tier 1 variant list (verbatim per Director msg_ad5e934d) -1. **PROMOTE**: `PolynomialCost { var: SizeVariable, degree: Rational }` (subsumes √n = n^(1/2), ∛n = n^(1/3), n^(2/3), and non-integer poly n^2.373 + n^2.807, plus existing integer poly) +1. **PROMOTE**: `PolynomialCost { var: SizeVariable, degree: Rational }` — **signed Rational, no `where` refinement** (Director RATIFIED scope-extension msg_2c1bfb0e 2026-05-13). Subsumes positive degrees: √n = n^(1/2), ∛n = n^(1/3), n^(2/3), non-integer 2.373/2.807, existing integer poly. Subsumes negative degrees: 1/n = n^(-1), 1/√n = n^(-1/2), 1/n² = n^(-2) (asymptotic-decay coverage per operator directive 2026-05-13). Arbitrary roots + inverse roots covered uniformly. 2. **ADD**: `PolyLogCost { var: SizeVariable, exponent: PolyLogExponent }` for log² n, log^k n (PolyLogExponent = Rational > 1 refinement; supports log^7.5 n / AKS Tier-1 case per operator BLOCKING PR #2824:333) 3. **ADD**: `ExponentialCost { base: ExponentialBase, var: SizeVariable }` for 2^n, c^n with c ≥ 2 (ExponentialBase = Int ≥ 2 refinement) 4. **ADD**: `FactorialCost { var: SizeVariable }` for n! @@ -135,9 +135,9 @@ Cons: ### Candidate Q2-Y — Collapse Linear into Polynomial(degree=1) ```dag -| PolynomialCost { var: SizeVariable, degree: Rational where degree > 0 } +| PolynomialCost { var: SizeVariable, degree: Rational } ``` -(LinearCost removed; `LinearCost(v)` ≡ `PolynomialCost { var: v, degree: 1 }`) +(LinearCost removed; `LinearCost(v)` ≡ `PolynomialCost { var: v, degree: 1 }`. Per Director scope-extension msg_2c1bfb0e: **no `where` refinement** — signed Rational admits negative degrees for asymptotic-decay coverage.) Pros: - Single uniform variant for all positive-degree polynomial bounds @@ -209,12 +209,37 @@ Current `src/v3/std/algebra.dag:69-72`: **Type-level refinement carriers (CORRECTED per PM msg_a52ed981)** — refinement-mechanism `type X = Y where predicate` is ALREADY RATIFIED at HEAD per gunbc#828 issuecomment-4390333451 Path 3 + Director Option 2 (gunbc#828 issuecomment-4390199218). Precedent: `dsl/std/integer.dag:181` (`PositiveInt = Nat where gt_zero`). KNOWN_PREDICATES registry at `src/v3/compiler/src/lower.rs:798-862`: `range / non_empty / brand / gt_zero / unicode_scalar`. NO fresh-records / inductive-sum carriers — refinement over canonical carrier is the canonical path: -- `PositiveRational = Rational where gt_zero` — REQUIRES `gt_zero` allowed_carriers extension to include `Rational` (atomic with carrier landing per Phase A) +- ~~`PositiveRational = Rational where gt_zero`~~ — **DROPPED per Director msg_2c1bfb0e scope-extension**: PolynomialCost.degree is plain `Rational` (signed; admits negative-degree decay). No gt_zero allowed_carriers extension needed for PolynomialCost. - `ExponentialBase = Int where range(min: 2)` — IMMEDIATELY available via `range` predicate (allowed_carriers includes Int) - `PolyLogExponent = Rational where gt_one` — REQUIRES NEW `gt_one` predicate (allowed_carriers: Rational + Int; mirrors `gt_zero` shape; atomic with carrier landing per Phase A) - `PositiveInt = Nat where gt_zero` — ALREADY EXISTS at `dsl/std/integer.dag:181`; worker reuses -These refinements make `degree ≤ 0` / `exponent ≤ 1` / `base ≤ 1` **structurally unrepresentable** at the carrier level via the ratified refinement mechanism — Practice 2 + Practice 6 satisfied; INVARIANTS P1 (single authority) preserved (no parallel rational/int authority). +These refinements make `exponent ≤ 1` / `base ≤ 1` **structurally unrepresentable** at the carrier level via the ratified refinement mechanism — Practice 2 + Practice 6 satisfied; INVARIANTS P1 (single authority) preserved. PolynomialCost.degree intentionally has no refinement: signed Rational admits asymptotic decay (negative degrees) per Director msg_2c1bfb0e scope-extension. + +## §6.1 — Q6 Asymptotic-dominance ordering with signed degrees (Director RATIFIED msg_2c1bfb0e) + +Signed-Rational degrees require explicit dominance rules across the sign boundary. Director-verbatim conjecture (RATIFIED): + +> - For positive degree a, b > 0: `n^a > n^b` iff `a > b` (existing rule). +> - Between positive + negative: any positive-degree term dominates any negative-degree term (`n^a > n^(-b)` for a, b > 0; positive grows → ∞, negative decays → 0). +> - Between negative + constant: `1 > n^(-a)` for any a > 0 (constant dominates decay-to-zero in asymptotic-magnitude lattice). +> - Between two negatives: `n^(-a) > n^(-b)` iff `a < b` (least-negative dominates; 1/n > 1/n²). +> +> **Conjecture**: the dominance rule is "compare degrees with reverse-sign-convention" — asymptotic dominance ≡ algebraic ordering of degrees, but the carrier-to-asymptotic-direction mapping handles sign. + +**Authority**: Q1-α already provides `Field.compare: fn(Rational, Rational) -> Ordering` on the signed-rational carrier. Worker encodes the dominance rule as a derived ordering on `(SizeVariable, Rational)` pairs using `Field.compare` for the magnitude comparison — no new ordering authority introduced. + +## §6.2 — Q7 SymbolicCost preserves full expression; Big-O is a derived operation (Director RATIFIED msg_2c1bfb0e) + +Director-verbatim disposition (RATIFIED): + +> SymbolicCost preserves the full expression ("symbolic" name commits to symbolic-representation, NOT pre-applied asymptotic-simplification). Sum-normalization rule: keep all terms in canonical sorted form (by dominance), DON'T drop sub-dominant terms during canonical-form construction. +> +> Big-O projection is a **derived operation** (separate function `dominant_term(SymbolicCost) -> SymbolicCost` or `asymptotic_class(SymbolicCost) -> ComplexityClass`); SymbolicCost itself is exact. + +**Rationale**: per `feedback_compositional_not_templating` — preserve info structurally; consumer projects as needed. Asymptotic-simplification at canonical-form construction would destroy info. + +**Implication for §5 algebra fold rules**: same-variable sums (e.g., `n + log(n) + 1/n`) canonicalize to `SumCost([PolyCost(n, 1), LogCost(n), PolyCost(n, -1)])` (dominance-sorted), NOT to the dominant term alone. The `+ ExpCost(c, v)` → `ExpCost(c, v)` style dominance rules in §5 are **derived-operation rules**, not canonical-form rules — they apply when computing `dominant_term`, not when constructing SymbolicCost. Worker brief Phase D encodes both: canonical-form preservation + dominant_term derivation. Variant count: **9** post-Q2-Y (Director-ratified; PolynomialCost.degree promotion is not a new variant), or **10** if Q2-X is ratified. @@ -269,6 +294,7 @@ No 🔴 RED introductions. Anti-pattern #2 (Director-enumerated): "Path B reviva 8. Multiplicative absorption rules where one variant absorbs another (`X · Y = X`) when X is asymptotically larger than Y additively — asymptotic absorption is sound for SUM but NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products must be `ProductCost` composite. §5 algebra rules table addresses (operator BLOCKING worker:140). 9. **PM-grep-corrected per msg_a52ed981 + codex 014544f4 finding #1**: Parallel rational-number carriers (fresh records like `{ num: PositiveInt; denom: PositiveInt }`, inductive sums, or any carrier shape OTHER than refinement) when the canonical refinement-mechanism (`type X = Y where predicate`) is RATIFIED at HEAD per gunbc#828 issuecomment-4390333451 Path 3 + Director Option 2. Refinement over canonical `Rational = Field>` is the canonical path; precedent `PositiveInt = Nat where gt_zero` at `dsl/std/integer.dag:181`. Anti-pattern fires on ANY fresh-carrier shape when refinement is available. 10. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) +11. **Director-added msg_2c1bfb0e**: Introducing parallel `InverseCost(SymbolicCost)` / `ReciprocalCost` / `DecayCost` variants when carrier-extension via signed `degree: Rational` is structurally clean. Same Q1-α / Q1-c lesson class — don't bridge-wrap when carrier-extension dissolves the question (`feedback_dissolve_bridges` + `feedback_no_metadata_markers`). ## §11. Cost-of-change accounting @@ -281,7 +307,7 @@ Per `INVARIANTS.md` "Cost of Change": For exotic (Tier-2) bounds: still requires UnknownCost("reason") at consumer site — that's the R4-deferral receipt. -## §12. Ratified dispositions (audit trail; all Q1-Q5 Director-ratified) +## §12. Ratified dispositions (audit trail; all Q1-Q7 Director-ratified) - **Q1**: **RATIFIED Q1-α** (msg_676ad4e7, supersedes msg_d86a5987 Q1-c) — use existing `Field.compare`; NO `OrderedField` introduction; cost-lens-local rational_lt/le/gt/ge/eq/ne free functions - **Q2**: **RATIFIED Q2-Y** (collapse LinearCost into PolynomialCost(degree=1)) @@ -289,6 +315,8 @@ For exotic (Tier-2) bounds: still requires UnknownCost("reason") at consumer sit - **Q4**: **RATIFIED** §6 STOP-SIGNAL text re-reset at 10th variant (9 ratified + 1 trigger) - **Q5**: **RATIFIED** this canvas (carrier-shape canvas before worker dispatch) - **§8 Tier-2 mechanism**: **RATIFIED defer to R4**; IteratedAlgebra rejected per §8 analysis +- **Q6** (Director msg_2c1bfb0e): **RATIFIED** signed-Rational `PolynomialCost.degree` (drop `where gt_zero` refinement); asymptotic-dominance rule "compare degrees with reverse-sign-convention" using existing `Field.compare` authority. Practice 4 🟢 GREEN — no new sum-types; carrier extension. +- **Q7** (Director msg_2c1bfb0e): **RATIFIED** SymbolicCost preserves full expression; canonical-form is dominance-sorted SumCost preserving all terms; Big-O is derived operation via `dominant_term` / `asymptotic_class` projection functions. ## §13. Reference diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index ab0db79261a..c1f8bfa3d9a 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -21,7 +21,7 @@ This brief encodes the ratified Tier-1 4-addition + 1-collapse + 1-promotion str ## §1. Ratified scope summary Net 7 → **9** SymbolicCost variants: -- **PROMOTE**: `PolynomialCost.degree: DegreeAtLeastTwo` → `PolynomialCost.degree: Rational where degree > 0` (subsumes √n, ∛n, n^(2/3), non-Int 2.373, AND the absorbed Linear case at degree=1) +- **PROMOTE**: `PolynomialCost.degree: DegreeAtLeastTwo` → `PolynomialCost.degree: Rational` (signed; **no `where` refinement** per Director msg_2c1bfb0e scope-extension) — subsumes positive (√n, ∛n, n^(2/3), n^2.373, absorbed Linear at degree=1) AND negative (1/n = n^(-1), 1/n² = n^(-2), asymptotic-decay coverage per operator directive 2026-05-13) - **REMOVE**: `LinearCost(SizeVariable)` — atomic migration to `PolynomialCost { var: v, degree: 1 }` (Q2-Y) - **ADD**: `PolyLogCost { var: SizeVariable, exponent: PolyLogExponent }` for log^k n (PolyLogExponent = Rational > 1 refinement; supports log^7.5 n cited Tier-1 AKS case) - **ADD**: `ExponentialCost { base: ExponentialBase, var: SizeVariable }` for c^n with c ≥ 2 (ExponentialBase = Int ≥ 2 refinement) @@ -125,7 +125,9 @@ type ExponentialBase = Int where range(min: 2) // PositiveRational: Rational > 0. REQUIRES KNOWN_PREDICATES extension: // add `Rational` to gt_zero's allowed_carriers (currently Nat + Int). // Worker authors atomic with carrier landing per Phase A. -type PositiveRational = Rational where gt_zero +// (PositiveRational DROPPED per Director msg_2c1bfb0e scope-extension — +// PolynomialCost.degree is plain signed Rational; admits negative-degree decay. +// No gt_zero allowed_carriers extension needed for PolynomialCost.) // PolyLogExponent: Rational > 1. REQUIRES KNOWN_PREDICATES extension: // add NEW `gt_one` predicate (allowed_carriers: Rational + Int) to @@ -158,7 +160,7 @@ Replace `src/v3/std/algebra.dag:190-197` with: ```dag type SymbolicCost inhabits Semiring = ConstantCost(Int) - | PolynomialCost { var: SizeVariable, degree: PositiveRational } // Q2-Y: absorbs LinearCost via degree=1; degree > 0 by carrier + | PolynomialCost { var: SizeVariable, degree: Rational } // Q2-Y: absorbs LinearCost via degree=1; Q6 signed Rational (admits decay) | PolyLogCost { var: SizeVariable, exponent: PolyLogExponent } // NEW: log^k n; exponent > 1 by carrier (admits 2, 3/2, 7.5; rejects 0/1 collapses) | ProductCost(NonSingletonList) | SumCost(NonSingletonList) @@ -171,13 +173,46 @@ type SymbolicCost inhabits Semiring 9 variants. **LinearCost is REMOVED** (anti-pattern #7: no bridge variants; atomic migration). **Invariants encoded at carrier level** (Practice 2/6 — NOT fold normalizer): -- `PolynomialCost.degree: PositiveRational` — `degree ≤ 0` is structurally impossible +- `PolynomialCost.degree: Rational` — **signed, no refinement** (Q6); negative degrees admitted for asymptotic-decay coverage. Asymptotic-dominance rule (Q6) is encoded in the algebra fold layer via `Field.compare` with reverse-sign-convention. - `PolyLogCost.exponent: PolyLogExponent` — `exponent ≤ 1` is structurally impossible (excludes 0=ConstantCost-collapse + 1=LogCost-collapse semantic dups); supports rational exponents like log^7.5 n (AKS primality cited Tier-1 case) - `ExponentialCost.base: ExponentialBase` — `base ≤ 1` is structurally impossible (excludes 0=degenerate + 1=ConstantCost-collapse) Reviewers MUST flag any attempt to use raw `Rational` / `Int` for these fields. -## §6. Phase D — Algebra interaction rules (Q3) +## §6. Phase D — Algebra interaction rules (Q3 + Q6 + Q7) + +### §6.0 — Q7 canonical-form preservation (Director RATIFIED msg_2c1bfb0e) + +**SymbolicCost preserves the full expression.** The same-variable algebra fold rules below apply to **derived-operation** projection (`dominant_term: SymbolicCost -> SymbolicCost`), NOT to canonical-form construction. Sum-canonicalization sorts terms by Q6 dominance ordering and preserves every term: + +``` +canonicalize(SumCost([n + log(n) + 1/n])) + = SumCost([PolyCost(n, 1), LogCost(n), PolyCost(n, -1)]) // dominance-sorted, all terms preserved +``` + +Big-O projection is a separate function applied by consumers: + +``` +fn dominant_term(c: SymbolicCost) -> SymbolicCost { + // Apply §6.1 dominance rules ONLY here, NOT during SumCost construction. +} +fn asymptotic_class(c: SymbolicCost) -> ComplexityClass { ... } +``` + +Worker MUST implement BOTH `canonicalize` (preserves all terms) and `dominant_term` (applies §6.1 dominance fold). Tests assert canonical-form preservation under mixed-sign (e.g., `n + 1/n` canonicalizes to 2-term SumCost, not 1-term PolyCost(n, 1)). + +### §6.1 — Q6 Asymptotic-dominance ordering with signed degrees (Director RATIFIED msg_2c1bfb0e) + +Dominance rule (used by `dominant_term`, NOT by canonicalize): + +- Positive degrees a, b > 0: `n^a > n^b` iff `a > b` +- Positive vs negative: `n^a > n^(-b)` for a, b > 0 (positive grows; negative decays) +- Constant vs negative: `1 > n^(-a)` for any a > 0 (constant dominates decay) +- Two negatives: `n^(-a) > n^(-b)` iff `a < b` (least-negative dominates; 1/n > 1/n²) + +**Implementation**: encode as a derived ordering over `(SizeVariable, Rational)` pairs using `Field.compare` for the underlying Rational comparison — Q1-α authority. NO separate ordered carrier introduced. + +### §6.2 — Same-variable algebra fold rules (applied by `dominant_term`) Update sum + product fold logic to implement the Director-ratified rule table (canvas §5). @@ -261,6 +296,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 8. **PM-grep-corrected per msg_a52ed981 + codex 014544f4 finding #1**: Parallel rational-number carriers (`PositiveRational { num: PositiveInt; denom: PositiveInt }`, inductive `PolyLogExponentSuccessor | PolyLogExponentFractional`, or any fresh record/sum shape) when refinement over canonical `Rational = Field>` carrier is available via ratified `type X = Y where predicate` mechanism (gunbc#828 issuecomment-4390333451 Path 3 RATIFIED; precedent `PositiveInt = Nat where gt_zero` at `dsl/std/integer.dag:181`). Anti-pattern fires on ANY fresh-carrier shape when refinement is available. 9. Multiplicative absorption rules (`X · Y = X`) where one variant absorbs another asymptotically — sound for SUM, NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products MUST be ProductCost composite (per operator BLOCKING worker:140) 10. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) +11. **Director-added msg_2c1bfb0e**: Introducing parallel `InverseCost(SymbolicCost)` / `ReciprocalCost` / `DecayCost` variants when carrier-extension via signed `degree: Rational` is structurally clean. Same Q1-α / Q1-c lesson class — don't bridge-wrap when carrier-extension dissolves the question (`feedback_dissolve_bridges` + `feedback_no_metadata_markers`). ## §12. 5 reviewer ratchets (Director-enumerated for PR review) @@ -327,6 +363,8 @@ Algebra rules §5/§6 implemented verbatim per canvas; (n!)² → UnknownCost ## §16. Reference +- Director scope-extension ratification msg_2c1bfb0e (Q6 signed-Rational + Q7 SymbolicCost preserves expression + anti-pattern #11) + - Canvas: PR #2828 / `docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md` - Director ratification (composite): PM msg_a055c38b relaying Director msg_d86a5987 (Q2-Q5 + §8 base) RECONCILED BY Director msg_676ad4e7 (Q1-α supersedes prior Q1-c) - Row anchor: PM PR #2824 From 91813078f1d1f7a9d43f7059d326ec38cbafbc23 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 06:54:56 +0000 Subject: [PATCH 25/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20pur?= =?UTF-8?q?ge=20stale=20PositiveRational=20refs=20(cursor=2010886)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cursor APPROVE_WITH_COMMENTS review 10886: post-Q6 scope-extension (243fd6379b), several PositiveRational / degree≤0 refinement references remained in canvas STOP-SIGNAL prose + worker brief verbatim STOP block, "zero new authority" line, hard-stop directive, STOP condition #4, anti-pattern #7, and §13 verification axis listing. Worker could follow the verbatim STOP/anti-pattern text and encode wrong carrier shape relative to ratified Q6/Q2-Y signed-Rational. Fix-forward: - Canvas §6 STOP-SIGNAL prose: PolynomialCost { degree: PositiveRational } → { degree: Rational } (signed per Q6) - Canvas §10 anti-pattern #7: drop degree≤0/PositiveRational requirement on PolynomialCost; explicit exclusion citing Q6 - Worker §4 verbatim STOP block: same PolynomialCost.degree text fix - Worker §5.0 "ZERO new authority": drop PositiveRational from refinement list; note PolynomialCost.degree plain signed - Worker §5.0 hard-stop directive: drop PositiveRational; add Q6 carve-out note - Worker §10 STOP #4 variant collision: drop PositiveRational from de-dup list; add anti-pattern-#7-fires note - Worker §11 anti-pattern #7: degree≤0 dropped; explicit PolynomialCost.degree exclusion per Q6 - Worker §13 verification axis: PositiveRational removed from refinement-carriers test list INVARIANTS P1/P2 single-authority restored across both briefs. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ubstrate-gate-105-symbolic-cost-tier1-canvas.md | 4 ++-- ...ubstrate-gate-105-symbolic-cost-tier1-worker.md | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index cf308edb833..2d35afe7987 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -205,7 +205,7 @@ Current `src/v3/std/algebra.dag:69-72`: > STOP SIGNAL: wanting an eighth variant. Pause and escalate rather than extending; the thesis claim is that seven covers the asymptotic surface, and any new variant should carry its own dissolution receipt. **Post-extension proposed text** (Mgr recommendation): -> STOP SIGNAL: wanting a 10th variant (or 11th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 9 variants covering ConstantCost / PolynomialCost { degree: PositiveRational } / PolyLogCost { exponent: PolyLogExponent } / LogCost / ProductCost / SumCost / ExponentialCost { base: ExponentialBase } / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. +> STOP SIGNAL: wanting a 10th variant (or 11th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 9 variants covering ConstantCost / PolynomialCost { degree: Rational } (signed per Q6) / PolyLogCost { exponent: PolyLogExponent } / LogCost / ProductCost / SumCost / ExponentialCost { base: ExponentialBase } / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. **Type-level refinement carriers (CORRECTED per PM msg_a52ed981)** — refinement-mechanism `type X = Y where predicate` is ALREADY RATIFIED at HEAD per gunbc#828 issuecomment-4390333451 Path 3 + Director Option 2 (gunbc#828 issuecomment-4390199218). Precedent: `dsl/std/integer.dag:181` (`PositiveInt = Nat where gt_zero`). KNOWN_PREDICATES registry at `src/v3/compiler/src/lower.rs:798-862`: `range / non_empty / brand / gt_zero / unicode_scalar`. NO fresh-records / inductive-sum carriers — refinement over canonical carrier is the canonical path: @@ -287,7 +287,7 @@ No 🔴 RED introductions. Anti-pattern #2 (Director-enumerated): "Path B reviva 4. Dominance lattice fudging via string-tagged Rational (use real ordered-witness) — §3 Q1-α addresses via existing Field.compare 5. UnknownCost used for textbook-Tier-1-coverable bounds post-promotion (STOP-SIGNAL violation) — §6 STOP-SIGNAL text encodes 6. **Director-ratified msg_676ad4e7**: Introducing parallel ordered-algebraic-structure carriers (`Ordered`) when the underlying carrier already provides `compare: fn(T, T) -> Ordering`. Lens-local predicate derivation from Ordering pattern-match is the canonical path. — §3 Q1-α addresses -7. **NEW (pending Director ratification per operator BLOCKING PR #2824:333)**: Tier-1 variant constructed with raw Int/Rational exponent/base that admits illegal collapse values (exponent=0/1 for PolyLogCost; base=0/1 for ExponentialCost; degree≤0 for PolynomialCost) bypassing the refinement type. PolyLogExponent/ExponentialBase/PositiveRational are required at the type level (Practice 2/6; illegal-states-unrepresentable). +7. **NEW (Director ratified per operator BLOCKING PR #2824:333)**: Tier-1 variant constructed with raw Int/Rational exponent/base that admits illegal collapse values (exponent=0/1 for PolyLogCost; base=0/1 for ExponentialCost) bypassing the refinement type. PolyLogExponent + ExponentialBase are required at the type level (Practice 2/6; illegal-states-unrepresentable). **PolynomialCost.degree is excluded** from this anti-pattern — Director msg_2c1bfb0e scope-extension intentionally admits signed Rational degrees for asymptotic-decay coverage (Q6). ### Mgr-derived (encoded for worker review) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index c1f8bfa3d9a..644925eb90e 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -94,7 +94,7 @@ Replace `src/v3/std/algebra.dag:60-72` block with (Director-ratified verbatim pe // IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and // escalate. Tier-1 textbook coverage (gate #105 carrier-extension // 2026-05-13, PR #) lands 9 variants covering ConstantCost / -// PolynomialCost { degree: PositiveRational } / PolyLogCost { exponent: +// PolynomialCost { degree: Rational } (signed per Q6) / PolyLogCost { exponent: // PolyLogExponent (Rational > 1) } / LogCost / ProductCost / SumCost / // ExponentialCost { base: ExponentialBase (Int ≥ 2) } / FactorialCost / // UnknownCost — sufficient @@ -141,7 +141,7 @@ type PolyLogExponent = Rational where gt_one 2. Add new `gt_one` predicate (allowed_carriers: `Rational + Int`; arg_shape: `Bare`) 3. Both extensions land in same PR as carrier-shape changes — atomic per §P5 -**ZERO new authority introduced**: PositiveRational + PolyLogExponent are refinements of canonical Rational; ExponentialBase is refinement of canonical Int. Practice 4 / P1 / Q-MachineConstraint-Carrier hard constraint "no dual representations" all satisfied. +**ZERO new authority introduced**: PolyLogExponent is a refinement of canonical Rational; ExponentialBase is a refinement of canonical Int. PolynomialCost.degree uses plain signed Rational (no refinement; Q6 scope-extension). Practice 4 / P1 / Q-MachineConstraint-Carrier hard constraint "no dual representations" all satisfied. **Authority chain for refinement mechanism**: - gunbc#828 issuecomment-4390333451 (Path 3 RATIFIED) @@ -149,9 +149,9 @@ type PolyLogExponent = Rational where gt_one - `dsl/std/integer.dag:171-181` precedent (`PositiveInt = Nat where gt_zero`) - `src/v3/compiler/src/lower.rs:798-862` KNOWN_PREDICATES registry -These types make `degree ≤ 0`, `exponent ≤ 1`, `base ≤ 1` structurally impossible to construct via the ratified refinement mechanism — no fold-time enforcement required, no new authority. +These refinements make `exponent ≤ 1` (PolyLogCost) and `base ≤ 1` (ExponentialCost) structurally impossible to construct — no fold-time enforcement required, no new authority. PolynomialCost.degree intentionally has no such refinement: Q6 signed Rational admits negative degrees for asymptotic-decay coverage. -**HARD STOP**: do NOT author PositiveRational / PolyLogExponent / ExponentialBase as fresh records / inductive sums when refinement over canonical carrier is available. That pattern is codex BLOCKING 014544f4 finding #1 + operator BLOCKING worker:104 anti-pattern (now §10 #8 below). +**HARD STOP**: do NOT author PolyLogExponent / ExponentialBase as fresh records / inductive sums when refinement over canonical carrier is available. That pattern is codex BLOCKING 014544f4 finding #1 + operator BLOCKING worker:104 anti-pattern (now §10 #8 below). (PositiveRational is no longer in scope per Q6 scope-extension; PolynomialCost.degree is plain signed Rational.) ### §5.1 — Replace SymbolicCost variant set @@ -278,7 +278,7 @@ After Phase A-F land + tests green, update `docs/r3-program-plan.md` §1.8 row # 1. **`OrderedRing` shape drift** at HEAD — if `dsl/std/algebra.dag:268-286` no longer carries the exact 14-field signature this brief mirrors, **STOP** and surface — strict-mirror authority broken. 2. **Existing `LinearCost`-consumer surface differs from canvas assumption** — if grep reveals consumer paths that can't migrate to `PolynomialCost(degree=1)` losslessly (e.g., type-level dispatches on LinearCost variant-tag), **STOP** — anti-pattern #7 atomic-migration discipline requires lossless migration. 3. **`Rational` carrier not at `dsl/std/rational.dag:26`** — if Rational has moved / changed shape since 2026-05-13 grep, **STOP** — Q1-α refinement target is wrong. -4. **Variant-name collision** at HEAD — if any of `PolyLogCost` / `ExponentialCost` / `FactorialCost` / `PositiveRational` / `ExponentialBase` / `PolyLogExponent` appear from parallel landing, **STOP** for de-duplication. (`PositiveInt` already exists at `dsl/std/integer.dag:181` — reuse.) +4. **Variant-name collision** at HEAD — if any of `PolyLogCost` / `ExponentialCost` / `FactorialCost` / `ExponentialBase` / `PolyLogExponent` appear from parallel landing, **STOP** for de-duplication. (`PositiveInt` already exists at `dsl/std/integer.dag:181` — reuse. `PositiveRational` is OUT of scope per Q6 — if encountered at HEAD as a parallel landing, that's an anti-pattern #7 fire.) 5. **Algebra rule §5.2 violation tempted** — if Phase D authoring tempts a named (n!)² variant or non-Unknown disposition, **STOP** — anti-pattern #5 fires; the rule disposition is Director-ratified. 6. **PR #2824 not merged at dispatch** OR **PR #2828 not merged at dispatch** — both gates AND; if either is unmerged, **STOP** and surface to Mgr; worker dispatch is blocked. @@ -292,7 +292,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 4. Dominance lattice fudging via string-tagged Rational (use real ordered-witness) — §3 Q1-α addresses via existing Field.compare 5. UnknownCost used for textbook-Tier-1-coverable bounds post-promotion (STOP-SIGNAL violation) 6. **Director-ratified msg_676ad4e7**: Introducing parallel ordered-algebraic-structure carriers (`Ordered`) when the underlying carrier already provides `compare: fn(T, T) -> Ordering` — lens-local predicate derivation from Ordering pattern-match is the canonical path -7. **Pending Director ratification per operator BLOCKING PR #2824:333**: Tier-1 variant constructed with raw Int/Rational exponent/base admitting illegal collapse values (exponent=0/1 for PolyLogCost; base=0/1 for ExponentialCost; degree≤0 for PolynomialCost) bypassing refinement type — PolyLogExponent/ExponentialBase/PositiveRational required at carrier level (Practice 2/6) +7. **Director ratified per operator BLOCKING PR #2824:333**: Tier-1 variant constructed with raw Int/Rational exponent/base admitting illegal collapse values (exponent=0/1 for PolyLogCost; base=0/1 for ExponentialCost) bypassing refinement type — PolyLogExponent + ExponentialBase required at carrier level (Practice 2/6). **PolynomialCost.degree is excluded** per Director msg_2c1bfb0e scope-extension — signed Rational degrees intentionally admit negative values for asymptotic-decay coverage (Q6). 8. **PM-grep-corrected per msg_a52ed981 + codex 014544f4 finding #1**: Parallel rational-number carriers (`PositiveRational { num: PositiveInt; denom: PositiveInt }`, inductive `PolyLogExponentSuccessor | PolyLogExponentFractional`, or any fresh record/sum shape) when refinement over canonical `Rational = Field>` carrier is available via ratified `type X = Y where predicate` mechanism (gunbc#828 issuecomment-4390333451 Path 3 RATIFIED; precedent `PositiveInt = Nat where gt_zero` at `dsl/std/integer.dag:181`). Anti-pattern fires on ANY fresh-carrier shape when refinement is available. 9. Multiplicative absorption rules (`X · Y = X`) where one variant absorbs another asymptotically — sound for SUM, NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products MUST be ProductCost composite (per operator BLOCKING worker:140) 10. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) @@ -309,7 +309,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: ## §13. Verification - `cargo test --workspace` green -- New hermetic ratchet `symbolic_cost_tier1_carrier_test.rs` (§7) asserts all 4 verification axes (variant set / refinement carriers (PositiveRational/PositiveInt/ExponentialBase/PolyLogExponent) / algebra rules sample / STOP-SIGNAL text) +- New hermetic ratchet `symbolic_cost_tier1_carrier_test.rs` (§7) asserts all 4 verification axes (variant set / refinement carriers (PositiveInt/ExponentialBase/PolyLogExponent — NOT PositiveRational; PolynomialCost.degree is plain signed Rational per Q6) / algebra rules sample / STOP-SIGNAL text) - **INVARIANTS P5 receipt for the new hand-Rust test file** (per claude APPROVE 10773 + codex BLOCKING 014544f4 finding #4): authoring `symbolic_cost_tier1_carrier_test.rs` adds new hand-Rust under `src/v3/compiler/tests/`. Per P5 "Pure Bootstrap" discipline, this PR's body MUST cite **exactly ONE P5 receipt category** with concrete path + LOC count: - (a) **hand-Rust deletion of equivalent or greater LOC**: cite specific deleted file/lines + LOC count - (b) **SG-0 census shrink receipt**: cite specific SG-0 cell + shrink delta From e7af2fecfa89b0bb0a9a6896dd509a339ea249e4 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 07:08:31 +0000 Subject: [PATCH 26/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20STO?= =?UTF-8?q?P-SIGNAL=20line=20range=20:60-72=20=E2=86=92=20:69-72?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cursor REQUEST_CHANGES 10904: brief cited STOP-SIGNAL as :60-72 across 7 surfaces but the live file has STOP at :69-72 and Pattern 3/4 dissolution receipt at :49-67. A literal Phase B "replace :60-72" would delete part of the dissolution receipt — INVARIANTS P1 (dispatch prose must ground in identifiable file facts) + P2 (single edit locus). Fix-forward: - Canvas L10 / L46 / L325 STOP-cite: :60-72 → :69-72 - Worker L42 / L90 (Phase B replace) / L261 / L350 / L373: :60-72 → :69-72 - Worker §4 Phase B: explicit DO-NOT-TOUCH callout on :49-67 dissolution receipt; replacement is surgical 4-line STOP block only Brief is now internally consistent with canvas:204 ("Current src/v3/std/algebra.dag:69-72") which was already correct. Co-Authored-By: Claude Opus 4.7 (1M context) --- ...-substrate-gate-105-symbolic-cost-tier1-canvas.md | 6 +++--- ...-substrate-gate-105-symbolic-cost-tier1-worker.md | 12 +++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 2d35afe7987..2a027138d38 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -7,7 +7,7 @@ ratification anchor: PM msg_4fd650b7 relaying Director msg_ad5e934d — Path A T operator framing: "current list looks very slim ... we need to land this all in R3 please" (2026-05-13) authority docs: - `src/v3/std/algebra.dag:190-197` — current 7-variant `SymbolicCost` - - `src/v3/std/algebra.dag:60-72` — `STOP SIGNAL: wanting an eighth variant` (will reset) + - `src/v3/std/algebra.dag:69-72` — `STOP SIGNAL: wanting an eighth variant` (will reset) - `docs/design-symbolic-cost-algebra.md` — current algebra - `dsl/std/algebra.dag:268-286` — existing `OrderedRing` witness pattern - `dsl/std/algebra.dag:294` — `Field` carries `compare: fn(T, T) -> Ordering` (foundational order primitive; derived predicates lt/le/gt/ge live lens-local under Q1-α) @@ -43,7 +43,7 @@ Tier 2 R4-DEFERRED per Director with named-consumer-trigger requirement: ## §2. State at HEAD (grep-verified 2026-05-13) - `src/v3/std/algebra.dag:190-197`: current 7 variants (ConstantCost, LinearCost, PolynomialCost with `degree: DegreeAtLeastTwo`, ProductCost, SumCost, LogCost, UnknownCost) -- `src/v3/std/algebra.dag:60-72`: STOP SIGNAL "wanting an eighth variant" +- `src/v3/std/algebra.dag:69-72`: STOP SIGNAL "wanting an eighth variant" - `dsl/std/algebra.dag:268-286`: `OrderedRing` witness with `compare/lt/le/gt/ge` already defined - `dsl/std/algebra.dag:287-295`: `Field` — **CORRECTION per operator BLOCKING 2026-05-13 (canvas:48)**: Field ALREADY has `compare: fn(T, T) -> Ordering` (line 294). The earlier "defined WITHOUT order operations" claim was wrong. Field is missing the derived order predicates (lt/le/gt/ge/eq/ne) that `OrderedRing` carries (lines 268-286), but the foundational `compare` operator IS already on Field. - `dsl/std/rational.dag:26`: `type Rational = Field>`. Per above correction: Rational already carries `compare` via Field — order primitive is present. What's missing is the convenience-predicate set (lt/le/gt/ge/eq/ne). This invalidates the original Q1 premise; see §3 revised candidate set below. @@ -322,7 +322,7 @@ For exotic (Tier-2) bounds: still requires UnknownCost("reason") at consumer sit - §1.8 row #105 (PM PR #2824 pending) — authority anchor - `src/v3/std/algebra.dag:190-197` — current 7-variant SymbolicCost -- `src/v3/std/algebra.dag:60-72` — current STOP SIGNAL +- `src/v3/std/algebra.dag:69-72` — current STOP SIGNAL - `dsl/std/algebra.dag:268-286` — OrderedRing precedent - `dsl/std/algebra.dag:294` — Field carries `compare: fn(T, T) -> Ordering` - `dsl/std/rational.dag:26` — Rational = Field> diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 644925eb90e..8eaf5d371be 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -39,7 +39,7 @@ Sibling substrate (Q1 — Rational ordering; **Director RATIFIED Q1-α per msg_6 ## §2. Authority chain (verbatim) -- `src/v3/std/algebra.dag:60-72` — current STOP SIGNAL (will be rewritten per §4) +- `src/v3/std/algebra.dag:69-72` — current STOP SIGNAL (will be rewritten per §4) - `src/v3/std/algebra.dag:190-197` — current 7-variant `SymbolicCost` - `dsl/std/algebra.dag:268-286` — `OrderedRing` precedent (`compare/lt/le/gt/ge` witness pattern) - `dsl/std/algebra.dag:287-295` — current `Field` (carries `compare: fn(T, T) -> Ordering` at :294; missing derived predicates lt/le/gt/ge/eq/ne — see §3 Q1-α premise correction) @@ -87,7 +87,9 @@ Q1-γ (OrderedField as Field-superset via inheritance) REJECTED by Director — ## §4. Phase B — STOP SIGNAL rewrite (Q4) -Replace `src/v3/std/algebra.dag:60-72` block with (Director-ratified verbatim per canvas §6): +Replace `src/v3/std/algebra.dag:69-72` block — and ONLY that 4-line block — with (Director-ratified verbatim per canvas §6): + +**DO NOT** touch lines `:49-67`: those carry the 4-pattern dissolution receipt (Pattern 1/2/3/4 commentary) and are out-of-scope for this PR. Phase B is a surgical replacement of the STOP-SIGNAL paragraph only; the dissolution-receipt prose updates (if any) belong to a separate canvas + PR (codex BLOCKING 10904 explicit warning). ``` // STOP SIGNAL: wanting a 10th variant (or 11th if Tier-2 @@ -258,7 +260,7 @@ Mirror `src/v3/compiler/tests/integration/cementing/` shape (cf. `complexity_len - Phase A Q1-α deliverables present: rational_lt/le/gt/ge/eq/ne free functions in cost-lens module; NO OrderedField type declared - `Rational = Field>` UNCHANGED at `dsl/std/rational.dag:26` (Q1-α) - Algebra rule sample tests (≥6 of §6 rules): assert fold output for representative inputs (e.g., `PolyCost(1/2) · PolyCost(1/2)` produces `PolyCost(1)`; `ExpCost(2,n) · PolyCost(d)` produces `ProductCost([ExpCost(2,n), PolyCost(d)])` — multiplicative cross-class is NOT absorbed per §6 + anti-pattern #9 (asymptotic absorption is sound for SUM but unsound for PRODUCT); `ExpCost(2,n) + PolyCost(d)` produces `ExpCost(2,n)` — additive cross-class absorption is sound; `FactorialCost(n)²` produces `UnknownCost` with the exact §5.2 reason-string) -- STOP-SIGNAL text at `:60-72` contains new "10th variant" wording +- STOP-SIGNAL text at `:69-72` contains new "10th variant" wording ## §8. Phase F — Consumer migration (atomic) @@ -347,7 +349,7 @@ Companion substrate (Q1-α): - Cost-lens-local Rational ordering helpers (NO new OrderedField; derived from existing Field.compare) - Rational stays as Field> (UNCHANGED) -STOP-SIGNAL re-reset to 10 (9 ratified + 1 trigger) at algebra.dag:60-72. +STOP-SIGNAL re-reset to 10 (9 ratified + 1 trigger) at algebra.dag:69-72. Algebra rules §5/§6 implemented verbatim per canvas; (n!)² → UnknownCost ("(v!)² exceeds Tier 1 — pending R4 named-variant canvas"). @@ -370,7 +372,7 @@ Algebra rules §5/§6 implemented verbatim per canvas; (n!)² → UnknownCost - Row anchor: PM PR #2824 - Sibling-witness precedent: `dsl/std/algebra.dag:268-286` (OrderedRing) - Current SymbolicCost: `src/v3/std/algebra.dag:190-197` -- Current STOP-SIGNAL: `src/v3/std/algebra.dag:60-72` +- Current STOP-SIGNAL: `src/v3/std/algebra.dag:69-72` - Rational: `dsl/std/rational.dag:26` - `feedback_strict_mirror_vs_novel_substrate_fact` — Q1-α discipline (strict-mirror of existing Field.compare; novel only at lens-local helper layer) - `feedback_state_space_vs_behavioral_invariants` — Q2-Y refinement-vs-fold discipline From e9cce9910c8dbb803ea72e96ac65df0b9e07313a Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 07:23:08 +0000 Subject: [PATCH 27/36] =?UTF-8?q?docs(r3):=20gate=20#105=20worker=20?= =?UTF-8?q?=E2=80=94=20drop=20stale=20gt=5Fzero=20extension=20from=20Phase?= =?UTF-8?q?=20A=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cursor APPROVE_WITH_COMMENTS 10920: §5.0 KNOWN_PREDICATES extension list still required extending gt_zero's allowed_carriers to Rational, but PositiveRational was dropped in the Q6 scope-extension (243fd6379b) — no in-scope refinement uses gt_zero on Rational anymore. Conflicting dispatch vs the comment block above. Fix-forward: Phase A list now has only the gt_one addition (genuinely required for PolyLogExponent = Rational where gt_one). Explicit parenthetical: gt_zero extension NOT required; range allowed_carriers already includes Int for ExponentialBase. Only gt_one is new. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../r3-substrate-gate-105-symbolic-cost-tier1-worker.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 8eaf5d371be..bd777a9b61b 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -139,9 +139,10 @@ type PolyLogExponent = Rational where gt_one ``` **Phase A KNOWN_PREDICATES extensions** (Mgr-tier scope; required for refinement-mechanism authority): -1. Extend `gt_zero`'s `allowed_carriers` to include `Rational` (was `Nat + Int`) -2. Add new `gt_one` predicate (allowed_carriers: `Rational + Int`; arg_shape: `Bare`) -3. Both extensions land in same PR as carrier-shape changes — atomic per §P5 +1. Add new `gt_one` predicate (allowed_carriers: `Rational + Int`; arg_shape: `Bare`) — required for `PolyLogExponent = Rational where gt_one` +2. Extension lands in same PR as carrier-shape changes — atomic per §P5 + +(`gt_zero` allowed_carriers extension is **NOT** required: PolynomialCost.degree is plain signed Rational per Q6 — no refinement uses `gt_zero` on Rational. `ExponentialBase = Int where range(min: 2)` uses the existing `range` predicate (allowed_carriers already includes Int). Only `gt_one` is genuinely new.) **ZERO new authority introduced**: PolyLogExponent is a refinement of canonical Rational; ExponentialBase is a refinement of canonical Int. PolynomialCost.degree uses plain signed Rational (no refinement; Q6 scope-extension). Practice 4 / P1 / Q-MachineConstraint-Carrier hard constraint "no dual representations" all satisfied. From da89089dd075a6559139a01cf691bfba5de70855 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 08:04:08 +0000 Subject: [PATCH 28/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20Q6?= =?UTF-8?q?=20zero-degree=20collision=20+=20Q7=20worker=20semantics=20+=20?= =?UTF-8?q?AP=20count?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex BLOCKING review 4bd0cb5a — 2 BLOCKING + 1 non-blocking: 1. Q6 carrier admits degree=0 colliding with ConstantCost (n^0 ≡ 1): Fix-forward: keep ratified plain signed Rational carrier; add explicit canonicalize-fold rule canvas §6.1 + worker §6 algebra: `canonicalize(PolyCost(_, 0)) ⇒ ConstantCost(1)`. Same dissolution discipline class as Q2-Y LinearCost ≡ PolyCost(d=1) collapse. Single authority for "value=1 constant" via ConstantCost, not parallel via PolyCost(_, 0). 2. Q7 output-semantics drift between canvas + worker §14: Fix-forward: worker §14 reframed — symbolic_cost_of returns EXACT canonical SymbolicCost (Q7 contract change, not backwards-compatible reduction). Big-O is derived via dominant_term projection. Legacy single-term consumers MUST wrap with dominant_term; canonical-form change is expected and ratified. 3. Anti-pattern off-by-one (non-blocking): worker §11 enumerated 11 items but header + §12 + §13 + §15 PR template said 10. Fix-forward: updated all 4 cite-list surfaces to 11 (7 Director-enumerated + 4 Mgr-derived). Co-Authored-By: Claude Opus 4.7 (1M context) --- ...bstrate-gate-105-symbolic-cost-tier1-canvas.md | 2 ++ ...bstrate-gate-105-symbolic-cost-tier1-worker.md | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 2a027138d38..4e3c7e978f0 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -229,6 +229,8 @@ Signed-Rational degrees require explicit dominance rules across the sign boundar **Authority**: Q1-α already provides `Field.compare: fn(Rational, Rational) -> Ordering` on the signed-rational carrier. Worker encodes the dominance rule as a derived ordering on `(SizeVariable, Rational)` pairs using `Field.compare` for the magnitude comparison — no new ordering authority introduced. +**Zero-degree collision dissolution** (per codex BLOCKING 4bd0cb5a finding #1): plain signed `Rational` admits `degree = 0`, which would collide with `ConstantCost` (n^0 ≡ 1 for any n). Resolution: **carrier stays plain signed Rational** (Q6 ratified shape preserved); collision is dissolved at the canonicalize-fold layer via the rule `canonicalize(PolyCost(_, 0)) ⇒ ConstantCost(1)` — same dissolution discipline as Q2-Y `LinearCost(v) ≡ PolyCost(v, 1)` collapse and Practice-4 coproduct-arm dissolution. Construction-time the carrier is permissive; canonical-form construction folds the degenerate case into the existing `ConstantCost` arm. Worker brief §6 algebra encodes this rule alongside the Q2-Y collapse — single-authority for "value=1 constant" via `ConstantCost`, not parallel via `PolyCost(_, 0)`. + ## §6.2 — Q7 SymbolicCost preserves full expression; Big-O is a derived operation (Director RATIFIED msg_2c1bfb0e) Director-verbatim disposition (RATIFIED): diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index bd777a9b61b..1dcfb4f3f17 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -225,8 +225,9 @@ Same-variable rules (operands share `SizeVariable`): | Operation | Result | |---|---| -| `PolyCost(d1) + PolyCost(d2)` | `PolyCost(max(d1, d2))` (uses `Rational.compare` (Q1-α free function `rational_max`)) | -| `PolyCost(d1) · PolyCost(d2)` | `PolyCost(d1 + d2)` (uses `Rational.add` (Field)) | +| `canonicalize(PolyCost(_, 0))` | `ConstantCost(1)` — zero-degree dissolution per canvas §6.1 (n^0 ≡ 1; collision with ConstantCost resolved at canonicalize-fold; codex BLOCKING 4bd0cb5a finding #1) | +| `PolyCost(d1) + PolyCost(d2)` (`dominant_term` projection) | `PolyCost(max(d1, d2))` (uses `Rational.compare` (Q1-α free function `rational_max`)) | +| `PolyCost(d1) · PolyCost(d2)` | `canonicalize(PolyCost(d1 + d2))` — uses `Rational.add` (Field); if `d1 + d2 = 0` collapses to `ConstantCost(1)` per zero-degree rule | | `PolyCost(d) · LogCost(v)` | `ProductCost([PolyCost(d), LogCost(v)])` (§5.1: composite, NOT PolyLogCost) | | `PolyLogCost(v, k1) · PolyLogCost(v, k2)` | `PolyLogCost(v, k1+k2)` | | `PolyLogCost(v, k1) + PolyLogCost(v, k2)` | `PolyLogCost(v, max(k1, k2))` | @@ -285,7 +286,7 @@ After Phase A-F land + tests green, update `docs/r3-program-plan.md` §1.8 row # 5. **Algebra rule §5.2 violation tempted** — if Phase D authoring tempts a named (n!)² variant or non-Unknown disposition, **STOP** — anti-pattern #5 fires; the rule disposition is Director-ratified. 6. **PR #2824 not merged at dispatch** OR **PR #2828 not merged at dispatch** — both gates AND; if either is unmerged, **STOP** and surface to Mgr; worker dispatch is blocked. -## §11. 10 anti-patterns (7 Director-enumerated/pending + 3 Mgr-derived per canvas §10) +## §11. 11 anti-patterns (7 Director-enumerated + 4 Mgr-derived per canvas §10) PR body MUST cite each verbatim + assert receipt-of-compliance: @@ -307,7 +308,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 2. **Q2-Y integrity**: NO LinearCost preservation paths alongside PolyCost(degree=1); atomic migration receipt required 3. **Q3 algebra rules**: §5.1 + §5.2 dispositions are load-bearing; reviewers flag deviation 4. **Q4 STOP-SIGNAL text**: must land at `src/v3/std/algebra.dag:69-72` with new variant cap at 10 (9 ratified + 1 trigger) -5. **All 10 anti-patterns enforceable** at PR review +5. **All 11 anti-patterns enforceable** at PR review ## §13. Verification @@ -323,7 +324,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: - PR body cites: - Gate #105 closure (Phase G ledger update) - Canvas PR #2828 + composite Director ratification verbatim Q1-Q5 + §8 (PM msg_a055c38b relaying msg_d86a5987 Q2-Q5/§8 base RECONCILED BY msg_676ad4e7 Q1-α supersession of prior Q1-c) - - 10 anti-patterns receipt-of-compliance (§11) + - 11 anti-patterns receipt-of-compliance (§11) - 5 reviewer ratchets (§12) — explicit assertion-of-compliance per item ## §14. Out of scope @@ -331,7 +332,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: - **Tier 2 variants** (LogLog / InverseAckermann / IteratedLog / HyperExp) — R4-deferred per Director §8. Worker must NOT add these. - **`Field` consumer migration** beyond cost-lens — Q1-α; Field stays in place unchanged (compare already present) - **InverseAckermann / IteratedAlgebra mechanism** — canvas §8 finding accepted; not introduced -- **Cost-lens behavioral changes** — this is a carrier-extension PR, not a semantics change; lens output must be backwards-compatible modulo Linear→Poly(d=1) lossless rewrite +- **Cost-lens behavioral changes** — this is a carrier-extension PR + Q7 canonical-form-preservation contract change. **Q7 OUTPUT SEMANTICS (Director RATIFIED msg_2c1bfb0e via canvas §6.2)**: `symbolic_cost_of(...)` returns **exact canonical SymbolicCost** with all dominance-sorted terms preserved — NOT dominant-term-reduced (no pre-applied asymptotic-simplification). Big-O projection is the separate derived function `dominant_term(SymbolicCost) -> SymbolicCost`. Consumers that previously expected dominant-only output MUST call `dominant_term` explicitly; this is the Q7 contract change, expected and ratified. Lens output for the Linear→Poly(d=1) atomic rewrite is lossless modulo the canonical-form change (multi-term SumCost where the prior shape may have been dominant-only). Worker tests assert: (1) canonicalize preserves all terms; (2) dominant_term applies §6.2 dominance fold; (3) consumers of `symbolic_cost_of` either accept multi-term output OR wrap with `dominant_term` for legacy single-term consumption. - **`docs/design-symbolic-cost-algebra.md` rewrite** — out of scope; tracked separately as doc-drift sweep ## §15. PR body framing template @@ -355,7 +356,7 @@ STOP-SIGNAL re-reset to 10 (9 ratified + 1 trigger) at algebra.dag:69-72. Algebra rules §5/§6 implemented verbatim per canvas; (n!)² → UnknownCost ("(v!)² exceeds Tier 1 — pending R4 named-variant canvas"). -10 anti-patterns receipt-of-compliance: +11 anti-patterns receipt-of-compliance: [enumerate each + cite that the implementation does not violate it] 5 reviewer ratchets compliance: From 77088ffd6f58141a1af6b571e5e28cf9e091ba85 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 08:12:36 +0000 Subject: [PATCH 29/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20Q6?= =?UTF-8?q?=20Option=20B=20Practice-2=20carrier=20refinement=20(msg=5Fb80b?= =?UTF-8?q?caa8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Director RATIFIED Option B on Q6 zero-degree Practice-2 tension via msg_b80bcaa8 (relayed by PM msg_9d248cbd 2026-05-13). Practice-2 carrier-level `where nonzero` refinement preferred over Practice-4 canonicalize-fold dissolution; sign-admission intent preserved. Director-distilled discipline rule (NEW, load-bearing): > Same-variant redundancy → Practice-4 collapse (Q2-Y LinearCost ≡ > PolyCost(d=1)). Cross-variant redundancy → Practice-2 carrier > refinement (PolyCost(d=0) ≡ ConstantCost(1)). Type-level state-space > tightening beats API-level normalization when redundant state crosses > variant boundaries. Canvas + worker fix-forward: - §1 PROMOTE / §3 Q2-Y candidate / §6 STOP-SIGNAL / §6.1 dissolution text: `Rational` → `Rational where nonzero` (sign-admission via msg_2c1bfb0e preserved; only degree=0 excluded) - Canvas §6.1: reframed from canonicalize-fold to carrier-level refinement; Practice-2 vs Practice-4 disambiguation rule encoded - Worker §5 Phase A KNOWN_PREDICATES list: add `nonzero` predicate (allowed_carriers: Rational; arg_shape: Bare); now 2 new predicates (gt_one + nonzero), not 1 - Worker §5 "ZERO new authority" line: cite cross-variant vs same-variant rule - Worker §6 algebra table: canonicalize-fold rule REMOVED (type prevents construction); multiplicative cancellation rule split into d1+d2≠0 and d1+d2=0 cases (=0 maps to ConstantCost(1) directly without PolyCost(d=0) intermediate which is type-rejected) - Worker §7 bootstrap ratchet: type-rejection negative test added (PolyCost(_, Rational(0)) must be structurally rejected; ±n admits) - §11 anti-pattern #12 (new, Director-added): forbid canonicalize-fold for cross-variant redundancy when carrier refinement available - AP cite-list counts: 11 → 12 across §11 header / §12 / §13 / §15 Co-Authored-By: Claude Opus 4.7 (1M context) --- ...ate-gate-105-symbolic-cost-tier1-canvas.md | 10 ++++-- ...ate-gate-105-symbolic-cost-tier1-worker.md | 32 +++++++++++-------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 4e3c7e978f0..5100888008d 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -25,7 +25,7 @@ PR #2824 (PM) carries §1.8 row #105 authority anchor; landing pending. Worker b ## §1. Ratified Tier 1 variant list (verbatim per Director msg_ad5e934d) -1. **PROMOTE**: `PolynomialCost { var: SizeVariable, degree: Rational }` — **signed Rational, no `where` refinement** (Director RATIFIED scope-extension msg_2c1bfb0e 2026-05-13). Subsumes positive degrees: √n = n^(1/2), ∛n = n^(1/3), n^(2/3), non-integer 2.373/2.807, existing integer poly. Subsumes negative degrees: 1/n = n^(-1), 1/√n = n^(-1/2), 1/n² = n^(-2) (asymptotic-decay coverage per operator directive 2026-05-13). Arbitrary roots + inverse roots covered uniformly. +1. **PROMOTE**: `PolynomialCost { var: SizeVariable, degree: Rational where nonzero }` — **signed Rational with carrier-level `where nonzero` refinement** (Director RATIFIED scope-extension msg_2c1bfb0e — sign-admission intent — AS REFINED BY msg_b80bcaa8: Practice-2 carrier-level exclusion of degree=0 to prevent parallel authority with ConstantCost; sign-admission preserved — refinement excludes ONLY 0, admits ±). Subsumes positive degrees: √n = n^(1/2), ∛n = n^(1/3), n^(2/3), non-integer 2.373/2.807, existing integer poly. Subsumes negative degrees: 1/n = n^(-1), 1/√n = n^(-1/2), 1/n² = n^(-2) (asymptotic-decay coverage per operator directive 2026-05-13). Arbitrary roots + inverse roots covered uniformly; degree=0 structurally unrepresentable per Practice 2. 2. **ADD**: `PolyLogCost { var: SizeVariable, exponent: PolyLogExponent }` for log² n, log^k n (PolyLogExponent = Rational > 1 refinement; supports log^7.5 n / AKS Tier-1 case per operator BLOCKING PR #2824:333) 3. **ADD**: `ExponentialCost { base: ExponentialBase, var: SizeVariable }` for 2^n, c^n with c ≥ 2 (ExponentialBase = Int ≥ 2 refinement) 4. **ADD**: `FactorialCost { var: SizeVariable }` for n! @@ -135,7 +135,7 @@ Cons: ### Candidate Q2-Y — Collapse Linear into Polynomial(degree=1) ```dag -| PolynomialCost { var: SizeVariable, degree: Rational } +| PolynomialCost { var: SizeVariable, degree: Rational where nonzero } ``` (LinearCost removed; `LinearCost(v)` ≡ `PolynomialCost { var: v, degree: 1 }`. Per Director scope-extension msg_2c1bfb0e: **no `where` refinement** — signed Rational admits negative degrees for asymptotic-decay coverage.) @@ -229,7 +229,10 @@ Signed-Rational degrees require explicit dominance rules across the sign boundar **Authority**: Q1-α already provides `Field.compare: fn(Rational, Rational) -> Ordering` on the signed-rational carrier. Worker encodes the dominance rule as a derived ordering on `(SizeVariable, Rational)` pairs using `Field.compare` for the magnitude comparison — no new ordering authority introduced. -**Zero-degree collision dissolution** (per codex BLOCKING 4bd0cb5a finding #1): plain signed `Rational` admits `degree = 0`, which would collide with `ConstantCost` (n^0 ≡ 1 for any n). Resolution: **carrier stays plain signed Rational** (Q6 ratified shape preserved); collision is dissolved at the canonicalize-fold layer via the rule `canonicalize(PolyCost(_, 0)) ⇒ ConstantCost(1)` — same dissolution discipline as Q2-Y `LinearCost(v) ≡ PolyCost(v, 1)` collapse and Practice-4 coproduct-arm dissolution. Construction-time the carrier is permissive; canonical-form construction folds the degenerate case into the existing `ConstantCost` arm. Worker brief §6 algebra encodes this rule alongside the Q2-Y collapse — single-authority for "value=1 constant" via `ConstantCost`, not parallel via `PolyCost(_, 0)`. +**Zero-degree exclusion via carrier-level refinement** (Director RATIFIED Option B per msg_b80bcaa8, supersedes prior canonicalize-fold approach): plain signed `Rational` would admit `degree = 0` which structurally collides with `ConstantCost` (n^0 ≡ 1) — Director rationale (verbatim): "degree=0 is P1 violation, not just Practice-4 normalization … type enforcement > API enforcement; Practice-2 carrier refinement = type-tier, Practice-4 canonicalize-fold = API-tier. Type wins." Resolution: **carrier is `Rational where nonzero`** — exclusion of degree=0 at carrier level via new `nonzero` predicate added to KNOWN_PREDICATES (Phase A; analogous to `gt_one` addition; orthogonal to sign — admits ± rationals). Practice 2 illegal-states-unrepresentable satisfied at type tier; no canonicalize-fold needed for this collision. + +**Practice-2 vs Practice-4 disambiguation rule** (Director-distilled msg_b80bcaa8, NEW load-bearing discipline): +> Same-variant redundancy (e.g., LinearCost vs PolyCost(d=1)) → Practice-4 collapse (Q2-Y precedent). Cross-variant redundancy (e.g., PolyCost(d=0) vs ConstantCost) → Practice-2 carrier refinement. Type-level state-space tightening beats API-level normalization when redundant state crosses variant boundaries. ## §6.2 — Q7 SymbolicCost preserves full expression; Big-O is a derived operation (Director RATIFIED msg_2c1bfb0e) @@ -297,6 +300,7 @@ No 🔴 RED introductions. Anti-pattern #2 (Director-enumerated): "Path B reviva 9. **PM-grep-corrected per msg_a52ed981 + codex 014544f4 finding #1**: Parallel rational-number carriers (fresh records like `{ num: PositiveInt; denom: PositiveInt }`, inductive sums, or any carrier shape OTHER than refinement) when the canonical refinement-mechanism (`type X = Y where predicate`) is RATIFIED at HEAD per gunbc#828 issuecomment-4390333451 Path 3 + Director Option 2. Refinement over canonical `Rational = Field>` is the canonical path; precedent `PositiveInt = Nat where gt_zero` at `dsl/std/integer.dag:181`. Anti-pattern fires on ANY fresh-carrier shape when refinement is available. 10. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) 11. **Director-added msg_2c1bfb0e**: Introducing parallel `InverseCost(SymbolicCost)` / `ReciprocalCost` / `DecayCost` variants when carrier-extension via signed `degree: Rational` is structurally clean. Same Q1-α / Q1-c lesson class — don't bridge-wrap when carrier-extension dissolves the question (`feedback_dissolve_bridges` + `feedback_no_metadata_markers`). +12. **Director-added msg_b80bcaa8**: Introducing canonicalize-fold rules for **cross-variant redundancy** when carrier-level refinement (`where `) is structurally available. Practice-2 type-tier exclusion beats Practice-4 API-tier normalization when redundant state crosses variant boundaries (PolyCost(d=0) ≡ ConstantCost(1) → use `where nonzero`, not canonicalize-fold). Same-variant collapse (Q2-Y LinearCost ≡ PolyCost(d=1)) is the appropriate Practice-4 lane; cross-variant redundancy must be carrier-refined. ## §11. Cost-of-change accounting diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 1dcfb4f3f17..3881bc4f83d 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -21,7 +21,7 @@ This brief encodes the ratified Tier-1 4-addition + 1-collapse + 1-promotion str ## §1. Ratified scope summary Net 7 → **9** SymbolicCost variants: -- **PROMOTE**: `PolynomialCost.degree: DegreeAtLeastTwo` → `PolynomialCost.degree: Rational` (signed; **no `where` refinement** per Director msg_2c1bfb0e scope-extension) — subsumes positive (√n, ∛n, n^(2/3), n^2.373, absorbed Linear at degree=1) AND negative (1/n = n^(-1), 1/n² = n^(-2), asymptotic-decay coverage per operator directive 2026-05-13) +- **PROMOTE**: `PolynomialCost.degree: DegreeAtLeastTwo` → `PolynomialCost.degree: Rational where nonzero` (signed with carrier-level zero-exclusion per Director msg_2c1bfb0e sign-admission intent + msg_b80bcaa8 Practice-2 carrier-level refinement; sign preserved — refinement excludes ONLY degree=0 to prevent parallel-authority with ConstantCost) — subsumes positive (√n, ∛n, n^(2/3), n^2.373, absorbed Linear at degree=1) AND negative (1/n = n^(-1), 1/n² = n^(-2)); degree=0 type-rejected - **REMOVE**: `LinearCost(SizeVariable)` — atomic migration to `PolynomialCost { var: v, degree: 1 }` (Q2-Y) - **ADD**: `PolyLogCost { var: SizeVariable, exponent: PolyLogExponent }` for log^k n (PolyLogExponent = Rational > 1 refinement; supports log^7.5 n cited Tier-1 AKS case) - **ADD**: `ExponentialCost { base: ExponentialBase, var: SizeVariable }` for c^n with c ≥ 2 (ExponentialBase = Int ≥ 2 refinement) @@ -96,7 +96,7 @@ Replace `src/v3/std/algebra.dag:69-72` block — and ONLY that 4-line block — // IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and // escalate. Tier-1 textbook coverage (gate #105 carrier-extension // 2026-05-13, PR #) lands 9 variants covering ConstantCost / -// PolynomialCost { degree: Rational } (signed per Q6) / PolyLogCost { exponent: +// PolynomialCost { degree: Rational where nonzero } (signed per Q6 + Practice-2 zero-exclusion per msg_b80bcaa8) / PolyLogCost { exponent: // PolyLogExponent (Rational > 1) } / LogCost / ProductCost / SumCost / // ExponentialCost { base: ExponentialBase (Int ≥ 2) } / FactorialCost / // UnknownCost — sufficient @@ -140,11 +140,12 @@ type PolyLogExponent = Rational where gt_one **Phase A KNOWN_PREDICATES extensions** (Mgr-tier scope; required for refinement-mechanism authority): 1. Add new `gt_one` predicate (allowed_carriers: `Rational + Int`; arg_shape: `Bare`) — required for `PolyLogExponent = Rational where gt_one` -2. Extension lands in same PR as carrier-shape changes — atomic per §P5 +2. Add new `nonzero` predicate (allowed_carriers: `Rational`; arg_shape: `Bare`) — required for `PolynomialCost.degree: Rational where nonzero` (Director RATIFIED Option B per msg_b80bcaa8: Practice-2 carrier-level exclusion of degree=0 to prevent parallel authority with ConstantCost; sign-admission preserved — orthogonal to ±) +3. Extensions land in same PR as carrier-shape changes — atomic per §P5 -(`gt_zero` allowed_carriers extension is **NOT** required: PolynomialCost.degree is plain signed Rational per Q6 — no refinement uses `gt_zero` on Rational. `ExponentialBase = Int where range(min: 2)` uses the existing `range` predicate (allowed_carriers already includes Int). Only `gt_one` is genuinely new.) +(`gt_zero` allowed_carriers extension is **NOT** required: PolynomialCost.degree uses `where nonzero` (orthogonal to sign), not `where gt_zero`. `ExponentialBase = Int where range(min: 2)` uses the existing `range` predicate. Only `gt_one` + `nonzero` are genuinely new predicates.) -**ZERO new authority introduced**: PolyLogExponent is a refinement of canonical Rational; ExponentialBase is a refinement of canonical Int. PolynomialCost.degree uses plain signed Rational (no refinement; Q6 scope-extension). Practice 4 / P1 / Q-MachineConstraint-Carrier hard constraint "no dual representations" all satisfied. +**ZERO new authority introduced**: PolyLogExponent + PolynomialCost.degree are refinements of canonical Rational; ExponentialBase is a refinement of canonical Int. Director-distilled discipline (msg_b80bcaa8): cross-variant redundancy → Practice-2 carrier refinement (PolyCost(d=0) vs ConstantCost); same-variant redundancy → Practice-4 collapse (Q2-Y LinearCost ≡ PolyCost(d=1)). Type-level state-space tightening beats API-level normalization when redundant state crosses variant boundaries. Practice 4 / P1 / P2 / Q-MachineConstraint-Carrier hard constraint "no dual representations" all satisfied. **Authority chain for refinement mechanism**: - gunbc#828 issuecomment-4390333451 (Path 3 RATIFIED) @@ -163,7 +164,7 @@ Replace `src/v3/std/algebra.dag:190-197` with: ```dag type SymbolicCost inhabits Semiring = ConstantCost(Int) - | PolynomialCost { var: SizeVariable, degree: Rational } // Q2-Y: absorbs LinearCost via degree=1; Q6 signed Rational (admits decay) + | PolynomialCost { var: SizeVariable, degree: Rational where nonzero } // Q2-Y: absorbs LinearCost via degree=1; Q6 signed Rational (admits decay) | PolyLogCost { var: SizeVariable, exponent: PolyLogExponent } // NEW: log^k n; exponent > 1 by carrier (admits 2, 3/2, 7.5; rejects 0/1 collapses) | ProductCost(NonSingletonList) | SumCost(NonSingletonList) @@ -176,7 +177,7 @@ type SymbolicCost inhabits Semiring 9 variants. **LinearCost is REMOVED** (anti-pattern #7: no bridge variants; atomic migration). **Invariants encoded at carrier level** (Practice 2/6 — NOT fold normalizer): -- `PolynomialCost.degree: Rational` — **signed, no refinement** (Q6); negative degrees admitted for asymptotic-decay coverage. Asymptotic-dominance rule (Q6) is encoded in the algebra fold layer via `Field.compare` with reverse-sign-convention. +- `PolynomialCost.degree: Rational where nonzero` — **signed with carrier-level zero-exclusion** (Q6 sign-admission + msg_b80bcaa8 Practice-2 refinement); negative degrees admitted for asymptotic-decay coverage; degree=0 type-rejected (prevents parallel authority with ConstantCost). Asymptotic-dominance rule (Q6) is encoded in the algebra fold layer via `Field.compare` with reverse-sign-convention. - `PolyLogCost.exponent: PolyLogExponent` — `exponent ≤ 1` is structurally impossible (excludes 0=ConstantCost-collapse + 1=LogCost-collapse semantic dups); supports rational exponents like log^7.5 n (AKS primality cited Tier-1 case) - `ExponentialCost.base: ExponentialBase` — `base ≤ 1` is structurally impossible (excludes 0=degenerate + 1=ConstantCost-collapse) @@ -225,9 +226,9 @@ Same-variable rules (operands share `SizeVariable`): | Operation | Result | |---|---| -| `canonicalize(PolyCost(_, 0))` | `ConstantCost(1)` — zero-degree dissolution per canvas §6.1 (n^0 ≡ 1; collision with ConstantCost resolved at canonicalize-fold; codex BLOCKING 4bd0cb5a finding #1) | -| `PolyCost(d1) + PolyCost(d2)` (`dominant_term` projection) | `PolyCost(max(d1, d2))` (uses `Rational.compare` (Q1-α free function `rational_max`)) | -| `PolyCost(d1) · PolyCost(d2)` | `canonicalize(PolyCost(d1 + d2))` — uses `Rational.add` (Field); if `d1 + d2 = 0` collapses to `ConstantCost(1)` per zero-degree rule | +| `PolyCost(d1) + PolyCost(d2)` (`dominant_term` projection) | `PolyCost(max(d1, d2))` (uses `Rational.compare` (Q1-α free function `rational_max`)). Note: `degree=0` is type-rejected at carrier level (`where nonzero`); the d1+d2=0 case in multiplication below requires explicit STOP/surface — see next row. | +| `PolyCost(d1) · PolyCost(d2)` where `d1 + d2 ≠ 0` | `PolyCost(d1 + d2)` — uses `Rational.add` (Field) | +| `PolyCost(d1) · PolyCost(d2)` where `d1 + d2 = 0` | `ConstantCost(1)` — multiplicative cancellation produces n^0 ≡ 1; fold rewrites to ConstantCost arm. **Not a parallel-authority concern** because PolyCost-with-degree=0 is type-rejected (carrier `Rational where nonzero`); the fold maps the cancellation result into the canonical ConstantCost arm directly. | | `PolyCost(d) · LogCost(v)` | `ProductCost([PolyCost(d), LogCost(v)])` (§5.1: composite, NOT PolyLogCost) | | `PolyLogCost(v, k1) · PolyLogCost(v, k2)` | `PolyLogCost(v, k1+k2)` | | `PolyLogCost(v, k1) + PolyLogCost(v, k2)` | `PolyLogCost(v, max(k1, k2))` | @@ -259,7 +260,9 @@ Mirror `src/v3/compiler/tests/integration/cementing/` shape (cf. `complexity_len `src/v3/compiler/tests/integration/cementing/symbolic_cost_tier1_carrier_test.rs` asserting: - 9 variant count (assert against `cost.dag` or `algebra.dag` source); REMOVED LinearCost (PolynomialCost.degree promotion to Rational is not a new variant) - All 9 variant names + field shapes structurally present +- **NEW (Director msg_b80bcaa8)**: type-rejection negative test asserts `PolynomialCost { var, degree: Rational(0) }` is structurally REJECTED at carrier level (`where nonzero` refinement). Admits positive (`Rational(2)` → ok) + negative (`Rational(-1)` → ok); rejects only zero. - Phase A Q1-α deliverables present: rational_lt/le/gt/ge/eq/ne free functions in cost-lens module; NO OrderedField type declared +- Phase A KNOWN_PREDICATES extension: both `gt_one` AND `nonzero` predicates added to lower.rs registry; bootstrap test asserts both predicates present with correct allowed_carriers. - `Rational = Field>` UNCHANGED at `dsl/std/rational.dag:26` (Q1-α) - Algebra rule sample tests (≥6 of §6 rules): assert fold output for representative inputs (e.g., `PolyCost(1/2) · PolyCost(1/2)` produces `PolyCost(1)`; `ExpCost(2,n) · PolyCost(d)` produces `ProductCost([ExpCost(2,n), PolyCost(d)])` — multiplicative cross-class is NOT absorbed per §6 + anti-pattern #9 (asymptotic absorption is sound for SUM but unsound for PRODUCT); `ExpCost(2,n) + PolyCost(d)` produces `ExpCost(2,n)` — additive cross-class absorption is sound; `FactorialCost(n)²` produces `UnknownCost` with the exact §5.2 reason-string) - STOP-SIGNAL text at `:69-72` contains new "10th variant" wording @@ -286,7 +289,7 @@ After Phase A-F land + tests green, update `docs/r3-program-plan.md` §1.8 row # 5. **Algebra rule §5.2 violation tempted** — if Phase D authoring tempts a named (n!)² variant or non-Unknown disposition, **STOP** — anti-pattern #5 fires; the rule disposition is Director-ratified. 6. **PR #2824 not merged at dispatch** OR **PR #2828 not merged at dispatch** — both gates AND; if either is unmerged, **STOP** and surface to Mgr; worker dispatch is blocked. -## §11. 11 anti-patterns (7 Director-enumerated + 4 Mgr-derived per canvas §10) +## §11. 12 anti-patterns (7 Director-enumerated + 5 Mgr-derived per canvas §10) PR body MUST cite each verbatim + assert receipt-of-compliance: @@ -301,6 +304,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 9. Multiplicative absorption rules (`X · Y = X`) where one variant absorbs another asymptotically — sound for SUM, NOT PRODUCT (n^d · c^n is NOT O(c^n)); cross-class products MUST be ProductCost composite (per operator BLOCKING worker:140) 10. `LinearCost`-consumer paths preserved alongside `PolynomialCost(degree=1)` (Q2-Y atomic-migration; bridge variants violate §P5) 11. **Director-added msg_2c1bfb0e**: Introducing parallel `InverseCost(SymbolicCost)` / `ReciprocalCost` / `DecayCost` variants when carrier-extension via signed `degree: Rational` is structurally clean. Same Q1-α / Q1-c lesson class — don't bridge-wrap when carrier-extension dissolves the question (`feedback_dissolve_bridges` + `feedback_no_metadata_markers`). +12. **Director-added msg_b80bcaa8**: Introducing canonicalize-fold rules for **cross-variant redundancy** when carrier-level refinement (`where `) is structurally available. Practice-2 type-tier exclusion beats Practice-4 API-tier normalization when the redundant state crosses variant boundaries (e.g., PolyCost(d=0) ≡ ConstantCost(1)). Same-variant collapse (Q2-Y LinearCost ≡ PolyCost(d=1)) is the appropriate Practice-4 lane; cross-variant redundancy must be carrier-refined. ## §12. 5 reviewer ratchets (Director-enumerated for PR review) @@ -308,7 +312,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: 2. **Q2-Y integrity**: NO LinearCost preservation paths alongside PolyCost(degree=1); atomic migration receipt required 3. **Q3 algebra rules**: §5.1 + §5.2 dispositions are load-bearing; reviewers flag deviation 4. **Q4 STOP-SIGNAL text**: must land at `src/v3/std/algebra.dag:69-72` with new variant cap at 10 (9 ratified + 1 trigger) -5. **All 11 anti-patterns enforceable** at PR review +5. **All 12 anti-patterns enforceable** at PR review ## §13. Verification @@ -324,7 +328,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: - PR body cites: - Gate #105 closure (Phase G ledger update) - Canvas PR #2828 + composite Director ratification verbatim Q1-Q5 + §8 (PM msg_a055c38b relaying msg_d86a5987 Q2-Q5/§8 base RECONCILED BY msg_676ad4e7 Q1-α supersession of prior Q1-c) - - 11 anti-patterns receipt-of-compliance (§11) + - 12 anti-patterns receipt-of-compliance (§11) - 5 reviewer ratchets (§12) — explicit assertion-of-compliance per item ## §14. Out of scope @@ -356,7 +360,7 @@ STOP-SIGNAL re-reset to 10 (9 ratified + 1 trigger) at algebra.dag:69-72. Algebra rules §5/§6 implemented verbatim per canvas; (n!)² → UnknownCost ("(v!)² exceeds Tier 1 — pending R4 named-variant canvas"). -11 anti-patterns receipt-of-compliance: +12 anti-patterns receipt-of-compliance: [enumerate each + cite that the implementation does not violate it] 5 reviewer ratchets compliance: From 84244611eae624207b3b49ec24638a091cf9015a Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 08:43:33 +0000 Subject: [PATCH 30/36] =?UTF-8?q?docs(r3):=20gate=20#105=20canvas=20?= =?UTF-8?q?=E2=80=94=20reconcile=20Q2-Y=20refinement=20+=20variant=20arith?= =?UTF-8?q?metic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cursor APPROVE_WITH_COMMENTS 10980 — 2 internal-consistency findings: 1. Q2-Y parenthetical "no where refinement" contradicted the snippet directly above showing `where nonzero` (post msg_b80bcaa8 Option B). Reconciled: explicit "no positivity / gt_zero refinement" framing per Director msg_2c1bfb0e sign-admission intent, AND explicit acknowledgment that `where nonzero` IS present per msg_b80bcaa8 Practice-2 carrier-level Option B (sign-orthogonal, excludes only 0). 2. Q2-Y Pros bullet "11 → 10 net" contradicted §4 closing "**9** net under Q2-Y". Reconciled: corrected to "7 → 9 net" matching §1 ratified scope (+3 new variants -1 collapsed = +3 net over existing 7) and §4 closing reconciliation pointer. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../r3-substrate-gate-105-symbolic-cost-tier1-canvas.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 5100888008d..e9c8ebb0121 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -137,12 +137,12 @@ Cons: ```dag | PolynomialCost { var: SizeVariable, degree: Rational where nonzero } ``` -(LinearCost removed; `LinearCost(v)` ≡ `PolynomialCost { var: v, degree: 1 }`. Per Director scope-extension msg_2c1bfb0e: **no `where` refinement** — signed Rational admits negative degrees for asymptotic-decay coverage.) +(LinearCost removed; `LinearCost(v)` ≡ `PolynomialCost { var: v, degree: 1 }`. Per Director scope-extension msg_2c1bfb0e + msg_b80bcaa8: **no positivity / `gt_zero` refinement** — signed Rational admits negative degrees for asymptotic-decay coverage; **carrier-level `where nonzero` refinement IS present** to exclude degree=0 collision with ConstantCost per Practice-2 (Director Option B ratification msg_b80bcaa8).) Pros: - Single uniform variant for all positive-degree polynomial bounds - Sum/product algebra closes uniformly: `PolyCost(d1) · PolyCost(d2) = PolyCost(d1+d2)` no Linear special case -- 11 → 10 net (Linear absorbed); aligns with §P5 Progress Is Dissolution +- 7 → 9 net (per §1 ratified scope: PROMOTE PolyCost.degree + ADD 3 new variants + REMOVE LinearCost = +3 net new variants over the existing 7; LinearCost-absorption aligns with §P5 Progress Is Dissolution). PolynomialCost.degree promotion is not a new variant — see §4 closing line for the variant-count reconciliation. Cons: - **Migration**: all LinearCost-consumer paths must rewrite to PolynomialCost(degree=1) From 134aafc147b9db21baa8f9817ab1adf8b112dcb0 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 09:35:24 +0000 Subject: [PATCH 31/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20cod?= =?UTF-8?q?ex=2077088ffd=20non-blocking=20wording=20hygiene?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex no-blocking + 2 non-blocking improvements (77088ffd review): - worker L156: "no such refinement" → "no positivity refinement, but DOES carry where nonzero" (clarifies sign-admission vs zero-exclusion distinction for downstream readers). - canvas L285: §10 anti-pattern header "7 Director + 3 Mgr-derived" → "7 Director + 5 Mgr-derived; 12 total" (matches actual 12-item list per worker §11 cite-list). Co-Authored-By: Claude Opus 4.7 (1M context) --- docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md | 2 +- docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index e9c8ebb0121..a33df84b009 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -282,7 +282,7 @@ For each Tier-1 addition under §1: No 🔴 RED introductions. Anti-pattern #2 (Director-enumerated): "Path B revival (RootCost as separate variant — Practice-4 RED)" — explicitly NOT done; roots are PolynomialCost(degree=1/2 etc.). -## §10. Anti-patterns (7 Director-enumerated/pending + 3 Mgr-derived) +## §10. Anti-patterns (7 Director-enumerated + 5 Mgr-derived; 12 total) ### Director-enumerated diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 3881bc4f83d..89b0c59ff6b 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -153,7 +153,7 @@ type PolyLogExponent = Rational where gt_one - `dsl/std/integer.dag:171-181` precedent (`PositiveInt = Nat where gt_zero`) - `src/v3/compiler/src/lower.rs:798-862` KNOWN_PREDICATES registry -These refinements make `exponent ≤ 1` (PolyLogCost) and `base ≤ 1` (ExponentialCost) structurally impossible to construct — no fold-time enforcement required, no new authority. PolynomialCost.degree intentionally has no such refinement: Q6 signed Rational admits negative degrees for asymptotic-decay coverage. +These refinements make `exponent ≤ 1` (PolyLogCost) and `base ≤ 1` (ExponentialCost) structurally impossible to construct — no fold-time enforcement required, no new authority. PolynomialCost.degree has **no positivity refinement** (admits ± per Q6 sign-admission msg_2c1bfb0e) but DOES carry the `where nonzero` refinement (msg_b80bcaa8 Practice-2 zero-exclusion to prevent ConstantCost collision). **HARD STOP**: do NOT author PolyLogExponent / ExponentialBase as fresh records / inductive sums when refinement over canonical carrier is available. That pattern is codex BLOCKING 014544f4 finding #1 + operator BLOCKING worker:104 anti-pattern (now §10 #8 below). (PositiveRational is no longer in scope per Q6 scope-extension; PolynomialCost.degree is plain signed Rational.) From 577f2f8fae9a5e9262d2223a34698512381ddc52 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 06:49:33 -0400 Subject: [PATCH 32/36] =?UTF-8?q?WIP:=20R3=20Substrate=20Mgr=20=E2=80=94?= =?UTF-8?q?=20lane=20through=20R3=20close?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ate-gate-105-symbolic-cost-tier1-canvas.md | 5 ++-- ...ate-gate-105-symbolic-cost-tier1-worker.md | 25 +++++++++++++------ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index a33df84b009..098d76c6e34 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -25,7 +25,7 @@ PR #2824 (PM) carries §1.8 row #105 authority anchor; landing pending. Worker b ## §1. Ratified Tier 1 variant list (verbatim per Director msg_ad5e934d) -1. **PROMOTE**: `PolynomialCost { var: SizeVariable, degree: Rational where nonzero }` — **signed Rational with carrier-level `where nonzero` refinement** (Director RATIFIED scope-extension msg_2c1bfb0e — sign-admission intent — AS REFINED BY msg_b80bcaa8: Practice-2 carrier-level exclusion of degree=0 to prevent parallel authority with ConstantCost; sign-admission preserved — refinement excludes ONLY 0, admits ±). Subsumes positive degrees: √n = n^(1/2), ∛n = n^(1/3), n^(2/3), non-integer 2.373/2.807, existing integer poly. Subsumes negative degrees: 1/n = n^(-1), 1/√n = n^(-1/2), 1/n² = n^(-2) (asymptotic-decay coverage per operator directive 2026-05-13). Arbitrary roots + inverse roots covered uniformly; degree=0 structurally unrepresentable per Practice 2. +1. **PROMOTE**: `PolynomialCost { var: SizeVariable, degree: NonZeroRational }` — **signed Rational with carrier-level `where nonzero` refinement** (Director RATIFIED scope-extension msg_2c1bfb0e — sign-admission intent — AS REFINED BY msg_b80bcaa8: Practice-2 carrier-level exclusion of degree=0 to prevent parallel authority with ConstantCost; sign-admission preserved — refinement excludes ONLY 0, admits ±). Subsumes positive degrees: √n = n^(1/2), ∛n = n^(1/3), n^(2/3), non-integer 2.373/2.807, existing integer poly. Subsumes negative degrees: 1/n = n^(-1), 1/√n = n^(-1/2), 1/n² = n^(-2) (asymptotic-decay coverage per operator directive 2026-05-13). Arbitrary roots + inverse roots covered uniformly; degree=0 structurally unrepresentable per Practice 2. 2. **ADD**: `PolyLogCost { var: SizeVariable, exponent: PolyLogExponent }` for log² n, log^k n (PolyLogExponent = Rational > 1 refinement; supports log^7.5 n / AKS Tier-1 case per operator BLOCKING PR #2824:333) 3. **ADD**: `ExponentialCost { base: ExponentialBase, var: SizeVariable }` for 2^n, c^n with c ≥ 2 (ExponentialBase = Int ≥ 2 refinement) 4. **ADD**: `FactorialCost { var: SizeVariable }` for n! @@ -135,7 +135,7 @@ Cons: ### Candidate Q2-Y — Collapse Linear into Polynomial(degree=1) ```dag -| PolynomialCost { var: SizeVariable, degree: Rational where nonzero } +| PolynomialCost { var: SizeVariable, degree: NonZeroRational } ``` (LinearCost removed; `LinearCost(v)` ≡ `PolynomialCost { var: v, degree: 1 }`. Per Director scope-extension msg_2c1bfb0e + msg_b80bcaa8: **no positivity / `gt_zero` refinement** — signed Rational admits negative degrees for asymptotic-decay coverage; **carrier-level `where nonzero` refinement IS present** to exclude degree=0 collision with ConstantCost per Practice-2 (Director Option B ratification msg_b80bcaa8).) @@ -212,6 +212,7 @@ Current `src/v3/std/algebra.dag:69-72`: - ~~`PositiveRational = Rational where gt_zero`~~ — **DROPPED per Director msg_2c1bfb0e scope-extension**: PolynomialCost.degree is plain `Rational` (signed; admits negative-degree decay). No gt_zero allowed_carriers extension needed for PolynomialCost. - `ExponentialBase = Int where range(min: 2)` — IMMEDIATELY available via `range` predicate (allowed_carriers includes Int) - `PolyLogExponent = Rational where gt_one` — REQUIRES NEW `gt_one` predicate (allowed_carriers: Rational + Int; mirrors `gt_zero` shape; atomic with carrier landing per Phase A) +- `NonZeroRational = Rational where nonzero` — REQUIRES NEW `nonzero` predicate (allowed_carriers: Rational; arg_shape: Bare). **Named alias** per HEAD parser constraint (codex BLOCKING worker:167): `where` refinements only attach to type aliases / parameters at HEAD (precedent `dsl/std/integer.dag:181 type PositiveInt = Nat where gt_zero`), NOT inline in struct field types. Used as `PolynomialCost.degree: NonZeroRational` per Director Option B msg_b80bcaa8. - `PositiveInt = Nat where gt_zero` — ALREADY EXISTS at `dsl/std/integer.dag:181`; worker reuses These refinements make `exponent ≤ 1` / `base ≤ 1` **structurally unrepresentable** at the carrier level via the ratified refinement mechanism — Practice 2 + Practice 6 satisfied; INVARIANTS P1 (single authority) preserved. PolynomialCost.degree intentionally has no refinement: signed Rational admits asymptotic decay (negative degrees) per Director msg_2c1bfb0e scope-extension. diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index 89b0c59ff6b..b16886cfa84 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -21,7 +21,7 @@ This brief encodes the ratified Tier-1 4-addition + 1-collapse + 1-promotion str ## §1. Ratified scope summary Net 7 → **9** SymbolicCost variants: -- **PROMOTE**: `PolynomialCost.degree: DegreeAtLeastTwo` → `PolynomialCost.degree: Rational where nonzero` (signed with carrier-level zero-exclusion per Director msg_2c1bfb0e sign-admission intent + msg_b80bcaa8 Practice-2 carrier-level refinement; sign preserved — refinement excludes ONLY degree=0 to prevent parallel-authority with ConstantCost) — subsumes positive (√n, ∛n, n^(2/3), n^2.373, absorbed Linear at degree=1) AND negative (1/n = n^(-1), 1/n² = n^(-2)); degree=0 type-rejected +- **PROMOTE**: `PolynomialCost.degree: DegreeAtLeastTwo` → `PolynomialCost.degree: NonZeroRational` (signed with carrier-level zero-exclusion per Director msg_2c1bfb0e sign-admission intent + msg_b80bcaa8 Practice-2 carrier-level refinement; sign preserved — refinement excludes ONLY degree=0 to prevent parallel-authority with ConstantCost) — subsumes positive (√n, ∛n, n^(2/3), n^2.373, absorbed Linear at degree=1) AND negative (1/n = n^(-1), 1/n² = n^(-2)); degree=0 type-rejected - **REMOVE**: `LinearCost(SizeVariable)` — atomic migration to `PolynomialCost { var: v, degree: 1 }` (Q2-Y) - **ADD**: `PolyLogCost { var: SizeVariable, exponent: PolyLogExponent }` for log^k n (PolyLogExponent = Rational > 1 refinement; supports log^7.5 n cited Tier-1 AKS case) - **ADD**: `ExponentialCost { base: ExponentialBase, var: SizeVariable }` for c^n with c ≥ 2 (ExponentialBase = Int ≥ 2 refinement) @@ -96,7 +96,7 @@ Replace `src/v3/std/algebra.dag:69-72` block — and ONLY that 4-line block — // IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and // escalate. Tier-1 textbook coverage (gate #105 carrier-extension // 2026-05-13, PR #) lands 9 variants covering ConstantCost / -// PolynomialCost { degree: Rational where nonzero } (signed per Q6 + Practice-2 zero-exclusion per msg_b80bcaa8) / PolyLogCost { exponent: +// PolynomialCost { degree: NonZeroRational } (signed per Q6 + Practice-2 zero-exclusion per msg_b80bcaa8) / PolyLogCost { exponent: // PolyLogExponent (Rational > 1) } / LogCost / ProductCost / SumCost / // ExponentialCost { base: ExponentialBase (Int ≥ 2) } / FactorialCost / // UnknownCost — sufficient @@ -136,11 +136,20 @@ type ExponentialBase = Int where range(min: 2) // the registry. Mirrors `gt_zero` shape. Worker authors atomic with // carrier landing per Phase A. type PolyLogExponent = Rational where gt_one + +// NonZeroRational: Rational ≠ 0 (admits positive AND negative; excludes only zero). +// REQUIRES KNOWN_PREDICATES extension: add NEW `nonzero` predicate +// (allowed_carriers: Rational; arg_shape: Bare) to the registry. +// Per codex BLOCKING worker:167: `where` refinements at HEAD attach only to +// type aliases / parameters (precedent `PositiveInt = Nat where gt_zero` at +// dsl/std/integer.dag:181), NOT inline in struct field types. NonZeroRational +// MUST be named at the type-alias layer; field types reference the alias. +type NonZeroRational = Rational where nonzero ``` **Phase A KNOWN_PREDICATES extensions** (Mgr-tier scope; required for refinement-mechanism authority): 1. Add new `gt_one` predicate (allowed_carriers: `Rational + Int`; arg_shape: `Bare`) — required for `PolyLogExponent = Rational where gt_one` -2. Add new `nonzero` predicate (allowed_carriers: `Rational`; arg_shape: `Bare`) — required for `PolynomialCost.degree: Rational where nonzero` (Director RATIFIED Option B per msg_b80bcaa8: Practice-2 carrier-level exclusion of degree=0 to prevent parallel authority with ConstantCost; sign-admission preserved — orthogonal to ±) +2. Add new `nonzero` predicate (allowed_carriers: `Rational`; arg_shape: `Bare`) — required for `PolynomialCost.degree: NonZeroRational` (Director RATIFIED Option B per msg_b80bcaa8: Practice-2 carrier-level exclusion of degree=0 to prevent parallel authority with ConstantCost; sign-admission preserved — orthogonal to ±) 3. Extensions land in same PR as carrier-shape changes — atomic per §P5 (`gt_zero` allowed_carriers extension is **NOT** required: PolynomialCost.degree uses `where nonzero` (orthogonal to sign), not `where gt_zero`. `ExponentialBase = Int where range(min: 2)` uses the existing `range` predicate. Only `gt_one` + `nonzero` are genuinely new predicates.) @@ -153,9 +162,9 @@ type PolyLogExponent = Rational where gt_one - `dsl/std/integer.dag:171-181` precedent (`PositiveInt = Nat where gt_zero`) - `src/v3/compiler/src/lower.rs:798-862` KNOWN_PREDICATES registry -These refinements make `exponent ≤ 1` (PolyLogCost) and `base ≤ 1` (ExponentialCost) structurally impossible to construct — no fold-time enforcement required, no new authority. PolynomialCost.degree has **no positivity refinement** (admits ± per Q6 sign-admission msg_2c1bfb0e) but DOES carry the `where nonzero` refinement (msg_b80bcaa8 Practice-2 zero-exclusion to prevent ConstantCost collision). +These refinements make `exponent ≤ 1` (PolyLogCost), `base ≤ 1` (ExponentialCost), and `degree = 0` (PolynomialCost via NonZeroRational) structurally impossible to construct — no fold-time enforcement required, no new authority. PolynomialCost.degree has **no positivity refinement** (admits ± per Q6 sign-admission msg_2c1bfb0e) but DOES carry the named `NonZeroRational` alias (msg_b80bcaa8 Practice-2 zero-exclusion to prevent ConstantCost collision; named-alias form per HEAD parser constraint). -**HARD STOP**: do NOT author PolyLogExponent / ExponentialBase as fresh records / inductive sums when refinement over canonical carrier is available. That pattern is codex BLOCKING 014544f4 finding #1 + operator BLOCKING worker:104 anti-pattern (now §10 #8 below). (PositiveRational is no longer in scope per Q6 scope-extension; PolynomialCost.degree is plain signed Rational.) +**HARD STOP**: do NOT author NonZeroRational / PolyLogExponent / ExponentialBase as fresh records / inductive sums when refinement over canonical carrier is available. That pattern is codex BLOCKING 014544f4 finding #1 + operator BLOCKING worker:104 anti-pattern (now §10 #8 below). All three MUST land as named type aliases following `type X = Y where pred` (codex BLOCKING worker:167 — inline `where` in field types is unsupported by HEAD parser; precedent `PositiveInt = Nat where gt_zero` at `dsl/std/integer.dag:181`). ### §5.1 — Replace SymbolicCost variant set @@ -164,7 +173,7 @@ Replace `src/v3/std/algebra.dag:190-197` with: ```dag type SymbolicCost inhabits Semiring = ConstantCost(Int) - | PolynomialCost { var: SizeVariable, degree: Rational where nonzero } // Q2-Y: absorbs LinearCost via degree=1; Q6 signed Rational (admits decay) + | PolynomialCost { var: SizeVariable, degree: NonZeroRational } // Q2-Y: absorbs LinearCost via degree=1; Q6 signed Rational (admits decay) | PolyLogCost { var: SizeVariable, exponent: PolyLogExponent } // NEW: log^k n; exponent > 1 by carrier (admits 2, 3/2, 7.5; rejects 0/1 collapses) | ProductCost(NonSingletonList) | SumCost(NonSingletonList) @@ -177,7 +186,7 @@ type SymbolicCost inhabits Semiring 9 variants. **LinearCost is REMOVED** (anti-pattern #7: no bridge variants; atomic migration). **Invariants encoded at carrier level** (Practice 2/6 — NOT fold normalizer): -- `PolynomialCost.degree: Rational where nonzero` — **signed with carrier-level zero-exclusion** (Q6 sign-admission + msg_b80bcaa8 Practice-2 refinement); negative degrees admitted for asymptotic-decay coverage; degree=0 type-rejected (prevents parallel authority with ConstantCost). Asymptotic-dominance rule (Q6) is encoded in the algebra fold layer via `Field.compare` with reverse-sign-convention. +- `PolynomialCost.degree: NonZeroRational` — **signed with carrier-level zero-exclusion** (Q6 sign-admission + msg_b80bcaa8 Practice-2 refinement); negative degrees admitted for asymptotic-decay coverage; degree=0 type-rejected (prevents parallel authority with ConstantCost). Asymptotic-dominance rule (Q6) is encoded in the algebra fold layer via `Field.compare` with reverse-sign-convention. - `PolyLogCost.exponent: PolyLogExponent` — `exponent ≤ 1` is structurally impossible (excludes 0=ConstantCost-collapse + 1=LogCost-collapse semantic dups); supports rational exponents like log^7.5 n (AKS primality cited Tier-1 case) - `ExponentialCost.base: ExponentialBase` — `base ≤ 1` is structurally impossible (excludes 0=degenerate + 1=ConstantCost-collapse) @@ -285,7 +294,7 @@ After Phase A-F land + tests green, update `docs/r3-program-plan.md` §1.8 row # 1. **`OrderedRing` shape drift** at HEAD — if `dsl/std/algebra.dag:268-286` no longer carries the exact 14-field signature this brief mirrors, **STOP** and surface — strict-mirror authority broken. 2. **Existing `LinearCost`-consumer surface differs from canvas assumption** — if grep reveals consumer paths that can't migrate to `PolynomialCost(degree=1)` losslessly (e.g., type-level dispatches on LinearCost variant-tag), **STOP** — anti-pattern #7 atomic-migration discipline requires lossless migration. 3. **`Rational` carrier not at `dsl/std/rational.dag:26`** — if Rational has moved / changed shape since 2026-05-13 grep, **STOP** — Q1-α refinement target is wrong. -4. **Variant-name collision** at HEAD — if any of `PolyLogCost` / `ExponentialCost` / `FactorialCost` / `ExponentialBase` / `PolyLogExponent` appear from parallel landing, **STOP** for de-duplication. (`PositiveInt` already exists at `dsl/std/integer.dag:181` — reuse. `PositiveRational` is OUT of scope per Q6 — if encountered at HEAD as a parallel landing, that's an anti-pattern #7 fire.) +4. **Variant-name collision** at HEAD — if any of `PolyLogCost` / `ExponentialCost` / `FactorialCost` / `ExponentialBase` / `PolyLogExponent` / `NonZeroRational` appear from parallel landing, **STOP** for de-duplication. (`PositiveInt` already exists at `dsl/std/integer.dag:181` — reuse. `PositiveRational` is OUT of scope per Q6 — if encountered at HEAD as a parallel landing, that's an anti-pattern #7 fire.) 5. **Algebra rule §5.2 violation tempted** — if Phase D authoring tempts a named (n!)² variant or non-Unknown disposition, **STOP** — anti-pattern #5 fires; the rule disposition is Director-ratified. 6. **PR #2824 not merged at dispatch** OR **PR #2828 not merged at dispatch** — both gates AND; if either is unmerged, **STOP** and surface to Mgr; worker dispatch is blocked. From 3be772b3a2d7dd8d9efda3af20fe0665cc2a9f23 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 10:49:59 +0000 Subject: [PATCH 33/36] =?UTF-8?q?docs(r3):=20gate=20#105=20=E2=80=94=20nam?= =?UTF-8?q?ed=20NonZeroRational=20alias=20(codex=20worker:167)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex BLOCKING worker:167: inline `Rational where nonzero` in struct field types is unsupported by HEAD parser/lowerer — `where` refinements attach only to type aliases / parameters (precedent `type PositiveInt = Nat where gt_zero` at dsl/std/integer.dag:181). Inline use would require unsupported substrate syntax instead of making illegal degree=0 unrepresentable through a proper named refinement carrier. Fix-forward: introduce `type NonZeroRational = Rational where nonzero` at the type-alias layer (alongside existing `PolyLogExponent = Rational where gt_one` + `ExponentialBase = Int where range(min: 2)`). PolynomialCost.degree field type references the named alias: `degree: NonZeroRational`. Updates across both briefs: - All `degree: Rational where nonzero` → `degree: NonZeroRational` (5 canvas occurrences + 10 worker occurrences) - Worker §5.0 dag block: NonZeroRational alias declaration added with rationale comment citing codex worker:167 + HEAD parser constraint - Canvas §6 refinement-carriers list: NonZeroRational row added with named-alias note - Worker §5.0 HARD STOP directive: NonZeroRational added to the hard-stop list (named alias, not fresh record); HEAD parser constraint cited - Worker §10 STOP #4 variant-collision list: NonZeroRational added - Worker §5.0 P1/P2 narrative: clarified "DOES carry NonZeroRational named-alias" framing - Worker §7 bootstrap ratchet test: type-rejection test asserts both the type-alias declaration AND the degree=0 rejection at carrier level - Worker §13 verification axis: NonZeroRational added to refinement- carriers test list INVARIANTS P2 + Practice 2 carrier-level illegal-states-unrepresentable satisfied via named alias (P5 / parser-supported substrate syntax). Co-Authored-By: Claude Opus 4.7 (1M context) --- .../r3-substrate-gate-105-symbolic-cost-tier1-worker.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md index b16886cfa84..9253d87ac66 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-worker.md @@ -269,7 +269,7 @@ Mirror `src/v3/compiler/tests/integration/cementing/` shape (cf. `complexity_len `src/v3/compiler/tests/integration/cementing/symbolic_cost_tier1_carrier_test.rs` asserting: - 9 variant count (assert against `cost.dag` or `algebra.dag` source); REMOVED LinearCost (PolynomialCost.degree promotion to Rational is not a new variant) - All 9 variant names + field shapes structurally present -- **NEW (Director msg_b80bcaa8)**: type-rejection negative test asserts `PolynomialCost { var, degree: Rational(0) }` is structurally REJECTED at carrier level (`where nonzero` refinement). Admits positive (`Rational(2)` → ok) + negative (`Rational(-1)` → ok); rejects only zero. +- **NEW (Director msg_b80bcaa8 + codex worker:167)**: type-rejection negative test asserts `PolynomialCost { var, degree: Rational(0) }` is structurally REJECTED at carrier level via `NonZeroRational` named-alias refinement. Test also asserts `type NonZeroRational = Rational where nonzero` is declared at the type-alias layer (NOT inline). Admits positive (`Rational(2)` → ok via NonZeroRational construction) + negative (`Rational(-1)` → ok); rejects only zero. - Phase A Q1-α deliverables present: rational_lt/le/gt/ge/eq/ne free functions in cost-lens module; NO OrderedField type declared - Phase A KNOWN_PREDICATES extension: both `gt_one` AND `nonzero` predicates added to lower.rs registry; bootstrap test asserts both predicates present with correct allowed_carriers. - `Rational = Field>` UNCHANGED at `dsl/std/rational.dag:26` (Q1-α) @@ -326,7 +326,7 @@ PR body MUST cite each verbatim + assert receipt-of-compliance: ## §13. Verification - `cargo test --workspace` green -- New hermetic ratchet `symbolic_cost_tier1_carrier_test.rs` (§7) asserts all 4 verification axes (variant set / refinement carriers (PositiveInt/ExponentialBase/PolyLogExponent — NOT PositiveRational; PolynomialCost.degree is plain signed Rational per Q6) / algebra rules sample / STOP-SIGNAL text) +- New hermetic ratchet `symbolic_cost_tier1_carrier_test.rs` (§7) asserts all 4 verification axes (variant set / refinement carriers (PositiveInt/ExponentialBase/PolyLogExponent/NonZeroRational — all named type aliases per HEAD parser constraint; NOT PositiveRational) / algebra rules sample / STOP-SIGNAL text) - **INVARIANTS P5 receipt for the new hand-Rust test file** (per claude APPROVE 10773 + codex BLOCKING 014544f4 finding #4): authoring `symbolic_cost_tier1_carrier_test.rs` adds new hand-Rust under `src/v3/compiler/tests/`. Per P5 "Pure Bootstrap" discipline, this PR's body MUST cite **exactly ONE P5 receipt category** with concrete path + LOC count: - (a) **hand-Rust deletion of equivalent or greater LOC**: cite specific deleted file/lines + LOC count - (b) **SG-0 census shrink receipt**: cite specific SG-0 cell + shrink delta From 338ac15a71feac5c85c0d084ef5c336542cd0eaf Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 11:53:16 +0000 Subject: [PATCH 34/36] =?UTF-8?q?docs(r3):=20gate=20#105=20canvas=20?= =?UTF-8?q?=E2=80=94=20fix=20=C2=A76=20'no=20refinement'=20stale=20text=20?= =?UTF-8?q?(codex=20canvas:218)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Canvas §6 closing paragraph still said "PolynomialCost.degree intentionally has no refinement" — pre-msg_b80bcaa8 framing that contradicts the NonZeroRational alias declared 3 lines above + ratified by msg_b80bcaa8. Fix-forward: reframe as "no positivity refinement, but DOES carry NonZeroRational named alias for zero-exclusion". Sign-admission preserved (msg_2c1bfb0e); zero-exclusion enforced (msg_b80bcaa8). Also added explicit reference to degree=0 alongside exponent≤1 / base≤1 in the structurally-unrepresentable set. Co-Authored-By: Claude Opus 4.7 (1M context) --- docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index 098d76c6e34..fae684528ca 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -215,7 +215,7 @@ Current `src/v3/std/algebra.dag:69-72`: - `NonZeroRational = Rational where nonzero` — REQUIRES NEW `nonzero` predicate (allowed_carriers: Rational; arg_shape: Bare). **Named alias** per HEAD parser constraint (codex BLOCKING worker:167): `where` refinements only attach to type aliases / parameters at HEAD (precedent `dsl/std/integer.dag:181 type PositiveInt = Nat where gt_zero`), NOT inline in struct field types. Used as `PolynomialCost.degree: NonZeroRational` per Director Option B msg_b80bcaa8. - `PositiveInt = Nat where gt_zero` — ALREADY EXISTS at `dsl/std/integer.dag:181`; worker reuses -These refinements make `exponent ≤ 1` / `base ≤ 1` **structurally unrepresentable** at the carrier level via the ratified refinement mechanism — Practice 2 + Practice 6 satisfied; INVARIANTS P1 (single authority) preserved. PolynomialCost.degree intentionally has no refinement: signed Rational admits asymptotic decay (negative degrees) per Director msg_2c1bfb0e scope-extension. +These refinements make `exponent ≤ 1` (PolyLogCost), `base ≤ 1` (ExponentialCost), and `degree = 0` (PolynomialCost via NonZeroRational) **structurally unrepresentable** at the carrier level via the ratified refinement mechanism — Practice 2 + Practice 6 satisfied; INVARIANTS P1 (single authority) preserved. PolynomialCost.degree has **no positivity refinement** (signed Rational admits asymptotic decay / negative degrees per Director msg_2c1bfb0e sign-admission), but DOES carry the named `NonZeroRational` alias (msg_b80bcaa8 Practice-2 zero-exclusion to prevent ConstantCost collision). Sign-admission preserved; zero-exclusion enforced. ## §6.1 — Q6 Asymptotic-dominance ordering with signed degrees (Director RATIFIED msg_2c1bfb0e) From 857d0a5c91a24bfa26847da74848ac3650e4c097 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 07:54:07 -0400 Subject: [PATCH 35/36] =?UTF-8?q?WIP:=20R3=20Substrate=20Mgr=20=E2=80=94?= =?UTF-8?q?=20lane=20through=20R3=20close?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index fae684528ca..f277f30c384 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -205,7 +205,7 @@ Current `src/v3/std/algebra.dag:69-72`: > STOP SIGNAL: wanting an eighth variant. Pause and escalate rather than extending; the thesis claim is that seven covers the asymptotic surface, and any new variant should carry its own dissolution receipt. **Post-extension proposed text** (Mgr recommendation): -> STOP SIGNAL: wanting a 10th variant (or 11th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 9 variants covering ConstantCost / PolynomialCost { degree: Rational } (signed per Q6) / PolyLogCost { exponent: PolyLogExponent } / LogCost / ProductCost / SumCost / ExponentialCost { base: ExponentialBase } / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. +> STOP SIGNAL: wanting a 10th variant (or 11th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 9 variants covering ConstantCost / PolynomialCost { degree: NonZeroRational } (signed per Q6; nonzero per msg_b80bcaa8) / PolyLogCost { exponent: PolyLogExponent } / LogCost / ProductCost / SumCost / ExponentialCost { base: ExponentialBase } / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. **Type-level refinement carriers (CORRECTED per PM msg_a52ed981)** — refinement-mechanism `type X = Y where predicate` is ALREADY RATIFIED at HEAD per gunbc#828 issuecomment-4390333451 Path 3 + Director Option 2 (gunbc#828 issuecomment-4390199218). Precedent: `dsl/std/integer.dag:181` (`PositiveInt = Nat where gt_zero`). KNOWN_PREDICATES registry at `src/v3/compiler/src/lower.rs:798-862`: `range / non_empty / brand / gt_zero / unicode_scalar`. NO fresh-records / inductive-sum carriers — refinement over canonical carrier is the canonical path: From f298bc8fd042e9d1772225ed7aed619992c5a685 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 13 May 2026 11:58:12 +0000 Subject: [PATCH 36/36] =?UTF-8?q?docs(r3):=20gate=20#105=20canvas=20?= =?UTF-8?q?=E2=80=94=20STOP-SIGNAL=20Tier-2=20cite=20msg=5Fad5e934d=20?= =?UTF-8?q?=E2=86=92=20msg=5Fd86a5987=20(cursor=2011087)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cursor APPROVE_WITH_COMMENTS 11087: canvas §6 STOP-SIGNAL cited msg_ad5e934d for Tier-2 R4-deferral, but the worker brief §4 verbatim STOP block cited msg_d86a5987 for the same sentence. msg_ad5e934d was the original Path A Tier-1 ratification; the §8 Tier-2-deferral disposition was ratified in msg_d86a5987 (per composite-ratification text already used elsewhere in worker §0/§2/§9/§13/§15). Canvas STOP-SIGNAL aligned to msg_d86a5987 for single-authority trace. INVARIANTS P2 single authoritative trace restored. Co-Authored-By: Claude Opus 4.7 (1M context) --- docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md index f277f30c384..9484861f7ba 100644 --- a/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md +++ b/docs/briefs/r3-substrate-gate-105-symbolic-cost-tier1-canvas.md @@ -205,7 +205,7 @@ Current `src/v3/std/algebra.dag:69-72`: > STOP SIGNAL: wanting an eighth variant. Pause and escalate rather than extending; the thesis claim is that seven covers the asymptotic surface, and any new variant should carry its own dissolution receipt. **Post-extension proposed text** (Mgr recommendation): -> STOP SIGNAL: wanting a 10th variant (or 11th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 9 variants covering ConstantCost / PolynomialCost { degree: NonZeroRational } (signed per Q6; nonzero per msg_b80bcaa8) / PolyLogCost { exponent: PolyLogExponent } / LogCost / ProductCost / SumCost / ExponentialCost { base: ExponentialBase } / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_ad5e934d; new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. +> STOP SIGNAL: wanting a 10th variant (or 11th if Tier-2 IteratedLog/LogLog/InverseAckermann/HyperExp surface). Pause and escalate. Tier-1 textbook coverage (gate #105 carrier-extension 2026-05-13) lands 9 variants covering ConstantCost / PolynomialCost { degree: NonZeroRational } (signed per Q6; nonzero per msg_b80bcaa8) / PolyLogCost { exponent: PolyLogExponent } / LogCost / ProductCost / SumCost / ExponentialCost { base: ExponentialBase } / FactorialCost / UnknownCost — sufficient for the asymptotic surface that R3-load-bearing lenses reason about. Tier-2 (LogLog / InverseAckermann / IteratedLog / HyperExp) is R4-DEFERRED per Director ratification msg_d86a5987 (§8 disposition); new variants in R4 require consumer-evidence-justified canvas. UnknownCost("reason: ...") remains algebra-top, but reviewer-tier STOP-SIGNAL fires if a Tier-1-coverable bound is collapsed to Unknown — that is anti-pattern #5 per gate #105. **Type-level refinement carriers (CORRECTED per PM msg_a52ed981)** — refinement-mechanism `type X = Y where predicate` is ALREADY RATIFIED at HEAD per gunbc#828 issuecomment-4390333451 Path 3 + Director Option 2 (gunbc#828 issuecomment-4390199218). Precedent: `dsl/std/integer.dag:181` (`PositiveInt = Nat where gt_zero`). KNOWN_PREDICATES registry at `src/v3/compiler/src/lower.rs:798-862`: `range / non_empty / brand / gt_zero / unicode_scalar`. NO fresh-records / inductive-sum carriers — refinement over canonical carrier is the canonical path: