Skip to content

Production build: release staged certificates; restate taken branches by if_pos / if_neg - #537

Open
afflom wants to merge 4 commits into
mainfrom
claude/release-staged-certificates-main
Open

afflom wants to merge 4 commits into
mainfrom
claude/release-staged-certificates-main

Conversation

@afflom

@afflom afflom commented Nov 14, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

https://claude.ai/code/session_013Asa3PLA7BQ6BQp5nWb8Hq

What

Two memory fixes in production build, found while exporting the uorc client (3 roots, 77 modules) on a 16 GB host.

  1. Release certificates once staged (verify/mod.rs, Certificate::released). The build used to keep every root's certificates in memory (text, authoring source, core DAG) for the whole preservation phase, and cloned them two or three more times. Now the program, crate and notation records are written to the stage before Lean starts, certificates are moved into the stage rather than cloned, and each one is cut down to what the audit reads: names, rows and pinned axioms. A rejected file's text is read back from preserve-src. Measured: lexlean RSS while Lean runs fell from 9.06 GiB to 1.9 GiB.
  2. Restate a conditional's taken branch (certificate/data_a/prove.rs, taken). conv_cond expects each branch at its motives applied to the branch's Boolean. That is an unreduced if b = true then t else e, while the branch derivation states its own relation. The kernel proved the two equal by definitional unfolding, and lazy delta could unfold the branch side first. With an Option.casesOn over an encoder call, iota then forced whnf of the encoder. In the uorc compress certificate this one check went past 11 GiB. Each taken branch is now cast by Eq.mpr with congr/congrArg over if_pos/if_neg. No axioms are added.

Not changed here, reported as found: a source match on a call's result is stated as T.casesOn, while the module elaborates a (possibly shared) matcher. The kernel then unfolds both sides and iota forces whnf of the scrutinee. uorc works around this by matching only on parameters.

Verification

  • cargo xtask verify-examples --write with LEXLEAN_EXAMPLES_PART=without:uor-atlas. Every example and stdlib verifies, and the records are rewritten in the last commit. uor-atlas writes no preservation records, and its Lean module (CensusCert8) was OOM-killed at 11 GiB on this 16 GB host, independent of this change.
  • uorc client export with both fixes (plus the uorc source changes above): passes in 2 h 3 min, largest Lean process 4.85 GiB.

uorc pins the same two commits on a branch off the uorc pin (4c41d39): claude/release-staged-certificates.


Generated by Claude Code

The production build kept every root's certificates (text, authoring
source and expression DAG) in memory, and cloned them two or three more
times, for the whole preservation phase. Records are now written to the
stage before Lean starts, certificates move into the stage instead of
being cloned, and each is released to what the audit reads (names, rows
and pinned axioms). A rejected file's text is read back from the stage.

Measured on the uorc client export (3 roots): lexlean RSS while Lean
runs 9.06 GiB -> 1.9 GiB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3PLA7BQ6BQp5nWb8Hq
conv_cond expects each branch at its motives applied to the branch's
Boolean, an unreduced `if b = true then t else e`, while the branch's
derivation states its own relation. The kernel proved the two equal by
definitional unfolding and could unfold the branch's computation (an
Option.casesOn over an encoder call, say) before it reduced the `if`,
evaluating the encoder as far as its closed parts go. In the uorc client's
compress certificate that one check passed 11 GiB.

Each taken branch is now cast by Eq.mpr with congr/congrArg over
if_pos/if_neg, so the kernel only instantiates lemmas. No axioms are added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3PLA7BQ6BQp5nWb8Hq
cargo xtask verify-examples --write (without uor-atlas, which writes no
preservation records).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Asa3PLA7BQ6BQp5nWb8Hq
…efault (§17.17)

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

@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.

Two bounded source reviews found no blocking correctness defect at2e508ce9. Certificate records serialize before release; A/B/E ordering, declaration metadata, pinned axiom policies, staging custody, compilation/replay and audit checks remain intact. The taken-branch transformation retains both original derivations and kernel obligations, using if_pos/if_neg and Eq.mpr. Let/nonmatching/equation/And/Or paths retain their prior behavior. The sampled production-coverage R10 source matches its new record's hash/length; its axiom policy and the inspected records' program/rendering bindings remain unchanged. This is bounded source credit, not whole-corpus or runtime acceptance.

Release routing needs disposition before landing: this PR targets main. AGENTS.md's Release lines section, citing SPEC9.4, says milestone work lands on release/vX.Y and main receives a release line at its tag. Please identify the intended release and carry this change through the required actual release/forward history; no automatic retargeting or duplicate patch is requested.

Existing owner should finish the exact-head full gate, establish tested/actual merged-tree equality, and retain explicit Atlas qualification and official record-writer custody. Reuse the existing writer/measurement receipts: the body reports an Atlas OOM and RSS/uorc improvements, which these source reviews do not independently establish. Current CI43628776286 is incomplete; passing honesty/repro alone is insufficient. No tests, writers or producers were repeated. Receipts pr537-certificate-lifecycle-review/receipt.json and pr537-taken-proof-review/receipt.json. #431/oldTC03 and other STOP constraints remain unchanged.

afflom commented Nov 14, 2026

Copy link
Copy Markdown
Member Author

On 2e508ce, "build and non-Lean tests" fails only on conformance_rp_11, which panics with "RP-11: the README has the capability table" (456 passed, 1 failed). This PR does not change the README. main at 71defb4 fails the same assertion: its ci run, the one after the README refresh in #331, reports the same RP-11 panic. So this failure comes from main, not from this change.


Generated by Claude Code

afflom commented Nov 16, 2026

Copy link
Copy Markdown
Member Author

Carried onto release/v0.5 as #559 (the three authored commits cherry-picked with -x, stacked on #443). Records for that line come from regenerate.yml.


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