Skip to content

[Merged by Bors] - refactor: don't expose definitions of immersions#39002

Closed
grunweg wants to merge 4 commits intoleanprover-community:masterfrom
grunweg:immersions-noexpose
Closed

[Merged by Bors] - refactor: don't expose definitions of immersions#39002
grunweg wants to merge 4 commits intoleanprover-community:masterfrom
grunweg:immersions-noexpose

Conversation

@grunweg
Copy link
Copy Markdown
Contributor

@grunweg grunweg commented May 6, 2026

Instead of using an irreducible_def, make it an unexposed definition. This has the same effect in other modules,
but leads to much shorter code as we can remove all rw [foo_def] for the immersion definitions.
It also allows removing the @[expose] section from the file (which is nice).

There is a small downside: in downstream projects not using the module system, the definition of immersions
will be unfolded now. At this point, this is a mostly hypothetical risk (and weighs lower than the real benefits of this change). The discussion leading to this change did not have substantial evidence either.

Inspired by the discussion in #35122.


Open in Gitpod

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

✅ PR Title Formatted Correctly

The title of this PR has been updated to match our commit style conventions.
Thank you!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

PR summary dd8018895f

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ IsImmersionAt
+ IsImmersionAtOfComplement
+ instance (h : IsImmersionAt I J n f x) : NormedAddCommGroup h.complement
+ instance (h : IsImmersionAt I J n f x) : NormedSpace 𝕜 h.complement
- instance (h : IsImmersionAt I J n f x) : NormedAddCommGroup h.complement := by
- instance (h : IsImmersionAt I J n f x) : NormedSpace 𝕜 h.complement := by

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.


No changes to strong technical debt.
No changes to weak technical debt.

Copy link
Copy Markdown
Member

@chrisflav chrisflav left a comment

Choose a reason for hiding this comment

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

I think this is much better and more user friendly. I don't think the risk "downstream users now get to see the definition" is very big (I personally don't even think that this specific definition is so bad that it needs to be hidden). Long term, I would hope (/ expect) that every Lean project uses the module system by default.

@grunweg grunweg changed the title RFC: don't expose definitions of immersions refactor: don't expose definitions of immersions May 7, 2026
@grunweg
Copy link
Copy Markdown
Contributor Author

grunweg commented May 7, 2026

I agree, and have thus turned this into a proper PR.

Copy link
Copy Markdown
Member

@chrisflav chrisflav left a comment

Choose a reason for hiding this comment

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

Thanks!
maintainer merge

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

🚀 Pull request has been placed on the maintainer queue by chrisflav.

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label May 7, 2026
@ocfnash
Copy link
Copy Markdown
Contributor

ocfnash commented May 7, 2026

Thanks, I agree this is much better.

bors merge

@mathlib-triage mathlib-triage Bot added ready-to-merge This PR has been sent to bors. and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels May 7, 2026
mathlib-bors Bot pushed a commit that referenced this pull request May 7, 2026
Instead of using an `irreducible_def`, make it an unexposed definition. This has the same effect in other modules,
but leads to much shorter code as we can remove all `rw [foo_def]` for the immersion definitions.
It also allows removing the `@[expose]` section from the file (which is nice).

There is a small downside: in downstream projects not using the module system, the definition of immersions
will be unfolded now. At this point, this is a mostly hypothetical risk (and weighs lower than the real benefits of this change). The [discussion](#28793 (comment)) leading to this change did not have substantial evidence either.

Inspired by the discussion in #35122.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors Bot commented May 7, 2026

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title refactor: don't expose definitions of immersions [Merged by Bors] - refactor: don't expose definitions of immersions May 7, 2026
@mathlib-bors mathlib-bors Bot closed this May 7, 2026
@grunweg grunweg deleted the immersions-noexpose branch May 7, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors. t-differential-geometry Manifolds etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants