lean4-htt/tests/lean/run/grind_eq_bwd.lean
Joachim Breitner 0e49576fe4
feat: guard_msgs to treat trace messages separate (#8267)
This PR makes `#guard_msgs` to treat `trace` messages separate from
`info`, `warning` and `error`. It also introduce the ability to say
`#guard_msgs (pass info`, like `(drop info)` so far, and also adds
`(check info)` as the explicit form of `(info)`, for completeness.

Fixes #8266
2025-05-09 05:44:34 +00:00

63 lines
1.5 KiB
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
theorem dummy (x : Nat) : x = x :=
rfl
/--
error: invalid pattern for `dummy`
[@Lean.Grind.eqBwdPattern `[Nat] #0 #0]
the pattern does not contain constant symbols for indexing
-/
#guard_msgs in
attribute [grind ←=] dummy
def α : Type := sorry
def inv : αα := sorry
def mul : ααα := sorry
def one : α := sorry
theorem inv_eq {a b : α} (w : mul a b = one) : inv a = b := sorry
/--
trace: [grind.ematch.pattern] inv_eq: [@Lean.Grind.eqBwdPattern `[α] (inv #2) #1]
-/
#guard_msgs in
set_option trace.grind.ematch.pattern true in
attribute [grind ←=] inv_eq
example {a b : α} (w : mul a b = one) : inv a = b := by
grind
example {a b : α} (w : mul a b = one) : inv a = b := by
grind only [<-= inv_eq]
structure S where
f : Bool → α
h : mul (f true) (f false) = one
h' : mul (f false) (f true) = one
attribute [grind =] S.h S.h'
example (s : S) : inv (s.f true) = s.f false := by
grind
example (s : S) : inv (s.f true) = s.f false := by
grind only [<-= inv_eq, = S.h]
example (s : S) : s.f false = inv (s.f true) := by
grind
example (s : S) : a = false → s.f a = inv (s.f true) := by
grind
example (s : S) : a ≠ s.f false → a = inv (s.f true) → False := by
grind
/--
trace: [grind.ematch.instance] inv_eq: mul (s.f true) (s.f false) = one → inv (s.f true) = s.f false
[grind.ematch.instance] S.h: mul (s.f true) (s.f false) = one
-/
#guard_msgs (trace) in
set_option trace.grind.ematch.instance true in
example (s : S) : inv (s.f true) = s.f false := by
grind