Skip to content
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

feat: allow anonymous equality proofs in match expressions #6853

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

jrr6
Copy link
Contributor

@jrr6 jrr6 commented Jan 29, 2025

This PR adds support for anonymous equality proofs in match expressions of the form match _ : e with ....

Closes #6759.

@jrr6 jrr6 added the changelog-language Language features, tactics, and metaprograms label Jan 29, 2025
@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 Jan 29, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jan 29, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Jan 29, 2025
@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Jan 29, 2025
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

@jrr6 jrr6 marked this pull request as ready for review January 29, 2025 18:20
Copy link
Collaborator

@nomeata nomeata left a comment

Choose a reason for hiding this comment

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

LGTM

@jrr6 jrr6 added this pull request to the merge queue Feb 4, 2025
Merged via the queue into leanprover:master with commit 8304bfe Feb 4, 2025
22 checks passed


theorem test_tactic (n : Nat) (h : n - 1 > 2) : n - 1 > 2 := by
match _ : n - 1 with
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this work with ifs? Do they lower to match?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To make sure I understand, are you asking whether Lean supports something like if _ : some_decidable_prop then ... else ...? If so, then yes, this was actually already supported; the purpose of this PR was to provide parity between match and if (see the example in #6759). Regarding whether if elaborates to a match: no, dependent if expressions elaborate to an application of dite, which is defined using the recursor for Decidable directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR 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.

Cannot use hole for context proof in match
4 participants