Repository navigation
perf: speed up InfiniteConnesRigidity proofs and imports - #447
Conversation
Optimize the compile cost of `LeanPool/InfiniteConnesRigidity` without changing any statement, definition, or public name (declaration-manifest verified: 4544 declarations before and after; only `simp`-generated auxiliary lemmas and three new private helper lemmas differ). Clean `lake build LeanPool.InfiniteConnesRigidity` on prebuilt Mathlib (32 cores, quiet machine): 118.0 s -> 92.8 s wall (-21%), 262.7 s -> 228.2 s user CPU (-13%). Per module: UniversalLattice 31 s -> 21 s, CarryAndCrossedProduct 29 s -> 21 s, SpectralAndPropertyT 24 s -> 22 s, GroupConstruction 15 s -> 13 s, FactorAndRigidity 18 s -> 17 s. - `l2Reindex` / `crossedIndexEquiv`: pass `(f := ...)` to `Equiv.summable_iff` so expected-type propagation no longer unfolds `Summable`/`HasSum`/`Filter.map` (9.2 s and 7.4 s -> 0.4 s each). - `polynomial_valuation_coefficient_ascent`: ascribe the `let`-bound types in the statement; the elaborated proposition is identical but statement elaboration drops from 5 s to 0.1 s. - Matrix identities over `Fin 3`/`Fin 4` (unipotent factorizations, Mennicke blocks, Cornulier root products, diagonal unit pairs): replace `Matrix.mul_apply`/`Fin.sum_univ_*` expansions by entrywise transvection peeling via private helpers `specialLinear_mul_transvection_apply` / `specialLinear_transvection_mul_apply`, and `simp` by `simp only`. - `rw [map_mul]` on unitary representations -> `MonoidHom.map_mul`, star algebra equivalence fields instead of `map_star`/`map_mul`/`map_add`, `Lambda` abbreviation in `change` goals, `div_eq_inv_mul` instead of `mul_comm` in a `simpa`, `ring` instead of `mul_left_comm` in `simp`. - `lake shake`: drop 10 unused imports and demote 10 `public import`s in CarryAndCrossedProduct and SpectralAndPropertyT to plain imports. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Advisory cross-file review against Lean Pool's supervisory rubric. This is not by itself a significance, source-verification, or merge verdict. The PR appears safe to merge, with no outstanding prior findings or newly introduced actionable defects. SummaryThis PR optimizes elaboration in the five
Reviews (14) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." |
Proof profile (new / modified Lean files)Statement changes
|
| File | Δ lines | HB base | HB head | Δ HB | Δ HB % | Wall base (s) | Wall head (s) |
|---|---|---|---|---|---|---|---|
LeanPool/InfiniteConnesRigidity/UniversalLattice.lean |
+140/-96 | 2,693 | 2,696 | +3 | +0.1% | 96.47 | 60.96 |
LeanPool/InfiniteConnesRigidity/CarryAndCrossedProduct.lean |
+41/-37 | 9,175 | 9,177 | +2 | +0.0% | 173.20 | 112.57 |
LeanPool/InfiniteConnesRigidity/GroupConstruction.lean |
+20/-10 | 2,632 | 2,634 | +2 | +0.1% | 81.29 | 67.55 |
LeanPool/InfiniteConnesRigidity/SpectralAndPropertyT.lean |
+57/-55 | 9,508 | 9,506 | -2 | -0.0% | 94.79 | 80.42 |
LeanPool/InfiniteConnesRigidity/FactorAndRigidity.lean |
+6/-12 | 6,659 | 6,659 | +0 | +0.0% | 108.13 | 89.94 |
| Total | +264/-210 | 30,667 | 30,672 | +5 | +0.0% | 553.9 | 411.4 |
Advisory only — never blocks merge. Full log uploaded as the proof-profile artifact.
|
Auto-rebase stopped: this PR conflicts with |
3 similar comments
|
Auto-rebase stopped: this PR conflicts with |
|
Auto-rebase stopped: this PR conflicts with |
|
Auto-rebase stopped: this PR conflicts with |
# Conflicts: # LeanPool/InfiniteConnesRigidity/GroupConstruction.lean
Mathlib 5ed29652 no longer reaches Matrix.PosSemidef.hadamard through the narrowed transitive imports; import its defining module directly. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Final exact-head review at Scope. Proof-level optimization of Reconciliation with Maintainability. Improved rather than traded away: the explicit lemma lists and shared helpers are more robust to simp-set drift than the bare Merging by protected squash once the required checks report. |
Export ConnesRigidity.MennickeIdentity.specialLinear_mul_transvection_apply from UniversalLattice, the root of the module chain, and use it from CarryAndCrossedProduct and GroupConstruction. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Final exact-head note at |
Summary
Daily optimization cycle, target:
LeanPool/InfiniteConnesRigidity(5 modules, 40.2k lines, imported 2026-09-13 in #393). It was selected as the most expensive project per line in the pool: its import-PR CI profile shows 30,681maxHeartbeatsunits and a 639 s seriallean --profilesum for only five files, about 3× the per-line cost of the next candidate (GapCVP), and it had never had an optimization pass. A CPU-time sweep over 385 files of 25 other large projects (ClassificationOfSurfaces, PhaseRetrieval, SpherePacking, Monlib4, OSforGFF, …) found no file above 130 CPU-s, versus this project's 90–160 s files.No statement, definition, instance, notation, or public name changes; proof terms and elaboration paths only, plus three new private helper lemmas and an import cleanup.
Measurements
Clean
lake build LeanPool.InfiniteConnesRigiditywith prebuilt Mathlib oleans (32-core WSL2 host, load < 3, project artifacts deleted from.lake/build/{lib/lean,ir}before each run, base and head worktrees sharing the same.lake/packages; runs interleaved head / base / head):8d2d0c5(project files identical at4de4e26, the PR base)Per-module Lake times (the modules form a linear import chain, so wall ≈ their sum):
Overall: −21 % wall, −13 % user CPU. Per-declaration attribution came from
lake env lean -Dtrace.profiler=true -Dtrace.profiler.threshold=200run with the lakefile options (maxSynthPendingDepth=3, the Mathlib linter set) and confirmed in truncated copies of the real files, e.g.l2Reindex9.2 s → 0.4 s,crossedIndexEquiv7.4 s → 0.4 s,polynomial_valuation_coefficient_ascentstatement 5.1 s → 0.1 s,IntegerElementaryProof.upperUnitriangular_factorization4.9 s → 0.45 s,mennickeBlock_rotation_conjugate3.3 s → 0.45 s,unitEntry_diagonalUnitPair_apply2.9 s → 0.35 s,unitary_mem_normalFixedSubmodule0.61 s → 0.15 s.Invariant audit
A declaration manifest was recorded from the base oleans and from the final head oleans with a Lean script (
importModulesover the five modules, every constant: kind, safety, reducibility hints, universe parameters, reducibility status, instance status and priority,simpmembership, protected/private,Expr.hashof the type, hash of the value, hash of the value with all proof subterms erased viaMeta.transform, and app.explicitrendering of the type).Result: 4544 declarations in the base, 4546 in the head. The only differences are
simp-generated auxiliary lemmas (*._simp_1_N) and 4 whose statements changed — all internal auxiliaries of the rewritten proofs;MennickeIdentity.specialLinear_transvection_mul_apply(UniversalLattice) andspecialLinear_mul_transvection_apply(CarryAndCrossedProduct, GroupConstruction);_proof_Nauxiliaries of definitions); every definition's value and proof-erased value hash is unchanged.#print axiomsofConnesRigidity.infiniteConnesRigidity, of the second main result, and of the edited definitions:propext,Classical.choice,Quot.soundonly.Changes
lpreindexing (l2Reindex,crossedIndexEquiv): pass(f := fun i ↦ ‖f i‖ ^ (2 : ℝ≥0∞).toReal)toEquiv.summable_iff; expected-type propagation previously spent 5 s unfoldingSummable/HasSum/Filter.mapbefore failing and retrying. The elaborated definitions are identical (rfl-checked and manifest-checked).polynomial_valuation_coefficient_ascentgetslet s : ℕ :=/let f' : Polynomial A :=ascriptions; the elaborated proposition is byte-identical (manifest), elaboration drops from 5 s to 0.1 s.Fin 3/Fin 4(unipotent factorizations in UniversalLattice and GroupConstruction, Mennicke block lemmas,mennickeBlock_rotation_conjugate,unitEntry_diagonalUnitPair_apply,mennickeBlock_mem_of_isUnit_topRight, Cornulier row/column root products): replaceMatrix.mul_apply/Fin.sum_univ_*expansions (3⁵–4⁵ terms per entry) with entrywise transvection peeling through the private helpers,simp onlylists collected in context, andring.rw [map_mul]onUnitaryRepresentation→MonoidHom.map_mul(52 rewrite sites in SpectralAndPropertyT, each saved a 0.25 sMulHomClasssearch);map_star/map_mul/map_addonStarAlgEquiv→ themap_star'/map_mul'/map_add'fields;mul_left_commin asimp only→ring;mul_commin asimpa only→div_eq_inv_mul;simp_all→simp_all only;changegoals spelled withSemidirectProduct (Multiplicative D) K kDActionuse the existingLambdaabbreviation.lake shake --force --fix): CarryAndCrossedProduct drops 6 unusedpublic imports and demotes 8 to plainimport; SpectralAndPropertyT drops 4 and demotes 2. UniversalLattice, GroupConstruction and FactorAndRigidity were already minimal.Commands run
Limitations
runLinter LeanPoolwere not reproduced locally (single-project worktree without the other 158 projects' oleans); CI runs them.parkWoodburn_mennicke_identity(~5 s, fourteen!![…]intermediate identities, nowsimp only), then ~1–2 s each (rankTwoParabolicSpecialLinear_*,stabilizedTwoByTwo_mem_elementaryThree_of_topLeft_isUnit,lambdaGroupFactorUnitary_*). Statement-level costs from instance searches on↥B(~0.3 s per declaration mentioning it) were left untouched because any shortcut instance would change the elaborated statements.🤖 Generated with Claude Code