feat(scripts): kernel-level axiom sweep with committed regression baseline - #300
feat(scripts): kernel-level axiom sweep with committed regression baseline#300alexanderlhicks wants to merge 6 commits into
Conversation
…eline Add `lake exe axiomsweep`: walks the compiled environment and computes, for every CompPoly.* declaration, its transitive axiom dependencies — the #print axioms information, library-wide, in one pass. Reads elaborated .olean data, so private and macro-generated declarations are included and no source heuristics are involved. Baseline at this commit: 7589 declarations across 275 modules, 0 sorryAx-tainted, 0 non-standard-axiom-tainted — the library is fully kernel-clean, and --check now keeps it that way (fails iff a declaration is tainted that scripts/axiom_baseline.json does not list; the 6 'sorry' tokens greps report on main are all inside comments). Wire-up: report-only CI step in lean_action_ci.yml after the warm rebuild; docs/wiki/quickstart.md documents the workflow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…, docs Collector: two-phase DFS + fixpoint repair. The one-pass DFS finalized self-referencing constants (every inductive/ctor pair) prematurely and memoized the wrong result for all later roots — confirmed by review to produce rows diverging from #print axioms on sibling repos. The repair pass re-derives every set in finalization order until stable: the least fixpoint = true kernel closure, strictly more accurate than #print axioms inside mutual families. Also: axiom *types* are traversed (CollectAxioms parity), duplicate constNames rows deduped (7589→7573), native trust-axiom names normalized to their owner (ax_N_M counters are Elab.async/toolchain-volatile), --check/--update-baseline mutually exclusive, unknown --root fails gracefully, nonstandard shrinkage detected, and bare Lean.ofReduceBool/Lean.trustCompiler are never baselinable (floor). Docs: known blind spots documented (structure-field defaults and examples never enter any environment walk; unimported files — paired with check_imports); scope stated (tests/ and bench/ outside the sweep); corrected sorry-token count (5, all comments); inventory rows added to scripts/README.md, docs/wiki/generated-files.md, AGENTS.md fast-start, quickstart CI mapping + lower-level commands. CI: infrastructure failures (exit != 1) now fail the step; only taint findings are report-only during the soak. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…teral for 4.30/4.31 portability Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🤖 PR Summary
Pull request objective: Add a kernel-level axiom and sorry accounting tool ( Statistics
Lean Declarations ✏️ Added: 17 declaration(s)
❌ Added: 4 `sorry`(s)
📋 **Additional Analysis**The diff largely adheres to the CompPoly style guide and contribution conventions. The main violations are line-length exceedances in 📄 **Per-File Summaries**
Last updated: 2026-08-11 10:46 UTC. |
Build Timing Report
Incremental Rebuild Signal
Slowest Current Build Files (warm library build)Showing 20 slowest current targets from the warm library build log, with comparison against the baseline warm library build log when available.
|
|
so, I added a |
|
(removed the |
What
Adds
lake exe axiomsweep: kernel-level axiom /sorryaccounting for the whole library, with a committed regression baseline.The tool loads the built
.oleanenvironment (the same data the kernel checked) and computes, for every declaration under the swept root modules, the set of axioms it transitively depends on — i.e. the#print axiomsinformation, library-wide, in one pass. Because it reads elaborated data rather than source text, it sees exactly what the kernel accepted: private declarations, macro-generated declarations, and instances included; no regex heuristics.Why
CompPoly is a correctness-critical dependency of downstream provers (ArkLib pins it), and until now had no kernel-level accounting: source greps report 6
sorrytokens onmain, but all of them sit inside comments — the kernel truth is that the library is fully clean, and this PR both proves that and adds the gate that keeps it true. Reviews of downstream repos have repeatedly found theorems that silently inheritsorryAxthrough framework stubs; this class of defect becomes mechanical to catch at the source.How
scripts/AxiomSweep.lean(+lean_exe axiomsweepin the lakefile): memoised traversal of the compiled environment; only imports coreLean, runtime-imports the built oleans, so it needs a completedlake buildand adds no dependencies. Runs in seconds.scripts/axiom_baseline.json: the currently-knownsorryAx-tainted declarations (and any non-standard-axiom dependents).--checkfails iff a declaration is tainted that the baseline does not list; closing gaps stays green and prints a nudge to shrink the baseline via--update-baseline.::warningon regression). Flip to enforcing by deleting the|| echoonce the baseline has soaked for a few PRs.Modes
Baseline at this commit
CompPoly.*modules.sorrytokens onmain; all are in comments — exactly the false positive a kernel-level census kills.)#print axioms(CPolynomial.Raw.divModByMonicAux_go_fst_canonical→ classical trio only);--checkexit codes verified.Notes
alh/axiom-sweepbranch (multi-root variant); the copies are intentionally self-contained per repo, mirroring how other scripts are shared across the org. If it proves its keep everywhere, extracting a shared home is a possible follow-up.lean4exportwas considered and deliberately not used: it targets external kernel checking, has no source positions, and would add a per-toolchain pinned dependency; walking the environment yields the same information with line numbers and zero new deps.Adversarial review
Five independent adversarial reviewers (one per repo deployment) attacked the tool, wiring, and baselines before this PR was opened. Everything they confirmed is fixed in the follow-up commit on this branch:
#print axiomsin both directions, with constructible shapes where a newsorrypassed--check. Fixed with a fixpoint-repair phase computing the true kernel closure (now strictly more accurate than#print axioms, whose ownCollectAxiomswobbles inside mutual families). Post-fix rows spot-verified against ground truth; sorry-sets unchanged everywhere.CollectAxiomsparity); duplicateconstNamesrows deduped;native_decideaxiom names normalized to their owning declaration (theax_N_Mcounters areElab.async/toolchain-volatile);--check/--update-baselinemutually exclusive; bareLean.ofReduceBool/Lean.trustCompilerare never baselinable (floor).examples never enter any environment walk (#print axiomsincluded); unimported files are invisible — paired with each repo's import-completeness gate.What survived attack unchanged: baseline determinism (byte-identical regeneration), all headline numbers, spot-checks vs
#print axioms, gate exit-code semantics, and the CI/step placement.🤖 Generated with Claude Code