Repository navigation
docs: design interprocedural cost (complexity-gate S3) — binding_id-keyed callee summaries, fail-closed recursion, substrate-gated activation - #4675
Merged
Conversation
…ss subjects via the COMPREP source-bridge (no reflection) The handoff seam between the landed COMPREP body producer and the landed cost/complexity lens stack: subjects come from source-as-data through the compiler's own pipeline (the post-ban-sanctioned COMPREP pattern), extracted via the canonical arrow_body_target_lookup accessor, folded through cost_lens and projected via complexity.dag, gated by complexity_bound_dominates with fail-closed Rejected→false. Rejects host-boundary supply (bootstrap-seed growth + second body-access path) and body_of sugar (operator-STOP surface, unneeded). Subject coverage rides the COMPREP wave ladder, honest-labeled. First consumer: complexity-gate exemplar row (S1a, adhoc-4e07f6f5-ebc). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
briansrls
marked this pull request as ready for review
June 11, 2026 15:57
… cycles demoted to a defect backstop, witness-refined SCC phase (P2) rejected as a second path Recursive surface forms lower via CallPattern classification onto the closed iteration primitives (DB-9, dsl/std/iteration.dag), so a well-formed lowered call graph is acyclic by construction and recursion is priced by the existing Loop treatment. The prior draft treated recursion as a lens-level SCC problem with a later termination-witness refinement phase — that re-derives what the lowering establishes structurally (second-path ban). SCC fail-closure survives only as an integrity backstop against lowering defects. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
6 tasks done
briansrls
pushed a commit
that referenced
this pull request
Jun 11, 2026
…sUnknown-budgets-are-errors amendment over the pre-amendment text from squash-merged #4675) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Worker attestation
Summary
Design-only doc for complexity-gate S3: closing the soundness gap where a call site costs
unit_cost()regardless of the callee's body (src/v4/lens/cost.dag:206), so a superlinear helper hides behind every caller as O(1). Follows the merged S1 (#4668/#4669,design-lens-subject-supply.md) and S2 (#4673) rungs; no code lands here.Key decisions pinned by the doc:
cost_lenssummaries keyed by binding_id (Implement brand-identity side-channel phase plan for A3/PD-3: equivalence-first ident channel + honest ident_span gates #4581 callee channel, never name strings), call edges via the canonical Transform-callee accessor, substitution via the existingsymbolic_sequential/symbolic_productalgebra. The single consult hook incost.dag's fold is explicitly flagged as an operator-STOP escalation, preferred over a shadow fold.CallPatternclassification onto the closed iteration primitives (INVARIANTS "Recursive Syntax Is Sugar", DB-9), so a well-formed lowered call graph is acyclic by construction and recursion is priced by the existing Loop treatment. SCC/self-edge fail-closure survives only as an integrity backstop against lowering defects (ClassUnknown→ red, never silently green). The earlier draft's "P2" (witness-refined SCC summaries at the lens level) is now an explicitly rejected alternative — it would re-derive at analysis time what the lowering establishes structurally (second-path ban). §3.1 additionally pins the operator's no-steady-state-unknowns rule: the CallPattern taxonomy is closed and exhaustive (same-argument "forever" loops lower torepeat(Forever), a named finite bound — not unknown; mutual recursion via DB-9 cluster facts), so everyClassUnknownover lowered code is a defect or modeling-gap work item, never a tolerated category.Test plan
base_cost_for_behaviorTransform→unit_cost()atsrc/v4/lens/cost.dag:206, interimeval_transform_callee_edgeatsrc/v4/compiler/05_eval.dag:1371, CallPattern lowering table atdsl/std/computation.dag:192, iteration-primitive closure atdsl/std/iteration.dag:1.