Repository navigation
Speed up CarlesonLT proof compilation - #1071
Conversation
Vilin97
left a comment
There was a problem hiding this comment.
Source review passed at afebc538cb866038e233c0ced929681c8701e622.
- The revised proofs use explicit continuity, scaling, and interval bounds. The Fourier inversion keeps the same phase and normalization, and the geometric-limit step removes only the residual term. Existing declaration signatures match the base in the two edited proof modules.
- The extracted kernel declarations retain their names and signatures.
ClassicalCarlesonpublicly importsFourierKernels, and the existing public Mathlib dependencies remain reachable at the pinned revision. The split retains the author, license, and adaptation notices. - All four reported single-core clean build pairs improved. The median recalculates to 140.515 s versus 125.440 s, a 10.73% reduction on the reported VM. Hosted validation is still running. Lean Action CI · Proof Profile
|
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 regression was found in the proof refactor or module extraction. SummaryRefactors
Checked the supplied changes, related callers, public definitions, theorem statements, project card, and repository guidance. The reported build savings were not independently measured. The pinned upstream source and its license were not independently checked; local attribution and metadata remain consistent. Reviews (1) · Last reviewed commit: "Optimize the CarlesonLT compilation path" · Reviewed by Greptile |
Proof profile (new / modified Lean files)
This build covers the added modules and their dependency cones on top of the measurement environment; modified files are measured without rebuilding the pool. Statement changes✅ No statements changed — all 780 tracked declarations across 4 modified files kept their type; only proofs / definition bodies changed. Also: 10 declarations added, 27 removed. A reorganization moves declarations between files, which shows up here as an add in one file and a remove in another. ➕ Declarations added (10)
➖ Declarations removed (27)
Statements are compared textually against the merge base (comments and whitespace ignored; Compile cost of modified files — base → headHeartbeats: 2,438,882 → 1,833,398 (-605,485, -24.8%). Commands: 809 → 817. Per-file wall sum: 300.6 s → 223.7 s (-25.6%). Wall clock is measured under parallel load and is noisy; heartbeats are deterministic and are the regression signal. Files: 1 compared — 1 cheaper, 0 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: 64,826 maxHeartbeats units across 1 valid file (403 added LOC). Sum of Count-heartbeats wall-clock total: 5.76 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.CarlesonLT.Auto.FourierKernels |
6.20 s |
Per-file `lean --profile` output
LeanPool/CarlesonLT/Auto/FourierKernels.lean
import took 2.48s
cumulative profiling times:
attribute application 0.212ms
blocked (unaccounted) 27.2ms
congr simp thm 4.18ms
declTypeLinter 7.7ms
elaboration 71.7ms
fix level params 1.74ms
import 2.48s
initialization 25.8ms
instantiate metavars 4.21ms
interpretation 719ms
let-to-have transformation 0.313ms
linting 40.7ms
module linting 0.0286ms
norm_num 80.6ms
parsing 15ms
process pre-definitions 27.3ms
ring 68.7ms
share common exprs 23.8ms
simp 101ms
tactic execution 467ms
tacticAnalysis 5.57ms
type checking 150ms
typeclass inference 749ms
real 4.09
user 3.14
sys 0.90
Advisory only — never blocks merge. Full log uploaded as the proof-profile artifact.
🤖 LLM review — refactor (
|
| Aspect | Value |
|---|---|
| Scope | Proof optimization and module split |
| Introduces tech debt | 🛑 yes |
| Maintainability | ✅ improved |
| Brittleness | ✅ more_robust |
| Risk | ✅ low |
The proof changes make dependencies clearer and reduce tactic search, with minor debt from splitting kernel identities across modules and leaving duplicated algebra.
Findings (3)
- module-boundary —
LeanPool/CarlesonLT/Auto/ClassicalCarleson.lean:120
The split moves the Dirichlet kernel definitions intoFourierKernelswhile leavingdirichletKernel_eq_integralanddirichletPer_mul_sinbehind the anisotropic Carleson import. Move these identities and their supporting lemmas alongside the definitions. Both proofs elaborate in isolation withFourierKernelsand Mathlib imports. - missed-reuse —
LeanPool/CarlesonLT/Auto/ModelOperator.lean:8045
The nonzero branch oftree_estimaterederives the normalized-conjugate identity and still callsfield_simp. Reassociate the product and use the newconj_div_norm_mulhelper, then close the remaining cast equality withComplex.ofReal_mul. - dead-leftover —
LeanPool/CarlesonLT/Auto/ModelOperator.lean:6908
The switch tolinarith onlyleaves thehsbindings unused inabs_sub_semiCenter_leandsuppBox_coord_lt. Remove both bindings so the proofs show which bounds they actually use.
Tokens: 2,728,022 in / 12,127 out · Tier: codex-subscription · Effort: xhigh · Billing: Codex subscription quota (no API credits) · Estimated cost: $11.0940 (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 single-core build for CarlesonLT fell by 10.73%.
Project and changes
CarlesonLT has roughly 15,000 lines of Lean. The weekly source profile put
ModelOperator.leanat 19.83 s of the project's 39.83 s, withAnisotropicCarleson.leannext on the build path. Profiling identified the joint-continuity proof and frequency-cutoff estimates as candidates for more direct arguments.Declaration audit
Base commit
2ba0fbcf895956d8bc5834ee7c423af1872f106a. A Lean environment manifest recorded all 1,473 existing declarations, including private and generated declarations, before editing. The comparison checked names, elaborated types, universe parameters, declaration kind, safety, exposure, reducibility, and non-proof values and recursor rules. All existing declarations matched. The raw differences were the module of origin for 28 relocated declarations and numeric macro-hygiene labels on bound variables in six generated private proofs. The comparison erased macro scopes only from private theorem binder names. Twelve supporting and compiler-generated declarations were added. Separate exported-environment checks matched the external declaration sets for the project index and the classical, model, and anisotropic entry points.Clean build measurements
Both worktrees used the pinned Lean and Mathlib versions and shared the same dependency cache. I cleared the selected project's build artifacts before each run and ran
lake --wfail --no-ansi build LeanPool.CarlesonLT.Importsunder/usr/bin/time -v. Each configuration used four concurrent base/head pairs, with disjoint CPU masks swapped between pairs and one or four Lean threads per build. Peak anonymous memory is the sum of project Lean processes'RssAnon + VmSwap, sampled every 100 ms.Single-core wall times by pair were 144.85, 116.46, 136.93, and 144.10 s on the base and 132.23, 105.32, 118.65, and 135.62 s on the patch. The median displayed compile time for
ModelOperator.leanin that configuration fell from 81 to 65 s. These are targeted builds on one shared Azure VM with cached dependencies. The wall-time gain varies with the worker count and VM load.Validation
lake shake --force --keep-public --add-public LeanPool.CarlesonLT.Imports.lake env lean --run scripts/ci/lint-project.leanandlake --no-build exe lint-stylefor all ten project modules.uv run --locked python -m lean_pool.quality --repo .. --static-onlyfrompython/and the repository's project-scoped axiom, option, compiler-message, and headline-declaration audits.lake exe mk_all --module --check, documentation toolchain and Mathlib pin checks,git diff --check, and the ten relevant CI tooling tests for Lake and the compiled axiom audit.