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

48 lines
1.6 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.

class OpAssoc (op : ααα) : Prop where
protected op_assoc (x y z) : op (op x y) z = op x (op y z)
abbrev op_assoc (op : ααα) [self : OpAssoc op] := self.op_assoc
structure SemigroupSig (α) where
op : ααα
structure SemiringSig (α) where
add : ααα
mul : ααα
def SemiringSig.toAddSemigroupSig (s : SemiringSig α) : SemigroupSig α where
op := s.add
def SemiringSig.toMulSemigroupSig (s : SemiringSig α) : SemigroupSig α where
op := s.mul
unif_hint (s : SemiringSig α) (t : SemigroupSig α) where
t =?= s.toAddSemigroupSig ⊢ t.op =?= s.add
unif_hint (s : SemiringSig α) (t : SemigroupSig α) where
t =?= s.toMulSemigroupSig ⊢ t.op =?= s.mul
class Semigroup (s : SemigroupSig α) : Prop where
protected op_assoc (x y z) : s.op (s.op x y) z = s.op x (s.op y z)
instance Semirgoup.toOpAssoc (s : SemigroupSig α) [Semigroup s] : OpAssoc (no_index s.op) := ⟨Semigroup.op_assoc⟩
class Semiring (s : SemiringSig α) : Prop where
protected add_assoc (x y z) : s.add (s.add x y) z = s.add x (s.add y z)
protected mul_assoc (x y z) : s.mul (s.mul x y) z = s.mul x (s.mul y z)
instance Semiring.toAddSemigroup (s : SemiringSig α) [Semiring s] : Semigroup (no_index s.toAddSemigroupSig) where
op_assoc := Semiring.add_assoc
instance Semiring.toMulSemigroup (s : SemiringSig α) [Semiring s] : Semigroup (no_index s.toMulSemigroupSig) where
op_assoc := Semiring.mul_assoc
section Test
variable (s : SemiringSig α) [Semiring s]
local infix:70 " ⋆ " => s.mul
example (w x y z : α) : (w ⋆ x) ⋆ (y ⋆ z) = w ⋆ ((x ⋆ y) ⋆ z) := by
repeat rw [op_assoc (.⋆.)]
end Test