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

27 lines
999 B
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.

module
public section
class Shelf (α : Type u) where
act : ααα
self_distrib : ∀ {x y z : α}, act x (act y z) = act (act x y) (act x z)
class UnitalShelf (α : Type u) extends Shelf α, One α where
one_act : ∀ a : α, act 1 a = a
act_one : ∀ a : α, act a 1 = a
infixr:65 " ◃ " => Shelf.act
-- Mathlib proof from UnitalShelf.act_act_self_eq
example {S} [UnitalShelf S] (x y : S) : (x ◃ y) ◃ x = x ◃ y := by
have h : (x ◃ y) ◃ x = (x ◃ y) ◃ (x ◃ 1) := by rw [UnitalShelf.act_one]
rw [h, ← Shelf.self_distrib, UnitalShelf.act_one]
attribute [grind =] UnitalShelf.one_act UnitalShelf.act_one
-- We actually want the reverse direction of `Shelf.self_distrib`, so don't use the `grind_eq` attribute.
grind_pattern Shelf.self_distrib => self.act (self.act x y) (self.act x z)
-- Proof using `grind`:
example {S} [UnitalShelf S] (x y : S) : (x ◃ y) ◃ x = x ◃ y := by
have h : (x ◃ y) ◃ x = (x ◃ y) ◃ (x ◃ 1) := by grind
grind