Repository navigation
Reduce SmoothedOctagon peak compiler memory - #1201
Conversation
|
Advisory cross-file review against Lean Pool's supervisory rubric. This is not by itself a significance, source-verification, or merge verdict. [Low impact] No actionable issue was found in the three proof refactors. SummaryChanges proof bodies in three
No actionable issues were found. Performance figures come from the PR description; builds and memory measurements were not repeated. The project card and headline statements were checked for consistency with this proof-only scope. External source and license claims were not independently reverified. Reviews (1) · Last reviewed commit: "Reduce SmoothedOctagon peak compiler mem..." · Reviewed by Greptile |
Proof profile (new / modified Lean files)Statement changes✅ No statements changed — all 66 tracked declarations across 3 modified files kept their type; only proofs / definition bodies changed. Also: 8 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 (8)
Statements are compared textually against the merge base (comments and whitespace ignored; Compile cost of modified files — base → headHeartbeats: 671,720 → 856,324 (+184,604, +27.5%). Commands: 31 → 38. Per-file wall sum: 68.0 s → 88.5 s (+30.1%). Wall clock is measured under parallel load and is noisy; heartbeats are deterministic and are the regression signal. Files: 1 compared — 0 cheaper, 1 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: 249,088 maxHeartbeats units across 1 valid file (64 added LOC). Sum of Count-heartbeats wall-clock total: 44.29 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 |
There was a problem hiding this comment.
Source accepted at 4c901684, pending required CI and the configured review.
- The three proof changes preserve the existing declarations. The structural audit confirms 31,075 existing declarations, with seven changed proof terms and 11 added private declarations. The boundary proof uses an exact rational grid and checks the degree bounds before transporting the identities to the reals.
- The normal clean runs measured a 16.0% lower highest sampled per-compiler memory peak and a 2.0% shorter build, with a 2.3% higher concurrent peak. Both normal build comparisons for
Polynomials.leanshowed lower wall time and memory. The instrumented GitHub profile measured 27.5% more heartbeats in that file, mainly in the added degree and grid checks. I weighed that cost against both normal-build measurements and kept the grid proof. - The instrumented Costate profile hits its per-command limit on both base and head. It therefore gives no paired heartbeat result for that file. The clean and focused builds both measured a substantial reduction in Costate compiler memory. Hosted profile
The required build now passes. I kept the checked-in costate proof after reading the configured review. Its grind callback relies on the pinned tactic’s context and compiles in the required build. The direct certificate is easier to read, but the configured review measured higher focused peak RSS for that version. The callback is a maintenance concern. I found no proof or build defect at this head.
🤖 LLM review — refactor (
|
| Aspect | Value |
|---|---|
| Scope | proof compilation refactor |
| Introduces tech debt | 🛑 yes |
| Maintainability | 🛑 regressed |
| Brittleness | 🛑 more_brittle |
| Risk | 🟡 medium |
The shared lemmas improve reuse, and the upper-entry costate proof needs a direct check of the cleared equality before merge.
Findings (1)
- brittle-automation —
LeanPool/SmoothedOctagon/SmoothedPolygons/Ch7/StrongTransversality/Costate.lean:431
The callback usesrename_i unequaland assumesgrindhas introduced the negation of the cleared equality as the last inaccessible hypothesis. The samelinear_combinationcompiled directly afterfield_simpin a scratch copy. In the focused comparison, peak RSS was 2.74 GiB for the direct proof, 2.58 GiB for the submitted proof, and 3.99 GiB for the base. Apply the certificate directly to the equality and rerun the focused memory measurement.
Tokens: 6,836,097 in / 19,570 out · Tier: codex-subscription · Effort: xhigh · Billing: Codex subscription quota (no API credits) · Estimated cost: $27.6379 (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 clean SmoothedOctagon build reduced the highest sampled Lean compiler peak by 15.998%.
Scope
SmoothedOctagon formalizes the Reinhardt conjecture and its equality case. The November 30 source profile put about 21 seconds into
valueUpper8_eqand 26 seconds intolro_B_F0u_ge. The clean baseline putCostate.leanand the outer-stripBoundaries/Polynomials.leanamong the highest-memory modules in the 553-module project.√3 ^ 2 - 3. Use a single polynomial check for each entry of the matrix conjugation and for the diagonal costate identity.Declaration audit
Measured base
f9dea40d813350b6d37cdf4771c58f5cb6ea7db3, PR base9caa1b309942e8beaeb9f393cf8d2051d52b8970, and head4c9016848de2f1a3eb56d7b667475e28f9fd9710. Main advanced during the run. I verified the project sources, Brouwer dependency, project card, dependency pins, and validation code matched between the two bases. I imported the compiled project in Lean's private and exported environment views and compared compressed manifests. All 31,075 existing declarations matched on name, defining module, fully elaborated type, universe parameters, declaration kind, safety, and exported visibility. The comparison also covered non-theorem bodies, kernel reducibility hints, and inductive and recursor data. It found 7 changed theorem proof terms and 11 added private declarations. The generated coefficient equations and costate auxiliary types were included in the comparison. The repository axiom and option audits passed.Measurements
Both clean runs compiled all 553 project modules with Lean 4.36.0 and Mathlib
fc4f59e577feb1a4956671bc04ac18aaaf8cd842. I cleared the project's own Lake outputs for each run and reused the prebuilt external dependencies and compiler plugin. Both runs usedtaskset -c 0,2,4,6,8,10,12,14 lake --wfail build +LeanPool.SmoothedOctagon.Importson the Azure VM. I sampledRssAnon + VmSwapfrom each project compiler approximately every 100 ms. The project-wide maximum moved fromStrongTransversality/Costate.leantoLargerNorm/Endpoints.lean.The focused comparison rebuilt the same three targets against warm dependencies.
Costate.leanTestZero1.leanBoundaries/Polynomials.leanValidation
lake --wfail build +LeanPool.SmoothedOctagon.Importsand the focusedlake --wfail buildruns passed.lake env lean --run scripts/ci/lint-project.lean <all 553 SmoothedOctagon modules>,lake exe lint-style LeanPool.SmoothedOctagon.Imports, andlake exe mk_all --module --checkpassed. The project also passedlake --no-build --wfail build +LeanPool.SmoothedOctagon.Importsafter moving to current main.uv run --locked python -m lean_pool.quality --repo .. --static-onlypassed frompython/. The repository's project-card, transitive axiom, compiled option and axiom-injection, and compiler-message checks also passed for the selected project.lake shake --force --keep-publicinformed the import review. The degree tactic has an explicitshake: keepimport.git diff --checkandpython -m lean_pool.build_time_limits checkpassed.The wall times and memory peaks are observations on this VM. The timing includes Lake scheduling with warmed dependencies. The focused comparison captures the changed modules, and the clean project comparison captures the broader build. GitHub runs the cross-project validation.