Repository navigation
Speed up HadwigerNelsonBounds certificate replay - #1025
Conversation
|
Advisory cross-file review against Lean Pool's supervisory rubric. This is not by itself a significance, source-verification, or merge verdict. [Medium impact] No actionable issue was found in this proof-only refactor. SummaryMoves 36 base-tree checks into seven independent certificate modules and switches 31 hard-gadget proofs to
Reviews (1) · Last reviewed commit: "Speed up HadwigerNelsonBounds certificat..." · Reviewed by Greptile |
Proof profile (new / modified Lean files)Statement changes✅ No statements changed — all 242 tracked declarations across 16 modified files kept their type; only proofs / definition bodies changed. Also: 36 declarations added, 0 removed. A reorganization moves declarations between files, which shows up here as an add in one file and a remove in another. ➕ Declarations added (36)
Statements are compared textually against the merge base (comments and whitespace ignored; Compile cost of modified files — base → headHeartbeats: 1,134,096 → 355,005 (-779,092, -68.7%). Commands: 142 → 178. Per-file wall sum: 165.8 s → 128.4 s (-22.6%). Wall clock is measured under parallel load and is noisy; heartbeats are deterministic and are the regression signal. Files: 15 compared — 8 cheaper, 7 costlier, 0 within noise (threshold: |Δ heartbeats| ≥ 1,000 and ≥ 1%). Both sides are elaborated against the merge-base build of the pool — sound when only proofs and definition bodies change; a file whose statements changed may fail there and is flagged ⚠. Heartbeats come from disjoint root command traces with
New files — absolute profileTotal heartbeats: — maxHeartbeats units across 0 valid files (74 added LOC). Sum of Count-heartbeats wall-clock total: 0.00 s. Repeated import cost inside Heartbeat values sum disjoint root command traces with LOC counts added lines in the profiled Lean files from this PR diff.
Aggregate phase totals
Advisory only — never blocks merge. Full log uploaded as the |
Vilin97
left a comment
There was a problem hiding this comment.
Approved at 46a605ec820e29da6e237cf53959b9aba374c7c4.
- The seven data modules preserve their certificate payloads and each checks the trees it defines. The 36 forwarding proofs cover indices 0 through 35 and preserve the original lookup and public theorem. The eight hard-gadget files contain exactly 31 changes from
decidetodecide +kernel, keeping the same Boolean tests and Lean’s kernel check. - The optimizer’s clean builds report a median of 77.13 seconds before and 60.61 seconds after, and its compiled declaration audit retains all 2,164 original records across the compared fields. The hosted profile covers 15 comparable files and reports 68.7% fewer elaboration heartbeats. The data modules cost more individually because they now do the moved work. The profile could not measure the new first-stage imports against the old build. Exact-head Lean CI built them successfully and passed lint, quality, and timing checks. Hosted profile · Exact-head Lean CI
🤖 LLM review — refactor (
|
| Aspect | Value |
|---|---|
| Scope | certificate replay and build parallelism |
| Introduces tech debt | ✅ no |
| Maintainability | ✅ improved |
| Brittleness | ➖ unchanged |
| Risk | ✅ low |
Failed checks now point to the module that owns the certificate, and the downstream proofs retain explicit case dispatch and the same Boolean checkers.
Tokens: 1,571,985 in / 15,057 out · Tier: codex-subscription · Effort: xhigh · Billing: Codex subscription quota (no API credits) · Estimated cost: $6.5138 (Standard API equivalent; uncached input) (long-context rate)
Automated review against .github/REFACTOR_REVIEW_RULES.md. Disagree? Reply on the PR; rules can be updated in a PR of their own.
Ready for review. The median clean build of
HadwigerNelsonBoundstook 21.4% less wall time.Certificate replay
The 71-module project's source profile at
ebaad62ab60d27fe11a5242fcbd7246d0d74d061attributed 28.89 seconds of the 31.23-secondPartsFirstStagerecording to the 36 base-tree verifications. Those certificates already live in seven data modules. Each module now checks its own trees, giving Lake seven independent jobs. The existing indexed lemmas apply those checks through their original auxiliary declarations. Lean Pool source profileThe 31 hard-gadget proofs use
decide +kernel. Lean's kernel checks the existing Boolean certificates, and the elaborator reuses the resulting proof without also reducing the decision procedure.Declaration audit
PR base
67a81208bb92d879df07c7ce70b8580e55ee310a. The benchmark and baseline manifest were recorded at981a0ba515543708bb42366028aacbf24642ff33. The intervening commit changed an independent project. The audited project and its build inputs match at both commits. A scratch Lean program usedLean.readModuleDataPartsto serialize kernel declarations from the exported, server, and private oleans of all 71 modules. It compared elaborated expression trees, binder information, universe parameter lists, names, safety, reducibility hints, and definition values. The comparison ignores expression annotations and theorem proof terms.All 2,164 original declaration names matched across the audited fields. Every original manifest record was present byte for byte. The 103 new declaration names comprise 36 base-tree lemmas and 67
decide +kernelproof auxiliaries.Build measurements
Lean 4.36.0 and Mathlib
fc4f59e577fe, on the same 16-vCPU Azure VM. Each run removed the project's output from.lake/build/lib/lean/LeanPooland.lake/build/ir/LeanPooland reused the dependency and linter-plugin builds. GNUtimemeasuredlake --no-ansi --wfail build +LeanPool.HadwigerNelsonBounds.Imports. All six runs rebuilt all 71 modules.PartsFirstStagePartsGadgetHardVerification2Wall time varied with load on the shared VM. The optimized median was 10.8% below the fastest measured baseline. The data modules now do their own verification work. The slowest of the seven took 4.6 seconds in the final run, up from 1.4 seconds for the slowest data module in the corresponding baseline run.
Local validation
--wfail.lake env lean --run scripts/ci/lint-project.lean <71 project modules>andlake --wfail exe lint-style LeanPool.HadwigerNelsonBounds.Imports.lake --wfail exe mk_all --module --checkandPYTHONPATH=python python -m lean_pool.quality --repo . --static-only.lean_pool.quality.PYTHONPATH=python python -m lean_pool.build_time_limits check --base 67a81208bb92d879df07c7ce70b8580e55ee310a --log ../candidate-3.logandgit diff --check.lake shake --force --keep-public LeanPool.HadwigerNelsonBounds.Imports. Its suggestions were direct tactic import additions.The timings and compiled-environment checks cover the selected project. Whole-pool validation runs in GitHub CI.