lean4-htt/tests/lean/run/try_trace1.lean
Leonardo de Moura 64b5bedc8c
feat: try? tactic (#6905)
This PR adds the `try?` tactic. This is the first draft, but it can
already solve examples such as:
```lean
example (e : Expr) : e.simplify.eval σ = e.eval σ := by
  try?
```
in `grind_constProp.lean`. In the example above, it suggests:
```lean
induction e using Expr.simplify.induct <;> grind?
``` 
In the same test file, we have
```lean
example (σ₁ σ₂ : State) : σ₁.join σ₂ ≼ σ₂ := by
  try?
```
and the following suggestion is produced
```lean
induction σ₁, σ₂ using State.join.induct <;> grind? 
```
2025-02-02 06:37:49 +00:00

44 lines
946 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.

set_option grind.warning false
/-- info: Try this: simp -/
#guard_msgs (info) in
example : [1, 2] ≠ [] := by
try?
/-- info: Try this: simp +arith -/
#guard_msgs (info) in
example : 4 + x + y ≥ 1 + x := by
try?
/-- info: Try this: grind? -/
#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 this: grind? [= f] -/
#guard_msgs (info) in
example : f (f 0) > 0 := by
try?
/-- info: Try this: grind? [= 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 this: grind? [= app] -/
#guard_msgs (info) in
example : app [a, b] [c] = [a, b, c] := by
try?
/-- info: Try this: (induction as, bs using app.induct) <;> grind? [= app] -/
#guard_msgs (info) in
example : app (app as bs) cs = app as (app bs cs) := by
try?