Repository navigation
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GymysasaRudYZ55vmiX8gm
PR summary 2567e5d3dcImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
|
!bench |
|
Benchmark results for a9c2924 against 4541bc6 are in. There are significant results. @kim-em
Large changes (2✅, 3🟥)
Medium changes (8✅, 3🟥)
Small changes (22✅, 9🟥)
|
…d warnings-as-errors Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
This pull request has conflicts, please merge |
…t-demote-v2 # Conflicts: # Mathlib/Dynamics/BirkhoffSum/NormedSpace.lean
…tive Demoting this import reorders the module load order so that `Sites.Sheafification` is loaded before `Sites.ConcreteSheafification`, which flips the tie-break between `instHasWeakSheafifyOfHasSheafify` and `sheafToPresheaf_isRightAdjoint`. Downstream, every stuck `HasWeakSheafify (J.over X) AddCommGrpCat` search then explores the `sheafToPresheaf_isRightAdjoint` preconditions before failing, making `ModuleCat.Sheaf.Quasicoherent` and its dependents about 3x slower. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
!bench |
|
Benchmark results for 265c9fc against 4541bc6 are in. There are significant results. @kim-em
Large changes (2✅)
Medium changes (9✅)
Small changes (18✅, 5🟥)
|
…laude/public-import-demote-v2
|
|
||
| public import Mathlib.Algebra.Algebra.Equiv | ||
| public import Mathlib.Algebra.Algebra.Hom | ||
| import Mathlib.Algebra.Algebra.Hom |
There was a problem hiding this comment.
This seems like a weird change to me, aren't the public definitions in this file using AlgHom?
There was a problem hiding this comment.
Indeed, because we haven't been running shake regularly in Mathlib, in fact many imports are simply redundant and can be dropped. I'm uncertain whether it is better to do that as part of this PR, as a preliminary PR, or not to do it at all.
There was a problem hiding this comment.
I think I'll just delete those imports which are touched here, but can be deleted.
…t-demote # Conflicts: # Mathlib/LinearAlgebra/TensorProduct/Basis.lean # Mathlib/Tactic/DeprecateTo.lean
Every import demoted by this PR whose module is already in the public closure of the file's remaining public imports is removed outright: such a private import is a no-op for the file and for everything downstream. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Restore the 27 deleted imports that were only reachable through `public meta import` chains (meta imports do not make declarations visible to non-meta code), and make `Lean.LocalContext` a public import of `Mathlib.Lean.LocalContext` again since its public definitions mention `LocalContext`. Co-Authored-By: Claude Fable 5.1 <[email protected]>
# Conflicts: # Mathlib/Analysis/Analytic/Order.lean # Mathlib/RingTheory/Adjoin/Polynomial/Bivariate.lean
|
This pull request has conflicts, please merge |
|
This pull request has conflicts, please merge |
…t-demote # Conflicts: # Mathlib/Algebra/Order/AbsoluteValue/Basic.lean # Mathlib/Algebra/Order/GroupWithZero/Unbundled/Basic.lean # Mathlib/Algebra/Order/GroupWithZero/Unbundled/Defs.lean # Mathlib/Algebra/Order/GroupWithZero/Unbundled/OrderIso.lean # Mathlib/AlgebraicGeometry/RationalMap.lean # Mathlib/Analysis/Normed/Operator/FredholmAlternative.lean # Mathlib/Analysis/Normed/Order/Hom/Basic.lean # Mathlib/Analysis/NormedSpace/FunctionSeries.lean # Mathlib/Analysis/NormedSpace/OperatorNorm/Completeness.lean # Mathlib/Analysis/NormedSpace/OperatorNorm/NNNorm.lean # Mathlib/Analysis/NormedSpace/OperatorNorm/Prod.lean # Mathlib/Analysis/NormedSpace/RCLike.lean # Mathlib/Analysis/NormedSpace/Real.lean # Mathlib/Analysis/Seminorm.lean # Mathlib/Condensed/CartesianClosed.lean # Mathlib/Condensed/Light/CartesianClosed.lean # Mathlib/Data/Finite/Card.lean # Mathlib/Data/Fintype/Units.lean # Mathlib/Data/Matrix/Action.lean # Mathlib/Data/Matrix/Bilinear.lean # Mathlib/Data/Matrix/DualNumber.lean # Mathlib/Data/Matrix/Invertible.lean # Mathlib/Data/NNRat/Order.lean # Mathlib/Data/Nat/Cast/Synonym.lean # Mathlib/Data/Nat/Lattice.lean # Mathlib/Data/Rat/Cardinal.lean # Mathlib/Data/Rat/NatSqrt/Real.lean # Mathlib/Data/Real/Archimedean.lean # Mathlib/Data/Real/CompleteField.lean # Mathlib/Data/Real/Hom.lean # Mathlib/Data/Real/StarOrdered.lean # Mathlib/Geometry/Manifold/VectorBundle/SmoothSection.lean # Mathlib/LinearAlgebra/ConvexSpace.lean # Mathlib/LinearAlgebra/ConvexSpace/AffineSpace.lean # Mathlib/MeasureTheory/Measure/CharacteristicFunction.lean # Mathlib/MeasureTheory/Measure/MeasureSpace.lean # Mathlib/NumberTheory/NumberField/FinitePlaces.lean # Mathlib/NumberTheory/RamificationInertia/Valuation.lean # Mathlib/Order/Bounded.lean # Mathlib/Order/Synonym.lean # Mathlib/RingTheory/Regular/Depth.lean # Mathlib/RingTheory/UniqueFactorizationDomain/Localization.lean # Mathlib/SetTheory/Cardinal/Cofinality.lean # Mathlib/Topology/Algebra/Module/WeakDual.lean
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
This pull request has conflicts, please merge |
…t-demote # Conflicts: # Mathlib/Analysis/CStarAlgebra/Module/Synonym.lean # Mathlib/Analysis/Fourier/Notation.lean # Mathlib/Analysis/InnerProductSpace/LinearPMap.lean # Mathlib/Analysis/Normed/Operator/ContinuousLinearMap.lean # Mathlib/Analysis/Normed/Operator/LinearIsometry.lean # Mathlib/Data/Fin/Init.lean # Mathlib/NumberTheory/Padics/PadicNumbers.lean # Mathlib/RepresentationTheory/Continuous/Basic.lean # Mathlib/RingTheory/Ideal/Operations.lean # Mathlib/Topology/Algebra/ContinuousAffineEquiv.lean # Mathlib/Topology/Algebra/Module/Alternating/Basic.lean # Mathlib/Topology/Algebra/Module/IsWeak.lean # Mathlib/Topology/Algebra/Module/LinearPMap.lean # Mathlib/Topology/Algebra/Module/Multilinear/Topology.lean # Mathlib/Topology/Algebra/Module/Spaces/UniformConvergenceCLM.lean # Mathlib/Topology/Algebra/Valued/ValuedField.lean # Mathlib/Topology/Instances/ENNReal/Lemmas.lean
|
bors merge |
This PR replaces `public import` with `import` in those cases where no additional downstream imports are then needed (and the changes doesn't otherwise cause an error). This is a small step towards a fully `shake` of public imports, essentially doing the "costless" piece. This is a semantic change, as there is no guarantee that downstream users of Mathlib will not need to adjust their imports. Nevertheless, I think this is worth doing! 🤖 Prepared with Claude Code
|
Pull request successfully merged into master. Build succeeded: |
leanprover-community#43918 made the import of `Mathlib.Analysis.Convex.SpecificFunctions.Deriv` in `Trigonometric/Bounds.lean` private, so `hasDerivAt_pow`, `strictMonoOn_of_deriv_pos` and `strictAntiOn_of_deriv_neg` are no longer available transitively. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…inflation Conflict in Mathlib/Topology/Algebra/Group/Quotient.lean resolved by keeping master's demoted imports (leanprover-community#43918) and adding the public import of Mathlib.Topology.Algebra.ContinuousMonoidHom needed by QuotientTopGroup.mk. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ds them (#46228) This PR turns 639 `public import A` lines into plain `import A`. No imports are added anywhere else. ### The idea, in plain words In a `module` file `B`: * `public import A` means: `B` uses `A`, **and** every file that imports `B` also gets `A`. * `import A` means: `B` uses `A`, but keeps it to itself. We switch `public import A` to `import A` in `B` when both of these hold: 1. `B` does not need `A` in anything it exports: theorem statements, the types of definitions, and the bodies of exposed definitions only use things `B` can see without `A`. Typically `A` is only used inside proofs. 2. No file that imports `B` (directly or indirectly) relies on getting `A` through `B`: every such file that uses something from `A` already imports it some other way. Because of (2), nothing else has to change: this PR only edits the import lines of the files whose imports become private. ### Example `Mathlib/Data/Fin/Basic.lean` had `public import Mathlib.Data.Int.DivMod`, but it only uses the `Int.emod` lemmas inside proofs, and every file downstream of `Fin.Basic` that uses `Int.DivMod` already reaches it another way. So it becomes `import Mathlib.Data.Int.DivMod`, and about 6,500 modules that import `Fin.Basic` no longer load `Int.DivMod` through it. ### How the candidates were chosen This is the same idea as #43918 (which found such imports by trial builds). Here the candidates come from the compiled `.olean` files, using the analysis `lake shake` already does (which modules each declaration's statement and proof depend on, split into public and private uses), with one addition: proofs nested inside exposed definitions count as public, since Lean elaborates them in the public scope. Since making one import private can make another one costly, the candidates are accepted one at a time, each re-checked against those already accepted. Skipped on purpose: * `module -- shake: keep-all` files and deprecated-module shims, whose job is to re-export; * imports marked `shake: keep` (except the ones only needed for `example`s); * imports that would hide, downstream, a module that registers options, aesop rule sets, simp attributes or `positivity` extensions; * files using `backward.privateInPublic`; * a handful of imports whose demotion broke `deriving` or `@[simps!]` in a full build. Overall, the total number of modules loaded across all Mathlib files (the sum of the import closures) goes down by about 1%, and 7,194 of 8,726 modules load fewer files. ### Other changes * `Mathlib/Combinatorics/SimpleGraph/Extremal/Turan.lean`: `grw [Nat.mod_le]` now closes its goal, so the `exact` after it is removed. As with #43918, this is a semantic change for downstream projects: something that used to arrive through `B` may now need an explicit import. Checked with `lake build Mathlib Archive Counterexamples` and `lake test`. Benchmark (`!bench`, against `master`): `build//instructions` **−95.4G (−0.09%)**. The largest single change is `Mathlib.Condensed.Discrete.Colimit` (−31%); there are two small (about +1G, low-significance) per-module regressions. For comparison, #43918 measured −0.12%. This is the first of a stack of three PRs, ordered from most to least conservative. ### Use of AI This PR was prepared with Claude Code (Claude Opus). It wrote the analysis tooling (a small Lean program built on `lake shake`'s dependency computation, plus Python scripts that pick the imports and edit the headers), ran the builds that found and removed the bad candidates, and drafted this description. All edits to `Mathlib/` are produced mechanically by those scripts. The hand fix listed above is the only non-header change. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…ds them (leanprover-community#46228) This PR turns 639 `public import A` lines into plain `import A`. No imports are added anywhere else. ### The idea, in plain words In a `module` file `B`: * `public import A` means: `B` uses `A`, **and** every file that imports `B` also gets `A`. * `import A` means: `B` uses `A`, but keeps it to itself. We switch `public import A` to `import A` in `B` when both of these hold: 1. `B` does not need `A` in anything it exports: theorem statements, the types of definitions, and the bodies of exposed definitions only use things `B` can see without `A`. Typically `A` is only used inside proofs. 2. No file that imports `B` (directly or indirectly) relies on getting `A` through `B`: every such file that uses something from `A` already imports it some other way. Because of (2), nothing else has to change: this PR only edits the import lines of the files whose imports become private. ### Example `Mathlib/Data/Fin/Basic.lean` had `public import Mathlib.Data.Int.DivMod`, but it only uses the `Int.emod` lemmas inside proofs, and every file downstream of `Fin.Basic` that uses `Int.DivMod` already reaches it another way. So it becomes `import Mathlib.Data.Int.DivMod`, and about 6,500 modules that import `Fin.Basic` no longer load `Int.DivMod` through it. ### How the candidates were chosen This is the same idea as leanprover-community#43918 (which found such imports by trial builds). Here the candidates come from the compiled `.olean` files, using the analysis `lake shake` already does (which modules each declaration's statement and proof depend on, split into public and private uses), with one addition: proofs nested inside exposed definitions count as public, since Lean elaborates them in the public scope. Since making one import private can make another one costly, the candidates are accepted one at a time, each re-checked against those already accepted. Skipped on purpose: * `module -- shake: keep-all` files and deprecated-module shims, whose job is to re-export; * imports marked `shake: keep` (except the ones only needed for `example`s); * imports that would hide, downstream, a module that registers options, aesop rule sets, simp attributes or `positivity` extensions; * files using `backward.privateInPublic`; * a handful of imports whose demotion broke `deriving` or `@[simps!]` in a full build. Overall, the total number of modules loaded across all Mathlib files (the sum of the import closures) goes down by about 1%, and 7,194 of 8,726 modules load fewer files. ### Other changes * `Mathlib/Combinatorics/SimpleGraph/Extremal/Turan.lean`: `grw [Nat.mod_le]` now closes its goal, so the `exact` after it is removed. As with leanprover-community#43918, this is a semantic change for downstream projects: something that used to arrive through `B` may now need an explicit import. Checked with `lake build Mathlib Archive Counterexamples` and `lake test`. Benchmark (`!bench`, against `master`): `build//instructions` **−95.4G (−0.09%)**. The largest single change is `Mathlib.Condensed.Discrete.Colimit` (−31%); there are two small (about +1G, low-significance) per-module regressions. For comparison, leanprover-community#43918 measured −0.12%. This is the first of a stack of three PRs, ordered from most to least conservative. ### Use of AI This PR was prepared with Claude Code (Claude Opus). It wrote the analysis tooling (a small Lean program built on `lake shake`'s dependency computation, plus Python scripts that pick the imports and edit the headers), ran the builds that found and removed the bad candidates, and drafted this description. All edits to `Mathlib/` are produced mechanically by those scripts. The hand fix listed above is the only non-header change. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- Regenerate `VecNotation.lean` as a pure move from `master`'s `Notation.lean`, restoring upstream changes that had been reverted (leanprover-community#44933, leanprover-community#43918, leanprover-community#44513, leanprover-community#43408, leanprover-community#42318); in particular `cons_transpose`, `head_transpose` and `tail_transpose` are no longer simp. - Fix the `!![...]` delaborator for literals with more than 32 entries, whose list literals contain `let`s and are too deep to delaborate as `#[...]`: delaborate entries one at a time. Move `listLitElems?` to `Notation/Basic.lean` and reuse it in the tactic parser. Add a 6x6 delaborator test. - Remove `@[simp]` from `transposeArray_size` and `submatrixArray_size` (simpNF). - Drop `@[expose]` from `Notation.lean` and `Notation/Basic.lean`. - Add the new modules to `Mathlib.lean`. - Nits: avoid shadowing in `List.tendsto_getD`, split tactic one-liners, merge `simp` calls in `CanonicalEmbedding/Basic.lean`, simplify the `Modular.lean` literal products, and replace `simp? says` with `simp` in `MathlibTest/matrix.lean`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This PR replaces
public importwithimportin those cases where no additional downstream imports are then needed (and the changes doesn't otherwise cause an error).This is a small step towards a fully
shakeof public imports, essentially doing the "costless" piece. This is a semantic change, as there is no guarantee that downstream users of Mathlib will not need to adjust their imports.Nevertheless, I think this is worth doing!
🤖 Prepared with Claude Code