[Merged by Bors] - style: use cases x with | ... instead of cases x; case => ...#9321
Closed
[Merged by Bors] - style: use cases x with | ... instead of cases x; case => ...#9321
cases x with | ... instead of cases x; case => ...#9321Conversation
Member
|
!bench |
Collaborator
|
Here are the benchmark results for commit 2581c17. |
Member
|
maintainer merge |
|
🚀 Pull request has been placed on the maintainer queue by alexjbest. |
Member
|
Btw, to what extent was this automatically generated? |
Member
Author
|
Not at all, although I did think about ways this kind of thing might be automated in the future. |
urkud
reviewed
Dec 29, 2023
mathlib-bors bot
pushed a commit
that referenced
this pull request
Dec 29, 2023
) This converts usages of the pattern ```lean cases h case inl h' => ... case inr h' => ... ``` which derive from mathported code, to the "structured `cases`" syntax: ```lean cases h with | inl h' => ... | inr h' => ... ``` The case where the subgoals are handled with `·` instead of `case` is more contentious (and much more numerous) so I left those alone. This pattern also appears with `cases'`, `induction`, `induction'`, and `rcases`. Furthermore, there is a similar transformation for `by_cases`: ```lean by_cases h : cond case pos => ... case neg => ... ``` is replaced by: ```lean if h : cond then ... else ... ``` Co-authored-by: Mario Carneiro <di.gama@gmail.com>
Contributor
|
Pull request successfully merged into master. Build succeeded: |
cases x with | ... instead of cases x; case => ...cases x with | ... instead of cases x; case => ...
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 converts usages of the pattern
which derive from mathported code, to the "structured
cases" syntax:cases h with | inl h' => ... | inr h' => ...The case where the subgoals are handled with
·instead ofcaseis more contentious (and much more numerous) so I left those alone. This pattern also appears withcases',induction,induction', andrcases. Furthermore, there is a similar transformation forby_cases:is replaced by: