Skip to content

feat: Meta.letToHave #8373

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

feat: Meta.letToHave #8373

wants to merge 2 commits into from

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented May 16, 2025

This PR adds a module for transforming lets to haves when we can detect that they are not dependent. The transformation is applied to all declarations defined using def/theorem/instance/opaque.

The compiler does not seem to recognize join points that use have instead of let, so there's a hack where lets named __do_jp are preserved. We'll revisit this when the new compiler is in place.

This PR adds a module for transforming `let`s to `have`s when we can detect that they are not dependent. The transformation is applied to all declarations defined using `def`/`theorem`/`instance`/`opaque`.

The compiler does not seem to recognize join points that use `have` instead of `let`, so there's a hack where `let`s named `__do_jp` are preserved. We'll revisit this when the new compiler is in place.
@kmill kmill added the changelog-language Language features, tactics, and metaprograms label May 16, 2025
@kmill kmill requested a review from leodemoura as a code owner May 16, 2025 02:43
@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 16, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request May 16, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request May 16, 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 16, 2025
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 changelog-language Language features, tactics, and metaprograms 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.

2 participants