feat: require indented tactic sequence after top-level by#13217
Closed
feat: require indented tactic sequence after top-level by#13217
by#13217Conversation
a67090f to
52d1286
Compare
Collaborator
|
Reference manual CI status:
|
mathlib-nightly-testing bot
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Mar 31, 2026
mathlib-nightly-testing bot
pushed a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Mar 31, 2026
This PR adds `checkColGtDefault`, a variant of `checkColGt` that defaults to checking against column 0 when no position has been saved via `withPosition`. Previously, `checkColGt` was a no-op at the top level, allowing `by` blocks to have un-indented tactic sequences: ```lean theorem foo (h : True) : True := by exact h -- was accepted, now requires indentation ``` `tacticSeqIndentGt` now uses `checkColGtDefault` instead of `checkColGt`, so `by`, `decreasing_by`, and `·` consistently require indented tactics at all levels. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52d1286 to
4635a66
Compare
|
Mathlib CI status (docs):
|
mathlib-nightly-testing bot
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Mar 31, 2026
mathlib-nightly-testing bot
pushed a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Mar 31, 2026
|
Mathlib CI status (docs):
|
nomeata
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Mar 31, 2026
Adapt to leanprover/lean4#13217 which requires indented tactic sequences after `by` and `decreasing_by`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Mathlib CI status (docs):
|
nomeata
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Mar 31, 2026
Adapt to leanprover/lean4#13217. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Mathlib CI status (docs):
|
nomeata
added a commit
that referenced
this pull request
Apr 1, 2026
…approach) This uses `withPosition commandParser` at the top level to enforce indentation in `by` blocks, combined with an empty-by fallback for better error messages. Compare with checkColPosGt approach in #13217. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
nomeata
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Apr 1, 2026
Adapt to leanprover/lean4#13217 which requires indented tactic sequences after `by` and `decreasing_by`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
nomeata
added a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Apr 1, 2026
Adapt to leanprover/lean4#13217. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
nomeata
added a commit
that referenced
this pull request
Apr 2, 2026
…approach) This uses `withPosition commandParser` at the top level to enforce indentation in `by` blocks, combined with an empty-by fallback for better error messages. Compare with checkColPosGt approach in #13217. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
|
This is not good, but #13229 is promising. |
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 makes two changes to
tacticSeqIndentGt(used byby,decreasing_by,·, andfinally):Strict indentation at the top level. Adds
checkColPosGt, a variant ofcheckColGtthatdefaults to checking against column 0 when no position has been saved via
withPosition.Previously,
checkColGtwas a no-op at the top level, allowingbyblocks to haveun-indented tactic sequences:
Empty tactic sequence fallback. When no appropriately indented content follows,
tacticSeqIndentGtfalls back to an empty tactic sequence (likeby {}) instead of a parseerror. This produces an elaboration error (unsolved goals) rather than a syntax error, which
gives better IDE support (goal display, completions) in incomplete tactic blocks.
This can be subsumed later by a more principled approach of wrapping
topLevelCommandParserFnwith
withPosition(cf. #3215).Related: #3215, #9524. Implements parts of #3555.
🤖 Generated with Claude Code