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

108 lines
3.1 KiB
Text
Raw Permalink 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.

module
opaque f [Inhabited α] : αα
theorem feq [Inhabited α] [Add α] [One α] (x : α) : f x = f (f x) + 1 := sorry
opaque g [Inhabited α] : ααα
theorem geq [Inhabited α] (x : α) : g x x = x := sorry
/--
error: `grind` failed
case grind
α : Type u_1
inst : Inhabited α
inst_1 : Add α
inst_2 : One α
x z y : α
h : g y z = z
h_1 : g z y = g y x
h_2 : ¬f x = g x x
⊢ False
[grind] Goal diagnostics
[facts] Asserted facts
[prop] g y z = z
[prop] g z y = g y x
[prop] ¬f x = g x x
[prop] f x = f (f x) + 1
[prop] g x x = x
[prop] f (f x) = f (f (f x)) + 1
[prop] f (f (f x)) = f (f (f (f x))) + 1
[eqc] False propositions
[prop] f x = g x x
[eqc] Equivalence classes
[eqc] {x, g x x}
[eqc] {z, g y z}
[eqc] {f x, f (f x) + 1}
[eqc] {g z y, g y x}
[eqc] {f (f x), f (f (f x)) + 1}
[eqc] {f (f (f x)), f (f (f (f x))) + 1}
[ematch] E-matching patterns
[thm] feq: [@f #4 #3 #0]
[thm] geq: [@g #2 #1 #0 #0]
[limits] Thresholds reached
[limit] maximum term generation has been reached, threshold: `(gen := 3)`
[grind] Diagnostics
[thm] E-Matching instances
[thm] feq ↦ 3
[thm] geq ↦ 1
-/
#guard_msgs (error) in
example [Inhabited α] [Add α] [One α] (x z y : α) : g y z = z → g z y = g y x → f x = g x x := by
grind (gen := 3) [= feq, = geq]
/--
error: `grind` failed
case grind
x z y : Int
h : g y z = z
h_1 : g z y = g y x
h_2 : ¬f (f x) = g x x
⊢ False
[grind] Goal diagnostics
[facts] Asserted facts
[prop] g y z = z
[prop] g z y = g y x
[prop] ¬f (f x) = g x x
[prop] f x + -1 * f (f x) + -1 = 0
[prop] f (f x) + -1 * f (f (f x)) + -1 = 0
[prop] g x x = x
[prop] f (f (f x)) + -1 * f (f (f (f x))) + -1 = 0
[eqc] False propositions
[prop] f (f x) = g x x
[eqc] Equivalence classes
[eqc] {x, g x x}
[eqc] {z, g y z}
[eqc] {0, f x + -1 * f (f x) + -1, f (f x) + -1 * f (f (f x)) + -1, f (f (f x)) + -1 * f (f (f (f x))) + -1}
[eqc] {g z y, g y x}
[eqc] {f x + -1 * f (f x), f (f x) + -1 * f (f (f x)), f (f (f x)) + -1 * f (f (f (f x)))}
[ematch] E-matching patterns
[thm] feq: [@f #4 #3 #0]
[thm] geq: [@g #2 #1 #0 #0]
[cutsat] Assignment satisfying linear constraints
[assign] x := 2
[assign] z := 3
[assign] y := 4
[assign] f x := 1
[assign] f (f x) := 0
[assign] g x x := 2
[assign] g z y := 5
[assign] g y x := 5
[assign] g y z := 3
[assign] f (f (f x)) := -1
[assign] f (f (f (f x))) := -2
[assoc] Operator `HAdd.hAdd`
[basis] Basis
[_] f (f (f x)) + -1 * f (f (f (f x))) = f x + -1 * f (f x)
[_] f (f x) + -1 * f (f (f x)) = f x + -1 * f (f x)
[_] f x + (-1 * f (f x) + -1) = 0
[properties] Properties
[_] commutative
[_] identity: `0`
[limits] Thresholds reached
[limit] maximum term generation has been reached, threshold: `(gen := 2)`
[grind] Diagnostics
[thm] E-Matching instances
[thm] feq ↦ 3
[thm] geq ↦ 1
-/
#guard_msgs (error) in
example (x z y : Int) : g y z = z → g z y = g y x → f (f x) = g x x := by
grind (gen := 2) -ring [= feq, = geq]