lean4-htt/tests/lean/interactive/plainGoal.lean
Kyle Miller af5322c7ef
feat: tactic info per intro hypothesis, rfl pattern (#9942)
This PR modifies `intro` to create tactic info localized to each
hypothesis, making it possible to see how `intro` works
variable-by-variable. Additionally:
- The tactic supports `intro rfl` to introduce an equality and
immediately substitute it, like `rintro rfl` (recall: the `rfl` pattern
is like doing `intro h; subst h`). The `rintro` tactic can also now
support `HEq` in `rfl` patterns if `eq_of_heq` applies.
- In `intro (h : t)`, elaboration of `t` is interleaved with unification
with the type of `h`, which prevents default instances from causing
unification to fail.
- Tactics that change types of hypotheses (including `intro (h : t)`,
`delta`, `dsimp`) now update the local instance cache.

In `intro x y z`, tactic info ranges are `intro x`, `y`, and `z`. The
reason for including `intro` with `x` is to make sure the info range is
"monotonic" while adding the first argument to `intro`.
2025-08-18 13:55:06 +00:00

150 lines
3.3 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

example : αα := by
--^ $/lean/plainGoal
--^ $/lean/plainGoal
intro a
--^ $/lean/plainGoal
--^ $/lean/plainGoal
--v $/lean/plainGoal
focus
apply a
example : αα := by
--^ $/lean/plainGoal
example : 0 + n = n := by
induction n with
| zero => simp; simp
--^ $/lean/plainGoal
| succ
--^ $/lean/plainGoal
example : αα := by
intro a; apply a
--^ $/lean/plainGoal
--^ $/lean/plainGoal
--^ $/lean/plainGoal
example (h1 : n = m) (h2 : m = 0) : 0 = n := by
rw [h1, h2]
--^ $/lean/plainGoal
--^ $/lean/plainGoal
--^ $/lean/plainGoal
example : 0 + n = n := by
induction n
focus
--^ $/lean/plainGoal
rfl
-- TODO: goal state after dedent
example : 0 + n = n := by
induction n
--^ $/lean/plainGoal
example : 0 + n = n := by
cases n
--^ $/lean/plainGoal
example : ∀ a b : Nat, a = b := by
intro a b
--^ $/lean/plainGoal
--^ $/lean/plainGoal
example : αα := (by
--^ $/lean/plainGoal
example (p : α → Prop) (a b : α) [DecidablePred p] (h : ∀ {p} [DecidablePred p], p a → p b) : p b := by
apply h _
--^ $/lean/plainGoal
-- should not display solved goal `⊢ DecidablePred p`
example : True ∧ False := by
constructor
{ constructor }
--^ $/lean/plainGoal
{ }
--^ $/lean/plainGoal
example : True ∧ False := by
constructor
· constructor
--^ $/lean/plainGoal
·
--^ $/lean/plainGoal
theorem left_distrib (t a b : Nat) : t * (a + b) = t * a + t * b := by
induction b
next => simp
next =>
rw [Nat.add_succ]
repeat (rw [Nat.mul_succ])
--^ $/lean/plainGoal
example (as bs cs : List α) : (as ++ bs) ++ cs = as ++ (bs ++ cs) := by
induction as <;> skip <;> (try rename_i h; simp[h]) <;> rfl
--^ $/lean/plainGoal
--^ $/lean/plainGoal
example : True := (by exact True.intro)
--^ $/lean/plainGoal
example : True := (by exact True.intro )
--^ $/lean/plainGoal
example : True ∧ False := by
· constructor; constructor
--^ $/lean/plainGoal
example : True = True := by
conv =>
--^ $/lean/plainGoal
whnf
--^ $/lean/plainGoal
--
--^ $/lean/plainGoal
example : True := by
have : True := by
-- type here
--^ $/lean/plainGoal
-- no `this` here either, but seems okay
--^ $/lean/plainGoal
example : True := by
have : True := by
-- type here
--^ $/lean/plainGoal
apply this
--^ $/lean/plainGoal
-- note: no output here at all because of parse error
example : False := by
-- EOF test
--^ $/lean/plainGoal
example (hp : p) (hq : q) : p ∧ q := by
suffices q ∧ p by
--^ $/lean/plainGoal
example (hp : p) (hq : q) : p ∧ q :=
show id (p ∧ q) by
--^ $/lean/plainGoal
example : True ∧ False := by
constructor
· --
--^ $/lean/plainGoal
--^ $/lean/plainGoal
section
example : True := by induction 1 with
--^ $/lean/plainGoal
example : True := by induction 1 with |
--^ $/lean/plainGoal
example : True := by induction 1 with done
--^ $/lean/plainGoal
end