Different structures:
x * (y * z) = (x * y) * zx * 1 = x ∧ 1 * x = xx * x⁻¹ = 1 ∧ x⁻¹ * x = 1These are type classes in Lean.
We can define our own type, integers modulo 2, and register it as an additive group:
inductive my_int : Type
| zero
| one
def my_int.add : my_int → my_int → my_int
| my_int.zero a := a
| a my_int.zero := a
| my_int.one my_int.one := my_int.zero
@[instance] def my_int.add_group : add_group my_int :=
{ add := my_int.add,
add_assoc :=
by intros a b c; cases' a; cases' b; cases' c; refl,
zero := my_int.zero,
zero_add := by intro a; cases' a; refl,
add_zero := by intro a; cases' a; refl,
neg := λa, a,
add_left_neg := by intro a; cases' a; refl }
For finite collections of elements, available structures:
dec_trivial is a lemma you can use for trivial decidable goals (i.e. if there are no variables in the expression).
For example (Ν, ≤) or (set Ν, ⊆).
x ≤ x), transitivity (x ≤ y → y ≤ z → x ≤ z)x ≤ y → y ≤ x → x = y)x ≤ y ∨ y ≤ x