lean4-htt/tests/elab/grind_params.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

80 lines
1.7 KiB
Text

module
def foo (x : Nat) := x + 2
example (f : Nat → Nat) : f (foo a) = b → f (c + 1) = d → c = a + 1 → b = d := by
grind [foo]
opaque bla : Nat → Nat
theorem blathm : bla (bla x) = bla x := sorry
example : bla (foo a) = b → bla b = bla (a + 2) := by
grind [foo, blathm]
example : bla (foo a) = b → bla b = bla (a + 2) := by
grind [foo, = blathm]
/--
error: invalid `grind` forward theorem, theorem `blathm` does not have propositional hypotheses
-/
#guard_msgs (error) in
example : bla (foo a) = b → bla b = bla (a + 2) := by
grind [foo, → blathm]
public opaque P : Nat → Prop
public opaque Q : Nat → Prop
opaque R : Nat → Prop
public theorem pq : P x → Q x := sorry
theorem qr : Q x → R x := sorry
example : P x → R x := by
grind [→ pq, → qr]
/--
error: `grind` failed
case grind
x : Nat
h : P x
h_1 : ¬R x
⊢ False
[grind] Goal diagnostics
[facts] Asserted facts
[prop] P x
[prop] ¬R x
[eqc] True propositions
[prop] P x
[eqc] False propositions
[prop] R x
[ematch] E-matching patterns
[thm] pq: [Q #1]
[thm] qr: [Q #1]
-/
#guard_msgs (error) in
example : P x → R x := by
grind [← pq, → qr]
example : P x → R x := by
grind [← pq, ← qr]
attribute [grind] blathm
example : bla (bla (bla (bla x))) = bla x := by
grind
example : bla (bla (bla (bla x))) = bla x := by
fail_if_success grind [-blathm]
sorry
example : bla (bla (bla (bla x))) = bla x := by
grind only [blathm]
example : bla (bla (bla (bla x))) = bla x := by
fail_if_success grind only
sorry
/--
error: `pq` is not marked with the `[grind]` attribute
-/
#guard_msgs (error) in
example : P x → R x := by
grind [-pq]