Indentation sensitivity for trailing notations & block structuring tactic#460
Closed
Kha wants to merge 4 commits intoleanprover:masterfrom
Closed
Indentation sensitivity for trailing notations & block structuring tactic#460Kha wants to merge 4 commits intoleanprover:masterfrom
Kha wants to merge 4 commits intoleanprover:masterfrom
Conversation
Co-authored-by: Mario Caneiro <di.gama@gmail.com>
ChrisHughes24
pushed a commit
to ChrisHughes24/lean4
that referenced
this pull request
Dec 2, 2022
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>
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 PR solves #451 by demanding that trailing parsers are indented more than the surrounding
withPositioncall (if any). This mostly affectsdoblocks and tactics (where it enables a proper implementation of-tactic blocks). In particular, the only affected code in the stdlib (no regressions in the tests) is code of the formdo a <|> bor
do a <|> bI believe that breaking such code is justified: in my opinion, the "signal" for continuing an action over multiple lines comes "too late/weak" in this style. It should either be part of the first line, or clearly marked via indentation:
do a <|> bor
do a <|> bThe new rule accepts both of these styles, and for experimentation I've used both to fix the stdlib.
Now, for the sake of completeness I should mention that there is an alternative solution to #451 that does not break the above code but requires changes in tactic syntax declarations: if we change any declaration
to
then it should be sufficient to demand that trailing parsers are at least as instead of more indented (i.e.
checkColGeinstead ofcheckColGt): code such aswould then be parsed as two tactics because the
-is not as indented asAnd.intro. The obvious problem with this solution is that all tactic writers will have to be aware of this issue.