lean4-htt/tests/lean/interactive/tacticInduction.lean
Kyle Miller 5d54b0b13f
fix: erroneous "no goals" in empty tactic list in induction/cases and other tactic info improvements (#9553)
This PR fixes a bug introduced in #7830 where if the cursor is at the
indicated position
```lean
example (as bs : List Nat) : (as.append bs).length = as.length + bs.length := by
  induction as with
  | nil => -- cursor
  | cons b bs ih =>
```
then the Infoview would show "no goals" rather than the `nil` goal. The
PR also fixes a separate bug where placing the cursor on the next line
after the `induction`/`cases` tactics like in
```lean
  induction as with
  | nil => sorry
  | cons b bs ih => sorry
  I -- < cursor
```
would report the original goal in the goal list. Furthermore, there are
numerous improvements to error recovery (including `allGoals`-type logic
for pre-tactics) and the visible tactic states when there are errors.
Adds `Tactic.throwOrLogErrorAt`/`Tactic.throwOrLogError` for throwing or
logging errors depending on the recovery state.
2025-07-26 23:15:31 +00:00

19 lines
471 B
Text

/-!
# Interactive tests of the induction tactic
-/
/-!
On an incomplete proof, the goal is visible at least for the first alternative.
-/
example (as bs : List Nat) : (as.append bs).length = as.length + bs.length := by
induction as with
| nil =>
--^ $/lean/plainGoal
| cons b bs ih =>
example (as bs : List Nat) : (as.append bs).length = as.length + bs.length := by
induction as with
| nil => sorry
| cons b bs ih => sorry
--
--^ $/lean/plainGoal