Skip to content

[Merged by Bors] - chore: reduce import all - #41389

Closed
felixpernegger wants to merge 4 commits into
leanprover-community:masterfrom
felixpernegger:lessimportall
Closed

felixpernegger wants to merge 4 commits into
leanprover-community:masterfrom
felixpernegger:lessimportall

Conversation

@felixpernegger

@felixpernegger felixpernegger commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Removes import all whenever possible. I also tried to "downgrade" by changing to import from import all, but that never made a difference. Excludes MathlibTest.

For a related PR, see #41222.


Open in Gitpod

@github-actions

github-actions Bot commented Jul 5, 2026 •

Copy link
Copy Markdown

PR summary 5bba9d8a3a

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Lean.Meta.RefinedDiscrTree.Encode 62 61 -1 (-1.61%)
Mathlib.Tactic.GCongr.Core 82 81 -1 (-1.22%)
Mathlib.Data.Int.Bitwise 402 399 -3 (-0.75%)
Mathlib.Control.Monad.Cont 138 137 -1 (-0.72%)
Mathlib.Data.Fintype.Parity 463 460 -3 (-0.65%)
Mathlib.Tactic.PNatToNat 488 485 -3 (-0.61%)
Mathlib.Tactic.FieldSimp.Discharger 513 511 -2 (-0.39%)
Import changes for all files
Files Import difference
../mathlib-ci/scripts/pr_summary/import_trans_difference.sh all
There are 7714 files with changed transitive imports taking up over 342301 characters: this is too many to display!
You can run this locally from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci


Declarations diff (regex)

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 5bba9d8).

  • +0 new declarations
  • −0 removed declarations

No declaration differences.


No changes to strong technical debt.

No changes to weak technical debt.

Current commit 5bba9d8a3a
Reference commit e90415aad1

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@felixpernegger

Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar

leanprover-radar commented Jul 5, 2026 •

Copy link
Copy Markdown

Benchmark results for 65dd51a against 2051676 are in. No significant results found. @felixpernegger

  • 🟥 build//instructions: +66.3G (+0.04%)

Small changes (1✅)

  • ✅ build/module/Mathlib.Tactic.GCongr.Core//instructions: -889.3M (-3.86%)

@grunweg

grunweg commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

!bench

@leanprover-radar

Copy link
Copy Markdown

Benchmark results for 65dd51a against 2051676 are in. (These commits have already been benchmarked in a previous command.) No significant results found. @grunweg

  • 🟥 build//instructions: +66.3G (+0.04%)

Small changes (1✅)

  • ✅ build/module/Mathlib.Tactic.GCongr.Core//instructions: -889.3M (-3.86%)

@grunweg

grunweg commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Hm, I'm not sure what to make of the instruction increases. They are not large, but so is the benefit of this PR.

@felixpernegger

Copy link
Copy Markdown
Contributor Author

Hm, I'm not sure what to make of the instruction increases. They are not large, but so is the benefit of this PR.

The way I see it, we definitely wouldn't accept a PR improving instruction increases by adding redundant hypothesis (especially when it is so little). So decreasing these imports is kind of "one and done" thing while the underlying reasons of the instruction increases (probably typeclass inference?) can always be dealt with at a later point.

I can investigate the increase though, probably from Mathlib/Tactic/PNatToNat.lean since this is the only removal which is not at last position.

@felixpernegger

Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar

leanprover-radar commented Jul 24, 2026 •

Copy link
Copy Markdown

Benchmark results for 1e1cad5 against e90415a are in. No significant results found. @felixpernegger

  • 🟥 build//instructions: +52.8G (+0.04%)

Small changes (1✅)

  • ✅ build/module/Mathlib.Tactic.GCongr.Core//instructions: -841.9M (-3.83%)

@thorimur

thorimur commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

If you'd like to grab the three -- for ... annotations for remaining import alls in #42462, I'll be happy to maintainer merge this. :) I think getting rid of import all is important for the hygiene of our import hierarchy, even if it's not a performance boost! :)

@thorimur thorimur added awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip labels Aug 7, 2026
@thorimur

thorimur commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

(I'm not sure if the tech debt label is intended to be bot-only; this PR definitely addresses some of it, though! :) )

@felixpernegger

Copy link
Copy Markdown
Contributor Author

If you'd like to grab the three -- for ... annotations for remaining import alls in #42462, I'll be happy to maintainer merge this. :) I think getting rid of import all is important for the hygiene of our import hierarchy, even if it's not a performance boost! :)

Thanks; :) (sorry I overlooked your message in the other PR)

@felixpernegger

Copy link
Copy Markdown
Contributor Author

(I'm not sure if the tech debt label is intended to be bot-only; this PR definitely addresses some of it, though! :) )

Until recently, the tech debt label had no bot integration at all; so its definitely not bot-only

@felixpernegger

Copy link
Copy Markdown
Contributor Author

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Aug 8, 2026
@grunweg

grunweg commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Thanks! I'll delegate in case there's a CI issue.
bors merge

@grunweg

grunweg commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

bors d+

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Aug 8, 2026
@mathlib-bors

mathlib-bors Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

✌️ felixpernegger can now approve this pull request until 2026-08-22 16:47 UTC (in 2 weeks). To approve and merge, reply with bors r+. More detailed instructions are available here.

⚠️ This delegation only covers changes within Archive/**, Counterexamples/**, docs/**, DownstreamTest/**, Mathlib/**, MathlibTest/**, widget/**, Archive.lean, Counterexamples.lean, docs.lean, Mathlib.lean; an author commit touching anything else will revoke it. Bors also revokes it if a later push changes too many files for it to check the full list — even if it stays within scope.

@mathlib-bors mathlib-bors Bot added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Aug 8, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Aug 8, 2026
Removes `import all` whenever possible. I also tried to "downgrade" by changing to `import` from `import all`, but that never made a difference. Excludes MathlibTest.

For a related PR, see #41222.

Co-authored-by: Batixx <[email protected]>
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Aug 8, 2026
@mathlib-bors

mathlib-bors Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

@mathlib-bors mathlib-bors Bot changed the title chore: reduce import all [Merged by Bors] - chore: reduce import all Aug 8, 2026
@mathlib-bors mathlib-bors Bot closed this Aug 8, 2026
@mathlib-bors mathlib-bors Bot removed the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Aug 8, 2026
attilavjda pushed a commit to attilavjda/mathlib4 that referenced this pull request Sep 5, 2026
Removes `import all` whenever possible. I also tried to "downgrade" by changing to `import` from `import all`, but that never made a difference. Excludes MathlibTest.

For a related PR, see leanprover-community#41222.

Co-authored-by: Batixx <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bors-staging This PR is currently being built by bors on the staging branch. ready-to-merge This PR has been sent to bors. tech debt Fixes cross-cutting technical debt, see the "technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants