Repository navigation
Speed up convex-octagon coverage certificate replay - #1027
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 defect was found in the replay or its integration. SummaryAdds a faster coverage-certificate replay while keeping the existing checker and theorem statements.
Reviewed the supplied changes, original checker, project card, entry modules, and repository guidance. External source and provenance claims were not independently verified. The reported build timings and declaration audit were not rerun. Reviews (1) · Last reviewed commit: "Speed up convex-octagon coverage certifi..." · Reviewed by Greptile |
Vilin97
left a comment
There was a problem hiding this comment.
Accept the replay change at commit af6a6e5, pending required CI.
- The equality proof covers arbitrary claims, starts and counts. The local decidability instance transports the faster Boolean replay back to the existing predicate. I verified that all 94 fact modules and their 375 chunk checks are byte-identical after removing the new import and local instance registration.
- The paired measurements show 17.11% less CPU time and 31.51% less summed compile time in the coverage modules. Sequential wall times varied with machine load. The CPU and module measurements support the change.
- The patch passes the whitespace check and combines cleanly with current main. Lean CI and Proof Profile were still running at review.
Proof profile (new / modified Lean files)
This build covers the changed modules and their dependency cones on top of the restored cache. The serial per-file sums below are useful for ranking slow files, not as a build budget. A base→head comparison was attempted but its measurements are unavailable (see the run log); modified files are omitted from the tables below. Statement changes✅ No statements changed — all 620 tracked declarations across 95 modified files kept their type; only proofs / definition bodies changed. Statements are compared textually against the merge base (comments and whitespace ignored; Total heartbeats: 8,608 maxHeartbeats units across 1 valid file (629 added LOC). Sum of Count-heartbeats wall-clock total: 2.16 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
Slowest changed modules (from
|
| Changed module | Lake time |
|---|---|
LeanPool.Erdos97ConvexOctagon.CoverageCertificateReplay |
2.40 s |
Per-file `lean --profile` output
LeanPool/Erdos97ConvexOctagon/CoverageCertificateReplay.lean
import took 761ms
cumulative profiling times:
attribute application 0.363ms
compilation (IR) 2.11ms
compilation (LCNF base) 24.1ms
compilation (LCNF impure) 9.93ms
compilation (LCNF mono) 15.6ms
congr simp thm 5.77ms
declTypeLinter 8.85ms
elaboration 95.8ms
fix level params 1.09ms
import 761ms
initialization 37.2ms
instantiate metavars 2.07ms
interpretation 187ms
let-to-have transformation 1.83ms
linting 25.8ms
module linting 0.0183ms
parsing 15.5ms
process pre-definitions 14.2ms
share common exprs 6.91ms
simp 132ms
tactic execution 227ms
tacticAnalysis 6.9ms
type checking 55.9ms
typeclass inference 71.4ms
real 1.65
user 1.42
sys 0.47
Advisory only — never blocks merge. Full log uploaded as the proof-profile artifact.
🤖 LLM review — refactor (
|
| Aspect | Value |
|---|---|
| Scope | kernel replay optimization |
| Introduces tech debt | 🛑 yes |
| Maintainability | 🛑 regressed |
| Brittleness | 🛑 more_brittle |
| Risk | 🟡 medium |
Keep the measured speedup by sharing the unchanged validation rules and making the chunk proofs select the replay explicitly.
Findings (2)
- duplicated-checker —
LeanPool/Erdos97ConvexOctagon/CoverageCertificateReplay.lean:291
The replay copies all six row-partition guards fromnodePruningValidB, andreplayActiveRowcopies the child-state checks fromprocessRow. Those rules are independent of the faster lookups. The equality proofs catch inconsistent edits at build time, while maintainers still have to change both implementations. Extract shared Boolean predicates for the partition and child-state checks, then rerun the chunk timing to verify the speedup. - silent-performance-fallback —
LeanPool/Erdos97ConvexOctagon/CoverageCertificateFacts80.lean:21
Each fact module must register the faster instance to get the speedup. In the timing probe, omitting the registration still letdecide +kernelsucceed with the standard Boolean instance, so a new or regenerated fact module can silently fall back to the slower checker. Use a shared chunk-proof tactic that passesnodeChunkReplayDecidableexplicitly so losing the replay becomes a build error.
Tokens: 1,905,318 in / 13,543 out · Tier: codex-subscription · Effort: xhigh · Billing: Codex subscription quota (no API credits) · Estimated cost: $7.8244 (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.
request_changes is an ask, not a close: of the reviewer's past request_changes verdicts, 39% were merged after a human looked. Read the findings before acting on the verdict.
Ready for review. The convex-octagon coverage certificates use a faster kernel replay with an equality proof back to the original checker.
Scope
The published Lean Pool profile attributes 438.31 of the project's 638.44 source seconds to 94 coverage-fact modules. Those modules contain 375 node-chunk checks with a common checker. The project source matches the profiled revision. Lean Pool source profile
nodeClaimChunkValidBfor arbitrary claims, starts, and counts. The fact modules register its decidability proof locally and retain their existingdecide +kernelscripts.Declaration audit
Base
34701e7c7dd46632161dafc475b2a80bccd6511a.I exported compressed manifests from Lean's private and exported environments. The comparison covered module membership, names, visibility, exact kernel types and universe parameters, declaration kind and safety, reducibility metadata, recursor rules, and exact non-proof bodies. It compared structural expressions with elaborator metadata removed.
All 4,120 base records covering 4,094 distinct names matched on those fields. The 375 changed proof bodies belong to the existing private
decideauxiliaries. The replay module accounts for all 126 added records, including three identical additional realizations of existing equation theorems. The existing source files differ only in the replay import and local instance registration, plus the generated import index.Measurements
Lean 4.36.0 and Mathlib
fc4f59e577feb1a4956671bc04ac18aaaf8cd842. Every timing rebuilt the complete project with pinned dependencies and the compiler plugin already built.LEAN_NUM_THREADS=4 LAKE_ARTIFACT_CACHE=false \ /usr/bin/time -f 'wall=%e user=%U sys=%S maxrss_kib=%M' \ lake --no-ansi --wfail build LeanPool.Erdos97ConvexOctagon.ImportsThe paired builds started together on the same Azure VM. Each had one logical CPU per physical core, with base pinned to odd CPU IDs and head to even CPU IDs. The paired wall time fell 11.58%, build CPU time fell 17.11%, and summed times for the 94 coverage-fact modules fell 31.51% (1,207.70 s to 827.10 s). Lean's declaration profiler measured 2.22 s to 1.06 s of kernel checking for
nodeClaimChunkValidB branchClaims6Row15 0 64 = truein a representative scratch probe.The sequential runs show the effect of varying VM load on elapsed time. The paired result is one comparison with warm dependency artifacts and the VM's concurrent workload.
Validation
lake env lean --run scripts/ci/lint-project.lean <all project modules>passed for 4,217 declarations.lake exe lint-style LeanPool.Erdos97ConvexOctagon.Importsandlake exe mk_all --module --checkpassed.uv run --locked --project python python -m lean_pool.quality --repo . --static-onlypassed. The same checker passed the project's main-declaration resolution, allowed-axiom audit, environment audit, and build-log audit.lake shake --force --keep-public LeanPool.Erdos97ConvexOctagon.Importsreported advisory suggestions in existing files outside the diff. The replay files and their imports received no suggestions.