lean4-htt/tests/lean/run/5993.lean
jrr6 23b23c1236
feat: validate, expose names, and add hovers for all suggestion tactics (#7474)
This PR updates `rw?`, `show_term`, and other tactic-suggesting tactics
to suggest `expose_names` when necessary and validate tactics prior to
suggesting them, as `exact?` already did, and it also ensures all such
tactics produce hover info in the messages showing tactic suggestions.

This introduces a breaking change in the `TryThis` API: the `type?`
parameter of `addRewriteSuggestion` is now an `LOption`, not an
`Option`, to obviate the need for a hack we previously used to indicate
that a rewrite closed the goal.

Closes #7350
2025-04-07 01:11:39 +00:00

35 lines
949 B
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.

/-!
# Avoid delaborating with field notation if object is a metavariable application.
https://github.com/leanprover/lean4/issues/5993
-/
set_option pp.mvars false
/-!
No field notation notation here. Used to print `refine ?_.succ` and `refine ?_.snd`.
-/
/--
info: Try this: refine Nat.succ ?_
---
info: found a partial proof, but the corresponding tactic failed:
(expose_names; refine Prod.snd ?_)
It may be possible to correct this proof by adding type annotations, explicitly specifying implicit arguments, or eliminating unnecessary function abstractions.
-/
#guard_msgs in
example : Nat := by
show_term refine Nat.succ ?_
show_term refine Prod.snd (α := Int) ?_
exact default
/-!
No field notation even under binders. (That is, be aware of delayed assignment metavariables.)
-/
/-- info: Try this: refine fun x => Nat.succ ?_ -/
#guard_msgs in
example : Nat → Nat := by
show_term refine fun _ => Nat.succ ?_
exact default