lean4-htt/tests/lean/run/grind_pp_attr.lean
Leonardo de Moura fbfb0757ca
feat: grind interactive mode basic tactics (#10677)
This PR implements the basic tactics for the new `grind` interactive
mode. While many additional `grind` tactics will be added later, the
foundational framework is already operational. The following `grind`
tactics are currently implemented: `skip`, `done`, `finish`, `lia`, and
`ring`.
This PR also removes the notion of `grind` fallback procedure since it
is subsumed by the new framework. Examples:
```lean
example (x y : Nat) : x ≥ y + 1 → x > 0 := by
  grind => skip; lia; done

open Lean Grind

example [CommRing α] (a b c : α)
  : a + b + c = 3 →
    a^2 + b^2 + c^2 = 5 →
    a^3 + b^3 + c^3 = 7 →
    a^4 + b^4 + c^4 = 9 := by
  grind => ring
```
2025-10-06 01:08:26 +00:00

75 lines
1.1 KiB
Text

module
import Lean.Elab.Command
open Lean Elab Command
def test (stx : Syntax) : CommandElabM Unit := do
let fmt : Option Format := ←
liftCoreM <| PrettyPrinter.ppCategory `command stx
if let some fmt := fmt then
let st := fmt.pretty
dbg_trace st
/--
info: @[grind =]
example :=
0
-/
#guard_msgs in
run_cmd test (← `(@[grind =] example := 0))
/--
info: @[grind _=_]
example :=
0
-/
#guard_msgs in
run_cmd test (← `(@[grind _=_] example := 0))
/--
info: @[grind =_]
example :=
0
-/
#guard_msgs in
run_cmd test (← `(@[grind =_] example := 0))
/--
info: @[grind →]
example :=
0
-/
#guard_msgs in
run_cmd test (← `(@[grind →] example := 0))
/--
info: @[grind ←]
example :=
0
-/
#guard_msgs in
run_cmd test (← `(@[grind ←] example := 0))
/--
info: @[grind ←=]
example :=
0
-/
#guard_msgs in
run_cmd test (← `(@[grind ←=] example := 0))
/--
info: @[grind]
example :=
0
-/
#guard_msgs in
run_cmd test (← `(@[grind] example := 0))
/--
info: @[grind ← gen]
example :=
0
-/
#guard_msgs in
run_cmd test (← `(@[grind ← gen] example := 0))