This PR wraps the top-level command parser with `withPosition` to enforce indentation in `by` blocks, combined with an empty-by fallback for better error messages. This subsumes #3215 (which introduced `withPosition commandParser` but without the empty-by fallback). It is also related to #9524, which explores elaboration with empty tactic sequences — this PR reuses that idea for the empty-by fallback, so that a `by` not followed by an indented tactic produces an elaboration error (unsolved goals) rather than a parse error. **Changes:** - `topLevelCommandParserFn` now uses `(withPosition commandParser).fn`, setting the saved position at the start of each top-level command - `tacticSeqIndentGt` gains an empty tactic sequence fallback (`pushNone`) so that missing indentation produces an elaboration error (unsolved goals) instead of a parse error - `isEmptyBy` in `goalsAt?` removed: with strict `by` indentation, empty `by` blocks parse successfully via `pushNone` (producing empty nodes) rather than producing `.missing` syntax, making the `isEmptyBy` check dead code. The `isEmpty` helper in `isSyntheticTacticCompletion` continues to work correctly because it handles both `.missing` and empty nodes from `pushNone` (via the vacuously-true `args.all isEmpty` on `#[]`) - Test files updated to indent `by` blocks and expression continuations that were previously at column 0 **Behavior:** - Top-level `by` blocks now require indentation (column > 0 for commands at column 0) - Commands indented inside `section` require proofs to be indented past the command's column - `#guard_msgs in example : True := by` works because tactic indentation is checked against the outermost command's column - Expression continuations (not just `by`) must also be indented past the command, which is slightly more strict but more consistent - `have : True := by` followed by a dedent now correctly puts `this` in scope in the outer tactic block (the `have` is structurally complete with an unsolved-goal error, rather than a parse error) **Code changes observed in practice (lean4 test suite + Mathlib):** - `by` blocks: top-level `theorem ... := by` / `decreasing_by` followed by tactics at column 0 must be indented - `variable` continuations: `variable {A : Type*} [Foo A]\n{B : Type*}` where the second line starts at column 0 must be indented (most common category in Mathlib) - Expression continuations: `def f : T :=\nexpr` or `#synth Foo\n[args]` where the body/arguments start at column 0 - Structure literals: `.symm\n{ toFun := ...` where the struct literal starts at column 0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
58 lines
2.3 KiB
Text
58 lines
2.3 KiB
Text
grind_cutsat_tests.lean:11:2-11:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:28:0-28:7: warning: declaration uses `sorry`
|
|
grind_cutsat_tests.lean:41:2-41:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:51:2-51:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:59:2-59:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:66:2-66:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:71:2-71:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:79:2-79:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:87:2-87:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:96:2-96:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:104:2-104:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:110:2-110:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:117:2-117:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:124:2-124:8: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:126:37-126:43: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:127:36-127:42: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:128:37-128:43: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:129:36-129:42: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:130:39-130:45: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|
|
grind_cutsat_tests.lean:131:37-131:43: warning: `cutsat` has been deprecated, use `lia` instead
|
|
Try this:
|
|
[apply] lia
|