Skip to content

#115 PR 4/5: SP-24, MD-14, an artifact's decoded value is one literal of the lowered program - #239

Draft
afflom wants to merge 43 commits into
release/v0.5from
claude/issue-115-lowering
Draft

afflom wants to merge 43 commits into
release/v0.5from
claude/issue-115-lowering

Conversation

@afflom

@afflom afflom commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Part of #115 (L3.2 of #106), PR 4 of the stack. Stacked on #238 (round two and its review fixes merged in) → #230 → #228.

Change.

What each certificate establishes (stated per review). Certificate A relates the lowered literal to its own value (conv_value has no source argument, as the existing path for a scalar literal). That the literal equals the artifact's bytes decoded by the closed schemas is established only by conformance_md_14's independent decoding. Neither does the other's job.

Tests.

  • conformance_md_14: lowers every root of examples/models, decodes each of the 8 artifact files by the closed schemas from its bytes alone, and runs check_artifacts_as_data on every root (each artifact definition is a literal equal to that decoding, 10 in R0..R2; no nullary function builds a list). Plants, all run through that same check: the fold disabled in the lowering (refused at Recognizer.outputBias), and on a clone of a real lowered program a literal turned back into its chain and an element changed (each returns its defect).
  • conformance_sp_24 (Lean): certifies the models example, stages and compiles every certificate A/B/E, audits the axioms, checks 10 literals render as 10 Constants, asserts certificate B's text and data name ItemDef.constant exactly for the roots with a constant, and plants a wrong lemma for the literal (refused by Lean).

Gates on this head. fmt, clippy -D warnings, validate-model (438 ids), validate-spec-links, --test bdd. With the three machine modules regenerated and the compiler/ and models locks rewritten locally, none committed: conformance_md_14 and conformance_sp_24 pass (108 s).

Without that regeneration (the unregenerated tree). conformance_md_14 fails at LLC0102 on the committed models lock until it is rewritten; conformance_sp_24 passes its non-Lean half and then fails at the committed RustSyntax.lean, which lacks ItemDef.constant (and, in the library compile, the committed TargetSemantics.lean). Both are the landing regeneration's.

Sweep. On the head before the #238 rework, conformance_md_, _sp_, _pd_, _ne_, _px_, _ex_ passed (70, 0 failed; comment on this PR); not re-run on this head.

Wait for the regeneration (yours). Everything on #230 and #238, plus the committed examples/models/expected/verify/preserve (programs, crates, certificates), the examples/models and compiler locks, and any bundle that embeds them.

Not established. Whether other consumers of the models records (oracle corpus, production-export bundles) include a root with an artifact. Type::heap() makes Option<List<_>> and Pair<List,_> literals constants too, broader than the statement's wording, as §17.16 says. No full just vv.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ

…cenarios and failing named tests

Rows, SPEC.md §31 rows, scenarios, and conformance_<id> tests only; the four
tests fail because no case is wired. No implementation, no identity moves.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
#91 stage 4's)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
The reference interpreter, the TargetSemantics denotation, and the SPEC.md
17.14 cost rules charge Expr.value its weight (one for a scalar). The case
conformance_tc_08 passes; the 14 fixtures with a literal heavier than one node,
their generated statements, and compiler/lexlean.lock are not regenerated, so
conformance_tc_01/03/04/05 fail on this tree until the maintainer sequences it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
…-per-thread constant

ItemDef::Constant (a thread-local cell and a clone per call) is lowered for a
nullary, infallible function whose body is a closed literal with a heap type in
rust-std; validate refuses a constant that calls or can fail; the machine reads
it as the function it caches. conformance_rb_18 counts allocations under the
pinned rustc, with the rebuilding rendering as a plant, and the calculus fixture
cached-literal puts a constant in TC-07's differential.

rb_01 and rb_07 wait on the maintainer's regeneration of the committed packages
and the rust_renderer record.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
…ed program

The lowering folds an artifact definition's Nil/Cons-of-literals body to one
Expr::Value, keyed on the declaration. Certificate A relates the source's
cons chain to the literal by conv_value (stated for every Value), so the
library does not grow. conformance_md_14 decodes each artifact file from its
bytes and compares; conformance_sp_24 certifies and Lean-checks the models
example and plants a wrong lemma.

The committed models records (programs, crates, certificates) are not
regenerated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ

afflom commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

Sweep on this branch (unregenerated tree): cargo test -p repo-conformance --test conformance -- --test-threads=2 conformance_md_ conformance_sp_ conformance_pd_ conformance_ne_ conformance_px_ conformance_ex_ → 70 passed, 0 failed (7514 s; 364 other cases filtered out).

So none of the md, sp, pd, ne, px, ex cases compares the committed models records with what the lowering now produces; the record comparisons are the xtask gates (check-golden, check-production-export, verify-examples, check-fixtures, check-calculus). I am running the first three and check-fixtures next and will post which are stale, since that is the list you regenerate from. Not run in this sweep: tc_, rb_, bs_, or_, rs_, gn_, gc_ (the first three were run on #230/#238; the rest do not touch lowered artifact roots as far as I know, which I have not checked).


Generated by Claude Code

…e records of spec/src

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
…mand and the limit of the text check

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
ItemDef.constant in RustSyntax with arms in RustSemantics; certificate B encodes
it as itself; the rule (infallible, closed literal, no binding) is stated by
validate and by the bootstrap RustValidate, held by five committed crates in
the BS-05 differential; the library repairs its one lemma that eliminates
ItemDef (findDispatch_some._f). A declared algebraic type is not a constant.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
…pec/src; certificate B states the machine's constant

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ

@afflom afflom left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maintainer review of SP-24 and MD-14 at 775bba0.

Verdict: ready with should-fixes. R3 order held (rows and tests from #228, implementation in 3d73651). The Corr library cost is zero: git diff pr238 pr239 -- language/ is empty, certificate A uses the existing conv_value (data_a/prove.rs:185-200; Core.lex.tex:1039, Corr p env (Expr.value t v) (Obs.value v)), no new lemma or constructor. The lowering folds only artifact declarations (production/source.rs:137-146, lower.rs:2512-2524), the classification is total, the cons spine is walked iteratively, and the new production code has no unwrap on user input. The machine's constant is covered: certificate B encodes each of the ten as ItemDef.constant and the B derivation is the nullary-function derivation over the literal. Rows are records in spec/src with validate-model and validate-spec-links at 438 on this head. With the three locks rewritten locally, conformance_md_14 passes and conformance_sp_24 passes its non-Lean half and then stops at the committed RustSyntax.lean lacking ItemDef.constant (the regeneration's).

Should fix

  1. VERIFICATION.md:4102-4130 has no Command: line (§27.9; the TC-08 and RB-18 records have one) and says "Planted, three ways" before four items.
  2. MD-14's plants 2 (cases/models.rs:3950-3985) are self-checks on values the test builds (builds_per_call on a chain it just built; assert_ne! of a list it just changed): they do not run the case's detection against a planted lowering. Either apply the per-root checks to a mutated lowered.program, or drop the "planted/detected" wording for them (plant 1, is_artifact → false, is a real plant and is recorded with its message).
  3. Add the certificate-B assertion from #238's review here, where the ten constants are counted: a certificate B text for a constant contains ItemDef.constant.
  4. PR body: "conformance_md_14 passes unregenerated" is stale on this head (it fails at LLC0102 on the models lock and passes after lexlean lock); say also that conformance_sp_24 on this head fails at the committed RustSyntax.lean until regeneration.

Notes

Certificate A's kernel check relates the lowered literal to its own value (conv_value has no source argument), as the existing SemanticTerm::Value path does; fidelity of the literal to the artifact's bytes is established only by MD-14's independent decoding (models.rs:3779-3830). State that split in the PR body. The (Nil|Cons, Value) branch in prove.rs:188-200 is keyed on shape, not on the artifact declaration; harmless while only artifacts fold, worth a comment. Type::heap() makes Option<List<_>> and Pair<List,_> literals constants too, broader than the statement's "list, string, or byte string" but as §17.16 says.

Order: the stack is on 42ce948 and does not merge with release/v0.5 at c00c252 (SPEC.md); the forward merge comes once #237 and #232 have landed, and the SPEC prose then moves into the chapter modules. The #230 repair of sem_value goes in first.


Generated by Claude Code

claude added 10 commits October 20, 2026 17:16
…ted, Then clause points at BS-05 and SP-24

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
…, certificate B asserted, record has its command

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
…rojection

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
…ojection)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
claude added 16 commits October 20, 2026 19:04
…PEC.md is their projection)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
…d is its projection)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
…and MD IDs (RP-11)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ
… has 446 IDs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ

afflom commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

Landing status: the regeneration of this stack under its new identity is done on the maintainer's tree (locks, goldens, calculus modules, production export, fixtures; the renderer record moved the identity once more and was folded in). One blocker before the verify sweep and the gate: conformance_bs_05 on the regenerated tree stops in the seeded rule corpus with

the rule corpus gave up before it reached 3 runs of: ["heap-list-match"]

which release/v0.5 reaches, so the new lowering changes the crates the corpus mutates. The committed-corpus counts also moved (248 manifests, 123 fixtures, 165 programs, 224 crates) and are recorded on the landing tree. The fix for the corpus is with the stack's author session on this branch; the landing resumes on its commit.


Generated by Claude Code

…ctor counts

On the regenerated corpus the seeded mutation search drew heap-list-match
twice in 400,000 draws, below the three runs each refusal is held to, and any
change of the base crates moves the draws. The refusal is therefore reached by
three hand-built rust-core crates (BY_HAND_ONLY), asserted at least three
times; the template leaves the seeded list. The regenerated corpus holds a
constant crate, which brings constant-shape into the seeded search.

Vectors: validateCrate 415 (172 refused), correspondCrate 270 (46 refused),
685 in all; evaluator 201 crates, 392 + 247 vectors, 500 seeded mutants with
270 and 260 refused. Restated in SPEC 17.23, the BS-05 row, the scenario and
VERIFICATION.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZLb4yopYgjBGQngfSuFeQ

afflom commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

release/v0.5 now carries the 0.4.0 line (#322 merged at 61b4638cd; register 472; #279's loop-end row is RB-22 and #126 stage 2's rows are SL-06 to SL-08, the release/v0.4 rows keeping their numbers). Merge origin/release/v0.5 into this branch and recount; it then proceeds in the v0.5 order. The second forward merge (H5, H6, the release-workflow fixes) follows #304's landing.


Generated by Claude Code

afflom commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Maintainer status audit against current release/v0.5 at 2849449: this draft is still substantive, not superseded by another landing. The release has no artifact-specific Folding/literal_of/is_artifact path in production/lower.rs; it stores the result of self.term directly. Certificate A still requires a source cons to lower to a two-operand Build, with no Nil/Cons-to-literal conv_value bridge. The MD-14/SP-24 cases and register rows are also absent. The ordinary scalar conv_value path is not this feature.

Please resume this existing branch as the owner delivery for #115 rather than preparing a duplicate patch. Its stated prerequisite PRs #230 and #238 are closed without merging, so refresh the dependency/landing plan along with the v0.5 integration and recount already requested above. The earlier reported BS-05 heap-list-match corpus failure and final integrated regeneration/full gate still need current evidence; this read-only comparison does not claim to have rerun them. Keep #115 open until the artifact-as-data acceptance and final-tree checks are established.

afflom commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Not landed on release/v0.5; stacked on #238/#230/#228 and conflicting. Lands after the v0.4→v0.5 forward merge (#405), then rebase the stack and regenerate once. Left as draft.


Generated by Claude Code

afflom commented Nov 14, 2026

Copy link
Copy Markdown
Member Author

I merged release/v0.5 (6c36829) into this branch locally to check the v0.5 landing. The text conflicts resolve: IDs MD-14/RB-18/SP-24/TC-08 are free, Chapter17 ports cleanly, and BS-05 takes the line's one heap-list-match crate plus this branch's 5 constant crates. The real blocker is that v0.5's bootstrap Rust pipeline (RustAst::Def, RustLower/RustBodies/RustPrint/RustLoops, BS-06..BS-14) has no DConstant. rust_print.rs::enc_item_def and binder_arm.rs fail to compile on ItemDef::Constant, and the bootstrap lowering would have to lower constants the way lower.rs now does. That is feature work in the bootstrap modules, not merge resolution, so this stays parked for the author. I'm not pushing the partial merge.


Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants