lean4-htt/tests/elab/grind_erase_attr.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

78 lines
1.3 KiB
Text

module
public section
opaque f : Nat → Nat
@[grind] theorem fthm : f (f x) = f x := sorry
theorem fthm' : f (f x) = x := sorry
/--
error: `fthm'` is not marked with the `[grind]` attribute
-/
#guard_msgs in
attribute [-grind] fthm'
set_option trace.grind.assert true
/--
trace: [grind.assert] ¬f (f (f a)) = f a
[grind.assert] f (f a) = f a
-/
#guard_msgs (trace) in
example : f (f (f a)) = f a := by
grind
attribute [-grind] fthm
/--
error: unsolved goals
a : Nat
⊢ f (f (f a)) = f a
---
trace: [grind.assert] ¬f (f (f a)) = f a
-/
#guard_msgs (trace, error) in
example : f (f (f a)) = f a := by
fail_if_success grind
/--
error: `fthm` is not marked with the `[grind]` attribute
-/
#guard_msgs in
attribute [-grind] fthm
attribute [grind] fthm
example : f (f (f a)) = f a := by
grind
def g (x : Nat) :=
match x with
| 0 => 1
| x+1 => 2 * g x
attribute [grind] g
example : g a = b → a = 0 → b = 1 := by
grind
attribute [-grind] g
/--
error: unsolved goals
a b : Nat
⊢ g a = b → a = 0 → b = 1
---
trace: [grind.assert] g a = b
[grind.assert] a = 0
[grind.assert] ¬b = 1
-/
#guard_msgs (trace, error) in
example : g a = b → a = 0 → b = 1 := by
fail_if_success grind
/--
error: `g` is not marked with the `[grind]` attribute
-/
#guard_msgs in
attribute [-grind] g