Skip to content

feat: do not export private declarations #8337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Kha
Copy link
Member

@Kha Kha commented May 14, 2025

This PR adjusts the experimental module system to not export any private declarations from modules.

Fixes #5002

@Kha
Copy link
Member Author

Kha commented May 14, 2025

!bench

@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label May 14, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request May 14, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request May 14, 2025
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

@leanprover-community-bot leanprover-community-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label May 14, 2025
@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit 58edbda.
There were significant changes against commit 29cc755:

  Benchmark                   Metric                 Change
  ====================================================================
+ Init size                   bytes .olean            -9.1%
- Init size                   bytes .olean.private     4.8%
+ bv_decide_inequality.lean   task-clock              -6.2%  (-21.5 σ)
+ bv_decide_inequality.lean   wall-clock              -5.9%  (-24.0 σ)
+ import Lean                 branches                -3.3%  (-89.9 σ)
+ import Lean                 instructions            -3.6%  (-89.3 σ)
+ import Lean                 maxrss                  -1.3%  (-77.5 σ)
+ import Lean                 task-clock             -10.9%  (-25.8 σ)
+ import Lean                 wall-clock             -10.9%  (-25.3 σ)
+ lake build clean            instructions            -1.1%  (-23.9 σ)
+ lake build clean            task-clock              -4.7%  (-43.0 σ)
+ lake build clean            wall-clock              -3.6%  (-21.7 σ)
+ lake config elab            instructions            -1.2%  (-76.1 σ)
+ lake config elab            maxrss                  -1.2%  (-29.2 σ)
+ lake config import          instructions            -2.5% (-192.3 σ)
+ lake config import          maxrss                  -2.5% (-143.3 σ)
+ lake config tree            instructions            -2.4%  (-34.8 σ)
+ lake config tree            maxrss                  -2.5%  (-47.9 σ)
+ lake env                    instructions            -2.5% (-124.2 σ)
+ lake env                    maxrss                  -2.5%  (-72.8 σ)
+ language server startup     branches                -1.3%  (-36.2 σ)
+ language server startup     instructions            -1.4%  (-32.5 σ)
- nat_repr                    branches                 1.4%  (247.0 σ)
- nat_repr                    instructions             1.4%  (194.8 σ)
+ stdlib                      maxrss                  -1.6% (-172.3 σ)
+ stdlib                      wall-clock              -2.5%  (-37.1 σ)
- stdlib size                 bytes .olean.private     4.8%
+ workspaceSymbols            maxrss                  -1.6%  (-25.2 σ)

@@ -90,7 +92,7 @@ structure Thunk (α : Type u) : Type u where
-/
mk ::
/-- Extract the getter function out of a thunk. Use `Thunk.get` instead. -/
private fn : Unit → α
fn : Unit → α

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Thunk.fn is public now, maybe add

@[inline] def Thunk.fnImpl (x : Thunk α) : Unit → α := fun _ => x.get
@[csimp] theorem Thunk.fn_eq_fnImpl : @Thunk.fn = @Thunk.fnImpl := rfl

@Kha Kha force-pushed the push-yrmrrukrkmkq branch 3 times, most recently from 6b7010f to 44c0b77 Compare May 16, 2025 08:41
@Kha Kha force-pushed the push-yrmrrukrkmkq branch from 44c0b77 to 2f371ff Compare May 16, 2025 09:08
@Kha Kha force-pushed the push-yrmrrukrkmkq branch from 2f371ff to 6886d98 Compare May 16, 2025 09:45
@Kha
Copy link
Member Author

Kha commented May 16, 2025

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit 6886d98.
There were significant changes against commit 528fe0b:

  Benchmark     Metric                 Change
  ===========================================
+ Init size     bytes .olean.private    -2.4%
+ stdlib size   bytes .olean.private    -2.4%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lemmas about private defs are not private by default
4 participants