Repository navigation
v4 infer: remove v4.lens.cost / SymbolicCost (C1 cherry-pick from PR #3441) - #3445
Conversation
…ommitment 4)
P3 commitment 4 (per docs/design-v4-compiler-homomorphism.md): compiler
core must not import specific lens names. 04_infer.dag was importing
v4.lens.cost { SymbolicCost } and carrying cost: SymbolicCost as a
field on InferredFacts. That makes cost-lens a compile-core fact
rather than a lens-side dimensional projection over InferredTree.
Salvaged from PR #3441 (Worker C / tidy-eagle-109, Wave-1) which
authored this fix correctly. The rest of #3441 carried changes that
need re-doing under the post-Pass-B / post-Practice-11 framing
(extdeps/file_system.dag NodeFileBinding boundary violation;
std/outcome.dag using legacy Outcome shape; NodeOutcomeFold.step
seeing Outcome<R> instead of R). Those land in a separate Wave-2
correction; this PR pulls out the one piece that's clean,
self-contained, and a real P3-violation removal worth landing on
its own.
Changes (4 hunks, src/v4/compiler/04_infer.dag only):
- Header // Consumes: line — strip v4.lens.cost
- Import block — remove import v4.lens.cost { SymbolicCost }
- Type InferredFacts — remove cost: SymbolicCost field
- RULING-1 comment — update 'cost/inhabitance coordinates remain T-9/T-12 bridged' → 'inhabitance coordinates remain T-9 bridged' (T-12 was the cost-lens task; no longer referenced from infer)
Other fields kept:
- inhabits: AlgebraRef — algebra inhabitance is a real grounding fact
- descent: TerminationProof — termination is a semantic validity
witness for grounding, NOT a cost/complexity projection (would
potentially be renamed descent_witness for clarity in a follow-up,
but the existing name is not a P3 violation; out of scope here)
Cost / complexity / SymbolicCost remains a legitimate concept; it
lives lens-side per the lens framework (P3 commitment 4 + Q14b
rejection of cost-lens-driven compile-core selection in the v4 design
doc). validate_then_compile can gate on complexity via a required
lens; coercion_fold cannot consult it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…sor exploratory) cursor flagged on PR #3445 that the InferredFacts cost-field removal in 04_infer.dag leaves two claim scaffolds constructing InferredFacts { cost: ... } and assumed they were inert. They are not — both are scaffold-data files that construct InferredFacts values; v2-compile would fail without this cleanup. FIX (same PR, atomic with the 04_infer.dag change): src/v4/test/claim/manual/infer_emit_compile_anchor.dag: - Header // Owns: drop anchor_stub_cost - Header // Consumes: drop lens/cost.dag - import v4.lens.cost { SymbolicCost, UnknownCost } removed (now unused) - data anchor_stub_cost: SymbolicCost = UnknownCost { ... } removed - anchor_stub_inferred_facts: cost: anchor_stub_cost field removed src/v4/test/claim/workflow/pipeline_rejections.dag: - import v4.lens.cost { UnknownCost } removed (now unused) - workflow_inferred_facts(): cost: UnknownCost { ... } field removed Final sweep verified (grep across src/v4/): - Zero remaining 'import v4.lens.cost' statements - Zero remaining 'cost: SymbolicCost' field constructions - All InferredFacts {} construction sites use the new field shape Other 'cost:' matches in src/v4/ are unrelated: - src/v4/lens/registry.dag — lens registry entry (lens-side, fine) - src/v4/extdeps/languages/*.dag — per-target language model declared costs (operation_cost, instruction_cost, etc.), unrelated to compiler-core InferredFacts cursor's APPROVE on PR #3445 stands; this fix is the hidden-blocker the exploratory observation surfaced. PR now atomic + CI-safe. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@cursor exploratory observation upgraded to in-PR fix in commit You were right that two claim scaffolds construct Cleanup (same PR, atomic):
Final sweep:
Other PR now atomic and CI-safe. Your APPROVE on the 04_infer.dag change stands. |
|
I validated that PR comment end-to-end, and it is already fully applied in this branch (including commit
I also ran the v4 compile gate to ensure CI-safety posture is intact:
No additional code changes were needed. |
briansrls
left a comment
There was a problem hiding this comment.
Review metadata
- Provider / model:
codex/unknown - Commit:
a12d4955· Trigger:schedule - Thinking:
96s wall
Non-blocking — Strengths
src/v4/compiler/04_infer.dagRemoving SymbolicCost from InferredFacts keeps cost authority in v4.lens.cost instead of carrying a parallel infer-stage fact.
ROADMAP — Verified
- T-12 cost lens authority: src/v4/TASKS.md makes cost/complexity a lens task depending on T-9, so this PR preserves the intended infer-to-lens direction.
✅ No blocking concerns.


Summary
Salvaged C1 from the Wave-1 Worker C PR (#3441 / tidy-eagle-109). The P3 commitment 4 violation removal is clean, self-contained, and worth landing on its own; the rest of #3441 needs re-doing under the post-Pass-B / post-Practice-11 framing and lands as Wave-2 corrections.
What
src/v4/compiler/04_infer.dagwas importingv4.lens.cost { SymbolicCost }and carryingcost: SymbolicCostas a field onInferredFacts. That makes cost-lens a compile-core fact rather than a lens-side dimensional projection overInferredTree. Per the v4 design doc's P3 commitment 4 (no specific lens imports in compiler-core) and Q14b rejection (cost-lens cannot drive compile-core target selection), this import is a hard violation.Changes
src/v4/compiler/04_infer.dagonly — 4 hunks:// Consumes:line — stripv4.lens.costimport v4.lens.cost { SymbolicCost }InferredFacts— removecost: SymbolicCostfieldcost/inhabitance coordinates remain T-9/T-12 bridged→inhabitance coordinates remain T-9 bridged(T-12 was the cost-lens task; no longer referenced from infer)What was kept (and why)
inhabits: AlgebraRef— algebra inhabitance is a real grounding fact required by T-9.descent: TerminationProof— termination is a semantic validity witness for grounding, NOT a cost/complexity projection. Out-of-scope follow-up could rename todescent_witnessfor clarity, but the current name is not a P3 violation.Where cost-lens still lives
Cost / complexity /
SymbolicCostremains a legitimate concept — it lives lens-side per the lens framework.validate_then_compilecan gate on complexity via a required lens (e.g.[ComplexityLens(max = Linear)]);coercion_foldcannot consult it. Per Ratified Q14b in the v4 design doc, cost-lens-driven compile-core target selection is explicitly rejected.Wave-1 disposition context
This PR is the C1 cherry-pick from the larger Wave-1 disposition. The other parts of #3441 are NOT pulled here:
extdeps/file_system.dagwithNodeFileBinding) — concept-home boundary violation (extdeps shouldn't know aboutNode); needs re-do under Practice 11 companion discipline.std/outcome.dag+NodeOutcomeFold) — uses legacyProduced/Rejected{diagnostic}Outcome shape + algebra signature gives policy authority to the algebra instead of the combinator; needs re-do against ratified Outcome shape + combinator-owns-policy discipline.Both C2 and C3 will be dispatched as Wave-2 corrections under a corrected brief; PR #3441 will be closed after this one lands.
Test plan
04_infer.dagtouchedcost: SymbolicCostorSymbolicCostfrom04_infer.dag's context (cost-lens-sideSymbolicCostis fine and stays)🤖 Generated with Claude Code