This PR ensures `try?` can suggest tactics that need to reference inaccessible local names. Example: ```lean /-- info: Try these: • · expose_names; induction as, bs_1 using app.induct <;> grind [= app] • · expose_names; induction as, bs_1 using app.induct <;> grind only [app] -/ #guard_msgs (info) in example : app (app as bs) cs = app as (app bs cs) := by have bs := 20 -- shadows `bs` in the target try? ```
99 lines
1.9 KiB
Text
99 lines
1.9 KiB
Text
set_option grind.warning false
|
||
|
||
/--
|
||
info: Try these:
|
||
• simp
|
||
• simp only [ne_eq, reduceCtorEq, not_false_eq_true]
|
||
• grind
|
||
• grind only
|
||
-/
|
||
#guard_msgs (info) in
|
||
example : [1, 2] ≠ [] := by
|
||
try?
|
||
|
||
/--
|
||
info: Try these:
|
||
• simp +arith
|
||
• simp +arith only [ge_iff_le]
|
||
• grind
|
||
• grind only
|
||
-/
|
||
#guard_msgs (info) in
|
||
example : 4 + x + y ≥ 1 + x := by
|
||
try?
|
||
|
||
/--
|
||
info: Try these:
|
||
• grind
|
||
• grind only
|
||
-/
|
||
#guard_msgs (info) in
|
||
example (f : Nat → Nat) : f a = b → a = c → f c = b := by
|
||
try?
|
||
|
||
def f : Nat → Nat
|
||
| 0 => 1
|
||
| _ => 2
|
||
|
||
/--
|
||
info: Try these:
|
||
• grind [= f]
|
||
• grind only [f]
|
||
-/
|
||
#guard_msgs (info) in
|
||
example : f (f 0) > 0 := by
|
||
try?
|
||
|
||
/--
|
||
info: Try these:
|
||
• grind [= f.eq_def]
|
||
• grind only [= f.eq_def]
|
||
-/
|
||
#guard_msgs (info) in
|
||
example : f x > 0 := by
|
||
try?
|
||
|
||
def app : List α → List α → List α
|
||
| [], bs => bs
|
||
| a::as, bs => a :: app as bs
|
||
|
||
/--
|
||
info: Try these:
|
||
• rfl
|
||
• grind [= app]
|
||
• grind only [app]
|
||
-/
|
||
#guard_msgs (info) in
|
||
example : app [a, b] [c] = [a, b, c] := by
|
||
try?
|
||
|
||
/--
|
||
info: Try these:
|
||
• (induction as, bs using app.induct) <;> grind [= app]
|
||
• (induction as, bs using app.induct) <;> grind only [app]
|
||
-/
|
||
#guard_msgs (info) in
|
||
example : app (app as bs) cs = app as (app bs cs) := by
|
||
try?
|
||
|
||
/--
|
||
info: Try these:
|
||
• · expose_names; induction as, bs_1 using app.induct <;> grind [= app]
|
||
• · expose_names; induction as, bs_1 using app.induct <;> grind only [app]
|
||
-/
|
||
#guard_msgs (info) in
|
||
example : app (app as bs) cs = app as (app bs cs) := by
|
||
have bs := 20 -- shadow variable in the goal
|
||
try?
|
||
|
||
/--
|
||
info: Try these:
|
||
• · expose_names; induction as, bs using app.induct <;> grind [= app]
|
||
• · expose_names; induction as, bs using app.induct <;> grind only [app]
|
||
-/
|
||
#guard_msgs (info) in
|
||
example : app (app as bs) cs = app as (app bs cs) := by
|
||
revert as bs cs
|
||
intro _ _ _
|
||
-- `as`, `bs`, and `cs` now have inaccessible names.
|
||
try?
|