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? ```
44 lines
946 B
Text
44 lines
946 B
Text
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?
|