-
Notifications
You must be signed in to change notification settings - Fork 715
refactor: use match compilation to generate splitter #11220
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PRs lets `realizeConst` use `withDeclNameForAuxNaming` so that auxilary definitions created there get non-clashing names.
Collaborator
Author
|
!radar |
|
Benchmark results for 04c56b3 against ef1dc21 are in! @nomeata Major changes (3)
Minor changes (2)
|
Collaborator
|
Reference manual CI status:
|
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Nov 17, 2025
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Nov 17, 2025
Collaborator
|
Mathlib CI status (docs):
|
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 18, 2025
This PR extracts two modules from `Match.MatchEqs`, in preparation of #11220 and to use the module system to draw clear boundaries between concerns here.
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Nov 18, 2025
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Nov 18, 2025
This PR allows setting reducibilityCoreExt in async contexts (e.g. when using `mkSparseCasesOn` in a realizable definition)
Collaborator
Author
|
!radar |
|
Benchmark results for 9bb4009 against a106ea0 are in! @nomeata Major changes (1)
Minor changes (2)
|
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Nov 21, 2025
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Nov 21, 2025
This PR adds two benchmarks for elaborating match statements of many `Nat` literals, one without and one with splitter generation.
…chim/bench-nat-match
Collaborator
Author
|
!radar |
|
Benchmark results for 4988c6e against dd28f00 are in! @nomeata Major changes (1)
Minor changes (5)
|
…chim/splitter-via-match
Collaborator
Author
|
!radar |
|
Benchmark results for 4988c6e against dd28f00 are in! @nomeata Major changes (1)
Minor changes (5)
|
Collaborator
Author
|
!radar |
|
Benchmark results for 035b886 against e548fa4 are in! @nomeata Major changes (2)
Minor changes (3)
|
nomeata
added a commit
that referenced
this pull request
Dec 4, 2025
This PR avoids generating hyps when not needed (i.e. if there is a catch-all so no completeness checking needed) during matching on values. This tweak was made possible by #11220.
algebraic-dev
pushed a commit
that referenced
this pull request
Dec 8, 2025
This PR changes how match splitters are generated: Rather than rewriting the match statement, the match compilation pipeline is used again. The benefits are: * Re-doing the match compilation means we can do more intelligent book keeping, e.g. prove overlap assumptions only once and re-use the proof, or prune the context of the MVar to speed up `contradiction`. This may have allowed a different solution than #11200. * It would unblock #11105, as the existing splitter implementation would have trouble dealing with the matchers produced that way. * It provides the necessary machinery also for source-exposed “none of the above” bindings, a feature that we probably want at some point (and we mostly need to find good syntax for, see #3136, although maybe I should open a dedicated RFC). * It allows us to skip costly things during matcher creation that would only be useful for the splitter, and thus allows performance improvements like #11508. * We can drop the existing implementation. It’s not entirely free: * We have to run `simpH` twice, once for the match equations and once for the splitter.
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
toolchain-available
A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR changes how match splitters are generated: Rather than rewriting the match statement, the match compilation pipeline is used again.
The benefits are:
Re-doing the match compilation means we can do more intelligent book keeping, e.g. prove overlap assumptions only once and re-use the proof, or prune the context of the MVar to speed up
contradiction. This may have allowed a different solution than perf: use Nat-based bitmask in sparse cases construction #11200.It would unblock feat: experiment: dividing match compilation #11105, as the existing splitter implementation would have trouble dealing with the matchers produced that way.
It provides the necessary machinery also for source-exposed “none of the above” bindings, a feature that we probably want at some point (and we mostly need to find good syntax for, see RFC: Overlapping matches and termination proofs #3136, although maybe I should open a dedicated RFC).
It allows us to skip costly things during matcher creation that would only be useful for the splitter, and thus allows performance improvements like perf: when matching on values, avoid generating hyps when not needed #11508.
We can drop the existing implementation.
It’s not entirely free:
simpHtwice, once for the match equations and once for the splitter.