Repository navigation
Add pinned Lean-library imports, glossary generation, wrappers and axiom auditing - #362
humuhumu33 wants to merge 29 commits into
Conversation
A replayed unit is keyed by a Merkle DAG of PrismPM ADR-015 DigestSets
({sha256, blake3}, label blake3:<hex>) over one canonical serialisation of a
declaration (name, universe parameters, kind attributes, type, value digest),
the keys of what it names, the Lean toolchain and the Mathlib revision. A unit
is a set of declaration keys, so the cache serves per-declaration and
per-module replay alike. Entries are canonical JSON named by key, carry the
executable digest that produced the result and a digest of their own bytes;
changed bytes, a foreign key, a forged environment or a malformed file are
LLV7019, malformed facts LLV7020. Facts come from the pinned Lean through an
embedded exporter (replay_facts.lean).
Adds rows RC-01..RC-06 (register, SPEC 31, scenarios, cases), SPEC 22.13, the
blake3 dependency (SPEC 8.5 table; deny.toml allows BSD-2-Clause for its
arrayref), a falsifiability record in VERIFICATION.md, and notes for #341 in
docs/proposals/mathlib-import-notes-338.md. lexlean verify does not use the
cache.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ps fetch (Refs #334) [[lean_library]] (language 1.2) declares an external Lean library once, by HTTPS URL and exact commit. The lock pins it with the digest of the library's own lake-manifest.json and the digest of its glossary, and the Lake workspace must require it as declared. lexlean deps fetch is the only command that acquires it (lake exe cache get); lock, check, build, fmt and verify stay offline and fail with LLV7019 when it is absent. Registers ML-01..ML-04 and LLC0109, LLC0110, LLV7019, LLV7020. The schema change that would move the language-1.2 identity is held back; see docs/proposals/mathlib-import-notes-334.md. Mathlib pin: 520045ab14e2 (tag v4.32.1). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…9, VR-24, #336) A class-polymorphic Lean declaration is specialised at a concrete type as one public term declaration of the host library, LexLeanSpec.<tag>.<declaration>, emitted by lexlean::wrappers (and cargo xtask emit-wrappers) from a lexlean/wrappers/1 request. The external-interface probe holds an entry that denotes a wrapper to (signature) = (type_of% @wrapper) := rfl; a signature that differs is LLT4017, a request outside the term grammar is LLT4018. Register rows GL-19 and VR-24 (459 IDs), SPEC 13.12 and 18.8, scenarios, failing named tests, fixture tests/fixtures/specialisation, planted defects in VERIFICATION.md, notes in docs/proposals/mathlib-import-notes-336.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…pe (#337) Measurement scripts under tooling/mathlib-speed (targeted vs umbrella import, leanchecker module vs fresh vs declaration-closure replay, byte-reproducibility of Mathlib modules built twice), a small Lean closure-replay tool, a planted-defect module pair, and the notes for the design document. No LexLean Rust or SPEC change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
lexlean deps glossary runs a Lean metaprogram under the pinned toolchain and writes a lexicon package of kind-lean entries plus a coverage report. LSE signatures are translated from the kernel type (binder modes kept, implicit and instance arguments left out of applications, annotations erased), names and surfaces follow a documented scheme, inductive types get eliminator descriptors, and anything LSE cannot express is refused with a registered code (LLT4101-LLT4107) and never weakened. Register rows CL-25, GL-19, GL-20; SPEC 13.12 and 23.4; fixtures under tests/glossary; working notes in docs/proposals. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… glossary section of #335)
…lib-import-integration
…ollide with the fetch codes of #334)
docs/proposals/mathlib-import.md covers the config surface, commands, lock rows, cache keys, the trust statement, diagnostics, limits and refusal reasons, the measurements of #334 to #338, and the owner decisions (D1 to D15). Sections for the axiom audit (#339) and the acceptance demo (#340) are marked PENDING. Check run: all 18 diagnostic codes named in the document have an entry in ERRORS.md; every section number cited exists in SPEC.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Section 13 now states the import axiom audit (VR-25, VR-26, LLV7023 to LLV7025) from note 339, with its findings and owner decisions (D15). The three codes are in the ERRORS.md of the #339 tree and not yet on the integration branch. The #340 demo section stays PENDING. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ons (VR-25, VR-26, #339) The probe module prints #print axioms for each used external whose Lean module is outside Init, Std, Lean, Lake and LexLeanRuntime; the observed sets are recorded in the attestation (imports) with the status "replayed in the pinned environment", and an import that depends on sorryAx (LLV7023), Lean.ofReduceBool (LLV7024) or Lean.trustCompiler / a native_decide axiom (LLV7025) is refused unless an axiom policy of the document names it. Schemas are untouched (identity move held back; see the notes). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
VR-25: the external-interface probe wrote an unreferenced instance binder with a name, which pinned Lean lints and a warning fails verification, and it ascribed a numeral the type of a caller local when the caller local was named like a binder of the callee (a, the type parameter of Eq). ML-05: fmt copied the project to a scratch directory without the declared library, so it failed with LLV7019 on any project that declares one. Also: xtask links the example Lake workspace into the clean copy instead of copying it, and audit-deferral skips .lake (fetched libraries). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Registers total 476. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
examples/mathlib-blake3-g: four language-1.2 modules proving, for BitVec 32
and UInt32, (a + b) - b = a, (a ^^^ b) ^^^ b = a, rotl (rotr a n) n = a for
n in {7, 8, 12, 16}, and that the eight-step inverse of the BLAKE3 G
function recovers its inputs, citing Lean core and Mathlib lemmas through a
generated glossary. Verified offline against the pinned Mathlib; expected/
holds the build and verification goldens. Notes for the design document in
docs/proposals/mathlib-import-notes-340.md.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Section 10.7 now holds the demo results from note 340 (statements, proof forms with external lemmas, measurements, coverage, the three defects found, what verified and what did not). D3 and D4 are rewritten: prose proofs with external lemmas work in a language-1.2 project, so the gap is semantic modules. New decisions D16 (CI for an example that needs the library) and D17 (the demo choices); new gaps in sections 12 and 15. Checked against the merged branch: all 23 diagnostic codes named are in ERRORS.md, all 17 register IDs named are in model/ids.toml, 476 IDs in model/ids.toml and SPEC.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The demo needs a fetched Mathlib, which no default gate has: demos live under demos/, nothing under examples/ declares a lean_library, cargo xtask verify-demos gives a demo the example gate plus its golden build and a reproducibility check, and .github/workflows/mathlib.yml fetches the library and runs it in a job of its own, outside the acceptance gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
afflom
left a comment
There was a problem hiding this comment.
Maintainer review.
- Base. Retarget to
release/v0.5(AGENTS.md, release lines:maintakes a line only at its tag). - CI red (run 41034507088,
rest+ 4 hosts):RP-05:xtask/Cargo.tomldescription omitsverify-demos.RP-11: README rangeEX-01..EX-09must end atEX-10.SP-17: Lean syntax literal") := rfl"atcrates/lexlean/src/backend/lean.rs:2541.
mathlib.ymlcost. It fetches ~7 GB on every PR and push, whatever changed. Add apaths:filter (demos/**,crates/lexlean/**,xtask/**,lean-toolchain,Cargo.lock, the workflow itself).- CI budget. Please convert to draft until
restis green; each push to a ready PR runs the whole gate (~500 runner-min).
Generated by Claude Code
|
The numeral capture also fails outside the probe, in a glossary defined value. At used as This PR targets |
|
Follow-up maintenance review at 7c6467d: the prior review is still outstanding. I am moving this PR to draft and retargeting it to release/v0.5 as already requested, so incomplete work does not keep triggering the full gate. Two additional concrete acceptance gaps need correction before the identity wave:
For the initial integration, retain the current pinned toolchain, generic Please also include the defined-value numeral-capture reproduction in the existing regression coverage, alongside the probe case. The prior CI corrections and scoped Mathlib workflow trigger remain required. Publish the resulting final scope/issue-closing list before requesting the full gate. |
|
Maintainer coordination at unchanged head |
|
I audited the proposed closing list against the actual child criteria and corrected the title/body. The prospective closure is now #335, #336 and #341 only, conditional on the remaining corrections and final gate. No issue was closed. #334 still needs a measured cold fetch (the design currently derives 5.4 minutes from file timestamps). #337/#338 do not have integrated imported-closure replay or warm-after-edit verify evidence. #339's current acceptance asks for replay wording this implementation cannot claim; accurately saying A register coordination detail: #391 had proposed VR-24 for a distinct single-kernel replay/publication guard. That issue now reserves VR-28, preserving this PR's existing VR-24–27 claims. No renumbering or extra identity wave is requested here. |
|
The requested ordinary defined-value regression is reviewed and available for this PR's source integration: commit 7d43d86d5 on maintainer branch fix/vr27-defined-value. It is a direct child of unchanged contributor head This changes only VR-27 coverage, its existing fixture and verification evidence. The defined Actual evidence: the historical printer generated Please include this single reviewed commit in the existing #362 source refresh before the coordinated schema/status corrections and official identity writers. The remaining review findings, final integration and acceptance evidence still belong to this PR; this prepared branch claims no issue closure or completed Mathlib milestone. Its feature-branch push matches none of the current workflow push filters, including Mathlib's, and no Actions run was created for the commit at the verification check. |
|
Maintainer coordination at unchanged head |
|
Reviewed source follow-up is published: 0734d13cc on fix/mathlib-schemas-status, directly atop reviewed VR-27 commit 7d43d86. Tree 5edb43d85fd0b435e1ed96f9b59939736183eda8 matches independent review. The contributor branch remains untouched; this belongs in existing #362, not a duplicate PR. The four missing closed schemas now match existing library/import writers, preserving every prior required field. Library presence requires language 1.2 even for []. Writer, VR-26, normative text and current docs consistently say Passed: seven focused Rust units (including actual row serialization/schema binding), 48 schema refusal cases, official model projection, correctly rooted canonical/model audit (477 IDs/104 codes), formatting and whitespace checks. The initial ENOSPC compile ran no tests and is not evidence. All three language identities are affected by the shared attestation schema. Pins/artifacts remain unchanged and intentionally stale; no verification or full gate ran on them. Integrate this reviewed source before official regeneration. Coordinate the final v0.5 wave with the accepted Lean 4.33.1 upgrade #420; current evidence remains from the existing 4.32.1 line. Remaining review findings, final integration and complete acceptance are still required. No readiness or issue closure is claimed. |
|
The remaining small source-readiness fixes are independently reviewed and published atop the earlier schema/regression preparation: 1144608af on fix/mathlib-source-readiness, tree 5bab1329f92af6e8e615508cc5d0edade342bfaa. This includes parents 0734d13 and 7d43d86; the contributor branch remains unchanged. The xtask description now includes its existing verify-demos and emit-wrappers commands; README's example range includes EX-10. SignatureExample reuses the renderer's existing assignment token, preserving its exact equality/rfl output and line mapping. SP-17's scanner and allow-list remain unchanged, including all planted-template refusals. The separate Mathlib workflow now limits push/PR execution to relevant build, embedded, demo and workflow inputs. Dispatch, branch selection, all job commands and normative ci.yml remain unchanged. Conservative demo/crate paths still include their documentation. Passed: exact rendering unit; SP-17/RP-05/RP-11/EX-10 with explicitly verified checkout roots; existing plants; 21 workflow-path cases; all-target/all-feature Clippy, formatting and whitespace checks. No library fetch, verification or full gate was run. The schema changes still require the coordinated identity/artifact wave and complete final acceptance, aligned with #420. These follow-ups address source findings, not readiness or closure of the broad Mathlib issues. |
|
The combined forward-source review found a concrete integration prerequisite: I opened scoped #438 (SL-15, assigned to me) for the minimum certified incremental interface and DigestSet adaptation. It belongs in this existing Mathlib integration and coordinated v0.5 source freeze, not a duplicate Mathlib PR or separate writer wave. The contract retains digest/framing/BLAKE3 bytes, bounded state/chunk memory, closed FIPS-length handling, existing SL-02/SL-06 guarantees and full final acceptance. No dependency exception, arbitrary size refusal or runtime implementation has been introduced. The remaining source union is being independently reviewed now, with strict schema/status/Host/#396 retention. It remains explicitly unbuildable at the unresolved hashing boundary; no compilation or successful Mathlib execution is claimed. |
|
Correction to the dependency decision above: independent call-site review confirms the streaming consumers are confined to the unused replay-cache prototype. I am separating that future #338 preparation explicitly: preserve all cache source, RC-01–06 claims/scenarios/tests, LLV7021/7022, exporter and normative/dependency mirrors together. The initial candidate will carry none of those delivery claims or disabled tests. The #341 design document may retain clearly labeled future cache designs and historical measurements. This preserves work and acceptance rather than removing requirements from #338. #438 is now correctly scoped to the future cache integration; its unexecuted design is preserved and implementation paused. Initial #362 remains scoped to #335/#336/#341, with #337/#338 and other broad trackers open. No new runtime feature, writer, source-branch mutation or test run was performed for this decision. |
|
Stays draft on Generated by Claude Code |
This draft prepares pinned Lean-library imports, glossary generation, specialisation wrappers and axiom auditing. Imported declarations are loaded from the pinned environment and signature-checked; this implementation does not replay their dependency closure. Generated project modules retain the required kernel replay and axiom checks. Design:
docs/proposals/mathlib-import.md.Closes #335, #336, #341.
The closing scope is limited to glossary generation, specialisation and the reviewed design document, after the outstanding source/schema/status corrections, coordinated regeneration and complete final-head gate. #333, #337, #338, #339 and #340 remain open: a cache library unused by
verify, a closure-replay prototype and the current demo do not complete their acceptance criteria. #334 remains open pending an actual measured colddeps fetchrun; file timestamps are not that measurement. The design document and imported-status wording must be updated to the accepted scope before landing. Cache integration, additional semantic proof forms and a new imported-closure checker are outside this integration.What this adds
[[lean_library]]config (HTTPS, exact 40-hex revision), lock rows, explicitlexlean deps fetch; every other command stays offlineML-01toML-04LLC0109,LLC0110,LLV7019,LLV7020lexlean deps glossary: generateskind = "lean"entries from Lean declarations, byte-deterministic, with a coverage report; untranslatable declarations are refusedCL-25,GL-19,GL-20LLT4101toLLT4107GL-21,VR-24LLT4017,LLT4018tooling/mathlib-speed/); no Rust or SPEC changeverify(design decision D6)RC-01toRC-06LLV7021,LLV7022VR-25,VR-26LLV7023toLLV7025demos/mathlib-blake3-g, a newverify-demostask and.github/workflows/mathlib.yml(it runslexlean deps fetch, then verifies the demo)ids.tomlThe register now has 477 IDs.
Collisions resolved while merging
The nine pieces were built in parallel and collided. These were renumbered here: the specialisation row
GL-19is nowGL-21; its SPEC section 13.12 is now 13.13 (section 13.12 is the glossary); the replay-cache codesLLV7019/LLV7020are nowLLV7021/LLV7022(the fetch codes keepLLV7019/LLV7020); the probe-binders rowVR-25is nowVR-27.Checks, honestly
Passed locally on the tip (
7c6467d94): fmt, model validation (477 IDs), spec-links, clippy, features, test inventory and theverify-demostask.Passed locally on the merge just before the demo restructure (
f1ea14fe0):cargo deny, and the new conformance casesGL-19toGL-21,ML-01toML-04,RC-01toRC-06andVR-24. They have not been rerun on the tip.Not completed locally: the full unit-test run and most
bddparts. WSL repeatedly killed the long runs; one run was OOM-killed on the 4.5 GB lane. CI on this PR is the first complete run of those. Findings so far:formatter_is_idempotent_on_every_examplepeaks near 6.8 GB on its own and passes when run alone.end_children::a_signal_the_host_did_not_handle_ends_it_by_defaultfailed once undernohupand has not been checked on cleanmain.conformance_rp_11failed onmainafter the README refresh removed the capability table; this PR restores the table (502f9f843).Known limits (full list in the design document): one toolchain and one Mathlib commit (
520045ab14e26149ee970e2e617ca04b09bde5d6, tagv4.32.1) on x86_64 Linux; a coldlake exe cache gettook about 5.4 minutes and 7 GB;deps glossarytakes a module or name list and a Lakerequireis still written by hand; the replay cache is not used byverify.🤖 Generated with Claude Code