Typeclasses for (semi)groups and monoids #
In this file we define typeclasses for algebraic structures with one binary operation.
The classes are named (add_)?(comm_)?(semigroup|monoid|group)
, where add_
means that
the class uses additive notation and comm_
means that the class assumes that the binary
operation is commutative.
The file does not contain any lemmas except for
- axioms of typeclasses restated in the root namespace;
- lemmas required for instances.
For basic lemmas about these classes see algebra.group.basic
.
We also introduce notation classes has_scalar
and has_vadd
for multiplicative and additive
actions and register the following instances:
has_pow M ℕ
, for monoidsM
, andhas_pow G ℤ
for groupsG
;has_scalar ℕ M
for additive monoidsM
, andhas_scalar ℤ G
for additive groupsG
.
Notation #
+
,-
,*
,/
,^
: the usual arithmetic operations; the underlying functions arehas_add.add
,has_neg.neg
/has_sub.sub
,has_mul.mul
,has_div.div
, andhas_pow.pow
.a • b
is used as notation forhas_scalar.smul a b
.a +ᵥ b
is used as notation forhas_vadd.vadd a b
.
- vadd : G → P → P
Type class for the +ᵥ
notation.
- smul : M → α → α
Typeclass for types with a scalar multiplication operation, denoted •
(\bu
)
Instances
- algebra.to_has_scalar
- mul_action.to_has_scalar
- smul_with_zero.to_has_scalar
- has_mul.to_has_scalar
- add_monoid.has_scalar_nat
- sub_neg_monoid.has_scalar_int
- mul_opposite.has_scalar
- has_mul.to_has_opposite_scalar
- units.has_scalar
- pi.has_scalar
- pi.has_scalar'
- prod.has_scalar
- add_con.quotient.has_nsmul
- add_con.quotient.has_zsmul
- linear_map.has_scalar
- sub_mul_action.has_scalar
- sub_mul_action.has_scalar'
- submodule.has_scalar
- punit.has_scalar
- dfinsupp.has_scalar
- finsupp.has_scalar
- set.has_scalar_set
- set.has_scalar
A semigroup is a type with an associative (*)
.
Instances
- comm_semigroup.to_semigroup
- left_cancel_semigroup.to_semigroup
- right_cancel_semigroup.to_semigroup
- monoid.to_semigroup
- semigroup_with_zero.to_semigroup
- multiplicative.semigroup
- mul_opposite.semigroup
- prod.semigroup
- nat.semigroup
- pi.semigroup
- int.semigroup
- rat.semigroup
- real.semigroup
- con.semigroup
- set.semigroup
An additive semigroup is a type with an associative (+)
.
Instances
- add_comm_semigroup.to_add_semigroup
- add_left_cancel_semigroup.to_add_semigroup
- add_right_cancel_semigroup.to_add_semigroup
- add_monoid.to_add_semigroup
- additive.add_semigroup
- mul_opposite.add_semigroup
- prod.add_semigroup
- with_top.add_semigroup
- with_bot.add_semigroup
- nat.add_semigroup
- pi.add_semigroup
- int.add_semigroup
- rat.add_semigroup
- real.add_semigroup
- add_con.add_semigroup
- set.add_semigroup
- add : G → G → G
- add_assoc : ∀ (a b c : G), a + b + c = a + (b + c)
- add_comm : ∀ (a b : G), a + b = b + a
A commutative additive semigroup is a type with an associative commutative (+)
.
Instances
- add_comm_monoid.to_add_comm_semigroup
- additive.add_comm_semigroup
- mul_opposite.add_comm_semigroup
- prod.add_comm_semigroup
- with_top.add_comm_semigroup
- with_bot.add_comm_semigroup
- nat.add_comm_semigroup
- pi.add_comm_semigroup
- int.add_comm_semigroup
- pnat.add_comm_semigroup
- rat.add_comm_semigroup
- real.add_comm_semigroup
- add_con.add_comm_semigroup
Typeclass for expressing that a type M
with multiplication and a one satisfies
1 * a = a
and a * 1 = a
for all a : M
.
Typeclass for expressing that a type M
with addition and a zero satisfies
0 + a = a
and a + 0 = a
for all a : M
.
Design note on add_monoid
and monoid
#
An add_monoid
has a natural ℕ
-action, defined by n • a = a + ... + a
, that we want to declare
as an instance as it makes it possible to use the language of linear algebra. However, there are
often other natural ℕ
-actions. For instance, for any semiring R
, the space of polynomials
polynomial R
has a natural R
-action defined by multiplication on the coefficients. This means
that polynomial ℕ
would have two natural ℕ
-actions, which are equal but not defeq. The same
goes for linear maps, tensor products, and so on (and even for ℕ
itself).
To solve this issue, we embed an ℕ
-action in the definition of an add_monoid
(which is by
default equal to the naive action a + ... + a
, but can be adjusted when needed), and declare
a has_scalar ℕ α
instance using this action. See Note [forgetful inheritance] for more
explanations on this pattern.
For example, when we define polynomial R
, then we declare the ℕ
-action to be by multiplication
on each coefficient (using the ℕ
-action on R
that comes from the fact that R
is
an add_monoid
). In this way, the two natural has_scalar ℕ (polynomial ℕ)
instances are defeq.
The tactic to_additive
transfers definitions and results from multiplicative monoids to additive
monoids. To work, it has to map fields to fields. This means that we should also add corresponding
fields to the multiplicative structure monoid
, which could solve defeq problems for powers if
needed. These problems do not come up in practice, so most of the time we will not need to adjust
the npow
field when defining multiplicative objects.
A basic theory for the power function on monoids and the ℕ
-action on additive monoids is built in
the file algebra.group_power.basic
. For now, we only register the most basic properties that we
need right away.
In the definition, we use n.succ
instead of n + 1
in the nsmul_succ'
and npow_succ'
fields
to make sure that to_additive
is not confused (otherwise, it would try to convert 1 : ℕ
to 0 : ℕ
).
- add : M → M → M
- add_assoc : ∀ (a b c : M), a + b + c = a + (b + c)
- zero : M
- zero_add : ∀ (a : M), 0 + a = a
- add_zero : ∀ (a : M), a + 0 = a
- nsmul : ℕ → M → M
- nsmul_zero' : (∀ (x : M), add_monoid.nsmul 0 x = 0) . "try_refl_tac"
- nsmul_succ' : (∀ (n : ℕ) (x : M), add_monoid.nsmul n.succ x = x + add_monoid.nsmul n x) . "try_refl_tac"
An add_monoid
is an add_semigroup
with an element 0
such that 0 + a = a + 0 = a
.
Instances
- add_comm_monoid.to_add_monoid
- add_left_cancel_monoid.to_add_monoid
- add_right_cancel_monoid.to_add_monoid
- sub_neg_monoid.to_add_monoid
- with_zero.add_monoid
- additive.add_monoid
- mul_opposite.add_monoid
- prod.add_monoid
- with_top.add_monoid
- with_bot.add_monoid
- order_dual.add_monoid
- nat.add_monoid
- pi.add_monoid
- int.add_monoid
- rat.add_monoid
- real.add_monoid
- add_submonoid.to_add_monoid
- free_add_monoid.add_monoid
- add_con.add_monoid
- dfinsupp.add_monoid
- finsupp.add_monoid
- set.add_monoid
- mul : M → M → M
- mul_assoc : ∀ (a b c : M), (a * b) * c = a * b * c
- one : M
- one_mul : ∀ (a : M), 1 * a = a
- mul_one : ∀ (a : M), a * 1 = a
- npow : ℕ → M → M
- npow_zero' : (∀ (x : M), monoid.npow 0 x = 1) . "try_refl_tac"
- npow_succ' : (∀ (n : ℕ) (x : M), monoid.npow n.succ x = x * monoid.npow n x) . "try_refl_tac"
A monoid
is a semigroup
with an element 1
such that 1 * a = a * 1 = a
.
Instances
- comm_monoid.to_monoid
- left_cancel_monoid.to_monoid
- right_cancel_monoid.to_monoid
- div_inv_monoid.to_monoid
- monoid_with_zero.to_monoid
- ring.to_monoid
- monoid.End.monoid
- add_monoid.End.monoid
- ring_hom.monoid
- with_one.monoid
- multiplicative.monoid
- mul_opposite.monoid
- prod.monoid
- order_dual.monoid
- nat.monoid
- function.End.monoid
- pi.monoid
- int.monoid
- rat.monoid
- real.monoid
- submonoid.to_monoid
- free_monoid.monoid
- con.monoid
- module.End.monoid
- set.monoid
Equations
- monoid.has_pow = {pow := λ (x : M) (n : ℕ), monoid.npow n x}
Equations
- add_monoid.has_scalar_nat = {smul := add_monoid.nsmul _inst_1}
- add : M → M → M
- add_assoc : ∀ (a b c : M), a + b + c = a + (b + c)
- zero : M
- zero_add : ∀ (a : M), 0 + a = a
- add_zero : ∀ (a : M), a + 0 = a
- nsmul : ℕ → M → M
- nsmul_zero' : (∀ (x : M), add_comm_monoid.nsmul 0 x = 0) . "try_refl_tac"
- nsmul_succ' : (∀ (n : ℕ) (x : M), add_comm_monoid.nsmul n.succ x = x + add_comm_monoid.nsmul n x) . "try_refl_tac"
- add_comm : ∀ (a b : M), a + b = b + a
An additive commutative monoid is an additive monoid with commutative (+)
.
Instances
- add_cancel_comm_monoid.to_add_comm_monoid
- non_unital_non_assoc_semiring.to_add_comm_monoid
- ordered_add_comm_monoid.to_add_comm_monoid
- add_comm_group.to_add_comm_monoid
- with_zero.add_comm_monoid
- additive.add_comm_monoid
- mul_opposite.add_comm_monoid
- prod.add_comm_monoid
- with_top.add_comm_monoid
- with_bot.add_comm_monoid
- order_dual.add_comm_monoid
- nat.add_comm_monoid
- add_monoid_hom.add_comm_monoid
- pi.add_comm_monoid
- int.add_comm_monoid
- fin.add_comm_monoid
- rat.add_comm_monoid
- set.set_semiring.add_comm_monoid
- real.add_comm_monoid
- add_submonoid.to_add_comm_monoid
- add_con.add_comm_monoid
- linear_map.add_comm_monoid
- submodule.add_comm_monoid
- dfinsupp.add_comm_monoid
- finsupp.add_comm_monoid
- enat.add_comm_monoid
- ennreal.add_comm_monoid
- set.add_comm_monoid
- mul : M → M → M
- mul_assoc : ∀ (a b c : M), (a * b) * c = a * b * c
- one : M
- one_mul : ∀ (a : M), 1 * a = a
- mul_one : ∀ (a : M), a * 1 = a
- npow : ℕ → M → M
- npow_zero' : (∀ (x : M), comm_monoid.npow 0 x = 1) . "try_refl_tac"
- npow_succ' : (∀ (n : ℕ) (x : M), comm_monoid.npow n.succ x = x * comm_monoid.npow n x) . "try_refl_tac"
- mul_comm : ∀ (a b : M), a * b = b * a
A commutative monoid is a monoid with commutative (*)
.
Instances
- cancel_comm_monoid.to_comm_monoid
- comm_group.to_comm_monoid
- comm_monoid_with_zero.to_comm_monoid
- comm_semiring.to_comm_monoid
- comm_ring.to_comm_monoid
- ordered_comm_monoid.to_comm_monoid
- linear_ordered_comm_ring.to_comm_monoid
- with_one.comm_monoid
- multiplicative.comm_monoid
- mul_opposite.comm_monoid
- prod.comm_monoid
- order_dual.comm_monoid
- nat.comm_monoid
- monoid_hom.comm_monoid
- pi.comm_monoid
- int.comm_monoid
- pnat.comm_monoid
- rat.comm_monoid
- real.comm_monoid
- submonoid.to_comm_monoid
- submonoid.center.comm_monoid
- con.comm_monoid
- associates.comm_monoid
- set.comm_monoid
- add : M → M → M
- add_assoc : ∀ (a b c : M), a + b + c = a + (b + c)
- add_left_cancel : ∀ (a b c : M), a + b = a + c → b = c
- zero : M
- zero_add : ∀ (a : M), 0 + a = a
- add_zero : ∀ (a : M), a + 0 = a
- nsmul : ℕ → M → M
- nsmul_zero' : (∀ (x : M), add_left_cancel_monoid.nsmul 0 x = 0) . "try_refl_tac"
- nsmul_succ' : (∀ (n : ℕ) (x : M), add_left_cancel_monoid.nsmul n.succ x = x + add_left_cancel_monoid.nsmul n x) . "try_refl_tac"
An additive monoid in which addition is left-cancellative.
Main examples are ℕ
and groups. This is the right typeclass for many sum lemmas, as having a zero
is useful to define the sum over the empty set, so add_left_cancel_semigroup
is not enough.
- mul : M → M → M
- mul_assoc : ∀ (a b c : M), (a * b) * c = a * b * c
- mul_left_cancel : ∀ (a b c : M), a * b = a * c → b = c
- one : M
- one_mul : ∀ (a : M), 1 * a = a
- mul_one : ∀ (a : M), a * 1 = a
- npow : ℕ → M → M
- npow_zero' : (∀ (x : M), left_cancel_monoid.npow 0 x = 1) . "try_refl_tac"
- npow_succ' : (∀ (n : ℕ) (x : M), left_cancel_monoid.npow n.succ x = x * left_cancel_monoid.npow n x) . "try_refl_tac"
A monoid in which multiplication is left-cancellative.
- add : M → M → M
- add_assoc : ∀ (a b c : M), a + b + c = a + (b + c)
- add_right_cancel : ∀ (a b c : M), a + b = c + b → a = c
- zero : M
- zero_add : ∀ (a : M), 0 + a = a
- add_zero : ∀ (a : M), a + 0 = a
- nsmul : ℕ → M → M
- nsmul_zero' : (∀ (x : M), add_right_cancel_monoid.nsmul 0 x = 0) . "try_refl_tac"
- nsmul_succ' : (∀ (n : ℕ) (x : M), add_right_cancel_monoid.nsmul n.succ x = x + add_right_cancel_monoid.nsmul n x) . "try_refl_tac"
An additive monoid in which addition is right-cancellative.
Main examples are ℕ
and groups. This is the right typeclass for many sum lemmas, as having a zero
is useful to define the sum over the empty set, so add_right_cancel_semigroup
is not enough.
- mul : M → M → M
- mul_assoc : ∀ (a b c : M), (a * b) * c = a * b * c
- mul_right_cancel : ∀ (a b c : M), a * b = c * b → a = c
- one : M
- one_mul : ∀ (a : M), 1 * a = a
- mul_one : ∀ (a : M), a * 1 = a
- npow : ℕ → M → M
- npow_zero' : (∀ (x : M), right_cancel_monoid.npow 0 x = 1) . "try_refl_tac"
- npow_succ' : (∀ (n : ℕ) (x : M), right_cancel_monoid.npow n.succ x = x * right_cancel_monoid.npow n x) . "try_refl_tac"
A monoid in which multiplication is right-cancellative.
- add : M → M → M
- add_assoc : ∀ (a b c : M), a + b + c = a + (b + c)
- add_left_cancel : ∀ (a b c : M), a + b = a + c → b = c
- zero : M
- zero_add : ∀ (a : M), 0 + a = a
- add_zero : ∀ (a : M), a + 0 = a
- nsmul : ℕ → M → M
- nsmul_zero' : (∀ (x : M), add_cancel_monoid.nsmul 0 x = 0) . "try_refl_tac"
- nsmul_succ' : (∀ (n : ℕ) (x : M), add_cancel_monoid.nsmul n.succ x = x + add_cancel_monoid.nsmul n x) . "try_refl_tac"
- add_right_cancel : ∀ (a b c : M), a + b = c + b → a = c
An additive monoid in which addition is cancellative on both sides.
Main examples are ℕ
and groups. This is the right typeclass for many sum lemmas, as having a zero
is useful to define the sum over the empty set, so add_right_cancel_semigroup
is not enough.
- mul : M → M → M
- mul_assoc : ∀ (a b c : M), (a * b) * c = a * b * c
- mul_left_cancel : ∀ (a b c : M), a * b = a * c → b = c
- one : M
- one_mul : ∀ (a : M), 1 * a = a
- mul_one : ∀ (a : M), a * 1 = a
- npow : ℕ → M → M
- npow_zero' : (∀ (x : M), cancel_monoid.npow 0 x = 1) . "try_refl_tac"
- npow_succ' : (∀ (n : ℕ) (x : M), cancel_monoid.npow n.succ x = x * cancel_monoid.npow n x) . "try_refl_tac"
- mul_right_cancel : ∀ (a b c : M), a * b = c * b → a = c
A monoid in which multiplication is cancellative.
- add : M → M → M
- add_assoc : ∀ (a b c : M), a + b + c = a + (b + c)
- add_left_cancel : ∀ (a b c : M), a + b = a + c → b = c
- zero : M
- zero_add : ∀ (a : M), 0 + a = a
- add_zero : ∀ (a : M), a + 0 = a
- nsmul : ℕ → M → M
- nsmul_zero' : (∀ (x : M), add_cancel_comm_monoid.nsmul 0 x = 0) . "try_refl_tac"
- nsmul_succ' : (∀ (n : ℕ) (x : M), add_cancel_comm_monoid.nsmul n.succ x = x + add_cancel_comm_monoid.nsmul n x) . "try_refl_tac"
- add_comm : ∀ (a b : M), a + b = b + a
Commutative version of add_cancel_monoid.
- mul : M → M → M
- mul_assoc : ∀ (a b c : M), (a * b) * c = a * b * c
- mul_left_cancel : ∀ (a b c : M), a * b = a * c → b = c
- one : M
- one_mul : ∀ (a : M), 1 * a = a
- mul_one : ∀ (a : M), a * 1 = a
- npow : ℕ → M → M
- npow_zero' : (∀ (x : M), cancel_comm_monoid.npow 0 x = 1) . "try_refl_tac"
- npow_succ' : (∀ (n : ℕ) (x : M), cancel_comm_monoid.npow n.succ x = x * cancel_comm_monoid.npow n x) . "try_refl_tac"
- mul_comm : ∀ (a b : M), a * b = b * a
Commutative version of cancel_monoid.
Equations
- cancel_comm_monoid.to_cancel_monoid M = {mul := cancel_comm_monoid.mul _inst_1, mul_assoc := _, mul_left_cancel := _, one := cancel_comm_monoid.one _inst_1, one_mul := _, mul_one := _, npow := cancel_comm_monoid.npow _inst_1, npow_zero' := _, npow_succ' := _, mul_right_cancel := _}
Equations
- add_cancel_comm_monoid.to_cancel_add_monoid M = {add := add_cancel_comm_monoid.add _inst_1, add_assoc := _, add_left_cancel := _, zero := add_cancel_comm_monoid.zero _inst_1, zero_add := _, add_zero := _, nsmul := add_cancel_comm_monoid.nsmul _inst_1, nsmul_zero' := _, nsmul_succ' := _, add_right_cancel := _}
The fundamental power operation in a group. zpow_rec n a = a*a*...*a
n times, for integer n
.
Use instead a ^ n
, which has better definitional behavior.
The fundamental scalar multiplication in an additive group. zsmul_rec n a = a+a+...+a
n
times, for integer n
. Use instead n • a
, which has better definitional behavior.
- mul : G → G → G
- mul_assoc : ∀ (a b c : G), (a * b) * c = a * b * c
- one : G
- one_mul : ∀ (a : G), 1 * a = a
- mul_one : ∀ (a : G), a * 1 = a
- npow : ℕ → G → G
- npow_zero' : (∀ (x : G), div_inv_monoid.npow 0 x = 1) . "try_refl_tac"
- npow_succ' : (∀ (n : ℕ) (x : G), div_inv_monoid.npow n.succ x = x * div_inv_monoid.npow n x) . "try_refl_tac"
- inv : G → G
- div : G → G → G
- div_eq_mul_inv : (∀ (a b : G), a / b = a * b⁻¹) . "try_refl_tac"
- zpow : ℤ → G → G
- zpow_zero' : (∀ (a : G), div_inv_monoid.zpow 0 a = 1) . "try_refl_tac"
- zpow_succ' : (∀ (n : ℕ) (a : G), div_inv_monoid.zpow (int.of_nat n.succ) a = a * div_inv_monoid.zpow (int.of_nat n) a) . "try_refl_tac"
- zpow_neg' : (∀ (n : ℕ) (a : G), div_inv_monoid.zpow -[1+ n] a = (div_inv_monoid.zpow ↑(n.succ) a)⁻¹) . "try_refl_tac"
A div_inv_monoid
is a monoid
with operations /
and ⁻¹
satisfying
div_eq_mul_inv : ∀ a b, a / b = a * b⁻¹
.
This is the immediate common ancestor of group
and group_with_zero
,
in order to deduplicate the name div_eq_mul_inv
.
The default for div
is such that a / b = a * b⁻¹
holds by definition.
Adding div
as a field rather than defining a / b := a * b⁻¹
allows us to
avoid certain classes of unification failures, for example:
Let foo X
be a type with a ∀ X, has_div (foo X)
instance but no
∀ X, has_inv (foo X)
, e.g. when foo X
is a euclidean_domain
. Suppose we
also have an instance ∀ X [cromulent X], group_with_zero (foo X)
. Then the
(/)
coming from group_with_zero_has_div
cannot be definitionally equal to
the (/)
coming from foo.has_div
.
In the same way, adding a zpow
field makes it possible to avoid definitional failures
in diamonds. See the definition of monoid
and Note [forgetful inheritance] for more
explanations on this.
- add : G → G → G
- add_assoc : ∀ (a b c : G), a + b + c = a + (b + c)
- zero : G
- zero_add : ∀ (a : G), 0 + a = a
- add_zero : ∀ (a : G), a + 0 = a
- nsmul : ℕ → G → G
- nsmul_zero' : (∀ (x : G), sub_neg_monoid.nsmul 0 x = 0) . "try_refl_tac"
- nsmul_succ' : (∀ (n : ℕ) (x : G), sub_neg_monoid.nsmul n.succ x = x + sub_neg_monoid.nsmul n x) . "try_refl_tac"
- neg : G → G
- sub : G → G → G
- sub_eq_add_neg : (∀ (a b : G), a - b = a + -b) . "try_refl_tac"
- zsmul : ℤ → G → G
- zsmul_zero' : (∀ (a : G), sub_neg_monoid.zsmul 0 a = 0) . "try_refl_tac"
- zsmul_succ' : (∀ (n : ℕ) (a : G), sub_neg_monoid.zsmul (int.of_nat n.succ) a = a + sub_neg_monoid.zsmul (int.of_nat n) a) . "try_refl_tac"
- zsmul_neg' : (∀ (n : ℕ) (a : G), sub_neg_monoid.zsmul -[1+ n] a = -sub_neg_monoid.zsmul ↑(n.succ) a) . "try_refl_tac"
A sub_neg_monoid
is an add_monoid
with unary -
and binary -
operations
satisfying sub_eq_add_neg : ∀ a b, a - b = a + -b
.
The default for sub
is such that a - b = a + -b
holds by definition.
Adding sub
as a field rather than defining a - b := a + -b
allows us to
avoid certain classes of unification failures, for example:
Let foo X
be a type with a ∀ X, has_sub (foo X)
instance but no
∀ X, has_neg (foo X)
. Suppose we also have an instance
∀ X [cromulent X], add_group (foo X)
. Then the (-)
coming from
add_group.has_sub
cannot be definitionally equal to the (-)
coming from
foo.has_sub
.
In the same way, adding a zsmul
field makes it possible to avoid definitional failures
in diamonds. See the definition of add_monoid
and Note [forgetful inheritance] for more
explanations on this.
Equations
- div_inv_monoid.has_pow = {pow := λ (x : M) (n : ℤ), div_inv_monoid.zpow n x}
Equations
- sub_neg_monoid.has_scalar_int = {smul := sub_neg_monoid.zsmul _inst_1}
- mul : G → G → G
- mul_assoc : ∀ (a b c : G), (a * b) * c = a * b * c
- one : G
- one_mul : ∀ (a : G), 1 * a = a
- mul_one : ∀ (a : G), a * 1 = a
- npow : ℕ → G → G
- npow_zero' : (∀ (x : G), group.npow 0 x = 1) . "try_refl_tac"
- npow_succ' : (∀ (n : ℕ) (x : G), group.npow n.succ x = x * group.npow n x) . "try_refl_tac"
- inv : G → G
- div : G → G → G
- div_eq_mul_inv : (∀ (a b : G), a / b = a * b⁻¹) . "try_refl_tac"
- zpow : ℤ → G → G
- zpow_zero' : (∀ (a : G), group.zpow 0 a = 1) . "try_refl_tac"
- zpow_succ' : (∀ (n : ℕ) (a : G), group.zpow (int.of_nat n.succ) a = a * group.zpow (int.of_nat n) a) . "try_refl_tac"
- zpow_neg' : (∀ (n : ℕ) (a : G), group.zpow -[1+ n] a = (group.zpow ↑(n.succ) a)⁻¹) . "try_refl_tac"
- mul_left_inv : ∀ (a : G), a⁻¹ * a = 1
A group
is a monoid
with an operation ⁻¹
satisfying a⁻¹ * a = 1
.
There is also a division operation /
such that a / b = a * b⁻¹
,
with a default so that a / b = a * b⁻¹
holds by definition.
Instances
- add : A → A → A
- add_assoc : ∀ (a b c : A), a + b + c = a + (b + c)
- zero : A
- zero_add : ∀ (a : A), 0 + a = a
- add_zero : ∀ (a : A), a + 0 = a
- nsmul : ℕ → A → A
- nsmul_zero' : (∀ (x : A), add_group.nsmul 0 x = 0) . "try_refl_tac"
- nsmul_succ' : (∀ (n : ℕ) (x : A), add_group.nsmul n.succ x = x + add_group.nsmul n x) . "try_refl_tac"
- neg : A → A
- sub : A → A → A
- sub_eq_add_neg : (∀ (a b : A), a - b = a + -b) . "try_refl_tac"
- zsmul : ℤ → A → A
- zsmul_zero' : (∀ (a : A), add_group.zsmul 0 a = 0) . "try_refl_tac"
- zsmul_succ' : (∀ (n : ℕ) (a : A), add_group.zsmul (int.of_nat n.succ) a = a + add_group.zsmul (int.of_nat n) a) . "try_refl_tac"
- zsmul_neg' : (∀ (n : ℕ) (a : A), add_group.zsmul -[1+ n] a = -add_group.zsmul ↑(n.succ) a) . "try_refl_tac"
- add_left_neg : ∀ (a : A), -a + a = 0
An add_group
is an add_monoid
with a unary -
satisfying -a + a = 0
.
There is also a binary operation -
such that a - b = a + -b
,
with a default so that a - b = a + -b
holds by definition.
Instances
Abbreviation for @sub_neg_monoid.to_add_monoid _ (@add_group.to_sub_neg_monoid _ _)
.
Useful because it corresponds to the fact that AddGroup
is a subcategory of AddMon
.
Not an instance since it duplicates
@sub_neg_monoid.to_add_monoid _ (@add_group.to_sub_neg_monoid _ _)
.
Equations
Abbreviation for @div_inv_monoid.to_monoid _ (@group.to_div_inv_monoid _ _)
.
Useful because it corresponds to the fact that Grp
is a subcategory of Mon
.
Not an instance since it duplicates @div_inv_monoid.to_monoid _ (@group.to_div_inv_monoid _ _)
.
See note [reducible non-instances].
Equations
Equations
- group.to_cancel_monoid = {mul := group.mul _inst_1, mul_assoc := _, mul_left_cancel := _, one := group.one _inst_1, one_mul := _, mul_one := _, npow := group.npow _inst_1, npow_zero' := _, npow_succ' := _, mul_right_cancel := _}
Equations
- add_group.to_cancel_add_monoid = {add := add_group.add _inst_1, add_assoc := _, add_left_cancel := _, zero := add_group.zero _inst_1, zero_add := _, add_zero := _, nsmul := add_group.nsmul _inst_1, nsmul_zero' := _, nsmul_succ' := _, add_right_cancel := _}
- mul : G → G → G
- mul_assoc : ∀ (a b c : G), (a * b) * c = a * b * c
- one : G
- one_mul : ∀ (a : G), 1 * a = a
- mul_one : ∀ (a : G), a * 1 = a
- npow : ℕ → G → G
- npow_zero' : (∀ (x : G), comm_group.npow 0 x = 1) . "try_refl_tac"
- npow_succ' : (∀ (n : ℕ) (x : G), comm_group.npow n.succ x = x * comm_group.npow n x) . "try_refl_tac"
- inv : G → G
- div : G → G → G
- div_eq_mul_inv : (∀ (a b : G), a / b = a * b⁻¹) . "try_refl_tac"
- zpow : ℤ → G → G
- zpow_zero' : (∀ (a : G), comm_group.zpow 0 a = 1) . "try_refl_tac"
- zpow_succ' : (∀ (n : ℕ) (a : G), comm_group.zpow (int.of_nat n.succ) a = a * comm_group.zpow (int.of_nat n) a) . "try_refl_tac"
- zpow_neg' : (∀ (n : ℕ) (a : G), comm_group.zpow -[1+ n] a = (comm_group.zpow ↑(n.succ) a)⁻¹) . "try_refl_tac"
- mul_left_inv : ∀ (a : G), a⁻¹ * a = 1
- mul_comm : ∀ (a b : G), a * b = b * a
A commutative group is a group with commutative (*)
.
Instances
- add : G → G → G
- add_assoc : ∀ (a b c : G), a + b + c = a + (b + c)
- zero : G
- zero_add : ∀ (a : G), 0 + a = a
- add_zero : ∀ (a : G), a + 0 = a
- nsmul : ℕ → G → G
- nsmul_zero' : (∀ (x : G), add_comm_group.nsmul 0 x = 0) . "try_refl_tac"
- nsmul_succ' : (∀ (n : ℕ) (x : G), add_comm_group.nsmul n.succ x = x + add_comm_group.nsmul n x) . "try_refl_tac"
- neg : G → G
- sub : G → G → G
- sub_eq_add_neg : (∀ (a b : G), a - b = a + -b) . "try_refl_tac"
- zsmul : ℤ → G → G
- zsmul_zero' : (∀ (a : G), add_comm_group.zsmul 0 a = 0) . "try_refl_tac"
- zsmul_succ' : (∀ (n : ℕ) (a : G), add_comm_group.zsmul (int.of_nat n.succ) a = a + add_comm_group.zsmul (int.of_nat n) a) . "try_refl_tac"
- zsmul_neg' : (∀ (n : ℕ) (a : G), add_comm_group.zsmul -[1+ n] a = -add_comm_group.zsmul ↑(n.succ) a) . "try_refl_tac"
- add_left_neg : ∀ (a : G), -a + a = 0
- add_comm : ∀ (a b : G), a + b = b + a
An additive commutative group is an additive group with commutative (+)
.
Instances
- ring.to_add_comm_group
- ordered_add_comm_group.to_add_comm_group
- add_units.add_comm_group
- additive.add_comm_group
- mul_opposite.add_comm_group
- prod.add_comm_group
- order_dual.add_comm_group
- add_monoid_hom.add_comm_group
- pi.add_comm_group
- int.add_comm_group
- fin.add_comm_group
- rat.add_comm_group
- real.add_comm_group
- myint.add_comm_group
- add_subgroup.to_add_comm_group
- add_subgroup.is_commutative.add_comm_group
- quotient_add_group.add_comm_group
- linear_map.add_comm_group
- submodule.add_comm_group
- punit.add_comm_group
- dfinsupp.add_comm_group
- finsupp.add_comm_group
Equations
- comm_group.to_cancel_comm_monoid = {mul := comm_group.mul _inst_1, mul_assoc := _, mul_left_cancel := _, one := comm_group.one _inst_1, one_mul := _, mul_one := _, npow := comm_group.npow _inst_1, npow_zero' := _, npow_succ' := _, mul_comm := _}
Equations
- add_comm_group.to_cancel_add_comm_monoid = {add := add_comm_group.add _inst_1, add_assoc := _, add_left_cancel := _, zero := add_comm_group.zero _inst_1, zero_add := _, add_zero := _, nsmul := add_comm_group.nsmul _inst_1, nsmul_zero' := _, nsmul_succ' := _, add_comm := _}